diff options
-rw-r--r-- | components/mail/contents/ui/main.qml | 19 | ||||
-rw-r--r-- | components/package/contents/ui/FocusComposer.qml | 2 | ||||
-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 | 17 | ||||
-rw-r--r-- | components/package/contents/ui/Settings.qml | 2 | ||||
-rw-r--r-- | framework/theme/CMakeLists.txt | 1 | ||||
-rw-r--r-- | framework/theme/themeplugin.cpp | 14 | ||||
-rw-r--r-- | framework/theme/unit.cpp | 29 | ||||
-rw-r--r-- | framework/theme/unit.h | 38 |
10 files changed, 106 insertions, 30 deletions
diff --git a/components/mail/contents/ui/main.qml b/components/mail/contents/ui/main.qml index 181174d2..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,11 +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 | } | 191 | } |
197 | 192 | ||
diff --git a/components/package/contents/ui/FocusComposer.qml b/components/package/contents/ui/FocusComposer.qml index bc8b3f2d..ab04dbed 100644 --- a/components/package/contents/ui/FocusComposer.qml +++ b/components/package/contents/ui/FocusComposer.qml | |||
@@ -55,7 +55,7 @@ Rectangle { | |||
55 | 55 | ||
56 | anchors { | 56 | anchors { |
57 | fill: parent | 57 | fill: parent |
58 | margins: unit.size * 3 | 58 | margins: Unit.size * 3 |
59 | } | 59 | } |
60 | 60 | ||
61 | Composer { | 61 | Composer { |
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 bf5185dc..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 |
@@ -84,10 +85,10 @@ ScrollView { | |||
84 | anchors { | 85 | anchors { |
85 | verticalCenter: parent.verticalCenter | 86 | verticalCenter: parent.verticalCenter |
86 | left: parent.left | 87 | left: parent.left |
87 | leftMargin: unit.size * 2 | 88 | leftMargin: Unit.size * 2 |
88 | } | 89 | } |
89 | 90 | ||
90 | height: unit.size * 9 | 91 | height: Unit.size * 9 |
91 | width: height | 92 | width: height |
92 | 93 | ||
93 | name: model.senderName | 94 | name: model.senderName |
@@ -99,7 +100,7 @@ ScrollView { | |||
99 | anchors { | 100 | anchors { |
100 | top: avatar.top | 101 | top: avatar.top |
101 | left: avatar.right | 102 | left: avatar.right |
102 | leftMargin: unit.size * 3 | 103 | leftMargin: Unit.size * 3 |
103 | } | 104 | } |
104 | 105 | ||
105 | text: model.senderName | 106 | text: model.senderName |
@@ -114,9 +115,9 @@ ScrollView { | |||
114 | // anchors { | 115 | // anchors { |
115 | // top: avatar.top | 116 | // top: avatar.top |
116 | // left: senderName.right | 117 | // left: senderName.right |
117 | // leftMargin: unit.size | 118 | // leftMargin: Unit.size |
118 | // right: date.left | 119 | // right: date.left |
119 | // rightMargin: unit.size | 120 | // rightMargin: Unit.size |
120 | // } | 121 | // } |
121 | // | 122 | // |
122 | // text: "(" + model.sender +")" | 123 | // text: "(" + model.sender +")" |
@@ -130,7 +131,7 @@ ScrollView { | |||
130 | anchors { | 131 | anchors { |
131 | top: avatar.top | 132 | top: avatar.top |
132 | right: parent.right | 133 | right: parent.right |
133 | rightMargin: unit.size * 2 | 134 | rightMargin: Unit.size * 2 |
134 | } | 135 | } |
135 | 136 | ||
136 | text: Qt.formatDateTime(model.date) | 137 | text: Qt.formatDateTime(model.date) |
@@ -144,7 +145,7 @@ ScrollView { | |||
144 | anchors { | 145 | anchors { |
145 | bottom: avatar.bottom | 146 | bottom: avatar.bottom |
146 | left: avatar.right | 147 | left: avatar.right |
147 | leftMargin: unit.size * 3 | 148 | leftMargin: Unit.size * 3 |
148 | } | 149 | } |
149 | 150 | ||
150 | text: model.subject | 151 | text: model.subject |
diff --git a/components/package/contents/ui/Settings.qml b/components/package/contents/ui/Settings.qml index fa886f2b..bada1140 100644 --- a/components/package/contents/ui/Settings.qml +++ b/components/package/contents/ui/Settings.qml | |||
@@ -75,7 +75,7 @@ Rectangle { | |||
75 | anchors { | 75 | anchors { |
76 | verticalCenter: parent.verticalCenter | 76 | verticalCenter: parent.verticalCenter |
77 | left: parent.left | 77 | left: parent.left |
78 | // leftMargin: unit.size * 3 | 78 | // leftMargin: Unit.size * 3 |
79 | } | 79 | } |
80 | source: accountFactory.icon | 80 | source: accountFactory.icon |
81 | } | 81 | } |
diff --git a/framework/theme/CMakeLists.txt b/framework/theme/CMakeLists.txt index 4314f662..319e3d39 100644 --- a/framework/theme/CMakeLists.txt +++ b/framework/theme/CMakeLists.txt | |||
@@ -1,6 +1,7 @@ | |||
1 | set(themeplugin_SRCS | 1 | set(themeplugin_SRCS |
2 | themeplugin.cpp | 2 | themeplugin.cpp |
3 | colorpalette.cpp | 3 | colorpalette.cpp |
4 | unit.cpp | ||
4 | ) | 5 | ) |
5 | 6 | ||
6 | add_library(themeplugin SHARED ${themeplugin_SRCS}) | 7 | add_library(themeplugin SHARED ${themeplugin_SRCS}) |
diff --git a/framework/theme/themeplugin.cpp b/framework/theme/themeplugin.cpp index 919205cf..ad9d0e1b 100644 --- a/framework/theme/themeplugin.cpp +++ b/framework/theme/themeplugin.cpp | |||
@@ -18,11 +18,12 @@ | |||
18 | 18 | ||
19 | #include "themeplugin.h" | 19 | #include "themeplugin.h" |
20 | 20 | ||
21 | #include "colorpalette.h" | ||
22 | |||
23 | #include <QtQml> | 21 | #include <QtQml> |
24 | #include <QQmlEngine> | 22 | #include <QQmlEngine> |
25 | 23 | ||
24 | #include "colorpalette.h" | ||
25 | #include "unit.h" | ||
26 | |||
26 | static QObject *colorpaletteInstace(QQmlEngine *engine, QJSEngine *scriptEngine) | 27 | static QObject *colorpaletteInstace(QQmlEngine *engine, QJSEngine *scriptEngine) |
27 | { | 28 | { |
28 | Q_UNUSED(engine); | 29 | Q_UNUSED(engine); |
@@ -31,10 +32,19 @@ static QObject *colorpaletteInstace(QQmlEngine *engine, QJSEngine *scriptEngine) | |||
31 | return new ColorPalette; | 32 | return new ColorPalette; |
32 | } | 33 | } |
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 | |||
34 | void ThemePlugin::registerTypes (const char *uri) | 43 | void ThemePlugin::registerTypes (const char *uri) |
35 | { | 44 | { |
36 | Q_ASSERT(uri == QLatin1String("org.kube.framework.theme")); | 45 | Q_ASSERT(uri == QLatin1String("org.kube.framework.theme")); |
37 | 46 | ||
38 | qmlRegisterSingletonType<ColorPalette>(uri, 1, 0, "ColorPalette", colorpaletteInstace); | 47 | qmlRegisterSingletonType<ColorPalette>(uri, 1, 0, "ColorPalette", colorpaletteInstace); |
48 | qmlRegisterSingletonType<Unit>(uri, 1, 0, "Unit", unitInstace); | ||
39 | 49 | ||
40 | } | 50 | } |
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 | }; | ||