-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapplicationui.cpp
126 lines (115 loc) · 2.69 KB
/
applicationui.cpp
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
// ekke (Ekkehard Gentz) @ekkescorner
#include "applicationui.hpp"
#include "uiconstants.hpp"
#include <QDebug>
using namespace ekke::constants;
ApplicationUI::ApplicationUI(QObject *parent) : QObject(parent)
{
// default theme is light
mIsDarkTheme = false;
// default primary color is Teal
mPrimaryPalette = 8;
// default accent color is DeepOrange
mAccentPalette = 15;
}
/* Change Theme Palette */
QStringList ApplicationUI::swapThemePalette()
{
mIsDarkTheme = !mIsDarkTheme;
if (mIsDarkTheme) {
return darkPalette;
}
return lightPalette;
}
/* Get current default Theme Palette */
QStringList ApplicationUI::defaultThemePalette()
{
if (mIsDarkTheme) {
return darkPalette;
}
return lightPalette;
}
/* Get one of the Primary Palettes */
QStringList ApplicationUI::primaryPalette(const int paletteIndex)
{
mPrimaryPalette = paletteIndex;
switch (paletteIndex) {
case 0:
return materialRed;
break;
case 1:
return materialPink;
break;
case 2:
return materialPurple;
break;
case 3:
return materialDeepPurple;
break;
case 4:
return materialIndigo;
break;
case 5:
return materialBlue;
break;
case 6:
return materialLightBlue;
break;
case 7:
return materialCyan;
break;
case 8:
return materialTeal;
break;
case 9:
return materialGreen;
break;
case 10:
return materialLightGreen;
break;
case 11:
return materialLime;
break;
case 12:
return materialYellow;
break;
case 13:
return materialAmber;
break;
case 14:
return materialOrange;
break;
case 15:
return materialDeepOrange;
break;
case 16:
return materialBrown;
break;
case 17:
return materialGrey;
break;
default:
return materialBlueGrey;
break;
}
}
/* Get one of the Accent Palettes */
QStringList ApplicationUI::accentPalette(const int paletteIndex)
{
mAccentPalette = paletteIndex;
int currentPrimary = mPrimaryPalette;
QStringList thePalette = primaryPalette(paletteIndex);
mPrimaryPalette = currentPrimary;
// we need: primaryColor, textOnPrimary, iconOnPrimaryFolder
return QStringList{thePalette.at(1), thePalette.at(4), thePalette.at(7)};
}
/* Get Default Primary Palette */
QStringList ApplicationUI::defaultPrimaryPalette()
{
return primaryPalette(mPrimaryPalette);
}
/* Get Default Accent Palette */
QStringList ApplicationUI::defaultAccentPalette()
{
return accentPalette(mAccentPalette);
}