Merge lp:~zsombi/ubuntu-ui-toolkit/cppActionItem into lp:ubuntu-ui-toolkit/staging
- cppActionItem
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Zsombor Egri |
Approved revision: | 1619 |
Merged at revision: | 1612 |
Proposed branch: | lp:~zsombi/ubuntu-ui-toolkit/cppActionItem |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Diff against target: |
874 lines (+420/-225) 16 files modified
components.api (+6/-10) src/Ubuntu/Components/1.2/ActionItem.qml (+0/-96) src/Ubuntu/Components/1.2/TextField.qml (+1/-1) src/Ubuntu/Components/1.2/TextInputPopover.qml (+1/-0) src/Ubuntu/Components/1.2/ToolbarButton.qml (+1/-0) src/Ubuntu/Components/1.3/ActionItem.qml (+0/-96) src/Ubuntu/Components/1.3/TextField.qml (+1/-1) src/Ubuntu/Components/ComponentModule.pro (+0/-2) src/Ubuntu/Components/plugin/plugin.cpp (+2/-0) src/Ubuntu/Components/plugin/plugin.pri (+4/-2) src/Ubuntu/Components/plugin/ucaction.cpp (+2/-3) src/Ubuntu/Components/plugin/ucaction.h (+7/-6) src/Ubuntu/Components/plugin/ucactionitem.cpp (+305/-0) src/Ubuntu/Components/plugin/ucactionitem.h (+77/-0) src/Ubuntu/Components/qmldir (+0/-3) tests/unit/tst_components/tst_actionitem.qml (+13/-5) |
To merge this branch: | bzr merge lp:~zsombi/ubuntu-ui-toolkit/cppActionItem |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Zsombor Egri | Approve | ||
Cris Dywan | Approve | ||
Review via email: mp+268348@code.launchpad.net |
Commit message
ActionItem moved to C++.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
Cris Dywan (kalikiana) wrote : | # |
Looks pretty good to me and seems as closely ported as possible.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1616
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
deb: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
deb: http://
UNSTABLE: http://
Zsombor Egri (zsombi) wrote : | # |
The component is flaky, the ActionSelection
- 1617. By Zsombor Egri
-
fixing text, iconName getters to return proper values when not having custom values
- 1618. By Zsombor Egri
-
update visible and enabled when action changes, connect text, iconSource and iconName property change signals to action to keep the value changes in sync
- 1619. By Zsombor Egri
-
random icon and text disappearance in Popups caused by a stupid mistake - unititialized member
Zsombor Egri (zsombi) wrote : | # |
Good to go now, all the needed functionality is there.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1619
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'components.api' | |||
2 | --- components.api 2015-08-12 15:22:59 +0000 | |||
3 | +++ components.api 2015-08-19 06:57:12 +0000 | |||
4 | @@ -43,14 +43,8 @@ | |||
5 | 43 | property string iconName | 43 | property string iconName |
6 | 44 | property url iconSource | 44 | property url iconSource |
7 | 45 | signal triggered(var value) | 45 | signal triggered(var value) |
16 | 46 | function var trigger(var value) | 46 | function trigger(var value) |
17 | 47 | property string text | 47 | function trigger() |
10 | 48 | Ubuntu.Components.ActionItem 1.3: StyledItem | ||
11 | 49 | property Action action | ||
12 | 50 | property string iconName | ||
13 | 51 | property url iconSource | ||
14 | 52 | signal triggered(var value) | ||
15 | 53 | function var trigger(var value) | ||
18 | 54 | property string text | 48 | property string text |
19 | 55 | Ubuntu.Components.ActionList 1.0 0.1: QtObject | 49 | Ubuntu.Components.ActionList 1.0 0.1: QtObject |
20 | 56 | readonly property Action actions | 50 | readonly property Action actions |
21 | @@ -1232,14 +1226,16 @@ | |||
22 | 1232 | property string iconName | 1226 | property string iconName |
23 | 1233 | property url iconSource | 1227 | property url iconSource |
24 | 1234 | signal triggered(var value) | 1228 | signal triggered(var value) |
26 | 1235 | function var trigger(var value) | 1229 | function trigger(var value) |
27 | 1230 | function trigger() | ||
28 | 1236 | property string text | 1231 | property string text |
29 | 1237 | Ubuntu.Components.ToolbarButton 1.3: StyledItem | 1232 | Ubuntu.Components.ToolbarButton 1.3: StyledItem |
30 | 1238 | property Action action | 1233 | property Action action |
31 | 1239 | property string iconName | 1234 | property string iconName |
32 | 1240 | property url iconSource | 1235 | property url iconSource |
33 | 1241 | signal triggered(var value) | 1236 | signal triggered(var value) |
35 | 1242 | function var trigger(var value) | 1237 | function trigger(var value) |
36 | 1238 | function trigger() | ||
37 | 1243 | property string text | 1239 | property string text |
38 | 1244 | Ubuntu.Components.ToolbarItems 1.0 0.1: Item | 1240 | Ubuntu.Components.ToolbarItems 1.0 0.1: Item |
39 | 1245 | property Item back | 1241 | property Item back |
40 | 1246 | 1242 | ||
41 | === removed file 'src/Ubuntu/Components/1.2/ActionItem.qml' | |||
42 | --- src/Ubuntu/Components/1.2/ActionItem.qml 2015-04-30 08:32:44 +0000 | |||
43 | +++ src/Ubuntu/Components/1.2/ActionItem.qml 1970-01-01 00:00:00 +0000 | |||
44 | @@ -1,96 +0,0 @@ | |||
45 | 1 | /* | ||
46 | 2 | * Copyright 2012 Canonical Ltd. | ||
47 | 3 | * | ||
48 | 4 | * This program is free software; you can redistribute it and/or modify | ||
49 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
50 | 6 | * the Free Software Foundation; version 3. | ||
51 | 7 | * | ||
52 | 8 | * This program is distributed in the hope that it will be useful, | ||
53 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
54 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
55 | 11 | * GNU Lesser General Public License for more details. | ||
56 | 12 | * | ||
57 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
58 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
59 | 15 | */ | ||
60 | 16 | |||
61 | 17 | import QtQuick 2.4 | ||
62 | 18 | import Ubuntu.Components 1.2 | ||
63 | 19 | |||
64 | 20 | /*! | ||
65 | 21 | \qmlabstract ActionItem | ||
66 | 22 | \inqmlmodule Ubuntu.Components 1.1 | ||
67 | 23 | \ingroup ubuntu | ||
68 | 24 | \brief A visual representation of an Action. The API of ActionItem is a | ||
69 | 25 | copy of the API of \l Action, with additional properties to define | ||
70 | 26 | visual aspects of the ActionItem. | ||
71 | 27 | |||
72 | 28 | If \l action is set, the values of the other properties will by default | ||
73 | 29 | be identical to the \l Action's property values. Setting the other properties | ||
74 | 30 | will override the properties copied from the \l Action. | ||
75 | 31 | |||
76 | 32 | See \l ToolbarItems for examples of how to use \l ToolbarButton or other ActionItems | ||
77 | 33 | in a toolbar. | ||
78 | 34 | */ | ||
79 | 35 | StyledItem { | ||
80 | 36 | id: actionItem | ||
81 | 37 | |||
82 | 38 | /*! | ||
83 | 39 | The \l Action associated with this ActionItem. If action is set, | ||
84 | 40 | the values of the Action properties are copied to the values of | ||
85 | 41 | the ActionItem properties. | ||
86 | 42 | */ | ||
87 | 43 | property Action action: null | ||
88 | 44 | |||
89 | 45 | visible: action ? action.visible : true | ||
90 | 46 | enabled: action ? action.enabled : true | ||
91 | 47 | |||
92 | 48 | /*! | ||
93 | 49 | The title of the actionItem. | ||
94 | 50 | Default value: action.text | ||
95 | 51 | */ | ||
96 | 52 | property string text: action ? action.text : "" | ||
97 | 53 | |||
98 | 54 | /*! | ||
99 | 55 | The image associated with the actionItem. | ||
100 | 56 | Default value: action.iconSource. | ||
101 | 57 | |||
102 | 58 | This is the URL of any image file | ||
103 | 59 | If both iconSource and iconName are defined, iconName will be ignored. | ||
104 | 60 | */ | ||
105 | 61 | property url iconSource: action ? action.iconSource : (iconName ? "image://theme/" + iconName : "") | ||
106 | 62 | |||
107 | 63 | /*! | ||
108 | 64 | The icon associated with the actionItem in the suru icon theme. | ||
109 | 65 | Default value: action.iconName. | ||
110 | 66 | |||
111 | 67 | \note The complete list of icons available in Ubuntu is not published yet. | ||
112 | 68 | For now please refer to the folders where the icon themes are installed: | ||
113 | 69 | \list | ||
114 | 70 | \li Ubuntu Touch: \l file:/usr/share/icons/suru | ||
115 | 71 | \li Ubuntu Desktop: \l file:/usr/share/icons/ubuntu-mono-dark | ||
116 | 72 | \endlist | ||
117 | 73 | These 2 separate icon themes will be merged soon. | ||
118 | 74 | |||
119 | 75 | If both iconSource and iconName are defined, iconName will be ignored. | ||
120 | 76 | */ | ||
121 | 77 | property string iconName: action ? action.iconName : "" | ||
122 | 78 | |||
123 | 79 | /*! | ||
124 | 80 | Called when the actionItem is triggered. | ||
125 | 81 | */ | ||
126 | 82 | signal triggered(var value) | ||
127 | 83 | |||
128 | 84 | /*! | ||
129 | 85 | If \l action is set, this will trigger it. | ||
130 | 86 | */ | ||
131 | 87 | onTriggered: if (action) action.trigger(value) | ||
132 | 88 | |||
133 | 89 | /*! | ||
134 | 90 | Trigger this action item if it is enabled. | ||
135 | 91 | */ | ||
136 | 92 | function trigger(value) { | ||
137 | 93 | var passingValue = value ? value : null | ||
138 | 94 | if (actionItem.enabled) actionItem.triggered(passingValue); | ||
139 | 95 | } | ||
140 | 96 | } | ||
141 | 97 | 0 | ||
142 | === modified file 'src/Ubuntu/Components/1.2/TextField.qml' | |||
143 | --- src/Ubuntu/Components/1.2/TextField.qml 2015-05-01 19:38:57 +0000 | |||
144 | +++ src/Ubuntu/Components/1.2/TextField.qml 2015-08-19 06:57:12 +0000 | |||
145 | @@ -99,7 +99,7 @@ | |||
146 | 99 | \note During text selection all interactive parent Flickables are turned off. | 99 | \note During text selection all interactive parent Flickables are turned off. |
147 | 100 | */ | 100 | */ |
148 | 101 | 101 | ||
150 | 102 | ActionItem { | 102 | Ubuntu.ActionItem { |
151 | 103 | id: control | 103 | id: control |
152 | 104 | 104 | ||
153 | 105 | implicitWidth: units.gu(25) | 105 | implicitWidth: units.gu(25) |
154 | 106 | 106 | ||
155 | === modified file 'src/Ubuntu/Components/1.2/TextInputPopover.qml' | |||
156 | --- src/Ubuntu/Components/1.2/TextInputPopover.qml 2015-07-02 23:33:22 +0000 | |||
157 | +++ src/Ubuntu/Components/1.2/TextInputPopover.qml 2015-08-19 06:57:12 +0000 | |||
158 | @@ -88,6 +88,7 @@ | |||
159 | 88 | action.text so we can get the proper button by text, action being not | 88 | action.text so we can get the proper button by text, action being not |
160 | 89 | accessible. https://bugs.launchpad.net/autopilot/+bug/1334599 | 89 | accessible. https://bugs.launchpad.net/autopilot/+bug/1334599 |
161 | 90 | */ | 90 | */ |
162 | 91 | // FIXME: AbstractButton has text property, which is getting the action.text, so no need to override! | ||
163 | 91 | property string text: action.text | 92 | property string text: action.text |
164 | 92 | width: Math.max(units.gu(5), implicitWidth) + units.gu(2) | 93 | width: Math.max(units.gu(5), implicitWidth) + units.gu(2) |
165 | 93 | height: units.gu(6) | 94 | height: units.gu(6) |
166 | 94 | 95 | ||
167 | === modified file 'src/Ubuntu/Components/1.2/ToolbarButton.qml' | |||
168 | --- src/Ubuntu/Components/1.2/ToolbarButton.qml 2015-04-30 08:32:44 +0000 | |||
169 | +++ src/Ubuntu/Components/1.2/ToolbarButton.qml 2015-08-19 06:57:12 +0000 | |||
170 | @@ -15,6 +15,7 @@ | |||
171 | 15 | */ | 15 | */ |
172 | 16 | 16 | ||
173 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
174 | 18 | import Ubuntu.Components 1.2 | ||
175 | 18 | 19 | ||
176 | 19 | /*! | 20 | /*! |
177 | 20 | \qmltype ToolbarButton | 21 | \qmltype ToolbarButton |
178 | 21 | 22 | ||
179 | === removed file 'src/Ubuntu/Components/1.3/ActionItem.qml' | |||
180 | --- src/Ubuntu/Components/1.3/ActionItem.qml 2015-04-25 08:54:58 +0000 | |||
181 | +++ src/Ubuntu/Components/1.3/ActionItem.qml 1970-01-01 00:00:00 +0000 | |||
182 | @@ -1,96 +0,0 @@ | |||
183 | 1 | /* | ||
184 | 2 | * Copyright 2012 Canonical Ltd. | ||
185 | 3 | * | ||
186 | 4 | * This program is free software; you can redistribute it and/or modify | ||
187 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
188 | 6 | * the Free Software Foundation; version 3. | ||
189 | 7 | * | ||
190 | 8 | * This program is distributed in the hope that it will be useful, | ||
191 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
192 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
193 | 11 | * GNU Lesser General Public License for more details. | ||
194 | 12 | * | ||
195 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
196 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
197 | 15 | */ | ||
198 | 16 | |||
199 | 17 | import QtQuick 2.4 | ||
200 | 18 | import Ubuntu.Components 1.3 | ||
201 | 19 | |||
202 | 20 | /*! | ||
203 | 21 | \qmlabstract ActionItem | ||
204 | 22 | \inqmlmodule Ubuntu.Components 1.1 | ||
205 | 23 | \ingroup ubuntu | ||
206 | 24 | \brief A visual representation of an Action. The API of ActionItem is a | ||
207 | 25 | copy of the API of \l Action, with additional properties to define | ||
208 | 26 | visual aspects of the ActionItem. | ||
209 | 27 | |||
210 | 28 | If \l action is set, the values of the other properties will by default | ||
211 | 29 | be identical to the \l Action's property values. Setting the other properties | ||
212 | 30 | will override the properties copied from the \l Action. | ||
213 | 31 | |||
214 | 32 | See \l ToolbarItems for examples of how to use \l ToolbarButton or other ActionItems | ||
215 | 33 | in a toolbar. | ||
216 | 34 | */ | ||
217 | 35 | StyledItem { | ||
218 | 36 | id: actionItem | ||
219 | 37 | |||
220 | 38 | /*! | ||
221 | 39 | The \l Action associated with this ActionItem. If action is set, | ||
222 | 40 | the values of the Action properties are copied to the values of | ||
223 | 41 | the ActionItem properties. | ||
224 | 42 | */ | ||
225 | 43 | property Action action: null | ||
226 | 44 | |||
227 | 45 | visible: action ? action.visible : true | ||
228 | 46 | enabled: action ? action.enabled : true | ||
229 | 47 | |||
230 | 48 | /*! | ||
231 | 49 | The title of the actionItem. | ||
232 | 50 | Default value: action.text | ||
233 | 51 | */ | ||
234 | 52 | property string text: action ? action.text : "" | ||
235 | 53 | |||
236 | 54 | /*! | ||
237 | 55 | The image associated with the actionItem. | ||
238 | 56 | Default value: action.iconSource. | ||
239 | 57 | |||
240 | 58 | This is the URL of any image file | ||
241 | 59 | If both iconSource and iconName are defined, iconName will be ignored. | ||
242 | 60 | */ | ||
243 | 61 | property url iconSource: action ? action.iconSource : (iconName ? "image://theme/" + iconName : "") | ||
244 | 62 | |||
245 | 63 | /*! | ||
246 | 64 | The icon associated with the actionItem in the suru icon theme. | ||
247 | 65 | Default value: action.iconName. | ||
248 | 66 | |||
249 | 67 | \note The complete list of icons available in Ubuntu is not published yet. | ||
250 | 68 | For now please refer to the folders where the icon themes are installed: | ||
251 | 69 | \list | ||
252 | 70 | \li Ubuntu Touch: \l file:/usr/share/icons/suru | ||
253 | 71 | \li Ubuntu Desktop: \l file:/usr/share/icons/ubuntu-mono-dark | ||
254 | 72 | \endlist | ||
255 | 73 | These 2 separate icon themes will be merged soon. | ||
256 | 74 | |||
257 | 75 | If both iconSource and iconName are defined, iconName will be ignored. | ||
258 | 76 | */ | ||
259 | 77 | property string iconName: action ? action.iconName : "" | ||
260 | 78 | |||
261 | 79 | /*! | ||
262 | 80 | Called when the actionItem is triggered. | ||
263 | 81 | */ | ||
264 | 82 | signal triggered(var value) | ||
265 | 83 | |||
266 | 84 | /*! | ||
267 | 85 | If \l action is set, this will trigger it. | ||
268 | 86 | */ | ||
269 | 87 | onTriggered: if (action) action.trigger(value) | ||
270 | 88 | |||
271 | 89 | /*! | ||
272 | 90 | Trigger this action item if it is enabled. | ||
273 | 91 | */ | ||
274 | 92 | function trigger(value) { | ||
275 | 93 | var passingValue = value ? value : null | ||
276 | 94 | if (actionItem.enabled) actionItem.triggered(passingValue); | ||
277 | 95 | } | ||
278 | 96 | } | ||
279 | 97 | 0 | ||
280 | === modified file 'src/Ubuntu/Components/1.3/TextField.qml' | |||
281 | --- src/Ubuntu/Components/1.3/TextField.qml 2015-08-11 17:15:59 +0000 | |||
282 | +++ src/Ubuntu/Components/1.3/TextField.qml 2015-08-19 06:57:12 +0000 | |||
283 | @@ -99,7 +99,7 @@ | |||
284 | 99 | \note During text selection all interactive parent Flickables are turned off. | 99 | \note During text selection all interactive parent Flickables are turned off. |
285 | 100 | */ | 100 | */ |
286 | 101 | 101 | ||
288 | 102 | ActionItem { | 102 | Ubuntu.ActionItem { |
289 | 103 | id: control | 103 | id: control |
290 | 104 | 104 | ||
291 | 105 | implicitWidth: units.gu(25) | 105 | implicitWidth: units.gu(25) |
292 | 106 | 106 | ||
293 | === modified file 'src/Ubuntu/Components/ComponentModule.pro' | |||
294 | --- src/Ubuntu/Components/ComponentModule.pro 2015-08-10 14:10:51 +0000 | |||
295 | +++ src/Ubuntu/Components/ComponentModule.pro 2015-08-19 06:57:12 +0000 | |||
296 | @@ -25,7 +25,6 @@ | |||
297 | 25 | 25 | ||
298 | 26 | #1.2 | 26 | #1.2 |
299 | 27 | QML_FILES += 1.2/AbstractButton.qml \ | 27 | QML_FILES += 1.2/AbstractButton.qml \ |
300 | 28 | 1.2/ActionItem.qml \ | ||
301 | 29 | 1.2/ActionList.qml \ | 28 | 1.2/ActionList.qml \ |
302 | 30 | 1.2/ActivityIndicator.qml \ | 29 | 1.2/ActivityIndicator.qml \ |
303 | 31 | 1.2/AnimatedItem.qml \ | 30 | 1.2/AnimatedItem.qml \ |
304 | @@ -83,7 +82,6 @@ | |||
305 | 83 | #1.3 | 82 | #1.3 |
306 | 84 | QML_FILES += 1.3/AbstractButton.qml \ | 83 | QML_FILES += 1.3/AbstractButton.qml \ |
307 | 85 | 1.3/ActionBar.qml \ | 84 | 1.3/ActionBar.qml \ |
308 | 86 | 1.3/ActionItem.qml \ | ||
309 | 87 | 1.3/ActionList.qml \ | 85 | 1.3/ActionList.qml \ |
310 | 88 | 1.3/ActivityIndicator.qml \ | 86 | 1.3/ActivityIndicator.qml \ |
311 | 89 | 1.3/AdaptivePageLayout.qml \ | 87 | 1.3/AdaptivePageLayout.qml \ |
312 | 90 | 88 | ||
313 | === modified file 'src/Ubuntu/Components/plugin/plugin.cpp' | |||
314 | --- src/Ubuntu/Components/plugin/plugin.cpp 2015-08-12 09:54:40 +0000 | |||
315 | +++ src/Ubuntu/Components/plugin/plugin.cpp 2015-08-19 06:57:12 +0000 | |||
316 | @@ -62,6 +62,7 @@ | |||
317 | 62 | #include "uclistitemstyle.h" | 62 | #include "uclistitemstyle.h" |
318 | 63 | #include "ucserviceproperties.h" | 63 | #include "ucserviceproperties.h" |
319 | 64 | #include "ucnamespace.h" | 64 | #include "ucnamespace.h" |
320 | 65 | #include "ucactionitem.h" | ||
321 | 65 | 66 | ||
322 | 66 | #include <sys/types.h> | 67 | #include <sys/types.h> |
323 | 67 | #include <unistd.h> | 68 | #include <unistd.h> |
324 | @@ -174,6 +175,7 @@ | |||
325 | 174 | qmlRegisterSingletonType<UCUriHandler>(uri, major, minor, "UriHandler", registerUriHandler); | 175 | qmlRegisterSingletonType<UCUriHandler>(uri, major, minor, "UriHandler", registerUriHandler); |
326 | 175 | qmlRegisterType<UCMouse>(uri, major, minor, "Mouse"); | 176 | qmlRegisterType<UCMouse>(uri, major, minor, "Mouse"); |
327 | 176 | qmlRegisterType<UCInverseMouse>(uri, major, minor, "InverseMouse"); | 177 | qmlRegisterType<UCInverseMouse>(uri, major, minor, "InverseMouse"); |
328 | 178 | qmlRegisterType<UCActionItem>(uri, major, minor, "ActionItem"); | ||
329 | 177 | } | 179 | } |
330 | 178 | 180 | ||
331 | 179 | void UbuntuComponentsPlugin::registerTypes(const char *uri) | 181 | void UbuntuComponentsPlugin::registerTypes(const char *uri) |
332 | 180 | 182 | ||
333 | === modified file 'src/Ubuntu/Components/plugin/plugin.pri' | |||
334 | --- src/Ubuntu/Components/plugin/plugin.pri 2015-08-12 09:54:40 +0000 | |||
335 | +++ src/Ubuntu/Components/plugin/plugin.pri 2015-08-19 06:57:12 +0000 | |||
336 | @@ -80,7 +80,8 @@ | |||
337 | 80 | $$PWD/ucstylehints.h \ | 80 | $$PWD/ucstylehints.h \ |
338 | 81 | $$PWD/livetimer.h \ | 81 | $$PWD/livetimer.h \ |
339 | 82 | $$PWD/livetimer_p.h \ | 82 | $$PWD/livetimer_p.h \ |
341 | 83 | $$PWD/timeutils_p.h | 83 | $$PWD/timeutils_p.h \ |
342 | 84 | $$PWD/ucactionitem.h | ||
343 | 84 | 85 | ||
344 | 85 | SOURCES += $$PWD/plugin.cpp \ | 86 | SOURCES += $$PWD/plugin.cpp \ |
345 | 86 | $$PWD/uctheme.cpp \ | 87 | $$PWD/uctheme.cpp \ |
346 | @@ -132,7 +133,8 @@ | |||
347 | 132 | $$PWD/ucdefaulttheme.cpp \ | 133 | $$PWD/ucdefaulttheme.cpp \ |
348 | 133 | $$PWD/ucstylehints.cpp \ | 134 | $$PWD/ucstylehints.cpp \ |
349 | 134 | $$PWD/livetimer.cpp \ | 135 | $$PWD/livetimer.cpp \ |
351 | 135 | $$PWD/livetimer_p.cpp | 136 | $$PWD/livetimer_p.cpp \ |
352 | 137 | $$PWD/ucactionitem.cpp | ||
353 | 136 | 138 | ||
354 | 137 | # adapters | 139 | # adapters |
355 | 138 | SOURCES += $$PWD/adapters/alarmsadapter_organizer.cpp | 140 | SOURCES += $$PWD/adapters/alarmsadapter_organizer.cpp |
356 | 139 | 141 | ||
357 | === modified file 'src/Ubuntu/Components/plugin/ucaction.cpp' | |||
358 | --- src/Ubuntu/Components/plugin/ucaction.cpp 2015-07-03 19:16:56 +0000 | |||
359 | +++ src/Ubuntu/Components/plugin/ucaction.cpp 2015-08-19 06:57:12 +0000 | |||
360 | @@ -150,13 +150,12 @@ | |||
361 | 150 | 150 | ||
362 | 151 | UCAction::UCAction(QObject *parent) | 151 | UCAction::UCAction(QObject *parent) |
363 | 152 | : QObject(parent) | 152 | : QObject(parent) |
364 | 153 | , m_itemHint(Q_NULLPTR) | ||
365 | 154 | , m_parameterType(None) | ||
366 | 153 | , m_factoryIconSource(true) | 155 | , m_factoryIconSource(true) |
367 | 154 | , m_enabled(true) | 156 | , m_enabled(true) |
368 | 155 | , m_visible(true) | 157 | , m_visible(true) |
369 | 156 | , m_published(false) | 158 | , m_published(false) |
370 | 157 | , m_itemHint(0) | ||
371 | 158 | , m_parameterType(None) | ||
372 | 159 | , m_shortcut(0) | ||
373 | 160 | { | 159 | { |
374 | 161 | generateName(); | 160 | generateName(); |
375 | 162 | } | 161 | } |
376 | 163 | 162 | ||
377 | === modified file 'src/Ubuntu/Components/plugin/ucaction.h' | |||
378 | --- src/Ubuntu/Components/plugin/ucaction.h 2015-07-07 13:57:50 +0000 | |||
379 | +++ src/Ubuntu/Components/plugin/ucaction.h 2015-08-19 06:57:12 +0000 | |||
380 | @@ -77,21 +77,22 @@ | |||
381 | 77 | void trigger(const QVariant &value = QVariant()); | 77 | void trigger(const QVariant &value = QVariant()); |
382 | 78 | 78 | ||
383 | 79 | private: | 79 | private: |
384 | 80 | bool m_factoryIconSource:1; | ||
385 | 81 | bool m_enabled:1; | ||
386 | 82 | bool m_visible:1; | ||
387 | 83 | bool m_published:1; | ||
388 | 84 | QQmlComponent *m_itemHint; | ||
389 | 85 | QString m_name; | 80 | QString m_name; |
390 | 86 | QString m_text; | 81 | QString m_text; |
391 | 87 | QString m_iconName; | 82 | QString m_iconName; |
392 | 88 | QUrl m_iconSource; | 83 | QUrl m_iconSource; |
393 | 89 | QString m_description; | 84 | QString m_description; |
394 | 90 | QString m_keywords; | 85 | QString m_keywords; |
395 | 86 | QVariant m_shortcut; | ||
396 | 87 | QQmlComponent *m_itemHint; | ||
397 | 91 | Type m_parameterType; | 88 | Type m_parameterType; |
399 | 92 | QVariant m_shortcut; | 89 | bool m_factoryIconSource:1; |
400 | 90 | bool m_enabled:1; | ||
401 | 91 | bool m_visible:1; | ||
402 | 92 | bool m_published:1; | ||
403 | 93 | 93 | ||
404 | 94 | friend class UCActionContext; | 94 | friend class UCActionContext; |
405 | 95 | friend class UCActionItem; | ||
406 | 95 | friend class UCListItemPrivate; | 96 | friend class UCListItemPrivate; |
407 | 96 | friend class UCListItemAttached; | 97 | friend class UCListItemAttached; |
408 | 97 | friend class UCListItemActionsPrivate; | 98 | friend class UCListItemActionsPrivate; |
409 | 98 | 99 | ||
410 | === added file 'src/Ubuntu/Components/plugin/ucactionitem.cpp' | |||
411 | --- src/Ubuntu/Components/plugin/ucactionitem.cpp 1970-01-01 00:00:00 +0000 | |||
412 | +++ src/Ubuntu/Components/plugin/ucactionitem.cpp 2015-08-19 06:57:12 +0000 | |||
413 | @@ -0,0 +1,305 @@ | |||
414 | 1 | /* | ||
415 | 2 | * Copyright 2015 Canonical Ltd. | ||
416 | 3 | * | ||
417 | 4 | * This program is free software; you can redistribute it and/or modify | ||
418 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
419 | 6 | * the Free Software Foundation; version 3. | ||
420 | 7 | * | ||
421 | 8 | * This program is distributed in the hope that it will be useful, | ||
422 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
423 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
424 | 11 | * GNU Lesser General Public License for more details. | ||
425 | 12 | * | ||
426 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
427 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
428 | 15 | */ | ||
429 | 16 | |||
430 | 17 | #include "ucactionitem.h" | ||
431 | 18 | #include "ucaction.h" | ||
432 | 19 | |||
433 | 20 | /*! | ||
434 | 21 | * \qmltype ActionItem | ||
435 | 22 | * \instantiates UCActionItem | ||
436 | 23 | * \inqmlmodule Ubuntu.Components 1.1 | ||
437 | 24 | * \ingroup ubuntu | ||
438 | 25 | * \brief A visual representation of an Action. The API of ActionItem is a | ||
439 | 26 | * copy of the API of \l Action, with additional properties to define | ||
440 | 27 | * visual aspects of the ActionItem. | ||
441 | 28 | * | ||
442 | 29 | * If \l action is set, the values of the other properties will by default | ||
443 | 30 | * be identical to the \l Action's property values. Setting the other properties | ||
444 | 31 | * will override the properties copied from the \l Action. | ||
445 | 32 | */ | ||
446 | 33 | |||
447 | 34 | /*! | ||
448 | 35 | * \qmlsignal ActionItem::triggered(var value) | ||
449 | 36 | * Called when the actionItem is triggered. | ||
450 | 37 | */ | ||
451 | 38 | UCActionItem::UCActionItem(QQuickItem *parent) | ||
452 | 39 | : UCStyledItemBase(parent) | ||
453 | 40 | , m_action(Q_NULLPTR) | ||
454 | 41 | , m_flags(0) | ||
455 | 42 | { | ||
456 | 43 | connect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged); | ||
457 | 44 | connect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged); | ||
458 | 45 | } | ||
459 | 46 | |||
460 | 47 | void UCActionItem::_q_visibleChanged() | ||
461 | 48 | { | ||
462 | 49 | m_flags |= CustomVisible; | ||
463 | 50 | disconnect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged); | ||
464 | 51 | } | ||
465 | 52 | |||
466 | 53 | void UCActionItem::_q_enabledChanged() | ||
467 | 54 | { | ||
468 | 55 | m_flags |= CustomEnabled; | ||
469 | 56 | disconnect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged); | ||
470 | 57 | } | ||
471 | 58 | |||
472 | 59 | // update visible property | ||
473 | 60 | void UCActionItem::_q_updateVisible() | ||
474 | 61 | { | ||
475 | 62 | bool visible = m_action ? m_action->m_visible : true; | ||
476 | 63 | setVisible(visible); | ||
477 | 64 | // reset flag and reconnect signal handler disconnected by the | ||
478 | 65 | m_flags &= ~CustomVisible; | ||
479 | 66 | if (m_action) { | ||
480 | 67 | connect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged); | ||
481 | 68 | } | ||
482 | 69 | } | ||
483 | 70 | |||
484 | 71 | // update enabled property | ||
485 | 72 | void UCActionItem::_q_updateEnabled() | ||
486 | 73 | { | ||
487 | 74 | bool enabled = m_action ? m_action->m_enabled : true; | ||
488 | 75 | setEnabled(enabled); | ||
489 | 76 | // reset flag and reconnect signal handler disconnected by the | ||
490 | 77 | m_flags &= ~CustomEnabled; | ||
491 | 78 | if (m_action) { | ||
492 | 79 | connect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged); | ||
493 | 80 | } | ||
494 | 81 | } | ||
495 | 82 | |||
496 | 83 | void UCActionItem::updateProperties() | ||
497 | 84 | { | ||
498 | 85 | if (!(m_flags & CustomText)) { | ||
499 | 86 | Q_EMIT textChanged(); | ||
500 | 87 | } | ||
501 | 88 | if (!(m_flags & CustomIconSource)) { | ||
502 | 89 | Q_EMIT iconSourceChanged(); | ||
503 | 90 | } | ||
504 | 91 | if (!(m_flags & CustomIconName)) { | ||
505 | 92 | Q_EMIT iconNameChanged(); | ||
506 | 93 | } | ||
507 | 94 | } | ||
508 | 95 | |||
509 | 96 | void UCActionItem::attachAction(bool attach) | ||
510 | 97 | { | ||
511 | 98 | if (attach) { | ||
512 | 99 | connect(this, &UCActionItem::triggered, | ||
513 | 100 | m_action, &UCAction::triggered, Qt::DirectConnection); | ||
514 | 101 | connect(m_action, &UCAction::visibleChanged, | ||
515 | 102 | this, &UCActionItem::_q_updateVisible, Qt::DirectConnection); | ||
516 | 103 | connect(m_action, &UCAction::enabledChanged, | ||
517 | 104 | this, &UCActionItem::_q_updateEnabled, Qt::DirectConnection); | ||
518 | 105 | if (!(m_flags & CustomText)) { | ||
519 | 106 | connect(m_action, &UCAction::textChanged, | ||
520 | 107 | this, &UCActionItem::textChanged, Qt::DirectConnection); | ||
521 | 108 | } | ||
522 | 109 | if (!(m_flags & CustomIconSource)) { | ||
523 | 110 | connect(m_action, &UCAction::iconSourceChanged, | ||
524 | 111 | this, &UCActionItem::iconSourceChanged, Qt::DirectConnection); | ||
525 | 112 | } | ||
526 | 113 | if (!(m_flags & CustomIconName)) { | ||
527 | 114 | connect(m_action, &UCAction::iconNameChanged, | ||
528 | 115 | this, &UCActionItem::iconNameChanged, Qt::DirectConnection); | ||
529 | 116 | } | ||
530 | 117 | } else { | ||
531 | 118 | disconnect(this, &UCActionItem::triggered, | ||
532 | 119 | m_action, &UCAction::triggered); | ||
533 | 120 | disconnect(m_action, &UCAction::visibleChanged, | ||
534 | 121 | this, &UCActionItem::_q_updateVisible); | ||
535 | 122 | disconnect(m_action, &UCAction::enabledChanged, | ||
536 | 123 | this, &UCActionItem::_q_updateEnabled); | ||
537 | 124 | if (!(m_flags & CustomText)) { | ||
538 | 125 | disconnect(m_action, &UCAction::textChanged, | ||
539 | 126 | this, &UCActionItem::textChanged); | ||
540 | 127 | } | ||
541 | 128 | if (!(m_flags & CustomIconSource)) { | ||
542 | 129 | disconnect(m_action, &UCAction::iconSourceChanged, | ||
543 | 130 | this, &UCActionItem::iconSourceChanged); | ||
544 | 131 | } | ||
545 | 132 | if (!(m_flags & CustomIconName)) { | ||
546 | 133 | disconnect(m_action, &UCAction::iconNameChanged, | ||
547 | 134 | this, &UCActionItem::iconNameChanged); | ||
548 | 135 | } | ||
549 | 136 | } | ||
550 | 137 | } | ||
551 | 138 | |||
552 | 139 | /*! | ||
553 | 140 | * \qmlproperty Action ActionItem::action | ||
554 | 141 | * The \l Action associated with this ActionItem. If action is set, the values | ||
555 | 142 | * of the \l Action properties are copied to the values of the ActionItem | ||
556 | 143 | * properties, unless those were previously overridden. | ||
557 | 144 | */ | ||
558 | 145 | void UCActionItem::setAction(UCAction *action) | ||
559 | 146 | { | ||
560 | 147 | if (m_action == action) { | ||
561 | 148 | return; | ||
562 | 149 | } | ||
563 | 150 | if (m_action) { | ||
564 | 151 | attachAction(false); | ||
565 | 152 | } | ||
566 | 153 | m_action = action; | ||
567 | 154 | Q_EMIT actionChanged(); | ||
568 | 155 | |||
569 | 156 | if (m_action) { | ||
570 | 157 | attachAction(true); | ||
571 | 158 | } | ||
572 | 159 | _q_updateVisible(); | ||
573 | 160 | _q_updateEnabled(); | ||
574 | 161 | updateProperties(); | ||
575 | 162 | } | ||
576 | 163 | |||
577 | 164 | /*! | ||
578 | 165 | * \qmlproperty string ActionItem::text | ||
579 | 166 | * The title of the actionItem. Defaults to the \c action.text. | ||
580 | 167 | */ | ||
581 | 168 | QString UCActionItem::text() | ||
582 | 169 | { | ||
583 | 170 | if (m_flags & CustomText) { | ||
584 | 171 | return m_text; | ||
585 | 172 | } | ||
586 | 173 | return m_action ? m_action->m_text : QString(); | ||
587 | 174 | } | ||
588 | 175 | void UCActionItem::setText(const QString &text) | ||
589 | 176 | { | ||
590 | 177 | if (m_text == text) { | ||
591 | 178 | return; | ||
592 | 179 | } | ||
593 | 180 | m_text = text; | ||
594 | 181 | if (m_action && !(m_flags & CustomText)) { | ||
595 | 182 | // disconnect change signal from Action | ||
596 | 183 | disconnect(m_action, &UCAction::textChanged, | ||
597 | 184 | this, &UCActionItem::textChanged); | ||
598 | 185 | } | ||
599 | 186 | m_flags |= CustomText; | ||
600 | 187 | Q_EMIT textChanged(); | ||
601 | 188 | } | ||
602 | 189 | void UCActionItem::resetText() | ||
603 | 190 | { | ||
604 | 191 | m_text.clear(); | ||
605 | 192 | m_flags &= ~CustomText; | ||
606 | 193 | if (m_action) { | ||
607 | 194 | // re-connect change signal from Action | ||
608 | 195 | connect(m_action, &UCAction::textChanged, | ||
609 | 196 | this, &UCActionItem::textChanged, Qt::DirectConnection); | ||
610 | 197 | } | ||
611 | 198 | Q_EMIT textChanged(); | ||
612 | 199 | } | ||
613 | 200 | |||
614 | 201 | /*! | ||
615 | 202 | * \qmlproperty url ActionItem::iconSource | ||
616 | 203 | * The image associated with the ActionItem. Defaults to \c action.iconSource. | ||
617 | 204 | * | ||
618 | 205 | * This is the URL of any image file. If both iconSource and \l iconName are defined, | ||
619 | 206 | * \l iconName will be ignored. | ||
620 | 207 | */ | ||
621 | 208 | QUrl UCActionItem::iconSource() | ||
622 | 209 | { | ||
623 | 210 | if (m_flags & CustomIconSource) { | ||
624 | 211 | return m_iconSource; | ||
625 | 212 | } | ||
626 | 213 | if (m_action) { | ||
627 | 214 | return m_action->m_iconSource; | ||
628 | 215 | } | ||
629 | 216 | return !iconName().isEmpty() ? QUrl(QString("image://theme/%1").arg(iconName())) : QUrl(); | ||
630 | 217 | } | ||
631 | 218 | void UCActionItem::setIconSource(const QUrl &iconSource) | ||
632 | 219 | { | ||
633 | 220 | if (m_iconSource == iconSource) { | ||
634 | 221 | return; | ||
635 | 222 | } | ||
636 | 223 | m_iconSource = iconSource; | ||
637 | 224 | if (m_action && !(m_flags & CustomIconSource)) { | ||
638 | 225 | // disconnect change signal from Action | ||
639 | 226 | disconnect(m_action, &UCAction::iconSourceChanged, | ||
640 | 227 | this, &UCActionItem::iconSourceChanged); | ||
641 | 228 | } | ||
642 | 229 | m_flags |= CustomIconSource; | ||
643 | 230 | Q_EMIT iconSourceChanged(); | ||
644 | 231 | } | ||
645 | 232 | void UCActionItem::resetIconSource() | ||
646 | 233 | { | ||
647 | 234 | m_iconSource.clear(); | ||
648 | 235 | m_flags &= ~CustomIconSource; | ||
649 | 236 | if (m_action) { | ||
650 | 237 | // re-connect change signal from Action | ||
651 | 238 | connect(m_action, &UCAction::iconSourceChanged, | ||
652 | 239 | this, &UCActionItem::iconSourceChanged, Qt::DirectConnection); | ||
653 | 240 | } | ||
654 | 241 | Q_EMIT iconSourceChanged(); | ||
655 | 242 | } | ||
656 | 243 | |||
657 | 244 | /*! | ||
658 | 245 | * \qmlproperty string ActionItem::iconName | ||
659 | 246 | * The icon associated with the actionItem in the suru icon theme. Defaults to | ||
660 | 247 | * \c action.iconName. | ||
661 | 248 | * | ||
662 | 249 | * \note The complete list of icons available in Ubuntu is not published yet. | ||
663 | 250 | * For now please refer to the folders where the icon themes are installed: | ||
664 | 251 | * \list | ||
665 | 252 | * \li Ubuntu Touch: \l file:/usr/share/icons/suru | ||
666 | 253 | * \li Ubuntu Desktop: \l file:/usr/share/icons/ubuntu-mono-dark | ||
667 | 254 | * \endlist | ||
668 | 255 | * These 2 separate icon themes will be merged soon. | ||
669 | 256 | * | ||
670 | 257 | * If both \l iconSource and iconName are defined, iconName will be ignored. | ||
671 | 258 | */ | ||
672 | 259 | QString UCActionItem::iconName() | ||
673 | 260 | { | ||
674 | 261 | if (m_flags & CustomIconName) { | ||
675 | 262 | return m_iconName; | ||
676 | 263 | } | ||
677 | 264 | return m_action ? m_action->m_iconName : QString(); | ||
678 | 265 | } | ||
679 | 266 | void UCActionItem::setIconName(const QString &iconName) | ||
680 | 267 | { | ||
681 | 268 | if (m_iconName == iconName) { | ||
682 | 269 | return; | ||
683 | 270 | } | ||
684 | 271 | m_iconName = iconName; | ||
685 | 272 | if (m_action && !(m_flags & CustomIconName)) { | ||
686 | 273 | // disconnect change signal from Action | ||
687 | 274 | disconnect(m_action, &UCAction::iconNameChanged, | ||
688 | 275 | this, &UCActionItem::iconNameChanged); | ||
689 | 276 | } | ||
690 | 277 | m_flags |= CustomIconName; | ||
691 | 278 | Q_EMIT iconNameChanged(); | ||
692 | 279 | // also sync iconSource if that is not a custom one or taken from action | ||
693 | 280 | if (!m_action || (m_flags & CustomIconSource)) { | ||
694 | 281 | Q_EMIT iconSourceChanged(); | ||
695 | 282 | } | ||
696 | 283 | } | ||
697 | 284 | void UCActionItem::resetIconName() | ||
698 | 285 | { | ||
699 | 286 | m_iconName.clear(); | ||
700 | 287 | m_flags &= ~CustomIconName; | ||
701 | 288 | if (m_action) { | ||
702 | 289 | // re-connect change signal from Action | ||
703 | 290 | connect(m_action, &UCAction::iconNameChanged, | ||
704 | 291 | this, &UCActionItem::iconNameChanged, Qt::DirectConnection); | ||
705 | 292 | } | ||
706 | 293 | Q_EMIT iconNameChanged(); | ||
707 | 294 | } | ||
708 | 295 | |||
709 | 296 | /*! | ||
710 | 297 | * \qmlmethod void ActionItem::trigger(var value) | ||
711 | 298 | * Trigger this action item if it is enabled. | ||
712 | 299 | */ | ||
713 | 300 | void UCActionItem::trigger(const QVariant &value) | ||
714 | 301 | { | ||
715 | 302 | if (isEnabled()) { | ||
716 | 303 | Q_EMIT triggered(value); | ||
717 | 304 | } | ||
718 | 305 | } | ||
719 | 0 | 306 | ||
720 | === added file 'src/Ubuntu/Components/plugin/ucactionitem.h' | |||
721 | --- src/Ubuntu/Components/plugin/ucactionitem.h 1970-01-01 00:00:00 +0000 | |||
722 | +++ src/Ubuntu/Components/plugin/ucactionitem.h 2015-08-19 06:57:12 +0000 | |||
723 | @@ -0,0 +1,77 @@ | |||
724 | 1 | /* | ||
725 | 2 | * Copyright 2015 Canonical Ltd. | ||
726 | 3 | * | ||
727 | 4 | * This program is free software; you can redistribute it and/or modify | ||
728 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
729 | 6 | * the Free Software Foundation; version 3. | ||
730 | 7 | * | ||
731 | 8 | * This program is distributed in the hope that it will be useful, | ||
732 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
733 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
734 | 11 | * GNU Lesser General Public License for more details. | ||
735 | 12 | * | ||
736 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
737 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
738 | 15 | */ | ||
739 | 16 | #ifndef UCACTIONITEM_H | ||
740 | 17 | #define UCACTIONITEM_H | ||
741 | 18 | |||
742 | 19 | #include "ucstyleditembase.h" | ||
743 | 20 | |||
744 | 21 | class UCAction; | ||
745 | 22 | class UCActionItem : public UCStyledItemBase | ||
746 | 23 | { | ||
747 | 24 | Q_OBJECT | ||
748 | 25 | Q_PROPERTY(UCAction *action MEMBER m_action WRITE setAction NOTIFY actionChanged FINAL) | ||
749 | 26 | Q_PROPERTY(QString text READ text WRITE setText RESET resetText NOTIFY textChanged) | ||
750 | 27 | Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource RESET resetIconSource NOTIFY iconSourceChanged) | ||
751 | 28 | Q_PROPERTY(QString iconName READ iconName WRITE setIconName RESET resetIconName NOTIFY iconNameChanged) | ||
752 | 29 | public: | ||
753 | 30 | explicit UCActionItem(QQuickItem *parent = 0); | ||
754 | 31 | |||
755 | 32 | void setAction(UCAction *action); | ||
756 | 33 | QString text(); | ||
757 | 34 | void setText(const QString &text); | ||
758 | 35 | void resetText(); | ||
759 | 36 | QUrl iconSource(); | ||
760 | 37 | void setIconSource(const QUrl &iconSource); | ||
761 | 38 | void resetIconSource(); | ||
762 | 39 | QString iconName(); | ||
763 | 40 | void setIconName(const QString &iconName); | ||
764 | 41 | void resetIconName(); | ||
765 | 42 | |||
766 | 43 | Q_SIGNALS: | ||
767 | 44 | void actionChanged(); | ||
768 | 45 | void textChanged(); | ||
769 | 46 | void iconSourceChanged(); | ||
770 | 47 | void iconNameChanged(); | ||
771 | 48 | void triggered(const QVariant &value); | ||
772 | 49 | |||
773 | 50 | public Q_SLOTS: | ||
774 | 51 | void trigger(const QVariant &value = QVariant()); | ||
775 | 52 | |||
776 | 53 | protected Q_SLOTS: | ||
777 | 54 | void _q_visibleChanged(); | ||
778 | 55 | void _q_enabledChanged(); | ||
779 | 56 | void _q_updateVisible(); | ||
780 | 57 | void _q_updateEnabled(); | ||
781 | 58 | |||
782 | 59 | protected: | ||
783 | 60 | enum { | ||
784 | 61 | CustomText = 0x01, | ||
785 | 62 | CustomIconSource = 0x02, | ||
786 | 63 | CustomIconName = 0x04, | ||
787 | 64 | CustomVisible = 0x40, | ||
788 | 65 | CustomEnabled = 0x80 | ||
789 | 66 | }; | ||
790 | 67 | QString m_text; | ||
791 | 68 | QString m_iconName; | ||
792 | 69 | QUrl m_iconSource; | ||
793 | 70 | UCAction *m_action; | ||
794 | 71 | quint8 m_flags; | ||
795 | 72 | |||
796 | 73 | void updateProperties(); | ||
797 | 74 | void attachAction(bool attach); | ||
798 | 75 | }; | ||
799 | 76 | |||
800 | 77 | #endif // UCACTIONITEM_H | ||
801 | 0 | 78 | ||
802 | === modified file 'src/Ubuntu/Components/qmldir' | |||
803 | --- src/Ubuntu/Components/qmldir 2015-08-10 14:27:35 +0000 | |||
804 | +++ src/Ubuntu/Components/qmldir 2015-08-19 06:57:12 +0000 | |||
805 | @@ -1,6 +1,5 @@ | |||
806 | 1 | module Ubuntu.Components | 1 | module Ubuntu.Components |
807 | 2 | plugin UbuntuComponents | 2 | plugin UbuntuComponents |
808 | 3 | ActionItem 0.1 1.2/ActionItem.qml | ||
809 | 4 | ActionList 0.1 1.2/ActionList.qml | 3 | ActionList 0.1 1.2/ActionList.qml |
810 | 5 | ToolbarItems 0.1 1.2/ToolbarItems.qml | 4 | ToolbarItems 0.1 1.2/ToolbarItems.qml |
811 | 6 | ToolbarButton 0.1 1.2/ToolbarButton.qml | 5 | ToolbarButton 0.1 1.2/ToolbarButton.qml |
812 | @@ -44,7 +43,6 @@ | |||
813 | 44 | DateUtils 0.1 1.2/dateUtils.js | 43 | DateUtils 0.1 1.2/dateUtils.js |
814 | 45 | 44 | ||
815 | 46 | #version 1.0 | 45 | #version 1.0 |
816 | 47 | ActionItem 1.0 1.2/ActionItem.qml | ||
817 | 48 | ActionList 1.0 1.2/ActionList.qml | 46 | ActionList 1.0 1.2/ActionList.qml |
818 | 49 | ToolbarItems 1.0 1.2/ToolbarItems.qml | 47 | ToolbarItems 1.0 1.2/ToolbarItems.qml |
819 | 50 | ToolbarButton 1.0 1.2/ToolbarButton.qml | 48 | ToolbarButton 1.0 1.2/ToolbarButton.qml |
820 | @@ -105,7 +103,6 @@ | |||
821 | 105 | ################################################# | 103 | ################################################# |
822 | 106 | #version 1.3 | 104 | #version 1.3 |
823 | 107 | ActionBar 1.3 1.3/ActionBar.qml | 105 | ActionBar 1.3 1.3/ActionBar.qml |
824 | 108 | ActionItem 1.3 1.3/ActionItem.qml | ||
825 | 109 | ActionList 1.3 1.3/ActionList.qml | 106 | ActionList 1.3 1.3/ActionList.qml |
826 | 110 | AdaptivePageLayout 1.3 1.3/AdaptivePageLayout.qml | 107 | AdaptivePageLayout 1.3 1.3/AdaptivePageLayout.qml |
827 | 111 | PageColumnsLayout 1.3 1.3/PageColumnsLayout.qml | 108 | PageColumnsLayout 1.3 1.3/PageColumnsLayout.qml |
828 | 112 | 109 | ||
829 | === modified file 'tests/unit/tst_components/tst_actionitem.qml' | |||
830 | --- tests/unit/tst_components/tst_actionitem.qml 2015-03-03 13:20:06 +0000 | |||
831 | +++ tests/unit/tst_components/tst_actionitem.qml 2015-08-19 06:57:12 +0000 | |||
832 | @@ -21,10 +21,22 @@ | |||
833 | 21 | TestCase { | 21 | TestCase { |
834 | 22 | name: "ActionItemAPI" | 22 | name: "ActionItemAPI" |
835 | 23 | 23 | ||
836 | 24 | SignalSpy { | ||
837 | 25 | id: triggerSpy | ||
838 | 26 | target: action1 | ||
839 | 27 | signalName: "triggered" | ||
840 | 28 | } | ||
841 | 29 | |||
842 | 24 | function initTestCase() { | 30 | function initTestCase() { |
843 | 25 | compare(item1.action, null, "action is null by default") | 31 | compare(item1.action, null, "action is null by default") |
844 | 26 | compare(item1.text, "", "text is empty string set by default") | 32 | compare(item1.text, "", "text is empty string set by default") |
845 | 27 | compare(item1.iconSource, "", "iconSource is empty string by default") | 33 | compare(item1.iconSource, "", "iconSource is empty string by default") |
846 | 34 | compare(item1.iconName, "", "iconSource is empty string by default") | ||
847 | 35 | } | ||
848 | 36 | |||
849 | 37 | function cleanup() { | ||
850 | 38 | item1.action = null; | ||
851 | 39 | triggerSpy.clear(); | ||
852 | 28 | } | 40 | } |
853 | 29 | 41 | ||
854 | 30 | function test_action() { | 42 | function test_action() { |
855 | @@ -33,10 +45,8 @@ | |||
856 | 33 | compare(item1.action, action1, "Action can be set") | 45 | compare(item1.action, action1, "Action can be set") |
857 | 34 | compare(item1.text, action1.text, "text is automatically set to action text") | 46 | compare(item1.text, action1.text, "text is automatically set to action text") |
858 | 35 | compare(item1.iconSource, action1.iconSource, "iconSource is automatically set to action iconSource") | 47 | compare(item1.iconSource, action1.iconSource, "iconSource is automatically set to action iconSource") |
859 | 36 | var numTriggers = action1.triggerCount | ||
860 | 37 | item1.triggered(null) | 48 | item1.triggered(null) |
863 | 38 | compare(action1.triggerCount, numTriggers+1, "ActionItem triggered() triggers action") | 49 | triggerSpy.wait(400); |
862 | 39 | item1.action = null | ||
864 | 40 | } | 50 | } |
865 | 41 | 51 | ||
866 | 42 | // NOTE: This test must be run AFTER test_action(), otherwise setting the action will | 52 | // NOTE: This test must be run AFTER test_action(), otherwise setting the action will |
867 | @@ -89,7 +99,5 @@ | |||
868 | 89 | id: action1 | 99 | id: action1 |
869 | 90 | text: "actionText" | 100 | text: "actionText" |
870 | 91 | iconSource: "imageURL" | 101 | iconSource: "imageURL" |
871 | 92 | property int triggerCount: 0 | ||
872 | 93 | onTriggered: triggerCount++ | ||
873 | 94 | } | 102 | } |
874 | 95 | } | 103 | } |
FAILED: Continuous integration, rev:1614 jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/2139/ jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-amd64- ci/867/ console jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-armhf- ci/869/ console jenkins. qa.ubuntu. com/job/ ubuntu- sdk-team- ubuntu- ui-toolkit- staging- vivid-i386- ci/866/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- sdk-team- ubuntu- ui-toolkit- staging- ci/2139/ rebuild
http://