diff options
-rw-r--r-- | accounts/maildir/package/contents/ui/MaildirAccountSettings.qml | 8 | ||||
-rw-r--r-- | components/mail/contents/ui/main.qml | 23 | ||||
-rw-r--r-- | components/package/contents/ui/ColorPalette.qml | 26 | ||||
-rw-r--r-- | components/package/contents/ui/Composer.qml | 10 | ||||
-rw-r--r-- | components/package/contents/ui/FocusComposer.qml | 10 | ||||
-rw-r--r-- | components/package/contents/ui/FolderListView.qml | 9 | ||||
-rw-r--r-- | components/package/contents/ui/ListItem.qml | 5 | ||||
-rw-r--r-- | components/package/contents/ui/MailListView.qml | 18 | ||||
-rw-r--r-- | components/package/contents/ui/Settings.qml | 7 | ||||
-rw-r--r-- | components/package/contents/ui/SingleMailView.qml | 3 | ||||
-rw-r--r-- | components/qmldir | 1 | ||||
-rw-r--r-- | framework/CMakeLists.txt | 2 | ||||
-rw-r--r-- | framework/theme/CMakeLists.txt | 14 | ||||
-rw-r--r-- | framework/theme/colorpalette.cpp | 45 | ||||
-rw-r--r-- | framework/theme/colorpalette.h | 47 | ||||
-rw-r--r-- | framework/theme/qmldir | 3 | ||||
-rw-r--r-- | framework/theme/themeplugin.cpp | 50 | ||||
-rw-r--r-- | framework/theme/themeplugin.h | 31 | ||||
-rw-r--r-- | framework/theme/unit.cpp | 29 | ||||
-rw-r--r-- | framework/theme/unit.h | 38 |
20 files changed, 303 insertions, 76 deletions
diff --git a/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml b/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml index a2564500..99814a06 100644 --- a/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml +++ b/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml | |||
@@ -20,18 +20,16 @@ import QtQuick.Controls 1.4 | |||
20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 |
21 | 21 | ||
22 | import org.kube.framework.settings 1.0 as KubeSettings | 22 | import org.kube.framework.settings 1.0 as KubeSettings |
23 | import org.kube.framework.theme 1.0 | ||
23 | import org.kde.kube.accounts.maildir 1.0 as MaildirAccount | 24 | import org.kde.kube.accounts.maildir 1.0 as MaildirAccount |
24 | import org.kube.components 1.0 as KubeComponents | 25 | |
25 | 26 | ||
26 | Rectangle { | 27 | Rectangle { |
27 | id: root | 28 | id: root |
28 | property string accountId | 29 | property string accountId |
29 | property string accountName: "Maildir" | 30 | property string accountName: "Maildir" |
30 | 31 | ||
31 | KubeComponents.ColorPalette { | 32 | color: ColorPalette.background |
32 | id: colorPalette | ||
33 | } | ||
34 | color: colorPalette.background | ||
35 | 33 | ||
36 | GridLayout { | 34 | GridLayout { |
37 | id: gridLayout | 35 | id: gridLayout |
diff --git a/components/mail/contents/ui/main.qml b/components/mail/contents/ui/main.qml index 8f2d3c52..d864f2fc 100644 --- a/components/mail/contents/ui/main.qml +++ b/components/mail/contents/ui/main.qml | |||
@@ -22,6 +22,7 @@ import org.kde.plasma.components 2.0 as PlasmaComponents | |||
22 | 22 | ||
23 | import org.kube.framework.actions 1.0 as KubeAction | 23 | import org.kube.framework.actions 1.0 as KubeAction |
24 | import org.kube.framework.settings 1.0 as KubeSettings | 24 | import org.kube.framework.settings 1.0 as KubeSettings |
25 | import org.kube.framework.theme 1.0 | ||
25 | import org.kube.components 1.0 as KubeComponents | 26 | import org.kube.components 1.0 as KubeComponents |
26 | 27 | ||
27 | ApplicationWindow { | 28 | ApplicationWindow { |
@@ -154,17 +155,17 @@ ApplicationWindow { | |||
154 | 155 | ||
155 | KubeComponents.FolderListView { | 156 | KubeComponents.FolderListView { |
156 | id: folderListView | 157 | id: folderListView |
157 | width: unit.size * 55 | 158 | width: Unit.size * 55 |
158 | Layout.maximumWidth: unit.size * 150 | 159 | Layout.maximumWidth: Unit.size * 150 |
159 | Layout.minimumWidth: unit.size * 30 | 160 | Layout.minimumWidth: Unit.size * 30 |
160 | } | 161 | } |
161 | 162 | ||
162 | KubeComponents.MailListView { | 163 | KubeComponents.MailListView { |
163 | id: mailListView | 164 | id: mailListView |
164 | parentFolder: folderListView.currentFolder | 165 | parentFolder: folderListView.currentFolder |
165 | width: unit.size * 80 | 166 | width: Unit.size * 80 |
166 | Layout.maximumWidth: unit.size * 250 | 167 | Layout.maximumWidth: Unit.size * 250 |
167 | Layout.minimumWidth: unit.size * 50 | 168 | Layout.minimumWidth: Unit.size * 50 |
168 | focus: true | 169 | focus: true |
169 | } | 170 | } |
170 | 171 | ||
@@ -187,15 +188,5 @@ ApplicationWindow { | |||
187 | 188 | ||
188 | anchors.fill: parent | 189 | anchors.fill: parent |
189 | } | 190 | } |
190 | |||
191 | //TODO find a better way to scale UI | ||
192 | Item { | ||
193 | id: unit | ||
194 | property int size: 5 | ||
195 | } | ||
196 | |||
197 | KubeComponents.ColorPalette { | ||
198 | id: colorPalette | ||
199 | } | ||
200 | } | 191 | } |
201 | 192 | ||
diff --git a/components/package/contents/ui/ColorPalette.qml b/components/package/contents/ui/ColorPalette.qml deleted file mode 100644 index db85cac6..00000000 --- a/components/package/contents/ui/ColorPalette.qml +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2015 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 3 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | import QtQuick 2.4 | ||
19 | |||
20 | //TODO probably expose it from the Cpp side | ||
21 | Item { | ||
22 | property string background: "#fcfcfc" | ||
23 | property string selected: "#3daee9" | ||
24 | property string read: "#232629" | ||
25 | property string border: "#232629" | ||
26 | } \ No newline at end of file | ||
diff --git a/components/package/contents/ui/Composer.qml b/components/package/contents/ui/Composer.qml index 01991b67..c16bf582 100644 --- a/components/package/contents/ui/Composer.qml +++ b/components/package/contents/ui/Composer.qml | |||
@@ -97,7 +97,7 @@ Item { | |||
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | PlasmaComponents.Button { | 100 | Button { |
101 | id: ccButton | 101 | id: ccButton |
102 | 102 | ||
103 | text: "Cc" | 103 | text: "Cc" |
@@ -108,7 +108,7 @@ Item { | |||
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | PlasmaComponents.Button { | 111 | Button { |
112 | id: bccButton | 112 | id: bccButton |
113 | 113 | ||
114 | text: "Bcc" | 114 | text: "Bcc" |
@@ -181,7 +181,7 @@ Item { | |||
181 | 181 | ||
182 | height: subject.height * 1.5 | 182 | height: subject.height * 1.5 |
183 | 183 | ||
184 | PlasmaComponents.Button { | 184 | Button { |
185 | 185 | ||
186 | anchors { | 186 | anchors { |
187 | bottom: parent.bottom | 187 | bottom: parent.bottom |
@@ -194,7 +194,7 @@ Item { | |||
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | PlasmaComponents.Button { | 197 | Button { |
198 | 198 | ||
199 | anchors { | 199 | anchors { |
200 | bottom: parent.bottom | 200 | bottom: parent.bottom |
@@ -217,7 +217,7 @@ Item { | |||
217 | 217 | ||
218 | model: composer.attachments | 218 | model: composer.attachments |
219 | 219 | ||
220 | delegate: PlasmaComponents.Label { | 220 | delegate: Label { |
221 | id: name | 221 | id: name |
222 | 222 | ||
223 | text: modelData | 223 | text: modelData |
diff --git a/components/package/contents/ui/FocusComposer.qml b/components/package/contents/ui/FocusComposer.qml index 8ec01cc9..ab04dbed 100644 --- a/components/package/contents/ui/FocusComposer.qml +++ b/components/package/contents/ui/FocusComposer.qml | |||
@@ -19,13 +19,15 @@ import QtQuick 2.4 | |||
19 | import QtQuick.Controls 1.4 | 19 | import QtQuick.Controls 1.4 |
20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 |
21 | 21 | ||
22 | import org.kube.framework.theme 1.0 | ||
23 | |||
22 | Rectangle { | 24 | Rectangle { |
23 | id: root | 25 | id: root |
24 | property variant originalMessage | 26 | property variant originalMessage |
25 | 27 | ||
26 | visible: false | 28 | visible: false |
27 | 29 | ||
28 | color: colorPalette.border | 30 | color: ColorPalette.border |
29 | 31 | ||
30 | opacity: 0.9 | 32 | opacity: 0.9 |
31 | 33 | ||
@@ -43,7 +45,7 @@ Rectangle { | |||
43 | height: root.height * 0.8 | 45 | height: root.height * 0.8 |
44 | width: root.width * 0.8 | 46 | width: root.width * 0.8 |
45 | 47 | ||
46 | color: colorPalette.background | 48 | color: ColorPalette.background |
47 | 49 | ||
48 | MouseArea { | 50 | MouseArea { |
49 | anchors.fill: parent | 51 | anchors.fill: parent |
@@ -53,7 +55,7 @@ Rectangle { | |||
53 | 55 | ||
54 | anchors { | 56 | anchors { |
55 | fill: parent | 57 | fill: parent |
56 | margins: unit.size * 3 | 58 | margins: Unit.size * 3 |
57 | } | 59 | } |
58 | 60 | ||
59 | Composer { | 61 | Composer { |
@@ -78,4 +80,4 @@ Rectangle { | |||
78 | } | 80 | } |
79 | } | 81 | } |
80 | } | 82 | } |
81 | } \ No newline at end of file | 83 | } |
diff --git a/components/package/contents/ui/FolderListView.qml b/components/package/contents/ui/FolderListView.qml index d78531a2..fafc1623 100644 --- a/components/package/contents/ui/FolderListView.qml +++ b/components/package/contents/ui/FolderListView.qml | |||
@@ -24,6 +24,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore | |||
24 | import org.kde.plasma.components 2.0 as PlasmaComponents | 24 | import org.kde.plasma.components 2.0 as PlasmaComponents |
25 | 25 | ||
26 | import org.kube.framework.domain 1.0 as KubeFramework | 26 | import org.kube.framework.domain 1.0 as KubeFramework |
27 | import org.kube.framework.theme 1.0 | ||
27 | 28 | ||
28 | Item { | 29 | Item { |
29 | id: root | 30 | id: root |
@@ -34,7 +35,7 @@ Item { | |||
34 | id: searchBox | 35 | id: searchBox |
35 | 36 | ||
36 | width: root.width | 37 | width: root.width |
37 | height: unit.size * 10 | 38 | height: Unit.size * 10 |
38 | 39 | ||
39 | TextField { | 40 | TextField { |
40 | anchors. centerIn: parent | 41 | anchors. centerIn: parent |
@@ -68,7 +69,7 @@ Item { | |||
68 | style: TreeViewStyle { | 69 | style: TreeViewStyle { |
69 | activateItemOnSingleClick: true | 70 | activateItemOnSingleClick: true |
70 | rowDelegate: Rectangle { | 71 | rowDelegate: Rectangle { |
71 | height: unit.size * 10 | 72 | height: Unit.size * 10 |
72 | color: "transparent" | 73 | color: "transparent" |
73 | } | 74 | } |
74 | itemDelegate: Rectangle { | 75 | itemDelegate: Rectangle { |
@@ -81,7 +82,7 @@ Item { | |||
81 | anchors { | 82 | anchors { |
82 | verticalCenter: parent.verticalCenter | 83 | verticalCenter: parent.verticalCenter |
83 | left: parent.left | 84 | left: parent.left |
84 | leftMargin: unit.size * 3 | 85 | leftMargin: Unit.size * 3 |
85 | } | 86 | } |
86 | source: model.icon | 87 | source: model.icon |
87 | } | 88 | } |
@@ -89,7 +90,7 @@ Item { | |||
89 | anchors { | 90 | anchors { |
90 | verticalCenter: parent.verticalCenter | 91 | verticalCenter: parent.verticalCenter |
91 | left: iconItem.right | 92 | left: iconItem.right |
92 | leftMargin: unit.size * 3 | 93 | leftMargin: Unit.size * 3 |
93 | } | 94 | } |
94 | renderType: Text.NativeRendering | 95 | renderType: Text.NativeRendering |
95 | text: styleData.value | 96 | text: styleData.value |
diff --git a/components/package/contents/ui/ListItem.qml b/components/package/contents/ui/ListItem.qml index 5396645d..bea3c11b 100644 --- a/components/package/contents/ui/ListItem.qml +++ b/components/package/contents/ui/ListItem.qml | |||
@@ -16,13 +16,14 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | import QtQuick 2.4 | 18 | import QtQuick 2.4 |
19 | import org.kube.framework.theme 1.0 | ||
19 | 20 | ||
20 | Item { | 21 | Item { |
21 | id: delegateRoot | 22 | id: delegateRoot |
22 | 23 | ||
23 | readonly property bool isCurrentItem: ListView.isCurrentItem | 24 | readonly property bool isCurrentItem: ListView.isCurrentItem |
24 | 25 | ||
25 | height: unit.width * 25 | 26 | height: Unit.width * 25 |
26 | width: parent.width | 27 | width: parent.width |
27 | 28 | ||
28 | MouseArea { | 29 | MouseArea { |
@@ -60,4 +61,4 @@ Item { | |||
60 | opacity: 0.2 | 61 | opacity: 0.2 |
61 | } | 62 | } |
62 | } | 63 | } |
63 | } \ No newline at end of file | 64 | } |
diff --git a/components/package/contents/ui/MailListView.qml b/components/package/contents/ui/MailListView.qml index 8b612c52..e7fc634f 100644 --- a/components/package/contents/ui/MailListView.qml +++ b/components/package/contents/ui/MailListView.qml | |||
@@ -24,6 +24,7 @@ import QtQml 2.2 | |||
24 | import org.kde.plasma.components 2.0 as PlasmaComponents | 24 | import org.kde.plasma.components 2.0 as PlasmaComponents |
25 | 25 | ||
26 | import org.kube.framework.domain 1.0 as KubeFramework | 26 | import org.kube.framework.domain 1.0 as KubeFramework |
27 | import org.kube.framework.theme 1.0 | ||
27 | 28 | ||
28 | ScrollView { | 29 | ScrollView { |
29 | id: root | 30 | id: root |
@@ -47,7 +48,7 @@ ScrollView { | |||
47 | 48 | ||
48 | delegate: PlasmaComponents.ListItem { | 49 | delegate: PlasmaComponents.ListItem { |
49 | width: listView.width | 50 | width: listView.width |
50 | height: unit.size * 12 | 51 | height: Unit.size * 12 |
51 | 52 | ||
52 | enabled: true | 53 | enabled: true |
53 | checked: listView.currentIndex == index | 54 | checked: listView.currentIndex == index |
@@ -72,7 +73,6 @@ ScrollView { | |||
72 | 73 | ||
73 | anchors.fill: parent | 74 | anchors.fill: parent |
74 | 75 | ||
75 | // color: colorPalette.read | ||
76 | color: "steelblue" | 76 | color: "steelblue" |
77 | opacity: 0.1 | 77 | opacity: 0.1 |
78 | 78 | ||
@@ -85,10 +85,10 @@ ScrollView { | |||
85 | anchors { | 85 | anchors { |
86 | verticalCenter: parent.verticalCenter | 86 | verticalCenter: parent.verticalCenter |
87 | left: parent.left | 87 | left: parent.left |
88 | leftMargin: unit.size * 2 | 88 | leftMargin: Unit.size * 2 |
89 | } | 89 | } |
90 | 90 | ||
91 | height: unit.size * 9 | 91 | height: Unit.size * 9 |
92 | width: height | 92 | width: height |
93 | 93 | ||
94 | name: model.senderName | 94 | name: model.senderName |
@@ -100,7 +100,7 @@ ScrollView { | |||
100 | anchors { | 100 | anchors { |
101 | top: avatar.top | 101 | top: avatar.top |
102 | left: avatar.right | 102 | left: avatar.right |
103 | leftMargin: unit.size * 3 | 103 | leftMargin: Unit.size * 3 |
104 | } | 104 | } |
105 | 105 | ||
106 | text: model.senderName | 106 | text: model.senderName |
@@ -115,9 +115,9 @@ ScrollView { | |||
115 | // anchors { | 115 | // anchors { |
116 | // top: avatar.top | 116 | // top: avatar.top |
117 | // left: senderName.right | 117 | // left: senderName.right |
118 | // leftMargin: unit.size | 118 | // leftMargin: Unit.size |
119 | // right: date.left | 119 | // right: date.left |
120 | // rightMargin: unit.size | 120 | // rightMargin: Unit.size |
121 | // } | 121 | // } |
122 | // | 122 | // |
123 | // text: "(" + model.sender +")" | 123 | // text: "(" + model.sender +")" |
@@ -131,7 +131,7 @@ ScrollView { | |||
131 | anchors { | 131 | anchors { |
132 | top: avatar.top | 132 | top: avatar.top |
133 | right: parent.right | 133 | right: parent.right |
134 | rightMargin: unit.size * 2 | 134 | rightMargin: Unit.size * 2 |
135 | } | 135 | } |
136 | 136 | ||
137 | text: Qt.formatDateTime(model.date) | 137 | text: Qt.formatDateTime(model.date) |
@@ -145,7 +145,7 @@ ScrollView { | |||
145 | anchors { | 145 | anchors { |
146 | bottom: avatar.bottom | 146 | bottom: avatar.bottom |
147 | left: avatar.right | 147 | left: avatar.right |
148 | leftMargin: unit.size * 3 | 148 | leftMargin: Unit.size * 3 |
149 | } | 149 | } |
150 | 150 | ||
151 | text: model.subject | 151 | text: model.subject |
diff --git a/components/package/contents/ui/Settings.qml b/components/package/contents/ui/Settings.qml index 1f5fc972..8da372e7 100644 --- a/components/package/contents/ui/Settings.qml +++ b/components/package/contents/ui/Settings.qml | |||
@@ -23,13 +23,14 @@ import org.kde.plasma.core 2.0 as PlasmaCore | |||
23 | 23 | ||
24 | import org.kube.framework.settings 1.0 as KubeSettings | 24 | import org.kube.framework.settings 1.0 as KubeSettings |
25 | import org.kube.framework.domain 1.0 as KubeFramework | 25 | import org.kube.framework.domain 1.0 as KubeFramework |
26 | import org.kube.framework.theme 1.0 | ||
26 | 27 | ||
27 | Rectangle { | 28 | Rectangle { |
28 | id: root | 29 | id: root |
29 | 30 | ||
30 | visible: false | 31 | visible: false |
31 | 32 | ||
32 | color: colorPalette.border | 33 | color: ColorPalette.border |
33 | 34 | ||
34 | opacity: 0.9 | 35 | opacity: 0.9 |
35 | 36 | ||
@@ -47,7 +48,7 @@ Rectangle { | |||
47 | height: root.height * 0.8 | 48 | height: root.height * 0.8 |
48 | width: root.width * 0.8 | 49 | width: root.width * 0.8 |
49 | 50 | ||
50 | color: colorPalette.background | 51 | color: ColorPalette.background |
51 | 52 | ||
52 | MouseArea { | 53 | MouseArea { |
53 | anchors.fill: parent | 54 | anchors.fill: parent |
@@ -78,7 +79,7 @@ Rectangle { | |||
78 | anchors { | 79 | anchors { |
79 | verticalCenter: parent.verticalCenter | 80 | verticalCenter: parent.verticalCenter |
80 | left: parent.left | 81 | left: parent.left |
81 | // leftMargin: unit.size * 3 | 82 | // leftMargin: Unit.size * 3 |
82 | } | 83 | } |
83 | source: accountFactory.icon | 84 | source: accountFactory.icon |
84 | } | 85 | } |
diff --git a/components/package/contents/ui/SingleMailView.qml b/components/package/contents/ui/SingleMailView.qml index ff48a9d3..4b801a89 100644 --- a/components/package/contents/ui/SingleMailView.qml +++ b/components/package/contents/ui/SingleMailView.qml | |||
@@ -20,6 +20,7 @@ import QtQuick.Controls 1.3 | |||
20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 |
21 | 21 | ||
22 | import org.kube.framework.domain 1.0 as KubeFramework | 22 | import org.kube.framework.domain 1.0 as KubeFramework |
23 | import org.kube.framework.theme 1.0 | ||
23 | 24 | ||
24 | Item { | 25 | Item { |
25 | id: root | 26 | id: root |
@@ -30,7 +31,7 @@ Item { | |||
30 | 31 | ||
31 | anchors.fill: parent | 32 | anchors.fill: parent |
32 | 33 | ||
33 | color: colorPalette.background | 34 | color: ColorPalette.background |
34 | } | 35 | } |
35 | 36 | ||
36 | Repeater { | 37 | Repeater { |
diff --git a/components/qmldir b/components/qmldir index 204beff8..e9a70bc5 100644 --- a/components/qmldir +++ b/components/qmldir | |||
@@ -1,6 +1,5 @@ | |||
1 | module org.kube.components | 1 | module org.kube.components |
2 | 2 | ||
3 | ColorPalette 1.0 ColorPalette.qml | ||
4 | FocusComposer 1.0 FocusComposer.qml | 3 | FocusComposer 1.0 FocusComposer.qml |
5 | SingleMailView 1.0 SingleMailView.qml | 4 | SingleMailView 1.0 SingleMailView.qml |
6 | FolderListView 1.0 FolderListView.qml | 5 | FolderListView 1.0 FolderListView.qml |
diff --git a/framework/CMakeLists.txt b/framework/CMakeLists.txt index be137441..d795e992 100644 --- a/framework/CMakeLists.txt +++ b/framework/CMakeLists.txt | |||
@@ -40,5 +40,7 @@ add_subdirectory(actions) | |||
40 | add_subdirectory(settings) | 40 | add_subdirectory(settings) |
41 | # Domain specific domain logic | 41 | # Domain specific domain logic |
42 | add_subdirectory(domain) | 42 | add_subdirectory(domain) |
43 | # Theme specfic things like colors | ||
44 | add_subdirectory(theme) | ||
43 | 45 | ||
44 | feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) | 46 | feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) |
diff --git a/framework/theme/CMakeLists.txt b/framework/theme/CMakeLists.txt new file mode 100644 index 00000000..319e3d39 --- /dev/null +++ b/framework/theme/CMakeLists.txt | |||
@@ -0,0 +1,14 @@ | |||
1 | set(themeplugin_SRCS | ||
2 | themeplugin.cpp | ||
3 | colorpalette.cpp | ||
4 | unit.cpp | ||
5 | ) | ||
6 | |||
7 | add_library(themeplugin SHARED ${themeplugin_SRCS}) | ||
8 | |||
9 | qt5_use_modules(themeplugin Core Quick Qml) | ||
10 | |||
11 | target_link_libraries(themeplugin) | ||
12 | |||
13 | install(TARGETS themeplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/framework/theme) | ||
14 | install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/framework/theme) | ||
diff --git a/framework/theme/colorpalette.cpp b/framework/theme/colorpalette.cpp new file mode 100644 index 00000000..a321a292 --- /dev/null +++ b/framework/theme/colorpalette.cpp | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #include "colorpalette.h" | ||
20 | |||
21 | ColorPalette::ColorPalette(QObject *parent) : QObject(parent), m_background("#fcfcfc"), m_selected("#3daee9"), m_read("#232629"), m_border("#232629") | ||
22 | { | ||
23 | |||
24 | } | ||
25 | |||
26 | QString ColorPalette::background() const | ||
27 | { | ||
28 | return m_background; | ||
29 | } | ||
30 | |||
31 | QString ColorPalette::read() const | ||
32 | { | ||
33 | return m_read; | ||
34 | } | ||
35 | |||
36 | QString ColorPalette::selected() const | ||
37 | { | ||
38 | return m_selected; | ||
39 | } | ||
40 | |||
41 | QString ColorPalette::border() const | ||
42 | { | ||
43 | return m_border; | ||
44 | } | ||
45 | |||
diff --git a/framework/theme/colorpalette.h b/framework/theme/colorpalette.h new file mode 100644 index 00000000..a06783f3 --- /dev/null +++ b/framework/theme/colorpalette.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #include <QObject> | ||
20 | #include <QString> | ||
21 | |||
22 | class ColorPalette : public QObject | ||
23 | { | ||
24 | Q_OBJECT | ||
25 | |||
26 | Q_PROPERTY (QString background READ background NOTIFY themeChanged) | ||
27 | Q_PROPERTY (QString selected READ background NOTIFY themeChanged) | ||
28 | Q_PROPERTY (QString read READ read NOTIFY themeChanged) | ||
29 | Q_PROPERTY (QString border READ border NOTIFY themeChanged) | ||
30 | |||
31 | public: | ||
32 | explicit ColorPalette(QObject *parent = Q_NULLPTR); | ||
33 | |||
34 | QString background() const; | ||
35 | QString selected() const; | ||
36 | QString read() const; | ||
37 | QString border() const; | ||
38 | |||
39 | signals: | ||
40 | void themeChanged(); | ||
41 | |||
42 | private: | ||
43 | QString m_background; | ||
44 | QString m_selected; | ||
45 | QString m_read; | ||
46 | QString m_border; | ||
47 | }; | ||
diff --git a/framework/theme/qmldir b/framework/theme/qmldir new file mode 100644 index 00000000..489a71ca --- /dev/null +++ b/framework/theme/qmldir | |||
@@ -0,0 +1,3 @@ | |||
1 | module org.kube.framework.theme | ||
2 | |||
3 | plugin themeplugin | ||
diff --git a/framework/theme/themeplugin.cpp b/framework/theme/themeplugin.cpp new file mode 100644 index 00000000..ad9d0e1b --- /dev/null +++ b/framework/theme/themeplugin.cpp | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #include "themeplugin.h" | ||
20 | |||
21 | #include <QtQml> | ||
22 | #include <QQmlEngine> | ||
23 | |||
24 | #include "colorpalette.h" | ||
25 | #include "unit.h" | ||
26 | |||
27 | static QObject *colorpaletteInstace(QQmlEngine *engine, QJSEngine *scriptEngine) | ||
28 | { | ||
29 | Q_UNUSED(engine); | ||
30 | Q_UNUSED(scriptEngine); | ||
31 | |||
32 | return new ColorPalette; | ||
33 | } | ||
34 | |||
35 | static QObject *unitInstace(QQmlEngine *engine, QJSEngine *scriptEngine) | ||
36 | { | ||
37 | Q_UNUSED(engine); | ||
38 | Q_UNUSED(scriptEngine); | ||
39 | |||
40 | return new Unit; | ||
41 | } | ||
42 | |||
43 | void ThemePlugin::registerTypes (const char *uri) | ||
44 | { | ||
45 | Q_ASSERT(uri == QLatin1String("org.kube.framework.theme")); | ||
46 | |||
47 | qmlRegisterSingletonType<ColorPalette>(uri, 1, 0, "ColorPalette", colorpaletteInstace); | ||
48 | qmlRegisterSingletonType<Unit>(uri, 1, 0, "Unit", unitInstace); | ||
49 | |||
50 | } | ||
diff --git a/framework/theme/themeplugin.h b/framework/theme/themeplugin.h new file mode 100644 index 00000000..d8ae43c1 --- /dev/null +++ b/framework/theme/themeplugin.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #pragma once | ||
20 | |||
21 | #include <QQmlEngine> | ||
22 | #include <QQmlExtensionPlugin> | ||
23 | |||
24 | class ThemePlugin : public QQmlExtensionPlugin | ||
25 | { | ||
26 | Q_OBJECT | ||
27 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") | ||
28 | |||
29 | public: | ||
30 | virtual void registerTypes(const char *uri); | ||
31 | }; \ No newline at end of file | ||
diff --git a/framework/theme/unit.cpp b/framework/theme/unit.cpp new file mode 100644 index 00000000..1f3803cb --- /dev/null +++ b/framework/theme/unit.cpp | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #include "unit.h" | ||
20 | |||
21 | Unit::Unit(QObject *parent) : QObject(parent), m_size(5) | ||
22 | { | ||
23 | |||
24 | } | ||
25 | |||
26 | int Unit::size() const | ||
27 | { | ||
28 | return m_size; | ||
29 | } \ No newline at end of file | ||
diff --git a/framework/theme/unit.h b/framework/theme/unit.h new file mode 100644 index 00000000..bd9b58f0 --- /dev/null +++ b/framework/theme/unit.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Michael Bohlender <michael.bohlender@kdemail.net> | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #include <QObject> | ||
20 | |||
21 | |||
22 | class Unit : public QObject | ||
23 | { | ||
24 | Q_OBJECT | ||
25 | Q_PROPERTY (int size READ size NOTIFY unitChanged) | ||
26 | |||
27 | |||
28 | public: | ||
29 | explicit Unit(QObject *parent = Q_NULLPTR); | ||
30 | |||
31 | int size() const; | ||
32 | |||
33 | signals: | ||
34 | void unitChanged(); | ||
35 | |||
36 | private: | ||
37 | int m_size; | ||
38 | }; | ||