Style.cpp
12.5 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
/************************************************************************
Copyright (c) 2005-2012 by Juphoon System Software Co., Ltd.
All rights reserved.
This software is confidential and proprietary to Juphoon System Software Co.,
Ltd.. No part of this software may be reproduced, stored, transmitted,
disclosed or used in any form or by any means other than as expressly
provided by the written license agreement between JusTel and its
licensee.
THIS SOFTWARE IS PROVIDED BY JusTel "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL JusTel BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Juphoon System Software Co., Ltd.
************************************************************************/
/*************************************************
File name : rstylemanager.cpp
Module : UI Manager
Author : vic.ren
Created on : 2012-07-26
Description :
The style manager
Modify History:
1. Date: Author: Modification:
2012-07-27 Vic Ren Upgrade
*************************************************/
/* include header files */
#include "JusCallPch.h"
#include <QApplication>
RStyle *RStyle::m_psRStyle = ZNULL;
RStyle::RStyle(QObject *parent) : QObject(parent)
{
}
RStyle *RStyle::Instance()
{
if (!m_psRStyle)
m_psRStyle = new RStyle;
return m_psRStyle;
}
QColor RStyle::backgroundColor()
{
return QColor(245, 245, 245);
}
QColor RStyle::mainColor()
{
return QColor(0, 123, 187);
}
QColor RStyle::secondaryColor()
{
return QColor(80, 80, 80);
}
QColor RStyle::thirdColor()
{
return QColor(100, 100, 100);
}
QColor RStyle::fourthColor()
{
return QColor(150, 150, 150);
}
QColor RStyle::fontColor()
{
return secondaryColor();
}
QColor RStyle::fontColorInactive()
{
return QColor(137, 137, 137);
}
QColor RStyle::fontColorDisabled()
{
return QColor(216, 216, 216);
}
QColor RStyle::fontColorHeightLight()
{
return Qt::white;
}
QColor RStyle::boderColor()
{
return secondaryColor();
}
QColor RStyle::boderColorDisabled()
{
return QColor(216, 216, 216);
}
QColor RStyle::hoverBgColor()
{
QColor colorRet = mainColor();
int Hue = colorRet.hue();
colorRet.setHsv(Hue, 77, 251);
return colorRet;
}
QColor RStyle::pressedBgColor()
{
QColor colorRet = mainColor();
int Hue = colorRet.hue();
colorRet.setHsv(Hue, 255, 123);
return colorRet;
}
QColor RStyle::selectedBgColor()
{
QColor colorRet = thirdColor();
int Hue = colorRet.hue();
colorRet.setHsv(Hue, 0, 204);
return colorRet;
}
QColor RStyle::disabledColor()
{
return QColor(180, 180, 180);
}
QColor RStyle::missedColor()
{
return mainColor();
}
QString RStyle::menuStyle()
{
return "QMenu{background:" + backgroundColor().name()
+ "; color:" + fontColor().name()
+ "; min-height: 30px; min-width: 110px; padding-top: 0px;"
"padding-right: 1px; padding-bottom: 0px; border:1px solid "
+ boderColor().name() + ";}"
"QMenu::item {padding-left: 10px; padding-right: 10px; height: 30px; min-width: 108px}"
"QMenu::item:selected {color:" + fontColor().name()+ "; background: "
+ hoverBgColor().name() + ";}"
"QMenu::item:pressed {color:white; background: "
+ pressedBgColor().name() + ";}"
"QMenu::item:disabled{color:gray;}"
"QMenu::separator{height:1px; background-color:" + boderColor().name()
+ "; margin-left: 0px;}";
}
QString RStyle::editStyle(bool bHasBoder)
{
QString qsStyle;
if (bHasBoder)
{
qsStyle = "RMetroEdt {color: " + fontColor().name()
+ "; border-radius:0px; border:1px solid " + boderColor().name()
+ "; background:transparent; padding-left: 10px}"
+ "RMetroEdt:focus {border:1px solid " + mainColor().name() + "}";
}
else
{
qsStyle = "RMetroEdt{color: " + fontColor().name()
+ "; border-radius:0px; border:0px; background:transparent;"
"padding-left: 0px}";
}
qsStyle += "RMetroEdt:disabled {color: " + fontColorDisabled().name()
+ ";border:1px solid " + boderColorDisabled().name()
+ "; background:transparent;}"
+ "RMetroEdt:read-only {color: "
+ fontColor().name() + "; border-radius:0px; border:0px;"
+ "background:transparent;}";
return qsStyle;
}
QString RStyle::textEditStyle()
{
return "QTextEdit {border-radius:0px; border:1px solid "
+ boderColor().name() + "; color: " + fontColor().name() + "; background-color: "
+ backgroundColor().name() + ";}"
"QTextEdit:disabled {border:0px;}"
+ menuStyle() + scrollBarStyle();
}
QString RStyle::comboBoxStyle()
{
return "QComboBox {color: " + fontColor().name()
+ "; border: 1px solid " + boderColor().name()
+ "; padding-left: 10px;"
"background:transparent; padding-right: 0px;}"
"QComboBox:disabled {color: " + fontColorDisabled().name()
+ ";border:1px solid " + boderColorDisabled().name() + ";}"
"QComboBox:focus {border:1px solid " + fontColor().name() + "}"
"QComboBox::drop-down {border:none; width:30px; height:30px;"
"background:transparent;}"
"QComboBox::down-arrow {border:none; background:transparent;"
"image:url(:/images/ic_combobox_dropdown.png);}"
"QComboBox::down-arrow:disabled {border:none; background:transparent;"
"image:url();}"
"QComboBox QAbstractItemView {border: 1px solid " + boderColor().name()
+ ";selection-background-color: rgb(4, 78, 128); color: white;"
"background:black;}";
}
QString RStyle::contactComboBoxStyle()
{
return "QComboBox {color: " + fontColor().name()
+ "; border: 1px solid " + boderColor().name()
+ "; padding-left: 10px;"
"background:transparent; padding-right: 0px; }"
"QComboBox:focus {border:1px solid " + fontColor().name() + "}"
"QComboBox::drop-down {border:none; width: 25px; height: 25px;"
"background:transparent;}"
"QComboBox::down-arrow {border:none; background:transparent;"
"image:url(:/images/ic_combobox_dropdown_small.png);}"
"QComboBox::down-arrow:disabled {border:none; background:transparent;"
"image:url();}"
"QComboBox QAbstractItemView {border: 1px solid " + boderColor().name()
+ ";selection-background-color: rgb(4, 78, 128); color: white;"
"background:black;}";
}
QString RStyle::sessLogComboBoxStyle()
{
return "QComboBox {color: " + fontColor().name()
+ "; padding-left: 20px;"
"background:transparent; padding-right: 0px;}"
"QComboBox:focus {border:1px solid " + fontColor().name() + "}"
"QComboBox::drop-down {border:none; width:30px; height:30px;"
"background:transparent;}"
"QComboBox::down-arrow {border:none; background:transparent;"
"image:url(:/images/ic_combobox_switch.png); padding-right: 250px;"
"padding-bottom: 5px}"
"QComboBox::down-arrow:disabled {border:none; background:transparent;"
"image:url();}"
"QComboBox QAbstractItemView {border: 1px solid " + boderColor().name()
+ ";selection-background-color: rgb(4, 78, 128); color: white;"
"background:black;}";
}
QString RStyle::scrollBarStyle()
{
return "QScrollBar {border:none;background: transparent; width: 14px; "
"margin: 0px; padding-right: 0px; padding-left: 7px}"
"QScrollBar::handle:vertical {background:rgb(222, 222, 222);"
"min-height:20px; width:7px; margin:0px;}"
"QScrollBar::handle:vertical:hover {background:"
+ RStyle::fontColorInactive().name() + ";}"
"QScrollBar::handle:vertical:pressed {background: rgb(80, 80, 80);}"
"QScrollBar::sub-line:vertical {width: 0px; height: 0px; background: transparent;}"
"QScrollBar::add-line:vertical {width: 0px; height: 0px; background: transparent;}"
"QScrollBar::add-page:vertical {width: 0px; height: 0px; background: transparent;}"
"QScrollBar::sub-page:vertical {width: 0px; height: 0px; background: transparent;}";
}
QString RStyle::scrollAreaStyle()
{
return "QScrollArea{border:none; background:" + backgroundColor().name()
+";}" + scrollBarStyle();
}
QString RStyle::listViewStyle()
{
return "QAbstractItemView {border:none; background:transparent;}"
"QAbstractItemView::branch {image:none;}"
+ scrollBarStyle() + menuStyle();
}
QString RStyle::treeViewStyle()
{
return "QAbstractItemView {border:none; background:" + backgroundColor().name() + ";}"
+ scrollBarStyle() + menuStyle();
}
QString RStyle::volumeMicBtnStyle()
{
return "QCheckBox::indicator:unchecked{border:none; background:transparent;"
"image:url(:/images/ic_btn_mic.png);}"
"QCheckBox::indicator:checked{border:none; background:transparent;"
"image:url(:/images/ic_btn_mic.png);}";
}
QString RStyle::volumeSpkBtnStyle()
{
return "QCheckBox::indicator:unchecked{border:none; background:transparent;"
"image:url(:/images/ic_btn_spk.png);}"
"QCheckBox::indicator:checked{border:none; background:transparent;"
"image:url(:/images/ic_btn_spk.png);}";
}
QString RStyle::sliderStyle()
{
return "QSlider:horizontal {min-width: 10px;}"
"QSlider::groove:horizontal {border: 0px; height: 3px}"
"QSlider::handle:horizontal {background: rgb(80, 80, 80); width:3px; height: 10px;"
"margin: -2px 0px;}"
"QSlider::sub-page:horizontal {border: 0px; background: rgb(80, 80, 80);"
"margin:0px 0px 0px 0px;}"
"QSlider::add-page:horizontal {border: 0px; background: rgb(80, 80, 80);"
"margin:0px 0px 0px 0px;}"
"QSlider:horizontal:disabled {min-width: 10px;}"
"QSlider::groove:horizontal:disabled {border: 0px; height: 3px}"
"QSlider::handle:horizontal:disabled {background: rgb(77, 77, 77); width:3px; height: 10px;"
"margin: -2px 0px;}"
"QSlider::sub-page:horizontal:disabled {border: 0px; background: rgb(77, 77, 77);"
"margin:0px 0px 0px 0px;}"
"QSlider::add-page:horizontal:disabled {border: 0px; background: rgb(77, 77, 77);"
"margin:0px 0px 0px 0px;}";
}
QString RStyle::sliderVerticalStyle(QColor color)
{
return "QSlider::groove:vertical {background: red; position: absolute;"
"left: 4px; right: 4px; width: 15px}"
"QSlider::handle:vertical {height: 10px; background: white; "
"margin: 0 -4px;}"
"QSlider::add-page:vertical {background: " + color.name() + ";}"
"QSlider::sub-page:vertical {background: " + fontColorDisabled().name() + ";}";
}
QFont RStyle::fontSize(int nFontSize)
{
QFont font = QApplication::font();
font.setPixelSize(nFontSize);
font.setBold(false);
return font;
}
QString RStyle::appStyle()
{
return "QCheckBox {color: " + fontColor().name() + "}"
"QCheckBox:disabled {color: " + disabledColor().name() + ";}"
"QCheckBox::indicator:unchecked{border:none; background:transparent;"
"image:url(:/images/ic_checkbox_n.png);}"
"QCheckBox::indicator:checked{border:none; background:transparent;"
"image:url(:/images/ic_checkbox_s.png);}"
"QCheckBox::indicator:unchecked:disabled {border:none;"
"background:transparent;image:url(:/images/ic_checkbox_dn.png);}"
"QCheckBox::indicator:checked:disabled {border:none;"
"background:transparent;image:url(:/images/ic_checkbox_ds.png);}"
"QRadioButton {color: " + fontColor().name() + "}"
"QRadioButton::indicator:unchecked{border:none; background:transparent;"
"image:url(:/images/ic_radio_n.png);}"
"QRadioButton::indicator:checked{border:none; background:transparent;"
"image:url(:/images/ic_radio_s.png);}"
"QLabel {color: " + fontColor().name() + "}"
"QLabel:disabled {color: " + fontColorDisabled().name() + "}"
+ menuStyle() + scrollBarStyle();
}