Merge lp:~zsombi/ubuntu-ui-toolkit/popup into lp:ubuntu-ui-toolkit/staging
- popup
- Merge into staging
Proposed by
Zsombor Egri
Status: | Work in progress |
---|---|
Proposed branch: | lp:~zsombi/ubuntu-ui-toolkit/popup |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Prerequisite: | lp:~zsombi/ubuntu-ui-toolkit/fixDefaultTheme |
Diff against target: |
456 lines (+306/-9) 9 files modified
components.api (+17/-0) src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeStyle.qml (+1/-0) src/Ubuntu/Components/plugin/plugin.cpp (+4/-0) src/Ubuntu/Components/plugin/plugin.pri (+4/-2) src/Ubuntu/Components/plugin/ucpopup.cpp (+153/-0) src/Ubuntu/Components/plugin/ucpopup.h (+119/-0) src/Ubuntu/Components/plugin/uctheme.cpp (+2/-2) src/Ubuntu/Components/plugin/uctheme.h (+3/-2) src/Ubuntu/Components/plugin/ucthemingextension.cpp (+3/-3) |
To merge this branch: | bzr merge lp:~zsombi/ubuntu-ui-toolkit/popup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu SDK team | Pending | ||
Review via email: mp+282152@code.launchpad.net |
Commit message
New Popup component.
Description of the change
To post a comment you must log in.
Unmerged revisions
- 1800. By Zsombor Egri
-
prereq sync
- 1799. By Zsombor Egri
-
attachItem to accept UCThemingExtensions
- 1798. By Zsombor Egri
-
Popup added
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'components.api' | |||
2 | --- components.api 2015-12-19 10:06:24 +0000 | |||
3 | +++ components.api 2016-01-11 10:15:15 +0000 | |||
4 | @@ -935,6 +935,17 @@ | |||
5 | 935 | function var show() | 935 | function var show() |
6 | 936 | function var hide() | 936 | function var hide() |
7 | 937 | property Item pointerTarget | 937 | property Item pointerTarget |
8 | 938 | Ubuntu.Components.Popup 1.3 UCPopup: Window | ||
9 | 939 | property Item caller | ||
10 | 940 | property bool hasPointer | ||
11 | 941 | signal aboutToOpen() | ||
12 | 942 | signal opened() | ||
13 | 943 | signal aboutToClose() | ||
14 | 944 | signal closed() | ||
15 | 945 | function open() | ||
16 | 946 | function close() | ||
17 | 947 | property PopupPositioning positioning | ||
18 | 948 | property string styleName | ||
19 | 938 | Ubuntu.Components.Popups.PopupBase 1.0 0.1: OrientationHelper | 949 | Ubuntu.Components.Popups.PopupBase 1.0 0.1: OrientationHelper |
20 | 939 | property Item dismissArea | 950 | property Item dismissArea |
21 | 940 | property PropertyAnimation fadingAnimation | 951 | property PropertyAnimation fadingAnimation |
22 | @@ -947,6 +958,12 @@ | |||
23 | 947 | property bool grabDismissAreaEvents | 958 | property bool grabDismissAreaEvents |
24 | 948 | function var show() | 959 | function var show() |
25 | 949 | function var hide() | 960 | function var hide() |
26 | 961 | Ubuntu.Components.PopupPosition 1.3 UCPopupPosition: QtObject | ||
27 | 962 | property Qt.Alignment align | ||
28 | 963 | property QPointF distanceFromCaller | ||
29 | 964 | property double pointerOffset | ||
30 | 965 | Ubuntu.Components.PopupPositioning 1.3 UCPopupPositioning: QtObject | ||
31 | 966 | property list<PopupPosition> positions | ||
32 | 950 | Ubuntu.Components.Popups.PopupUtils 0.1 1.0 1.3 | 967 | Ubuntu.Components.Popups.PopupUtils 0.1 1.0 1.3 |
33 | 951 | Ubuntu.Components.ProgressBar 1.0 0.1: AnimatedItem | 968 | Ubuntu.Components.ProgressBar 1.0 0.1: AnimatedItem |
34 | 952 | property bool indeterminate | 969 | property bool indeterminate |
35 | 953 | 970 | ||
36 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeStyle.qml' | |||
37 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeStyle.qml 2015-12-10 16:39:45 +0000 | |||
38 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeStyle.qml 2016-01-11 10:15:15 +0000 | |||
39 | @@ -118,6 +118,7 @@ | |||
40 | 118 | target: bottomEdge | 118 | target: bottomEdge |
41 | 119 | onCommitStarted: loader.asynchronous = false | 119 | onCommitStarted: loader.asynchronous = false |
42 | 120 | onCommitCompleted: loader.asynchronous = true | 120 | onCommitCompleted: loader.asynchronous = true |
43 | 121 | onStatusChanged: print("BottomEdge.status", bottomEdge.status) | ||
44 | 121 | } | 122 | } |
45 | 122 | } | 123 | } |
46 | 123 | } | 124 | } |
47 | 124 | 125 | ||
48 | === modified file 'src/Ubuntu/Components/plugin/plugin.cpp' | |||
49 | --- src/Ubuntu/Components/plugin/plugin.cpp 2016-01-11 10:15:14 +0000 | |||
50 | +++ src/Ubuntu/Components/plugin/plugin.cpp 2016-01-11 10:15:15 +0000 | |||
51 | @@ -76,6 +76,7 @@ | |||
52 | 76 | #include "ucbottomedgeregion.h" | 76 | #include "ucbottomedgeregion.h" |
53 | 77 | #include "ucbottomedgestyle.h" | 77 | #include "ucbottomedgestyle.h" |
54 | 78 | #include "ucpagetreenode.h" | 78 | #include "ucpagetreenode.h" |
55 | 79 | #include "ucpopup.h" | ||
56 | 79 | 80 | ||
57 | 80 | // From UbuntuGestures | 81 | // From UbuntuGestures |
58 | 81 | #include "private/ucswipearea_p.h" | 82 | #include "private/ucswipearea_p.h" |
59 | @@ -263,6 +264,9 @@ | |||
60 | 263 | qmlRegisterType<UCBottomEdge>(uri, 1, 3, "BottomEdge"); | 264 | qmlRegisterType<UCBottomEdge>(uri, 1, 3, "BottomEdge"); |
61 | 264 | qmlRegisterType<UCBottomEdgeRegion>(uri, 1, 3, "BottomEdgeRegion"); | 265 | qmlRegisterType<UCBottomEdgeRegion>(uri, 1, 3, "BottomEdgeRegion"); |
62 | 265 | qmlRegisterType<UCPageTreeNode>(uri, 1, 3, "PageTreeNode"); | 266 | qmlRegisterType<UCPageTreeNode>(uri, 1, 3, "PageTreeNode"); |
63 | 267 | qmlRegisterType<UCPopup>(uri, 1, 3, "Popup"); | ||
64 | 268 | qmlRegisterType<UCPopupPositioning>(uri, 1, 3, "PopupPositioning"); | ||
65 | 269 | qmlRegisterType<UCPopupPosition>(uri, 1, 3, "PopupPosition"); | ||
66 | 266 | } | 270 | } |
67 | 267 | 271 | ||
68 | 268 | void UbuntuComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) | 272 | void UbuntuComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) |
69 | 269 | 273 | ||
70 | === modified file 'src/Ubuntu/Components/plugin/plugin.pri' | |||
71 | --- src/Ubuntu/Components/plugin/plugin.pri 2015-12-17 15:23:26 +0000 | |||
72 | +++ src/Ubuntu/Components/plugin/plugin.pri 2016-01-11 10:15:15 +0000 | |||
73 | @@ -106,7 +106,8 @@ | |||
74 | 106 | $$PWD/ucbottomedgestyle.h \ | 106 | $$PWD/ucbottomedgestyle.h \ |
75 | 107 | $$PWD/ucbottomedgeregion.h \ | 107 | $$PWD/ucbottomedgeregion.h \ |
76 | 108 | $$PWD/ucpagetreenode.h \ | 108 | $$PWD/ucpagetreenode.h \ |
78 | 109 | $$PWD/ucpagetreenode_p.h | 109 | $$PWD/ucpagetreenode_p.h \ |
79 | 110 | $$PWD/ucpopup.h | ||
80 | 110 | 111 | ||
81 | 111 | SOURCES += $$PWD/plugin.cpp \ | 112 | SOURCES += $$PWD/plugin.cpp \ |
82 | 112 | $$PWD/uctheme.cpp \ | 113 | $$PWD/uctheme.cpp \ |
83 | @@ -176,7 +177,8 @@ | |||
84 | 176 | $$PWD/ucbottomedge.cpp \ | 177 | $$PWD/ucbottomedge.cpp \ |
85 | 177 | $$PWD/ucbottomedgestyle.cpp \ | 178 | $$PWD/ucbottomedgestyle.cpp \ |
86 | 178 | $$PWD/ucbottomedgeregion.cpp \ | 179 | $$PWD/ucbottomedgeregion.cpp \ |
88 | 179 | $$PWD/ucpagetreenode.cpp | 180 | $$PWD/ucpagetreenode.cpp \ |
89 | 181 | $$PWD/ucpopup.cpp | ||
90 | 180 | 182 | ||
91 | 181 | # adapters | 183 | # adapters |
92 | 182 | SOURCES += $$PWD/adapters/alarmsadapter_organizer.cpp | 184 | SOURCES += $$PWD/adapters/alarmsadapter_organizer.cpp |
93 | 183 | 185 | ||
94 | === added file 'src/Ubuntu/Components/plugin/ucpopup.cpp' | |||
95 | --- src/Ubuntu/Components/plugin/ucpopup.cpp 1970-01-01 00:00:00 +0000 | |||
96 | +++ src/Ubuntu/Components/plugin/ucpopup.cpp 2016-01-11 10:15:15 +0000 | |||
97 | @@ -0,0 +1,153 @@ | |||
98 | 1 | /* | ||
99 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
100 | 3 | * | ||
101 | 4 | * This program is free software; you can redistribute it and/or modify | ||
102 | 5 | * it under the terms of the GNU General Public License as published by | ||
103 | 6 | * the Free Software Foundation; version 3. | ||
104 | 7 | * | ||
105 | 8 | * This program is distributed in the hope that it will be useful, | ||
106 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
107 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
108 | 11 | * GNU General Public License for more details. | ||
109 | 12 | * | ||
110 | 13 | * You should have received a copy of the GNU General Public License | ||
111 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
112 | 15 | * | ||
113 | 16 | * Author: Zsombor Egri <zsombor.egri@canonical.com> | ||
114 | 17 | */ | ||
115 | 18 | |||
116 | 19 | #include "ucpopup.h" | ||
117 | 20 | |||
118 | 21 | UCPopupPosition::UCPopupPosition(QObject *parent) | ||
119 | 22 | : QObject(parent) | ||
120 | 23 | { | ||
121 | 24 | } | ||
122 | 25 | |||
123 | 26 | Qt::Alignment UCPopupPosition::align() const | ||
124 | 27 | { | ||
125 | 28 | return m_align; | ||
126 | 29 | } | ||
127 | 30 | void UCPopupPosition::setAlign(Qt::Alignment align) | ||
128 | 31 | { | ||
129 | 32 | if (m_align == align) { | ||
130 | 33 | return; | ||
131 | 34 | } | ||
132 | 35 | m_align = align; | ||
133 | 36 | Q_EMIT alignChanged(); | ||
134 | 37 | } | ||
135 | 38 | |||
136 | 39 | QPointF UCPopupPosition::distanceFromCaller() const | ||
137 | 40 | { | ||
138 | 41 | return m_distanceFromCaller; | ||
139 | 42 | } | ||
140 | 43 | void UCPopupPosition::setDistanceFromCaller(const QPointF &distance) | ||
141 | 44 | { | ||
142 | 45 | if (m_distanceFromCaller == distance) { | ||
143 | 46 | return; | ||
144 | 47 | } | ||
145 | 48 | m_distanceFromCaller = distance; | ||
146 | 49 | Q_EMIT distanceFromCallerChanged(); | ||
147 | 50 | } | ||
148 | 51 | |||
149 | 52 | qreal UCPopupPosition::pointerOffset() const | ||
150 | 53 | { | ||
151 | 54 | return m_pointerOffset; | ||
152 | 55 | } | ||
153 | 56 | void UCPopupPosition::setPointerOffset(qreal offset) | ||
154 | 57 | { | ||
155 | 58 | if (m_pointerOffset == offset) { | ||
156 | 59 | return; | ||
157 | 60 | } | ||
158 | 61 | m_pointerOffset = offset; | ||
159 | 62 | Q_EMIT pointerOffsetChanged(); | ||
160 | 63 | } | ||
161 | 64 | |||
162 | 65 | |||
163 | 66 | UCPopupPositioning::UCPopupPositioning(QObject *parent) | ||
164 | 67 | : QObject(parent) | ||
165 | 68 | { | ||
166 | 69 | } | ||
167 | 70 | |||
168 | 71 | QList<UCPopupPosition*> UCPopupPositioning::positionsList() | ||
169 | 72 | { | ||
170 | 73 | return m_positions; | ||
171 | 74 | } | ||
172 | 75 | |||
173 | 76 | QQmlListProperty<UCPopupPosition> UCPopupPositioning::positions() | ||
174 | 77 | { | ||
175 | 78 | return QQmlListProperty<UCPopupPosition>(this, m_positions); | ||
176 | 79 | } | ||
177 | 80 | |||
178 | 81 | |||
179 | 82 | UCPopup::UCPopup(QWindow *parent) | ||
180 | 83 | : QQuickWindow(parent) | ||
181 | 84 | { | ||
182 | 85 | } | ||
183 | 86 | UCPopup::UCPopup(QQuickRenderControl *renderControl) | ||
184 | 87 | : QQuickWindow(renderControl) | ||
185 | 88 | { | ||
186 | 89 | } | ||
187 | 90 | |||
188 | 91 | QString UCPopup::styleName() const | ||
189 | 92 | { | ||
190 | 93 | return m_styleName; | ||
191 | 94 | } | ||
192 | 95 | void UCPopup::setStyleName(const QString &name) | ||
193 | 96 | { | ||
194 | 97 | if (m_styleName == name) { | ||
195 | 98 | return; | ||
196 | 99 | } | ||
197 | 100 | m_styleName = name; | ||
198 | 101 | Q_EMIT styleNameChanged(); | ||
199 | 102 | } | ||
200 | 103 | |||
201 | 104 | UCPopupPositioning *UCPopup::positioning() const | ||
202 | 105 | { | ||
203 | 106 | return m_positioning; | ||
204 | 107 | } | ||
205 | 108 | void UCPopup::setPositioning(UCPopupPositioning *positioning) | ||
206 | 109 | { | ||
207 | 110 | if (m_positioning == positioning) { | ||
208 | 111 | return; | ||
209 | 112 | } | ||
210 | 113 | m_positioning = positioning; | ||
211 | 114 | Q_EMIT positioningChanged(); | ||
212 | 115 | } | ||
213 | 116 | |||
214 | 117 | QQuickItem *UCPopup::caller() const | ||
215 | 118 | { | ||
216 | 119 | return m_caller; | ||
217 | 120 | } | ||
218 | 121 | void UCPopup::setCaller(QQuickItem *caller) | ||
219 | 122 | { | ||
220 | 123 | if (m_caller == caller) { | ||
221 | 124 | return; | ||
222 | 125 | } | ||
223 | 126 | m_caller = caller; | ||
224 | 127 | Q_EMIT callerChanged(); | ||
225 | 128 | } | ||
226 | 129 | |||
227 | 130 | bool UCPopup::hasPointer() const | ||
228 | 131 | { | ||
229 | 132 | return m_hasPointer; | ||
230 | 133 | } | ||
231 | 134 | void UCPopup::setHasPointer(bool hasPointer) | ||
232 | 135 | { | ||
233 | 136 | if (m_hasPointer == hasPointer) { | ||
234 | 137 | return; | ||
235 | 138 | } | ||
236 | 139 | m_hasPointer = hasPointer; | ||
237 | 140 | Q_EMIT hasPointerChanged(); | ||
238 | 141 | } | ||
239 | 142 | |||
240 | 143 | void UCPopup::open() | ||
241 | 144 | { | ||
242 | 145 | setVisible(true); | ||
243 | 146 | } | ||
244 | 147 | |||
245 | 148 | void UCPopup::close() | ||
246 | 149 | { | ||
247 | 150 | setVisible(false); | ||
248 | 151 | } | ||
249 | 152 | |||
250 | 153 | #include "moc_ucpopup.cpp" | ||
251 | 0 | 154 | ||
252 | === added file 'src/Ubuntu/Components/plugin/ucpopup.h' | |||
253 | --- src/Ubuntu/Components/plugin/ucpopup.h 1970-01-01 00:00:00 +0000 | |||
254 | +++ src/Ubuntu/Components/plugin/ucpopup.h 2016-01-11 10:15:15 +0000 | |||
255 | @@ -0,0 +1,119 @@ | |||
256 | 1 | /* | ||
257 | 2 | * Copyright (C) 2015 Canonical, Ltd. | ||
258 | 3 | * | ||
259 | 4 | * This program is free software; you can redistribute it and/or modify | ||
260 | 5 | * it under the terms of the GNU General Public License as published by | ||
261 | 6 | * the Free Software Foundation; version 3. | ||
262 | 7 | * | ||
263 | 8 | * This program is distributed in the hope that it will be useful, | ||
264 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
265 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
266 | 11 | * GNU General Public License for more details. | ||
267 | 12 | * | ||
268 | 13 | * You should have received a copy of the GNU General Public License | ||
269 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
270 | 15 | * | ||
271 | 16 | * Author: Zsombor Egri <zsombor.egri@canonical.com> | ||
272 | 17 | */ | ||
273 | 18 | |||
274 | 19 | #ifndef UCPOPUP_H | ||
275 | 20 | #define UCPOPUP_H | ||
276 | 21 | |||
277 | 22 | #include <QtCore/QObject> | ||
278 | 23 | #include <QtQuick/QQuickItem> | ||
279 | 24 | #include <QtQml/QQmlListProperty> | ||
280 | 25 | #include "ucthemingextension.h" | ||
281 | 26 | |||
282 | 27 | class UCPopupPosition : public QObject | ||
283 | 28 | { | ||
284 | 29 | Q_OBJECT | ||
285 | 30 | Q_PROPERTY(Qt::Alignment align READ align WRITE setAlign NOTIFY alignChanged FINAL) | ||
286 | 31 | Q_PROPERTY(QPointF distanceFromCaller READ distanceFromCaller WRITE setDistanceFromCaller NOTIFY distanceFromCallerChanged FINAL) | ||
287 | 32 | Q_PROPERTY(qreal pointerOffset READ pointerOffset WRITE setPointerOffset NOTIFY pointerOffsetChanged FINAL) | ||
288 | 33 | public: | ||
289 | 34 | explicit UCPopupPosition(QObject *parent = 0); | ||
290 | 35 | |||
291 | 36 | Qt::Alignment align() const; | ||
292 | 37 | void setAlign(Qt::Alignment align); | ||
293 | 38 | QPointF distanceFromCaller() const; | ||
294 | 39 | void setDistanceFromCaller(const QPointF &distance); | ||
295 | 40 | qreal pointerOffset() const; | ||
296 | 41 | void setPointerOffset(qreal offset); | ||
297 | 42 | |||
298 | 43 | |||
299 | 44 | Q_SIGNALS: | ||
300 | 45 | void alignChanged(); | ||
301 | 46 | void distanceFromCallerChanged(); | ||
302 | 47 | void pointerOffsetChanged(); | ||
303 | 48 | |||
304 | 49 | private: | ||
305 | 50 | QPointF m_distanceFromCaller; | ||
306 | 51 | qreal m_pointerOffset = -1; | ||
307 | 52 | Qt::Alignment m_align = 0; | ||
308 | 53 | }; | ||
309 | 54 | |||
310 | 55 | class UCPopupPositioning : public QObject | ||
311 | 56 | { | ||
312 | 57 | Q_OBJECT | ||
313 | 58 | Q_PROPERTY(QQmlListProperty<UCPopupPosition> positions READ positions) | ||
314 | 59 | public: | ||
315 | 60 | explicit UCPopupPositioning(QObject *parent = 0); | ||
316 | 61 | |||
317 | 62 | QList<UCPopupPosition*> positionsList(); | ||
318 | 63 | QQmlListProperty<UCPopupPosition> positions(); | ||
319 | 64 | |||
320 | 65 | private: | ||
321 | 66 | QList<UCPopupPosition*> m_positions; | ||
322 | 67 | }; | ||
323 | 68 | |||
324 | 69 | // FIXME: when we move on Qt 5.5, make sure we derive from QQuickWindowQmlImpl! | ||
325 | 70 | class UCPopup : public QQuickWindow//, public UCThemingExtension | ||
326 | 71 | { | ||
327 | 72 | Q_OBJECT | ||
328 | 73 | // Q_INTERFACES(UCThemingExtension) | ||
329 | 74 | // Q_PROPERTY(UCTheme theme READ getTheme WRITE setTheme NOTIFY themeChanged FINAL) | ||
330 | 75 | Q_PROPERTY(QString styleName READ styleName WRITE setStyleName NOTIFY styleNameChanged FINAL) | ||
331 | 76 | Q_PROPERTY(UCPopupPositioning *positioning READ positioning WRITE setPositioning NOTIFY positioningChanged FINAL) | ||
332 | 77 | Q_PROPERTY(QQuickItem *caller READ caller WRITE setCaller NOTIFY callerChanged FINAL) | ||
333 | 78 | Q_PROPERTY(bool hasPointer READ hasPointer WRITE setHasPointer NOTIFY hasPointerChanged FINAL) | ||
334 | 79 | public: | ||
335 | 80 | UCPopup(QWindow *parent = 0); | ||
336 | 81 | explicit UCPopup(QQuickRenderControl *renderControl); | ||
337 | 82 | |||
338 | 83 | QString styleName() const; | ||
339 | 84 | void setStyleName(const QString &name); | ||
340 | 85 | UCPopupPositioning *positioning() const; | ||
341 | 86 | void setPositioning(UCPopupPositioning *positioning); | ||
342 | 87 | QQuickItem *caller() const; | ||
343 | 88 | void setCaller(QQuickItem *caller); | ||
344 | 89 | bool hasPointer() const; | ||
345 | 90 | void setHasPointer(bool hasPointer); | ||
346 | 91 | |||
347 | 92 | protected: | ||
348 | 93 | // void preThemeChanged() override {} | ||
349 | 94 | // void postThemeChanged() override {} | ||
350 | 95 | |||
351 | 96 | public Q_SLOTS: | ||
352 | 97 | void open(); | ||
353 | 98 | void close(); | ||
354 | 99 | |||
355 | 100 | Q_SIGNALS: | ||
356 | 101 | void themeChanged(); | ||
357 | 102 | void styleNameChanged(); | ||
358 | 103 | void positioningChanged(); | ||
359 | 104 | void callerChanged(); | ||
360 | 105 | void hasPointerChanged(); | ||
361 | 106 | |||
362 | 107 | void aboutToOpen(); | ||
363 | 108 | void opened(); | ||
364 | 109 | void aboutToClose(); | ||
365 | 110 | void closed(); | ||
366 | 111 | |||
367 | 112 | private: | ||
368 | 113 | QString m_styleName; | ||
369 | 114 | UCPopupPositioning *m_positioning = nullptr; | ||
370 | 115 | QQuickItem *m_caller = nullptr; | ||
371 | 116 | bool m_hasPointer = true; | ||
372 | 117 | }; | ||
373 | 118 | |||
374 | 119 | #endif // UCPOPUP_H | ||
375 | 0 | 120 | ||
376 | === modified file 'src/Ubuntu/Components/plugin/uctheme.cpp' | |||
377 | --- src/Ubuntu/Components/plugin/uctheme.cpp 2016-01-11 10:15:14 +0000 | |||
378 | +++ src/Ubuntu/Components/plugin/uctheme.cpp 2016-01-11 10:15:15 +0000 | |||
379 | @@ -641,7 +641,7 @@ | |||
380 | 641 | listener, &ContextPropertyChangeListener::updateContextProperty); | 641 | listener, &ContextPropertyChangeListener::updateContextProperty); |
381 | 642 | } | 642 | } |
382 | 643 | 643 | ||
384 | 644 | void UCTheme::attachItem(QQuickItem *item, bool attach) | 644 | void UCTheme::attachItem(UCThemingExtension *item, bool attach) |
385 | 645 | { | 645 | { |
386 | 646 | if (attach) { | 646 | if (attach) { |
387 | 647 | m_attachedItems.append(item); | 647 | m_attachedItems.append(item); |
388 | @@ -653,7 +653,7 @@ | |||
389 | 653 | void UCTheme::updateThemedItems() | 653 | void UCTheme::updateThemedItems() |
390 | 654 | { | 654 | { |
391 | 655 | for (int i = 0; i < m_attachedItems.count(); i++) { | 655 | for (int i = 0; i < m_attachedItems.count(); i++) { |
393 | 656 | UCThemingExtension *extension = qobject_cast<UCThemingExtension*>(m_attachedItems[i]); | 656 | UCThemingExtension *extension = m_attachedItems[i]; |
394 | 657 | if (extension) { | 657 | if (extension) { |
395 | 658 | extension->itemThemeReloaded(this); | 658 | extension->itemThemeReloaded(this); |
396 | 659 | } | 659 | } |
397 | 660 | 660 | ||
398 | === modified file 'src/Ubuntu/Components/plugin/uctheme.h' | |||
399 | --- src/Ubuntu/Components/plugin/uctheme.h 2016-01-11 10:15:14 +0000 | |||
400 | +++ src/Ubuntu/Components/plugin/uctheme.h 2016-01-11 10:15:15 +0000 | |||
401 | @@ -35,6 +35,7 @@ | |||
402 | 35 | class UCStyledItemBase; | 35 | class UCStyledItemBase; |
403 | 36 | class QQmlAbstractBinding; | 36 | class QQmlAbstractBinding; |
404 | 37 | class QQuickItem; | 37 | class QQuickItem; |
405 | 38 | class UCThemingExtension; | ||
406 | 38 | class UCTheme : public QObject, public QQmlParserStatus | 39 | class UCTheme : public QObject, public QQmlParserStatus |
407 | 39 | { | 40 | { |
408 | 40 | Q_OBJECT | 41 | Q_OBJECT |
409 | @@ -79,7 +80,7 @@ | |||
410 | 79 | // internal, used by the deprecated Theme.createStyledComponent() | 80 | // internal, used by the deprecated Theme.createStyledComponent() |
411 | 80 | QQmlComponent* createStyleComponent(const QString& styleName, QObject* parent, quint16 version = 0); | 81 | QQmlComponent* createStyleComponent(const QString& styleName, QObject* parent, quint16 version = 0); |
412 | 81 | static void createDefaultTheme(QQmlEngine* engine); | 82 | static void createDefaultTheme(QQmlEngine* engine); |
414 | 82 | void attachItem(QQuickItem *item, bool attach); | 83 | void attachItem(UCThemingExtension *item, bool attach); |
415 | 83 | 84 | ||
416 | 84 | // helper functions | 85 | // helper functions |
417 | 85 | QColor getPaletteColor(const char *profile, const char *color); | 86 | QColor getPaletteColor(const char *profile, const char *color); |
418 | @@ -160,7 +161,7 @@ | |||
419 | 160 | QPointer<QObject> m_palette; // the palette might be from the default style if the theme doesn't define palette | 161 | QPointer<QObject> m_palette; // the palette might be from the default style if the theme doesn't define palette |
420 | 161 | QList<ThemeRecord> m_themePaths; | 162 | QList<ThemeRecord> m_themePaths; |
421 | 162 | UCDefaultTheme m_defaultTheme; | 163 | UCDefaultTheme m_defaultTheme; |
423 | 163 | QPODVector<QQuickItem*, 4> m_attachedItems; | 164 | QPODVector<UCThemingExtension*, 4> m_attachedItems; |
424 | 164 | bool m_completed:1; | 165 | bool m_completed:1; |
425 | 165 | 166 | ||
426 | 166 | friend class UCDeprecatedTheme; | 167 | friend class UCDeprecatedTheme; |
427 | 167 | 168 | ||
428 | === modified file 'src/Ubuntu/Components/plugin/ucthemingextension.cpp' | |||
429 | --- src/Ubuntu/Components/plugin/ucthemingextension.cpp 2016-01-11 10:15:14 +0000 | |||
430 | +++ src/Ubuntu/Components/plugin/ucthemingextension.cpp 2016-01-11 10:15:15 +0000 | |||
431 | @@ -159,7 +159,7 @@ | |||
432 | 159 | UCThemingExtension::~UCThemingExtension() | 159 | UCThemingExtension::~UCThemingExtension() |
433 | 160 | { | 160 | { |
434 | 161 | if (theme) { | 161 | if (theme) { |
436 | 162 | theme->attachItem(themedItem, false); | 162 | theme->attachItem(this, false); |
437 | 163 | } | 163 | } |
438 | 164 | } | 164 | } |
439 | 165 | 165 | ||
440 | @@ -240,14 +240,14 @@ | |||
441 | 240 | 240 | ||
442 | 241 | // disconnect from the previous set | 241 | // disconnect from the previous set |
443 | 242 | if (theme) { | 242 | if (theme) { |
445 | 243 | theme->attachItem(themedItem, false); | 243 | theme->attachItem(this, false); |
446 | 244 | } | 244 | } |
447 | 245 | 245 | ||
448 | 246 | theme = newTheme; | 246 | theme = newTheme; |
449 | 247 | 247 | ||
450 | 248 | // connect to the new set | 248 | // connect to the new set |
451 | 249 | if (theme) { | 249 | if (theme) { |
453 | 250 | theme->attachItem(themedItem, true); | 250 | theme->attachItem(this, true); |
454 | 251 | // set the parent of the theme if custom | 251 | // set the parent of the theme if custom |
455 | 252 | setParentTheme(); | 252 | setParentTheme(); |
456 | 253 | } | 253 | } |