-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstylesheetgenerator.cpp
More file actions
173 lines (157 loc) · 6.06 KB
/
stylesheetgenerator.cpp
File metadata and controls
173 lines (157 loc) · 6.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#include "stylesheetgenerator.h"
#include <QString>
#include <QPair>
#include <QVector>
#include <QColor>
const QFont StylesheetGenerator::DefaultFont = QFont("DejaVu Sans");
const QString StylesheetGenerator::DefaultFontHexColor = QString("#42C0FB");
const QString StylesheetGenerator::DefaultPausedFontHexColor = QString("#BB2A3C");
const QString StylesheetGenerator::DefaultGradientOneFontHexColor = QString("#007FFF");
const QString StylesheetGenerator::DefaultGradientTwoFontHexColor = QString("#E066FF");
const QString StylesheetGenerator::DefaultWidgetDarkModeBackground = QString("#1A1A1A");
const QString StylesheetGenerator::DefaultStopwatchBackground = QString("black");
const QString StylesheetGenerator::DefaultStopwatchBorderColor = QString("black");
const QString StylesheetGenerator::DefaultStopwatchBorderWidth = QString("0px");
const QVector<QPair<QString,QString>> StylesheetGenerator::NiceColors = {
{"#ffffff", "white"},
{"#BB2A3C", "braeburn apple"},
{"#F08080", "lightcoral"},
{"#FF7F50", "coral"},
{"#FCD59C", "bread"},
{"#FFD700", "gold"},
{"#5EDA9E", "fresh green"},
{"#00C957", "emeraldgreen"},
{"#42C0FB", "caribbean"},
{"#4973AB", "blue bird"},
{"#F6A4D5", "dog tongue"},
{"#F54D70", "cranberry jello"},
{"#CC00FF", "grape"},
{"#3A3A38", "blackberry"},
{"#000000", "black"}
};
StylesheetGenerator::StylesheetGenerator()
{
}
const QString StylesheetGenerator::DefaultHeader(int fontSize, QString color, QString background)
{
return QString("QLabel { "
"font-family: DejaVu Sans Bold;"
"font-size: %1pt;"
"font-weight: bold;"
"color: %2;"
"background: %3;"
"}").arg(fontSize).arg(color, background);
}
const QString StylesheetGenerator::DefaultLabel(int fontSize)
{
return QString("QLabel { "
"font-family: DejaVu Sans; "
"font-size: %1pt;"
"}").arg(fontSize);
}
const QString StylesheetGenerator::DefaultDangerLabel(int fontSize)
{
return QString("QLabel { "
"font-family: DejaVu Sans; "
"font-size: %1pt;"
"color: #EE2C2C;"
"}").arg(fontSize);
}
const QString StylesheetGenerator::DefaultWidgetBackground()
{
//hex = "Red";
return QString("QWidget, QFrame {"
"background-color: %1;"
"color: White;"
"font-size: 12pt;"
"}"
"QSplitter {"
"background-color: %1;"
"color: White;"
"}"
"QTabWidget {"
"background-color: %1;"
"color: White;"
"}").arg(DefaultWidgetDarkModeBackground);
}
const QString StylesheetGenerator::DefaultButtonStyle(int fontSize, QString backgroundColor, QString borderColor)
{
return QString("QPushButton {"
"color: %4;"
"font-size: %1pt;"
"font-weight: medium;"
"background-color: %2;"
"border-style: solid;"
"border-width: 2px;"
"border-radius: 10px;"
"border-color: %3;"
"padding: 6px;"
"}"
"QPushButton:hover {"
" text-decoration: underline;"
"}"
"QPushButton:pressed {"
"border-style: inset;"
"padding-left: 7px;"
"padding-top: 7px;"
"}").arg(fontSize).arg(backgroundColor).arg(borderColor).arg("white");
}
const QString StylesheetGenerator::DefaultQKeySequenceEditStyle(int fontSize, QString backgroundColor, QString borderColor)
{
return QString("QKeySequenceEdit {"
"font-size: %1pt;"
"font-weight: bold;"
"background-color: %2;"
"border-width: 2px;"
"border-color: %3;"
"}").arg(fontSize).arg(backgroundColor, borderColor);
}
const QString StylesheetGenerator::DefaultDangerButton()
{
return QString("QPushButton { "
"color: White;"
//"background-color: #EE2C2C;"
"border-width: 2px;"
"border-color: #EE2C2C;"
//"border-color: #BE2625;}");
//"font-size: %1pt;"
"font-weight: medium;"
"border-style: solid;"
"border-radius: 10px;"
"padding: 6px;"
"}"
"QPushButton:hover {"
" text-decoration: underline;"
"}"
"QPushButton:pressed {"
"border-style: solid;"
"padding-left: 7px;"
"padding-top: 7px;"
"}");//.arg(fontSize).arg(backgroundColor).arg(borderColor).arg("white");
}
const QString StylesheetGenerator::NewStopwatchStylesheet(QColor textColor, QColor backgroundColor)
{
return QString("QLabel "
"{ "
"background-color : %2; "
"color : %1; "
//"border: %4 solid %3;"
"}").arg(textColor.name())
.arg(backgroundColor.name());
// .arg(border.name()) // Border color
// .arg(thickness); // Border thickness
}
const QString StylesheetGenerator::NewModuleOutputStylesheet(QColor color, QColor background, QColor border, QString thickness)
{
if (!thickness.endsWith("px"))
thickness = "0px";
return QString("QLabel "
"{ "
"background-color : %2; "
"color : %1; "
"border: %4 solid %3;"
"}").arg(color.name()) // Text color
.arg(background.name()) // Background color
.arg(border.name()) // Border color
.arg(thickness); // Border thickness
}