Merge lp:~tpeeters/ubuntu-ui-toolkit/noPrivateHeader into lp:~bzoltan/ubuntu-ui-toolkit/landing_140514
- noPrivateHeader
- Merge into landing_140514
Status: | Superseded |
---|---|
Proposed branch: | lp:~tpeeters/ubuntu-ui-toolkit/noPrivateHeader |
Merge into: | lp:~bzoltan/ubuntu-ui-toolkit/landing_140514 |
Diff against target: |
5307 lines (+2765/-560) 87 files modified
CHANGES (+1/-0) components.api (+55/-2) debian/changelog (+113/-2) debian/control (+7/-7) examples/ubuntu-ui-toolkit-gallery/ListItems.qml (+11/-2) modules/Ubuntu/Components/AnimatedItem.qml (+1/-38) modules/Ubuntu/Components/Label.qml (+1/-0) modules/Ubuntu/Components/ListItems/Base.qml (+1/-1) modules/Ubuntu/Components/ListItems/Empty.qml (+1/-1) modules/Ubuntu/Components/ListItems/ThinDivider.qml (+5/-2) modules/Ubuntu/Components/Page.qml (+7/-0) modules/Ubuntu/Components/Pickers/DatePicker.qml (+7/-7) modules/Ubuntu/Components/Pickers/PickerRow.qml (+1/-1) modules/Ubuntu/Components/TextInputPopover.qml (+7/-7) modules/Ubuntu/Components/Themes/Ambiance/ActivityIndicatorStyle.qml (+2/-2) modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml (+2/-2) modules/Ubuntu/Components/Toolbar.qml (+3/-3) modules/Ubuntu/Components/ToolbarItems.qml (+1/-1) modules/Ubuntu/Components/plugin/filterbehavior.cpp (+47/-0) modules/Ubuntu/Components/plugin/filterbehavior.h (+46/-0) modules/Ubuntu/Components/plugin/i18n.cpp (+7/-11) modules/Ubuntu/Components/plugin/plugin.cpp (+10/-1) modules/Ubuntu/Components/plugin/plugin.pro (+6/-0) modules/Ubuntu/Components/plugin/shapeitem.cpp (+47/-13) modules/Ubuntu/Components/plugin/shapeitem.h (+8/-0) modules/Ubuntu/Components/plugin/shapeitemtexture.h (+2/-3) modules/Ubuntu/Components/plugin/sortbehavior.cpp (+47/-0) modules/Ubuntu/Components/plugin/sortbehavior.h (+46/-0) modules/Ubuntu/Components/plugin/sortfiltermodel.cpp (+252/-0) modules/Ubuntu/Components/plugin/sortfiltermodel.h (+68/-0) modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp (+6/-3) modules/Ubuntu/Components/plugin/ucalarm.cpp (+15/-4) modules/Ubuntu/Components/plugin/ucthemesettings.cpp (+4/-3) modules/Ubuntu/Layouts/plugin/plugin.pro (+1/-1) modules/Ubuntu/Layouts/plugin/propertychanges.cpp (+18/-33) modules/Ubuntu/Layouts/plugin/propertychanges_p.h (+3/-16) modules/Ubuntu/Layouts/plugin/ulitemlayout.h (+4/-1) modules/Ubuntu/Layouts/plugin/ullayouts.cpp (+92/-81) modules/Ubuntu/Layouts/plugin/ullayouts.h (+8/-3) modules/Ubuntu/Layouts/plugin/ullayouts_p.h (+3/-5) po/ca.po (+2/-2) po/de.po (+2/-2) po/es.po (+2/-2) po/fi.po (+2/-2) po/fr.po (+2/-2) po/gl.po (+2/-2) po/he.po (+2/-2) po/hu.po (+2/-2) po/ko.po (+2/-2) po/my.po (+2/-2) po/nl.po (+2/-2) po/oc.po (+2/-2) po/pt_BR.po (+2/-2) po/sv.po (+2/-2) po/uk.po (+2/-2) tests/autopilot/ubuntuuitoolkit/__init__.py (+4/-2) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py (+4/-2) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py (+45/-1) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py (+53/-30) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+32/-1) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_mainview.py (+1/-1) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py (+28/-11) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py (+10/-5) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/pickers.py (+255/-0) tests/autopilot/ubuntuuitoolkit/emulators.py (+2/-2) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py (+203/-0) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+201/-0) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py (+50/-24) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textfield.py (+27/-0) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py (+4/-0) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py (+47/-80) tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py (+1/-1) tests/qmlapicheck.py (+6/-5) tests/resources/alarm/Alarms.qml (+1/-1) tests/resources/toolbar/header.qml (+143/-0) tests/unit/tst_alarms/tst_alarms.cpp (+46/-0) tests/unit/tst_components/tst_label.qml (+1/-1) tests/unit/tst_components/tst_sortfiltermodel.qml (+123/-0) tests/unit/tst_components/tst_toolbaritems.qml (+10/-1) tests/unit/tst_i18n/localizedApp/.click/status (+1/-0) tests/unit/tst_i18n/src/tst_i18n.cpp (+5/-17) tests/unit/tst_i18n/tst_i18n.pro (+1/-1) tests/unit_x11/tst_components/tst_datepicker.qml (+1/-1) tests/unit_x11/tst_layouts/NestedVisibility.qml (+163/-0) tests/unit_x11/tst_layouts/Visibility.qml (+84/-0) tests/unit_x11/tst_layouts/tst_layouts.cpp (+214/-86) tests/unit_x11/tst_layouts/tst_layouts.pro (+3/-1) |
To merge this branch: | bzr merge lp:~tpeeters/ubuntu-ui-toolkit/noPrivateHeader |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zoltan Balogh | Pending | ||
Review via email:
|
Commit message
Undo changes of r1082 that cause a regression in messaging-app (and contenthub).
Description of the change
Undo changes of r1082 that cause a regression in messaging-app (and contenthub).
Unmerged revisions
- 1088. By Tim Peeters
-
revert r1082 because it breaks contenthub (and thus messaging-app)
- 1087. By Zoltan Balogh
-
Landing 28/05
- 1086. By Cris Dywan
-
Tweak API parsing to include the Button.font property. Fixes: https:/
/bugs.launchpad .net/bugs/ 1322169. Approved by PS Jenkins bot.
- 1085. By Zsombor Egri
-
Missing "default" keyword added to children property of Base, causing rendering and test case failures on Qt 5.3. Fixes: https:/
/bugs.launchpad .net/bugs/ 1317881. Approved by PS Jenkins bot, Tim Peeters.
- 1084. By Ugo Riboni
-
Allow requesting extra large thumbnails.
Approved by PS Jenkins bot, Zsombor Egri.
- 1083. By Florian Boucault
-
AnimatedItem: deprecated as it was not used and still costly.
Approved by PS Jenkins bot, Zsombor Egri.
- 1082. By Tim Peeters
-
Make Header component internal as it was always documented.
Approved by Zsombor Egri, PS Jenkins bot.
- 1081. By Cris Dywan
-
Call bindtextdomain on /usr if APP_DIR is not defined. Fixes: https:/
/bugs.launchpad .net/bugs/ 1322630. Approved by PS Jenkins bot, Tim Peeters, David Planella.
- 1080. By Zoltan Balogh
-
Replace split with match to work around failing split() function usage.
Approved by Zsombor Egri, PS Jenkins bot.
- 1079. By Cris Dywan
-
More unit tests and property corrections for SortFilterModel.
Approved by Tim Peeters, PS Jenkins bot.
Preview Diff
1 | === modified file 'CHANGES' | |||
2 | --- CHANGES 2014-04-24 20:35:41 +0000 | |||
3 | +++ CHANGES 2014-05-28 18:09:57 +0000 | |||
4 | @@ -19,6 +19,7 @@ | |||
5 | 19 | 19 | ||
6 | 20 | API Changes | 20 | API Changes |
7 | 21 | *********** | 21 | *********** |
8 | 22 | * CHANGED IN: ThinDivider: base class Image TO Rectangle | ||
9 | 22 | * ADDED IN: all modules exported as 0.1 as well as 1.0 version | 23 | * ADDED IN: all modules exported as 0.1 as well as 1.0 version |
10 | 23 | * ADDED IN: PickerDelegate: readonly property Picker picker | 24 | * ADDED IN: PickerDelegate: readonly property Picker picker |
11 | 24 | * CHANGED IN: OptionSelector: readonly property bool currentlyExpanded TO property bool currentlyExpanded | 25 | * CHANGED IN: OptionSelector: readonly property bool currentlyExpanded TO property bool currentlyExpanded |
12 | 25 | 26 | ||
13 | === modified file 'components.api' | |||
14 | --- components.api 2014-05-13 09:13:32 +0000 | |||
15 | +++ components.api 2014-05-28 18:09:57 +0000 | |||
16 | @@ -31,6 +31,7 @@ | |||
17 | 31 | AbstractButton | 31 | AbstractButton |
18 | 32 | property color color | 32 | property color color |
19 | 33 | property Gradient gradient | 33 | property Gradient gradient |
20 | 34 | property font font | ||
21 | 34 | property string iconPosition | 35 | property string iconPosition |
22 | 35 | CheckBox 0.1 1.0 | 36 | CheckBox 0.1 1.0 |
23 | 36 | AbstractButton | 37 | AbstractButton |
24 | @@ -94,7 +95,7 @@ | |||
25 | 94 | property real __leftIconMargin | 95 | property real __leftIconMargin |
26 | 95 | property real __rightIconMargin | 96 | property real __rightIconMargin |
27 | 96 | property bool __iconIsItem | 97 | property bool __iconIsItem |
29 | 97 | property internal children | 98 | default property internal children |
30 | 98 | Caption 0.1 1.0 | 99 | Caption 0.1 1.0 |
31 | 99 | Item | 100 | Item |
32 | 100 | property string text | 101 | property string text |
33 | @@ -140,6 +141,7 @@ | |||
34 | 140 | property bool expanded | 141 | property bool expanded |
35 | 141 | property bool multiSelection | 142 | property bool multiSelection |
36 | 142 | property bool colourImage | 143 | property bool colourImage |
37 | 144 | property Component delegate | ||
38 | 143 | property real containerHeight | 145 | property real containerHeight |
39 | 144 | property int selectedIndex | 146 | property int selectedIndex |
40 | 145 | property bool currentlyExpanded | 147 | property bool currentlyExpanded |
41 | @@ -175,7 +177,7 @@ | |||
42 | 175 | Base | 177 | Base |
43 | 176 | property string subText | 178 | property string subText |
44 | 177 | ThinDivider 0.1 1.0 | 179 | ThinDivider 0.1 1.0 |
46 | 178 | Image | 180 | Rectangle |
47 | 179 | ValueSelector 0.1 1.0 | 181 | ValueSelector 0.1 1.0 |
48 | 180 | Empty | 182 | Empty |
49 | 181 | property variant icon | 183 | property variant icon |
50 | @@ -204,12 +206,14 @@ | |||
51 | 204 | Object 0.1 1.0 | 206 | Object 0.1 1.0 |
52 | 205 | QtObject | 207 | QtObject |
53 | 206 | default property internal children | 208 | default property internal children |
54 | 209 | property list<QtObject> __defaultPropertyFix | ||
55 | 207 | OptionSelector 0.1 1.0 | 210 | OptionSelector 0.1 1.0 |
56 | 208 | ListItem.Empty | 211 | ListItem.Empty |
57 | 209 | property var model | 212 | property var model |
58 | 210 | property bool expanded | 213 | property bool expanded |
59 | 211 | property bool multiSelection | 214 | property bool multiSelection |
60 | 212 | property bool colourImage | 215 | property bool colourImage |
61 | 216 | property Component delegate | ||
62 | 213 | property real containerHeight | 217 | property real containerHeight |
63 | 214 | property int selectedIndex | 218 | property int selectedIndex |
64 | 215 | property bool currentlyExpanded | 219 | property bool currentlyExpanded |
65 | @@ -235,6 +239,7 @@ | |||
66 | 235 | Page 0.1 1.0 | 239 | Page 0.1 1.0 |
67 | 236 | PageTreeNode | 240 | PageTreeNode |
68 | 237 | property string title | 241 | property string title |
69 | 242 | property Item tools | ||
70 | 238 | property Item __customHeaderContents | 243 | property Item __customHeaderContents |
71 | 239 | property Flickable flickable | 244 | property Flickable flickable |
72 | 240 | property list<Action> actions | 245 | property list<Action> actions |
73 | @@ -355,6 +360,7 @@ | |||
74 | 355 | OrientationHelper | 360 | OrientationHelper |
75 | 356 | property Item dismissArea | 361 | property Item dismissArea |
76 | 357 | property bool grabDismissAreaEvents | 362 | property bool grabDismissAreaEvents |
77 | 363 | property PropertyAnimation fadingAnimation | ||
78 | 358 | function show() | 364 | function show() |
79 | 359 | function hide() | 365 | function hide() |
80 | 360 | function __closeIfHidden() | 366 | function __closeIfHidden() |
81 | @@ -613,6 +619,11 @@ | |||
82 | 613 | function mouseLongPress(item, x, y, button, modifiers, delay) | 619 | function mouseLongPress(item, x, y, button, modifiers, delay) |
83 | 614 | function tryCompareFunction(func, expectedResult, timeout) | 620 | function tryCompareFunction(func, expectedResult, timeout) |
84 | 615 | plugins.qmltypes | 621 | plugins.qmltypes |
85 | 622 | name: "FilterBehavior" | ||
86 | 623 | prototype: "QObject" | ||
87 | 624 | exports: ["FilterBehavior 1.1"] | ||
88 | 625 | Property { name: "property"; type: "string" } | ||
89 | 626 | Property { name: "pattern"; type: "QRegExp" } | ||
90 | 616 | name: "InverseMouseAreaType" | 627 | name: "InverseMouseAreaType" |
91 | 617 | prototype: "QQuickMouseArea" | 628 | prototype: "QQuickMouseArea" |
92 | 618 | exports: ["InverseMouseArea 0.1", "InverseMouseArea 1.0"] | 629 | exports: ["InverseMouseArea 0.1", "InverseMouseArea 1.0"] |
93 | @@ -621,6 +632,41 @@ | |||
94 | 621 | Method { | 632 | Method { |
95 | 622 | name: "contains" | 633 | name: "contains" |
96 | 623 | Parameter { name: "point"; type: "QPointF" } | 634 | Parameter { name: "point"; type: "QPointF" } |
97 | 635 | name: "QAbstractProxyModel" | ||
98 | 636 | prototype: "QAbstractItemModel" | ||
99 | 637 | Property { name: "sourceModel"; type: "QAbstractItemModel"; isPointer: true } | ||
100 | 638 | name: "QSortFilterProxyModel" | ||
101 | 639 | prototype: "QAbstractProxyModel" | ||
102 | 640 | Property { name: "filterRegExp"; type: "QRegExp" } | ||
103 | 641 | Property { name: "filterKeyColumn"; type: "int" } | ||
104 | 642 | Property { name: "dynamicSortFilter"; type: "bool" } | ||
105 | 643 | Property { name: "filterCaseSensitivity"; type: "Qt::CaseSensitivity" } | ||
106 | 644 | Property { name: "sortCaseSensitivity"; type: "Qt::CaseSensitivity" } | ||
107 | 645 | Property { name: "isSortLocaleAware"; type: "bool" } | ||
108 | 646 | Property { name: "sortRole"; type: "int" } | ||
109 | 647 | Property { name: "filterRole"; type: "int" } | ||
110 | 648 | Method { | ||
111 | 649 | name: "setFilterRegExp" | ||
112 | 650 | Parameter { name: "pattern"; type: "string" } | ||
113 | 651 | Method { | ||
114 | 652 | name: "setFilterWildcard" | ||
115 | 653 | Parameter { name: "pattern"; type: "string" } | ||
116 | 654 | Method { | ||
117 | 655 | name: "setFilterFixedString" | ||
118 | 656 | Parameter { name: "pattern"; type: "string" } | ||
119 | 657 | Method { name: "clear" } | ||
120 | 658 | Method { name: "invalidate" } | ||
121 | 659 | name: "QSortFilterProxyModelQML" | ||
122 | 660 | prototype: "QSortFilterProxyModel" | ||
123 | 661 | exports: ["SortFilterModel 1.1"] | ||
124 | 662 | Property { name: "model"; type: "QAbstractItemModel"; isPointer: true } | ||
125 | 663 | Property { name: "count"; type: "int"; isReadonly: true } | ||
126 | 664 | Property { name: "sort"; type: "SortBehavior"; isReadonly: true; isPointer: true } | ||
127 | 665 | Property { name: "filter"; type: "FilterBehavior"; isReadonly: true; isPointer: true } | ||
128 | 666 | Method { | ||
129 | 667 | name: "get" | ||
130 | 668 | Parameter { name: "row"; type: "int" } | ||
131 | 669 | Method { name: "count"; type: "int" } | ||
132 | 624 | name: "ShapeItem" | 670 | name: "ShapeItem" |
133 | 625 | prototype: "QQuickItem" | 671 | prototype: "QQuickItem" |
134 | 626 | exports: ["Shape 0.1", "Shape 1.0"] | 672 | exports: ["Shape 0.1", "Shape 1.0"] |
135 | @@ -636,6 +682,11 @@ | |||
136 | 636 | Property { name: "borderSource"; type: "string" } | 682 | Property { name: "borderSource"; type: "string" } |
137 | 637 | Signal { name: "borderChanged" } | 683 | Signal { name: "borderChanged" } |
138 | 638 | Method { name: "gridUnitChanged" } | 684 | Method { name: "gridUnitChanged" } |
139 | 685 | name: "SortBehavior" | ||
140 | 686 | prototype: "QObject" | ||
141 | 687 | exports: ["SortBehavior 1.1"] | ||
142 | 688 | Property { name: "property"; type: "string" } | ||
143 | 689 | Property { name: "order"; type: "Qt::SortOrder" } | ||
144 | 639 | name: "UCAlarm" | 690 | name: "UCAlarm" |
145 | 640 | prototype: "QObject" | 691 | prototype: "QObject" |
146 | 641 | exports: ["Alarm 0.1", "Alarm 1.0"] | 692 | exports: ["Alarm 0.1", "Alarm 1.0"] |
147 | @@ -819,6 +870,8 @@ | |||
148 | 819 | exports: ["Layouts 0.1", "Layouts 1.0"] | 870 | exports: ["Layouts 0.1", "Layouts 1.0"] |
149 | 820 | Property { name: "currentLayout"; type: "string"; isReadonly: true } | 871 | Property { name: "currentLayout"; type: "string"; isReadonly: true } |
150 | 821 | Property { name: "layouts"; type: "ULConditionalLayout"; isList: true; isReadonly: true } | 872 | Property { name: "layouts"; type: "ULConditionalLayout"; isList: true; isReadonly: true } |
151 | 873 | Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } | ||
152 | 874 | Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } | ||
153 | 822 | name: "ULLayoutsAttached" | 875 | name: "ULLayoutsAttached" |
154 | 823 | prototype: "QObject" | 876 | prototype: "QObject" |
155 | 824 | Property { name: "item"; type: "string" } | 877 | Property { name: "item"; type: "string" } |
156 | 825 | 878 | ||
157 | === modified file 'debian/changelog' | |||
158 | --- debian/changelog 2014-05-16 11:56:17 +0000 | |||
159 | +++ debian/changelog 2014-05-28 18:09:57 +0000 | |||
160 | @@ -1,4 +1,115 @@ | |||
162 | 1 | ubuntu-ui-toolkit (0.1.46+14.10.20140512-0ubuntu2) UNRELEASED; urgency=medium | 1 | ubuntu-ui-toolkit (0.1.46+14.10.20140527-0ubuntu2) UNRELEASED; urgency=medium |
163 | 2 | |||
164 | 3 | [ Christian Dywan ] | ||
165 | 4 | * Tweak API parsing to include the Button.font property. | ||
166 | 5 | Fixes: https://bugs.launchpad.net/bugs/1322169 | ||
167 | 6 | * Call bindtextdomain on /usr if APP_DIR is not defined. | ||
168 | 7 | Fixes: https://bugs.launchpad.net/bugs/1322630 | ||
169 | 8 | * More unit tests and property corrections for SortFilterModel. | ||
170 | 9 | * Read ubuntu-ui-toolkit.ini from $XDG_CONFIG_HOME. | ||
171 | 10 | * Skip test_ubuntushape which is flakey and add a FIXME. | ||
172 | 11 | |||
173 | 12 | [ Zsombor Egri ] | ||
174 | 13 | * Missing "default" keyword added to children property of Base, | ||
175 | 14 | causing rendering and test case failures on Qt 5.3. | ||
176 | 15 | Fixes: https://bugs.launchpad.net/bugs/1317881 | ||
177 | 16 | |||
178 | 17 | [ Ugo Riboni ] | ||
179 | 18 | * Allow requesting extra large thumbnails. | ||
180 | 19 | |||
181 | 20 | [ Florian Boucault ] | ||
182 | 21 | * AnimatedItem: deprecated as it was not used and still costly. | ||
183 | 22 | * Label: default font weight is now light. | ||
184 | 23 | |||
185 | 24 | [ Tim Peeters ] | ||
186 | 25 | * Make Header component internal as it was always documented. | ||
187 | 26 | |||
188 | 27 | |||
189 | 28 | [ Zoltán Balogh ] | ||
190 | 29 | * Replace split with match to work around failing split() | ||
191 | 30 | function usage. | ||
192 | 31 | |||
193 | 32 | -- Zoltán Balogh <zoltan@bakter.hu> Wed, 28 May 2014 11:54:22 +0200 | ||
194 | 33 | |||
195 | 34 | ubuntu-ui-toolkit (0.1.46+14.10.20140527-0ubuntu1) utopic; urgency=medium | ||
196 | 35 | |||
197 | 36 | [ Timo Jyrinki ] | ||
198 | 37 | * Allow using the renamed QML packages. Allow also old names | ||
199 | 38 | for eg. trusty backporting. For additional cross-building | ||
200 | 39 | friendliness, add :any to python build dependencies. | ||
201 | 40 | |||
202 | 41 | [ Leo Arias ] | ||
203 | 42 | * Rewrite OptionSelector tests using new helpers. | ||
204 | 43 | * Added autopilot helpers to pick a time from a date picker. | ||
205 | 44 | * In autopilot select all text only if not already selected. | ||
206 | 45 | Fixes: https://bugs.launchpad.net/bugs/1321222. | ||
207 | 46 | |||
208 | 47 | [ Christian Dywan ] | ||
209 | 48 | * Skip flaky test_updateAlarm_Repeating. | ||
210 | 49 | * Skip test_ubuntushape which is flakey and add a FIXME. | ||
211 | 50 | * Read ubuntu-ui-toolkit.ini from $XDG_CONFIG_HOME. | ||
212 | 51 | * More unit tests and property corrections for SortFilterModel. | ||
213 | 52 | |||
214 | 53 | [ Tim Peeters ] | ||
215 | 54 | * Fix bug where header actions are painted in the middle | ||
216 | 55 | of the page. Fixes: https://bugs.launchpad.net/bugs/1319861 | ||
217 | 56 | * Add header demo program to the resources. | ||
218 | 57 | * Show header if it was not visible before clicking header | ||
219 | 58 | button in autopilot test. | ||
220 | 59 | |||
221 | 60 | [ Florian Boucault ] | ||
222 | 61 | * ActivityIndicator: do not rely on the main thread to animate | ||
223 | 62 | by using an Animator. | ||
224 | 63 | * ThinDivider: use a Rectangle instead of an Image. | ||
225 | 64 | 5x faster creation. | ||
226 | 65 | * Label: default font weight is now light. | ||
227 | 66 | |||
228 | 67 | [ Zsombor Egri ] | ||
229 | 68 | * Ubuntu Layouts reparents those default layout components which | ||
230 | 69 | are not subject of layout instead of altering their visible and | ||
231 | 70 | enabled properties. | ||
232 | 71 | Fixes: https://bugs.launchpad.net/bugs/1204834 | ||
233 | 72 | https://bugs.launchpad.net/bugs/1298886 | ||
234 | 73 | https://bugs.launchpad.net/bugs/1300668. | ||
235 | 74 | |||
236 | 75 | [ Alberto Mardegan ] | ||
237 | 76 | * Keep a map of windows and associated textures. | ||
238 | 77 | Fixes: https://bugs.launchpad.net/bugs/1296728. | ||
239 | 78 | |||
240 | 79 | -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 27 May 2014 07:51:29 +0000 | ||
241 | 80 | |||
242 | 81 | ubuntu-ui-toolkit (0.1.46+14.10.20140520-0ubuntu1) utopic; urgency=medium | ||
243 | 82 | |||
244 | 83 | [ Leo Arias ] | ||
245 | 84 | * Added the swipe_into_view method to autopilot helpers. | ||
246 | 85 | Fixed the name of the QQuickFlickable autopilot helper. | ||
247 | 86 | Fixes: https://bugs.launchpad.net/bugs/1286479 | ||
248 | 87 | https://bugs.launchpad.net/bugs/1314433. | ||
249 | 88 | * On the autopilot helpers, find the top container starting from | ||
250 | 89 | the flickable. Fixes: https://bugs.launchpad.net/bugs/1314390. | ||
251 | 90 | |||
252 | 91 | [ Christian Dywan ] | ||
253 | 92 | * Use i18n.dtr for toolkit-owned translations. | ||
254 | 93 | Fixes: https://bugs.launchpad.net/bugs/1317539 | ||
255 | 94 | * Introduce QML bindings for SortFilterModel. | ||
256 | 95 | Fixes: https://bugs.launchpad.net/bugs/1266529 | ||
257 | 96 | * Pick data path if .click is present. | ||
258 | 97 | Fixes: https://bugs.launchpad.net/bugs/1317772 | ||
259 | 98 | |||
260 | 99 | [ Tim Peeters ] | ||
261 | 100 | * Quick fix for TabBarStyle.qml:119: TypeError: Cannot | ||
262 | 101 | read property of null. | ||
263 | 102 | |||
264 | 103 | [ Zsombor Egri ] | ||
265 | 104 | * One time alarms omit dayOfWeek value changes. | ||
266 | 105 | Fixes: https://bugs.launchpad.net/bugs/1319401 | ||
267 | 106 | |||
268 | 107 | [ CI bot ] | ||
269 | 108 | * Resync trunk | ||
270 | 109 | |||
271 | 110 | -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 20 May 2014 08:35:48 +0000 | ||
272 | 111 | |||
273 | 112 | ubuntu-ui-toolkit (0.1.46+14.10.20140516-0ubuntu1) utopic; urgency=medium | ||
274 | 2 | 113 | ||
275 | 3 | [ Tim Peeters ] | 114 | [ Tim Peeters ] |
276 | 4 | * Take visibility of actions into account when determining whether | 115 | * Take visibility of actions into account when determining whether |
277 | @@ -31,7 +142,7 @@ | |||
278 | 31 | on mobile architectures (less rattling, more realistic). | 142 | on mobile architectures (less rattling, more realistic). |
279 | 32 | Fixes: https://bugs.launchpad.net/bugs/1290201. | 143 | Fixes: https://bugs.launchpad.net/bugs/1290201. |
280 | 33 | 144 | ||
282 | 34 | -- Zoltán Balogh <zoltan@bakter.hu> Wed, 14 May 2014 15:46:58 +0300 | 145 | -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 16 May 2014 11:58:25 +0000 |
283 | 35 | 146 | ||
284 | 36 | ubuntu-ui-toolkit (0.1.46+14.10.20140512-0ubuntu1) utopic; urgency=low | 147 | ubuntu-ui-toolkit (0.1.46+14.10.20140512-0ubuntu1) utopic; urgency=low |
285 | 37 | 148 | ||
286 | 38 | 149 | ||
287 | === modified file 'debian/control' | |||
288 | --- debian/control 2014-05-12 09:33:55 +0000 | |||
289 | +++ debian/control 2014-05-28 18:09:57 +0000 | |||
290 | @@ -6,9 +6,9 @@ | |||
291 | 6 | devscripts, | 6 | devscripts, |
292 | 7 | libgles2-mesa-dev, | 7 | libgles2-mesa-dev, |
293 | 8 | libglib2.0-dev, | 8 | libglib2.0-dev, |
297 | 9 | python3, | 9 | python3:any, |
298 | 10 | python, | 10 | python:any, |
299 | 11 | libqt5qml-graphicaleffects | libqt5graphicaleffects5, | 11 | qml-module-qtgraphicaleffects | libqt5qml-graphicaleffects, |
300 | 12 | qt5-default, | 12 | qt5-default, |
301 | 13 | qtbase5-dev, | 13 | qtbase5-dev, |
302 | 14 | qtbase5-private-dev, | 14 | qtbase5-private-dev, |
303 | @@ -17,12 +17,12 @@ | |||
304 | 17 | libqt5sql5-sqlite, | 17 | libqt5sql5-sqlite, |
305 | 18 | qtdeclarative5-dev-tools, | 18 | qtdeclarative5-dev-tools, |
306 | 19 | qtdeclarative5-private-dev, | 19 | qtdeclarative5-private-dev, |
310 | 20 | qtdeclarative5-qtquick2-plugin, | 20 | qml-module-qtquick2 | qtdeclarative5-qtquick2-plugin, |
311 | 21 | qtdeclarative5-test-plugin, | 21 | qml-module-qttest | qtdeclarative5-test-plugin, |
312 | 22 | qtdeclarative5-window-plugin, | 22 | qml-module-qtquick-window2 | qtdeclarative5-window-plugin, |
313 | 23 | qtdeclarative5-qtfeedback-plugin, | 23 | qtdeclarative5-qtfeedback-plugin, |
314 | 24 | qtdeclarative5-unity-action-plugin (>= 1.1.0), | 24 | qtdeclarative5-unity-action-plugin (>= 1.1.0), |
316 | 25 | qtdeclarative5-localstorage-plugin, | 25 | qml-module-qtquick-localstorage | qtdeclarative5-localstorage-plugin, |
317 | 26 | qtdeclarative5-doc-html, | 26 | qtdeclarative5-doc-html, |
318 | 27 | qtwebkit5-doc-html, | 27 | qtwebkit5-doc-html, |
319 | 28 | qtsvg5-doc-html, | 28 | qtsvg5-doc-html, |
320 | 29 | 29 | ||
321 | === modified file 'examples/ubuntu-ui-toolkit-gallery/ListItems.qml' | |||
322 | --- examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2014-04-28 10:30:06 +0000 | |||
323 | +++ examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2014-05-28 18:09:57 +0000 | |||
324 | @@ -15,7 +15,7 @@ | |||
325 | 15 | */ | 15 | */ |
326 | 16 | 16 | ||
327 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.0 |
329 | 18 | import Ubuntu.Components 0.1 as Toolkit | 18 | import Ubuntu.Components 1.1 as Toolkit |
330 | 19 | import Ubuntu.Components.ListItems 0.1 as ListItem | 19 | import Ubuntu.Components.ListItems 0.1 as ListItem |
331 | 20 | 20 | ||
332 | 21 | Template { | 21 | Template { |
333 | @@ -259,11 +259,20 @@ | |||
334 | 259 | ListElement { name: "Potato"; details: "Vegetable" } | 259 | ListElement { name: "Potato"; details: "Vegetable" } |
335 | 260 | } | 260 | } |
336 | 261 | 261 | ||
337 | 262 | Toolkit.SortFilterModel { | ||
338 | 263 | id: processedFruits | ||
339 | 264 | model: fruitModel | ||
340 | 265 | sort.property: "title" | ||
341 | 266 | sort.order: Qt.DescendingOrder | ||
342 | 267 | filter.property: "details" | ||
343 | 268 | filter.pattern: /Vegetable/ | ||
344 | 269 | } | ||
345 | 270 | |||
346 | 262 | Toolkit.UbuntuListView { | 271 | Toolkit.UbuntuListView { |
347 | 263 | id: ubuntuListView | 272 | id: ubuntuListView |
348 | 264 | anchors { left: parent.left; right: parent.right } | 273 | anchors { left: parent.left; right: parent.right } |
349 | 265 | height: units.gu(24) | 274 | height: units.gu(24) |
351 | 266 | model: fruitModel | 275 | model: processedFruits |
352 | 267 | clip: true | 276 | clip: true |
353 | 268 | 277 | ||
354 | 269 | delegate: ListItem.Expandable { | 278 | delegate: ListItem.Expandable { |
355 | 270 | 279 | ||
356 | === modified file 'modules/Ubuntu/Components/AnimatedItem.qml' | |||
357 | --- modules/Ubuntu/Components/AnimatedItem.qml 2014-04-23 08:50:20 +0000 | |||
358 | +++ modules/Ubuntu/Components/AnimatedItem.qml 2014-05-28 18:09:57 +0000 | |||
359 | @@ -30,45 +30,8 @@ | |||
360 | 30 | id: root | 30 | id: root |
361 | 31 | /*! | 31 | /*! |
362 | 32 | \preliminary | 32 | \preliminary |
363 | 33 | \deprecated | ||
364 | 33 | Specifies whether the component is on the visible area of the Flickable or not. | 34 | Specifies whether the component is on the visible area of the Flickable or not. |
365 | 34 | */ | 35 | */ |
366 | 35 | property bool onScreen: true | 36 | property bool onScreen: true |
367 | 36 | |||
368 | 37 | QtObject { | ||
369 | 38 | id: internal | ||
370 | 39 | property Flickable flickable | ||
371 | 40 | |||
372 | 41 | // returns whether the component is in the visible area of the flickable | ||
373 | 42 | function checkOnScreen() | ||
374 | 43 | { | ||
375 | 44 | var pos = root.mapToItem(flickable, 0, 0) | ||
376 | 45 | root.onScreen = (pos.y + root.height >= 0) && (pos.y <= internal.flickable.height) && | ||
377 | 46 | (pos.x + root.width >= 0) && (pos.x <= internal.flickable.width) | ||
378 | 47 | } | ||
379 | 48 | // lookup for a flickable parent | ||
380 | 49 | function updateFlickableParent() | ||
381 | 50 | { | ||
382 | 51 | var flickable = root.parent | ||
383 | 52 | while (flickable) { | ||
384 | 53 | if (flickable.hasOwnProperty("flicking") && flickable.hasOwnProperty("flickableDirection")) { | ||
385 | 54 | // non-interactive flickables must be skipped as those do not provide | ||
386 | 55 | // on-screen detection support | ||
387 | 56 | if (flickable.interactive) | ||
388 | 57 | break | ||
389 | 58 | } | ||
390 | 59 | flickable = flickable.parent | ||
391 | 60 | } | ||
392 | 61 | internal.flickable = flickable | ||
393 | 62 | } | ||
394 | 63 | } | ||
395 | 64 | |||
396 | 65 | Connections { | ||
397 | 66 | target: internal.flickable | ||
398 | 67 | |||
399 | 68 | onContentXChanged: internal.checkOnScreen() | ||
400 | 69 | onContentYChanged: internal.checkOnScreen() | ||
401 | 70 | } | ||
402 | 71 | |||
403 | 72 | Component.onCompleted: internal.updateFlickableParent() | ||
404 | 73 | onParentChanged: internal.updateFlickableParent() | ||
405 | 74 | } | 37 | } |
406 | 75 | 38 | ||
407 | === modified file 'modules/Ubuntu/Components/Label.qml' | |||
408 | --- modules/Ubuntu/Components/Label.qml 2014-04-23 08:50:20 +0000 | |||
409 | +++ modules/Ubuntu/Components/Label.qml 2014-05-28 18:09:57 +0000 | |||
410 | @@ -56,6 +56,7 @@ | |||
411 | 56 | 56 | ||
412 | 57 | font.pixelSize: FontUtils.sizeToPixels(fontSize) | 57 | font.pixelSize: FontUtils.sizeToPixels(fontSize) |
413 | 58 | font.family: "Ubuntu" | 58 | font.family: "Ubuntu" |
414 | 59 | font.weight: Font.Light | ||
415 | 59 | color: Theme.palette.selected.backgroundText | 60 | color: Theme.palette.selected.backgroundText |
416 | 60 | 61 | ||
417 | 61 | /* FIXME: workaround for QTBUG 35095 where Text's alignment is incorrect | 62 | /* FIXME: workaround for QTBUG 35095 where Text's alignment is incorrect |
418 | 62 | 63 | ||
419 | === modified file 'modules/Ubuntu/Components/ListItems/Base.qml' | |||
420 | --- modules/Ubuntu/Components/ListItems/Base.qml 2014-04-28 19:24:56 +0000 | |||
421 | +++ modules/Ubuntu/Components/ListItems/Base.qml 2014-05-28 18:09:57 +0000 | |||
422 | @@ -159,7 +159,7 @@ | |||
423 | 159 | /*! | 159 | /*! |
424 | 160 | \internal | 160 | \internal |
425 | 161 | */ | 161 | */ |
427 | 162 | property alias children: middle.data | 162 | default property alias children: middle.data |
428 | 163 | Item { | 163 | Item { |
429 | 164 | id: middle | 164 | id: middle |
430 | 165 | property bool anchorToIconHelper: !__iconIsItem && iconHelper.source != "" | 165 | property bool anchorToIconHelper: !__iconIsItem && iconHelper.source != "" |
431 | 166 | 166 | ||
432 | === modified file 'modules/Ubuntu/Components/ListItems/Empty.qml' | |||
433 | --- modules/Ubuntu/Components/ListItems/Empty.qml 2014-04-30 11:04:41 +0000 | |||
434 | +++ modules/Ubuntu/Components/ListItems/Empty.qml 2014-05-28 18:09:57 +0000 | |||
435 | @@ -390,7 +390,7 @@ | |||
436 | 390 | width: units.gu(5) | 390 | width: units.gu(5) |
437 | 391 | } | 391 | } |
438 | 392 | Label { | 392 | Label { |
440 | 393 | text: i18n.tr("Delete") | 393 | text: i18n.dtr('ubuntu-ui-toolkit', 'Delete') |
441 | 394 | verticalAlignment: Text.AlignVCenter | 394 | verticalAlignment: Text.AlignVCenter |
442 | 395 | anchors { | 395 | anchors { |
443 | 396 | verticalCenter: parent.verticalCenter | 396 | verticalCenter: parent.verticalCenter |
444 | 397 | 397 | ||
445 | === modified file 'modules/Ubuntu/Components/ListItems/ThinDivider.qml' | |||
446 | --- modules/Ubuntu/Components/ListItems/ThinDivider.qml 2014-04-20 19:25:12 +0000 | |||
447 | +++ modules/Ubuntu/Components/ListItems/ThinDivider.qml 2014-05-28 18:09:57 +0000 | |||
448 | @@ -44,11 +44,14 @@ | |||
449 | 44 | } | 44 | } |
450 | 45 | \endqml | 45 | \endqml |
451 | 46 | */ | 46 | */ |
453 | 47 | Image { | 47 | Rectangle { |
454 | 48 | anchors { | 48 | anchors { |
455 | 49 | left: (parent) ? parent.left : null | 49 | left: (parent) ? parent.left : null |
456 | 50 | right: (parent) ? parent.right : null | 50 | right: (parent) ? parent.right : null |
457 | 51 | } | 51 | } |
458 | 52 | height: (visible) ? units.dp(2) : 0 | 52 | height: (visible) ? units.dp(2) : 0 |
460 | 53 | source: "artwork/ListItemDividerHorizontal.png" | 53 | gradient: Gradient { |
461 | 54 | GradientStop { position: 0.0; color: "#26000000" } | ||
462 | 55 | GradientStop { position: 1.0; color: "#14F3F3E7" } | ||
463 | 56 | } | ||
464 | 54 | } | 57 | } |
465 | 55 | 58 | ||
466 | === removed file 'modules/Ubuntu/Components/ListItems/artwork/ListItemDividerHorizontal@18.png' | |||
467 | 56 | Binary files modules/Ubuntu/Components/ListItems/artwork/ListItemDividerHorizontal@18.png 2013-02-06 11:48:20 +0000 and modules/Ubuntu/Components/ListItems/artwork/ListItemDividerHorizontal@18.png 1970-01-01 00:00:00 +0000 differ | 59 | Binary files modules/Ubuntu/Components/ListItems/artwork/ListItemDividerHorizontal@18.png 2013-02-06 11:48:20 +0000 and modules/Ubuntu/Components/ListItems/artwork/ListItemDividerHorizontal@18.png 1970-01-01 00:00:00 +0000 differ |
468 | === modified file 'modules/Ubuntu/Components/Page.qml' | |||
469 | --- modules/Ubuntu/Components/Page.qml 2014-05-16 11:33:37 +0000 | |||
470 | +++ modules/Ubuntu/Components/Page.qml 2014-05-28 18:09:57 +0000 | |||
471 | @@ -185,6 +185,13 @@ | |||
472 | 185 | value: page.pageStack | 185 | value: page.pageStack |
473 | 186 | when: tools && tools.hasOwnProperty("pageStack") | 186 | when: tools && tools.hasOwnProperty("pageStack") |
474 | 187 | } | 187 | } |
475 | 188 | Binding { | ||
476 | 189 | target: tools | ||
477 | 190 | property: "visible" | ||
478 | 191 | value: false | ||
479 | 192 | when: header && !header.useDeprecatedToolbar && | ||
480 | 193 | page.tools !== null | ||
481 | 194 | } | ||
482 | 188 | 195 | ||
483 | 189 | function isVerticalFlickable(object) { | 196 | function isVerticalFlickable(object) { |
484 | 190 | if (object && object.hasOwnProperty("flickableDirection") && object.hasOwnProperty("contentHeight")) { | 197 | if (object && object.hasOwnProperty("flickableDirection") && object.hasOwnProperty("contentHeight")) { |
485 | 191 | 198 | ||
486 | === modified file 'modules/Ubuntu/Components/Pickers/DatePicker.qml' | |||
487 | --- modules/Ubuntu/Components/Pickers/DatePicker.qml 2014-04-23 08:50:20 +0000 | |||
488 | +++ modules/Ubuntu/Components/Pickers/DatePicker.qml 2014-05-28 18:09:57 +0000 | |||
489 | @@ -42,7 +42,7 @@ | |||
490 | 42 | Column { | 42 | Column { |
491 | 43 | Label { | 43 | Label { |
492 | 44 | text: "Selected date: W" + datePicker.week + " - " + | 44 | text: "Selected date: W" + datePicker.week + " - " + |
494 | 45 | Qt.formatDate(datePicker.date, "dddd, dd-mmmm-yyyy") | 45 | Qt.formatDate(datePicker.date, "dddd, dd-MMMM-yyyy") |
495 | 46 | } | 46 | } |
496 | 47 | DatePicker { | 47 | DatePicker { |
497 | 48 | id: datePicker | 48 | id: datePicker |
498 | @@ -61,7 +61,7 @@ | |||
499 | 61 | 61 | ||
500 | 62 | Column { | 62 | Column { |
501 | 63 | Label { | 63 | Label { |
503 | 64 | text: "Selected month: " + Qt.formatDate(datePicker.date, "mmmm-yyyy") | 64 | text: "Selected month: " + Qt.formatDate(datePicker.date, "MMMM-yyyy") |
504 | 65 | } | 65 | } |
505 | 66 | DatePicker { | 66 | DatePicker { |
506 | 67 | id: datePicker | 67 | id: datePicker |
507 | @@ -117,7 +117,7 @@ | |||
508 | 117 | 117 | ||
509 | 118 | Column { | 118 | Column { |
510 | 119 | Label { | 119 | Label { |
512 | 120 | text: "Selected date: " + Qt.formatDate(datePicker.date, "dddd, dd-mmmm-yyyy") | 120 | text: "Selected date: " + Qt.formatDate(datePicker.date, "dddd, dd-MMMM-yyyy") |
513 | 121 | } | 121 | } |
514 | 122 | DatePicker { | 122 | DatePicker { |
515 | 123 | id: datePicker | 123 | id: datePicker |
516 | @@ -523,7 +523,8 @@ | |||
517 | 523 | function updatePickers() { | 523 | function updatePickers() { |
518 | 524 | if (completed) { | 524 | if (completed) { |
519 | 525 | // check mode flags first | 525 | // check mode flags first |
521 | 526 | var modes = datePicker.mode.split(/\W/g); | 526 | // FIXME: The js split(/\W/g) terminates the process on armhf with Qt 5.3 (v4 js) (https://bugreports.qt-project.org/browse/QTBUG-39255) |
522 | 527 | var modes = datePicker.mode.match(/\w+/g); | ||
523 | 527 | 528 | ||
524 | 528 | showYearPicker = showMonthPicker = showDayPicker = | 529 | showYearPicker = showMonthPicker = showDayPicker = |
525 | 529 | showHoursPicker = showMinutesPicker = showSecondsPicker = false; | 530 | showHoursPicker = showMinutesPicker = showSecondsPicker = false; |
526 | @@ -607,7 +608,8 @@ | |||
527 | 607 | completed = false; | 608 | completed = false; |
528 | 608 | 609 | ||
529 | 609 | // use short format to exclude any extra characters | 610 | // use short format to exclude any extra characters |
531 | 610 | var format = datePicker.locale.dateFormat(Locale.ShortFormat).split(/\W/g); | 611 | // FIXME: The js split(/\W/g) terminates the process on armhf with Qt 5.3 (v4 js) (https://bugreports.qt-project.org/browse/QTBUG-39255) |
532 | 612 | var format = datePicker.locale.dateFormat(Locale.ShortFormat).match(/\w+/g); | ||
533 | 611 | // loop through the format to decide the position of the tumbler | 613 | // loop through the format to decide the position of the tumbler |
534 | 612 | var formatIndex = 0; | 614 | var formatIndex = 0; |
535 | 613 | for (var i in format) { | 615 | for (var i in format) { |
536 | @@ -667,5 +669,3 @@ | |||
537 | 667 | } | 669 | } |
538 | 668 | } | 670 | } |
539 | 669 | } | 671 | } |
540 | 670 | |||
541 | 671 | |||
542 | 672 | 672 | ||
543 | === modified file 'modules/Ubuntu/Components/Pickers/PickerRow.qml' | |||
544 | --- modules/Ubuntu/Components/Pickers/PickerRow.qml 2014-04-23 08:50:20 +0000 | |||
545 | +++ modules/Ubuntu/Components/Pickers/PickerRow.qml 2014-05-28 18:09:57 +0000 | |||
546 | @@ -96,7 +96,7 @@ | |||
547 | 96 | } | 96 | } |
548 | 97 | delegate: PickerDelegate { | 97 | delegate: PickerDelegate { |
549 | 98 | Label { | 98 | Label { |
551 | 99 | objectName: "PickerRow_PickerLabel" | 99 | objectName: "PickerRow_PickerLabel" + (pickerModel ? modelData : "") |
552 | 100 | text: pickerModel ? pickerModel.text(modelData) : "" | 100 | text: pickerModel ? pickerModel.text(modelData) : "" |
553 | 101 | anchors.fill: parent | 101 | anchors.fill: parent |
554 | 102 | verticalAlignment: Text.AlignVCenter | 102 | verticalAlignment: Text.AlignVCenter |
555 | 103 | 103 | ||
556 | === modified file 'modules/Ubuntu/Components/TextInputPopover.qml' | |||
557 | --- modules/Ubuntu/Components/TextInputPopover.qml 2014-04-28 06:48:28 +0000 | |||
558 | +++ modules/Ubuntu/Components/TextInputPopover.qml 2014-05-28 18:09:57 +0000 | |||
559 | @@ -22,39 +22,39 @@ | |||
560 | 22 | objectName: "text_input_popover" | 22 | objectName: "text_input_popover" |
561 | 23 | actions: ActionList { | 23 | actions: ActionList { |
562 | 24 | Action { | 24 | Action { |
564 | 25 | text: i18n.tr("Select All") | 25 | text: i18n.dtr('ubuntu-ui-toolkit', "Select All") |
565 | 26 | enabled: target && target.text !== "" && target.text !== target.selectedText | 26 | enabled: target && target.text !== "" && target.text !== target.selectedText |
566 | 27 | onTriggered: target.selectAll() | 27 | onTriggered: target.selectAll() |
567 | 28 | } | 28 | } |
568 | 29 | Action { | 29 | Action { |
570 | 30 | text: i18n.tr("Select Word") | 30 | text: i18n.dtr('ubuntu-ui-toolkit', "Select Word") |
571 | 31 | enabled: target && target.text !== "" && target.selectedText === "" | 31 | enabled: target && target.text !== "" && target.selectedText === "" |
572 | 32 | onTriggered: target.selectWord() | 32 | onTriggered: target.selectWord() |
573 | 33 | } | 33 | } |
574 | 34 | Action { | 34 | Action { |
576 | 35 | text: i18n.tr("Cut") | 35 | text: i18n.dtr('ubuntu-ui-toolkit', "Cut") |
577 | 36 | // If paste/editing is not possible, then disable also "Cut" operation | 36 | // If paste/editing is not possible, then disable also "Cut" operation |
578 | 37 | // It is applicable for ReadOnly's TextFields and TextAreas | 37 | // It is applicable for ReadOnly's TextFields and TextAreas |
579 | 38 | enabled: target && target.selectedText !== "" && target.canPaste | 38 | enabled: target && target.selectedText !== "" && target.canPaste |
580 | 39 | onTriggered: target.cut() | 39 | onTriggered: target.cut() |
581 | 40 | } | 40 | } |
582 | 41 | Action { | 41 | Action { |
584 | 42 | text: i18n.tr("Copy") | 42 | text: i18n.dtr('ubuntu-ui-toolkit', "Copy") |
585 | 43 | enabled: target && target.selectedText !== "" | 43 | enabled: target && target.selectedText !== "" |
586 | 44 | onTriggered: target.copy() | 44 | onTriggered: target.copy() |
587 | 45 | } | 45 | } |
588 | 46 | Action { | 46 | Action { |
590 | 47 | text: i18n.tr("Paste") | 47 | text: i18n.dtr('ubuntu-ui-toolkit', "Paste") |
591 | 48 | enabled: target && target.canPaste | 48 | enabled: target && target.canPaste |
592 | 49 | onTriggered: target.paste() | 49 | onTriggered: target.paste() |
593 | 50 | } | 50 | } |
594 | 51 | Action { | 51 | Action { |
596 | 52 | text: i18n.tr("Undo") | 52 | text: i18n.dtr('ubuntu-ui-toolkit', "Undo") |
597 | 53 | enabled: target && target.canUndo | 53 | enabled: target && target.canUndo |
598 | 54 | onTriggered: target.undo() | 54 | onTriggered: target.undo() |
599 | 55 | } | 55 | } |
600 | 56 | Action { | 56 | Action { |
602 | 57 | text: i18n.tr("Redo") | 57 | text: i18n.dtr('ubuntu-ui-toolkit', "Redo") |
603 | 58 | enabled: target && target.canRedo | 58 | enabled: target && target.canRedo |
604 | 59 | onTriggered: target.redo() | 59 | onTriggered: target.redo() |
605 | 60 | } | 60 | } |
606 | 61 | 61 | ||
607 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/ActivityIndicatorStyle.qml' | |||
608 | --- modules/Ubuntu/Components/Themes/Ambiance/ActivityIndicatorStyle.qml 2014-04-23 08:50:20 +0000 | |||
609 | +++ modules/Ubuntu/Components/Themes/Ambiance/ActivityIndicatorStyle.qml 2014-05-28 18:09:57 +0000 | |||
610 | @@ -14,7 +14,7 @@ | |||
611 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
612 | 15 | */ | 15 | */ |
613 | 16 | 16 | ||
615 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.2 |
616 | 18 | import Ubuntu.Components 1.1 | 18 | import Ubuntu.Components 1.1 |
617 | 19 | 19 | ||
618 | 20 | Image { | 20 | Image { |
619 | @@ -28,7 +28,7 @@ | |||
620 | 28 | verticalAlignment: Image.AlignVCenter | 28 | verticalAlignment: Image.AlignVCenter |
621 | 29 | source: "artwork/spinner.png" | 29 | source: "artwork/spinner.png" |
622 | 30 | 30 | ||
624 | 31 | NumberAnimation on rotation { | 31 | RotationAnimator on rotation { |
625 | 32 | running: styledItem.running | 32 | running: styledItem.running |
626 | 33 | from: 0 | 33 | from: 0 |
627 | 34 | to: 360 | 34 | to: 360 |
628 | 35 | 35 | ||
629 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml' | |||
630 | --- modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2014-05-09 11:21:23 +0000 | |||
631 | +++ modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2014-05-28 18:09:57 +0000 | |||
632 | @@ -116,8 +116,8 @@ | |||
633 | 116 | AbstractButton { | 116 | AbstractButton { |
634 | 117 | id: button | 117 | id: button |
635 | 118 | anchors { | 118 | anchors { |
638 | 119 | top: parent.top | 119 | top: parent ? parent.top : undefined |
639 | 120 | bottom: parent.bottom | 120 | bottom: parent ? parent.bottom : undefined |
640 | 121 | } | 121 | } |
641 | 122 | width: text.paintedWidth + text.anchors.leftMargin + text.anchors.rightMargin | 122 | width: text.paintedWidth + text.anchors.leftMargin + text.anchors.rightMargin |
642 | 123 | 123 | ||
643 | 124 | 124 | ||
644 | === modified file 'modules/Ubuntu/Components/Toolbar.qml' | |||
645 | --- modules/Ubuntu/Components/Toolbar.qml 2014-04-23 08:50:20 +0000 | |||
646 | +++ modules/Ubuntu/Components/Toolbar.qml 2014-05-28 18:09:57 +0000 | |||
647 | @@ -27,9 +27,9 @@ | |||
648 | 27 | Panel { | 27 | Panel { |
649 | 28 | id: toolbar | 28 | id: toolbar |
650 | 29 | anchors { | 29 | anchors { |
654 | 30 | left: parent.left | 30 | left: parent ? parent.left : undefined |
655 | 31 | right: parent.right | 31 | right: parent ? parent.right : undefined |
656 | 32 | bottom: parent.bottom | 32 | bottom: parent ? parent.bottom : undefined |
657 | 33 | } | 33 | } |
658 | 34 | height: background.height | 34 | height: background.height |
659 | 35 | 35 | ||
660 | 36 | 36 | ||
661 | === modified file 'modules/Ubuntu/Components/ToolbarItems.qml' | |||
662 | --- modules/Ubuntu/Components/ToolbarItems.qml 2014-04-23 08:50:20 +0000 | |||
663 | +++ modules/Ubuntu/Components/ToolbarItems.qml 2014-05-28 18:09:57 +0000 | |||
664 | @@ -139,7 +139,7 @@ | |||
665 | 139 | property Item back: ToolbarButton { | 139 | property Item back: ToolbarButton { |
666 | 140 | objectName: "back_toolbar_button" | 140 | objectName: "back_toolbar_button" |
667 | 141 | iconSource: Qt.resolvedUrl("artwork/back.png") | 141 | iconSource: Qt.resolvedUrl("artwork/back.png") |
669 | 142 | text: i18n.tr("Back") | 142 | text: i18n.dtr('ubuntu-ui-toolkit', 'Back') |
670 | 143 | visible: toolbarItems.pageStack && toolbarItems.pageStack.depth > 1 | 143 | visible: toolbarItems.pageStack && toolbarItems.pageStack.depth > 1 |
671 | 144 | /*! | 144 | /*! |
672 | 145 | If there is a \l PageStack of sufficient depth, triggering the back button | 145 | If there is a \l PageStack of sufficient depth, triggering the back button |
673 | 146 | 146 | ||
674 | === added file 'modules/Ubuntu/Components/plugin/filterbehavior.cpp' | |||
675 | --- modules/Ubuntu/Components/plugin/filterbehavior.cpp 1970-01-01 00:00:00 +0000 | |||
676 | +++ modules/Ubuntu/Components/plugin/filterbehavior.cpp 2014-05-28 18:09:57 +0000 | |||
677 | @@ -0,0 +1,47 @@ | |||
678 | 1 | /* | ||
679 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
680 | 3 | * | ||
681 | 4 | * Authors: | ||
682 | 5 | * Christian Dywan <christian.dywan@canonical.com> | ||
683 | 6 | * | ||
684 | 7 | * This program is free software; you can redistribute it and/or modify | ||
685 | 8 | * it under the terms of the GNU Lesser General Public License as published by | ||
686 | 9 | * the Free Software Foundation; version 3. | ||
687 | 10 | * | ||
688 | 11 | * This program is distributed in the hope that it will be useful, | ||
689 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
690 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
691 | 14 | * GNU Lesser General Public License for more details. | ||
692 | 15 | * | ||
693 | 16 | * You should have received a copy of the GNU Lesser General Public License | ||
694 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
695 | 18 | */ | ||
696 | 19 | |||
697 | 20 | #include "filterbehavior.h" | ||
698 | 21 | |||
699 | 22 | QString | ||
700 | 23 | FilterBehavior::property() const | ||
701 | 24 | { | ||
702 | 25 | return m_property; | ||
703 | 26 | } | ||
704 | 27 | |||
705 | 28 | void | ||
706 | 29 | FilterBehavior::setProperty(const QString& property) | ||
707 | 30 | { | ||
708 | 31 | m_property = property; | ||
709 | 32 | Q_EMIT propertyChanged(); | ||
710 | 33 | } | ||
711 | 34 | |||
712 | 35 | QRegExp | ||
713 | 36 | FilterBehavior::pattern() const | ||
714 | 37 | { | ||
715 | 38 | return m_pattern; | ||
716 | 39 | } | ||
717 | 40 | |||
718 | 41 | void | ||
719 | 42 | FilterBehavior::setPattern(QRegExp pattern) | ||
720 | 43 | { | ||
721 | 44 | m_pattern = pattern; | ||
722 | 45 | Q_EMIT patternChanged(); | ||
723 | 46 | } | ||
724 | 47 | |||
725 | 0 | 48 | ||
726 | === added file 'modules/Ubuntu/Components/plugin/filterbehavior.h' | |||
727 | --- modules/Ubuntu/Components/plugin/filterbehavior.h 1970-01-01 00:00:00 +0000 | |||
728 | +++ modules/Ubuntu/Components/plugin/filterbehavior.h 2014-05-28 18:09:57 +0000 | |||
729 | @@ -0,0 +1,46 @@ | |||
730 | 1 | /* | ||
731 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
732 | 3 | * | ||
733 | 4 | * Authors: | ||
734 | 5 | * Christian Dywan <christian.dywan@canonical.com> | ||
735 | 6 | * | ||
736 | 7 | * This program is free software; you can redistribute it and/or modify | ||
737 | 8 | * it under the terms of the GNU Lesser General Public License as published by | ||
738 | 9 | * the Free Software Foundation; version 3. | ||
739 | 10 | * | ||
740 | 11 | * This program is distributed in the hope that it will be useful, | ||
741 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
742 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
743 | 14 | * GNU Lesser General Public License for more details. | ||
744 | 15 | * | ||
745 | 16 | * You should have received a copy of the GNU Lesser General Public License | ||
746 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
747 | 18 | */ | ||
748 | 19 | |||
749 | 20 | #ifndef FILTERBEHAVIOR_H | ||
750 | 21 | #define FILTERBEHAVIOR_H | ||
751 | 22 | |||
752 | 23 | #include <QSortFilterProxyModel> | ||
753 | 24 | |||
754 | 25 | class FilterBehavior : public QObject { | ||
755 | 26 | Q_OBJECT | ||
756 | 27 | |||
757 | 28 | Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged) | ||
758 | 29 | Q_PROPERTY(QRegExp pattern READ pattern WRITE setPattern NOTIFY patternChanged) | ||
759 | 30 | |||
760 | 31 | public: | ||
761 | 32 | QString property() const; | ||
762 | 33 | void setProperty(const QString& property); | ||
763 | 34 | QRegExp pattern() const; | ||
764 | 35 | void setPattern(QRegExp pattern); | ||
765 | 36 | |||
766 | 37 | Q_SIGNALS: | ||
767 | 38 | void propertyChanged(); | ||
768 | 39 | void patternChanged(); | ||
769 | 40 | |||
770 | 41 | private: | ||
771 | 42 | QString m_property; | ||
772 | 43 | QRegExp m_pattern; | ||
773 | 44 | }; | ||
774 | 45 | |||
775 | 46 | #endif // FILTERBEHAVIOR_H | ||
776 | 0 | 47 | ||
777 | === modified file 'modules/Ubuntu/Components/plugin/i18n.cpp' | |||
778 | --- modules/Ubuntu/Components/plugin/i18n.cpp 2014-04-23 08:50:20 +0000 | |||
779 | +++ modules/Ubuntu/Components/plugin/i18n.cpp 2014-05-28 18:09:57 +0000 | |||
780 | @@ -17,7 +17,6 @@ | |||
781 | 17 | */ | 17 | */ |
782 | 18 | 18 | ||
783 | 19 | #include "i18n.h" | 19 | #include "i18n.h" |
784 | 20 | #include <QtCore/QStandardPaths> | ||
785 | 21 | #include <QtCore/QDir> | 20 | #include <QtCore/QDir> |
786 | 22 | 21 | ||
787 | 23 | namespace C { | 22 | namespace C { |
788 | @@ -102,19 +101,16 @@ | |||
789 | 102 | m_domain = domain; | 101 | m_domain = domain; |
790 | 103 | C::textdomain(domain.toUtf8()); | 102 | C::textdomain(domain.toUtf8()); |
791 | 104 | /* | 103 | /* |
792 | 105 | Look for locale folder as per XDG basedir spec | ||
793 | 106 | The default is /usr/share/locale if we don't set a folder | 104 | The default is /usr/share/locale if we don't set a folder |
795 | 107 | We look for share/domain to pick correctly among multiple prefixes | 105 | For click we use APP_DIR/share/locale |
796 | 106 | e.g. /usr/share/click/preinstalled/com.example.foo/current/share/locale | ||
797 | 108 | */ | 107 | */ |
806 | 109 | QString dataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, | 108 | QString appDir(getenv("APP_DIR")); |
807 | 110 | domain, QStandardPaths::LocateDirectory)); | 109 | if (!QDir::isAbsolutePath (appDir)) { |
808 | 111 | if (!dataPath.isEmpty()) { | 110 | appDir = "/usr"; |
801 | 112 | QDir dataDir(dataPath); | ||
802 | 113 | if (dataDir.cdUp() && dataDir.cd("locale")) { | ||
803 | 114 | QString localePath(dataDir.path()); | ||
804 | 115 | C::bindtextdomain(domain.toUtf8(), localePath.toUtf8()); | ||
805 | 116 | } | ||
809 | 117 | } | 111 | } |
810 | 112 | QString localePath(QDir(appDir).filePath("share/locale")); | ||
811 | 113 | C::bindtextdomain(domain.toUtf8(), localePath.toUtf8()); | ||
812 | 118 | Q_EMIT domainChanged(); | 114 | Q_EMIT domainChanged(); |
813 | 119 | } | 115 | } |
814 | 120 | 116 | ||
815 | 121 | 117 | ||
816 | === modified file 'modules/Ubuntu/Components/plugin/plugin.cpp' | |||
817 | --- modules/Ubuntu/Components/plugin/plugin.cpp 2014-04-20 19:25:12 +0000 | |||
818 | +++ modules/Ubuntu/Components/plugin/plugin.cpp 2014-05-28 18:09:57 +0000 | |||
819 | @@ -1,5 +1,5 @@ | |||
820 | 1 | /* | 1 | /* |
822 | 2 | * Copyright 2012 Canonical Ltd. | 2 | * Copyright 2012-2014 Canonical Ltd. |
823 | 3 | * | 3 | * |
824 | 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
825 | 5 | * it under the terms of the GNU Lesser General Public License as published by | 5 | * it under the terms of the GNU Lesser General Public License as published by |
826 | @@ -48,6 +48,7 @@ | |||
827 | 48 | #include "ucurihandler.h" | 48 | #include "ucurihandler.h" |
828 | 49 | #include "ucmouse.h" | 49 | #include "ucmouse.h" |
829 | 50 | #include "ucinversemouse.h" | 50 | #include "ucinversemouse.h" |
830 | 51 | #include "sortfiltermodel.h" | ||
831 | 51 | 52 | ||
832 | 52 | #include <sys/types.h> | 53 | #include <sys/types.h> |
833 | 53 | #include <unistd.h> | 54 | #include <unistd.h> |
834 | @@ -186,6 +187,14 @@ | |||
835 | 186 | 187 | ||
836 | 187 | // register custom event | 188 | // register custom event |
837 | 188 | ForwardedEvent::registerForwardedEvent(); | 189 | ForwardedEvent::registerForwardedEvent(); |
838 | 190 | |||
839 | 191 | // register parent type so that properties can get/ set it | ||
840 | 192 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 1, "QAbstractItemModel", "Not instantiable"); | ||
841 | 193 | |||
842 | 194 | // register 1.1 only API | ||
843 | 195 | qmlRegisterType<QSortFilterProxyModelQML>(uri, 1, 1, "SortFilterModel"); | ||
844 | 196 | qmlRegisterUncreatableType<FilterBehavior>(uri, 1, 1, "FilterBehavior", "Not instantiable"); | ||
845 | 197 | qmlRegisterUncreatableType<SortBehavior>(uri, 1, 1, "SortBehavior", "Not instantiable"); | ||
846 | 189 | } | 198 | } |
847 | 190 | 199 | ||
848 | 191 | void UbuntuComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) | 200 | void UbuntuComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) |
849 | 192 | 201 | ||
850 | === modified file 'modules/Ubuntu/Components/plugin/plugin.pro' | |||
851 | --- modules/Ubuntu/Components/plugin/plugin.pro 2014-03-25 06:46:36 +0000 | |||
852 | +++ modules/Ubuntu/Components/plugin/plugin.pro 2014-05-28 18:09:57 +0000 | |||
853 | @@ -55,6 +55,9 @@ | |||
854 | 55 | alarmrequest_p_p.h \ | 55 | alarmrequest_p_p.h \ |
855 | 56 | adapters/alarmsadapter_p.h \ | 56 | adapters/alarmsadapter_p.h \ |
856 | 57 | ucstatesaver.h \ | 57 | ucstatesaver.h \ |
857 | 58 | sortbehavior.h \ | ||
858 | 59 | filterbehavior.h \ | ||
859 | 60 | sortfiltermodel.h \ | ||
860 | 58 | statesaverbackend_p.h \ | 61 | statesaverbackend_p.h \ |
861 | 59 | ucstatesaver_p.h \ | 62 | ucstatesaver_p.h \ |
862 | 60 | ucurihandler.h \ | 63 | ucurihandler.h \ |
863 | @@ -87,6 +90,9 @@ | |||
864 | 87 | thumbnailgenerator.cpp \ | 90 | thumbnailgenerator.cpp \ |
865 | 88 | alarmrequest_p.cpp \ | 91 | alarmrequest_p.cpp \ |
866 | 89 | ucstatesaver.cpp \ | 92 | ucstatesaver.cpp \ |
867 | 93 | sortbehavior.cpp \ | ||
868 | 94 | filterbehavior.cpp \ | ||
869 | 95 | sortfiltermodel.cpp \ | ||
870 | 90 | statesaverbackend_p.cpp \ | 96 | statesaverbackend_p.cpp \ |
871 | 91 | ucurihandler.cpp \ | 97 | ucurihandler.cpp \ |
872 | 92 | ucmousefilters.cpp \ | 98 | ucmousefilters.cpp \ |
873 | 93 | 99 | ||
874 | === modified file 'modules/Ubuntu/Components/plugin/shapeitem.cpp' | |||
875 | --- modules/Ubuntu/Components/plugin/shapeitem.cpp 2014-04-08 18:41:31 +0000 | |||
876 | +++ modules/Ubuntu/Components/plugin/shapeitem.cpp 2014-05-28 18:09:57 +0000 | |||
877 | @@ -32,6 +32,9 @@ | |||
878 | 32 | // Threshold in grid unit defining the texture quality to be used. | 32 | // Threshold in grid unit defining the texture quality to be used. |
879 | 33 | const float lowHighTextureThreshold = 11.0f; | 33 | const float lowHighTextureThreshold = 11.0f; |
880 | 34 | 34 | ||
881 | 35 | // Map of windows and associated textures. | ||
882 | 36 | QHash<QOpenGLContext*, ShapeItem::TextureHandles> ShapeItem::textures_; | ||
883 | 37 | |||
884 | 35 | static const char* const shapeVertexShader = | 38 | static const char* const shapeVertexShader = |
885 | 36 | "uniform lowp mat4 matrix; \n" | 39 | "uniform lowp mat4 matrix; \n" |
886 | 37 | "attribute lowp vec4 positionAttrib; \n" | 40 | "attribute lowp vec4 positionAttrib; \n" |
887 | @@ -338,6 +341,21 @@ | |||
888 | 338 | update(); | 341 | update(); |
889 | 339 | } | 342 | } |
890 | 340 | 343 | ||
891 | 344 | void ShapeItem::onOpenglContextDestroyed() | ||
892 | 345 | { | ||
893 | 346 | QOpenGLContext* context = qobject_cast<QOpenGLContext*>(sender()); | ||
894 | 347 | if (Q_UNLIKELY(!context)) return; | ||
895 | 348 | |||
896 | 349 | QHash<QOpenGLContext*, TextureHandles>::iterator it = | ||
897 | 350 | textures_.find(context); | ||
898 | 351 | if (it != textures_.end()) { | ||
899 | 352 | TextureHandles &textureHandles = it.value(); | ||
900 | 353 | delete textureHandles.high; | ||
901 | 354 | delete textureHandles.low; | ||
902 | 355 | textures_.erase(it); | ||
903 | 356 | } | ||
904 | 357 | } | ||
905 | 358 | |||
906 | 341 | QSGNode* ShapeItem::updatePaintNode(QSGNode* old_node, UpdatePaintNodeData* data) | 359 | QSGNode* ShapeItem::updatePaintNode(QSGNode* old_node, UpdatePaintNodeData* data) |
907 | 342 | { | 360 | { |
908 | 343 | Q_UNUSED(data); | 361 | Q_UNUSED(data); |
909 | @@ -345,19 +363,28 @@ | |||
910 | 345 | // FIXME(loicm) Shape textures are stored in the read-only data section of the plugin as it | 363 | // FIXME(loicm) Shape textures are stored in the read-only data section of the plugin as it |
911 | 346 | // avoids having to deal with paths for now. It should preferably be loaded from a file. | 364 | // avoids having to deal with paths for now. It should preferably be loaded from a file. |
912 | 347 | 365 | ||
920 | 348 | /* Textures created with QWindow::createTextureFromImage() become invalid | 366 | // OpenGL allocates textures per context, so we store textures reused by |
921 | 349 | * when the window is destroyed; therefore, we must keep track of which | 367 | // all shape instances per context as well |
922 | 350 | * window was used to create them and be ready to re-create them if that | 368 | QOpenGLContext* openglContext = window() ? window()->openglContext() : NULL; |
923 | 351 | * window goes away. */ | 369 | if (Q_UNLIKELY(!openglContext)) { |
924 | 352 | static QPointer<QWindow> textureOwner = 0; | 370 | qCritical() << "Window has no GL context!"; |
925 | 353 | if (!textureOwner) { | 371 | delete old_node; |
926 | 354 | shapeTextureHigh.texture = window()->createTextureFromImage( | 372 | return NULL; |
927 | 373 | } | ||
928 | 374 | |||
929 | 375 | TextureHandles &textureHandles = textures_[openglContext]; | ||
930 | 376 | // If the hash table didn't contain an entry for the current context, the | ||
931 | 377 | // line above has just caused the creation of a default-constructed value. | ||
932 | 378 | if (!textureHandles.high) { | ||
933 | 379 | textureHandles.high = window()->createTextureFromImage( | ||
934 | 355 | QImage(shapeTextureHigh.data, shapeTextureHigh.width, shapeTextureHigh.height, | 380 | QImage(shapeTextureHigh.data, shapeTextureHigh.width, shapeTextureHigh.height, |
935 | 356 | QImage::Format_ARGB32_Premultiplied)); | 381 | QImage::Format_ARGB32_Premultiplied)); |
937 | 357 | shapeTextureLow.texture = window()->createTextureFromImage( | 382 | textureHandles.low = window()->createTextureFromImage( |
938 | 358 | QImage(shapeTextureLow.data, shapeTextureLow.width, shapeTextureLow.height, | 383 | QImage(shapeTextureLow.data, shapeTextureLow.width, shapeTextureLow.height, |
939 | 359 | QImage::Format_ARGB32_Premultiplied)); | 384 | QImage::Format_ARGB32_Premultiplied)); |
941 | 360 | textureOwner = window(); | 385 | QObject::connect(openglContext, SIGNAL(aboutToBeDestroyed()), |
942 | 386 | this, SLOT(onOpenglContextDestroyed()), | ||
943 | 387 | Qt::DirectConnection); | ||
944 | 361 | } | 388 | } |
945 | 362 | 389 | ||
946 | 363 | // The image item sets its texture in its updatePaintNode() method when QtQuick iterates through | 390 | // The image item sets its texture in its updatePaintNode() method when QtQuick iterates through |
947 | @@ -387,8 +414,15 @@ | |||
948 | 387 | 414 | ||
949 | 388 | ShapeTexturedMaterial* texturedMaterial = node->texturedMaterial(); | 415 | ShapeTexturedMaterial* texturedMaterial = node->texturedMaterial(); |
950 | 389 | ShapeColoredMaterial* coloredMaterial = node->coloredMaterial(); | 416 | ShapeColoredMaterial* coloredMaterial = node->coloredMaterial(); |
953 | 390 | TextureData* textureData = (gridUnit_ > lowHighTextureThreshold) ? | 417 | TextureData* textureData; |
954 | 391 | &shapeTextureHigh : &shapeTextureLow; | 418 | QSGTexture* textureHandle; |
955 | 419 | if (gridUnit_ > lowHighTextureThreshold) { | ||
956 | 420 | textureData = &shapeTextureHigh; | ||
957 | 421 | textureHandle = textureHandles.high; | ||
958 | 422 | } else { | ||
959 | 423 | textureData = &shapeTextureLow; | ||
960 | 424 | textureHandle = textureHandles.low; | ||
961 | 425 | } | ||
962 | 392 | 426 | ||
963 | 393 | // Set the shape texture to be used by the materials depending on current grid unit. The radius | 427 | // Set the shape texture to be used by the materials depending on current grid unit. The radius |
964 | 394 | // is set considering the current grid unit and the texture raster grid unit. When the item size | 428 | // is set considering the current grid unit and the texture raster grid unit. When the item size |
965 | @@ -406,8 +440,8 @@ | |||
966 | 406 | radius = halfMinWidthHeight; | 440 | radius = halfMinWidthHeight; |
967 | 407 | scaledDown |= 1; | 441 | scaledDown |= 1; |
968 | 408 | } | 442 | } |
971 | 409 | coloredMaterial->setShapeTexture(textureData->texture, !!scaledDown); | 443 | coloredMaterial->setShapeTexture(textureHandle, !!scaledDown); |
972 | 410 | texturedMaterial->setShapeTexture(textureData->texture, !!scaledDown); | 444 | texturedMaterial->setShapeTexture(textureHandle, !!scaledDown); |
973 | 411 | 445 | ||
974 | 412 | // Update the other material properties. | 446 | // Update the other material properties. |
975 | 413 | coloredMaterial->setColor(color_); | 447 | coloredMaterial->setColor(color_); |
976 | 414 | 448 | ||
977 | === modified file 'modules/Ubuntu/Components/plugin/shapeitem.h' | |||
978 | --- modules/Ubuntu/Components/plugin/shapeitem.h 2013-10-18 08:56:39 +0000 | |||
979 | +++ modules/Ubuntu/Components/plugin/shapeitem.h 2014-05-28 18:09:57 +0000 | |||
980 | @@ -91,6 +91,7 @@ | |||
981 | 91 | 91 | ||
982 | 92 | private Q_SLOTS: | 92 | private Q_SLOTS: |
983 | 93 | void onImagePropertiesChanged(); | 93 | void onImagePropertiesChanged(); |
984 | 94 | void onOpenglContextDestroyed(); | ||
985 | 94 | 95 | ||
986 | 95 | private: | 96 | private: |
987 | 96 | enum DirtyFlags { | 97 | enum DirtyFlags { |
988 | @@ -110,6 +111,12 @@ | |||
989 | 110 | | DirtyGridUnit | DirtyGeometry) | 111 | | DirtyGridUnit | DirtyGeometry) |
990 | 111 | }; | 112 | }; |
991 | 112 | 113 | ||
992 | 114 | struct TextureHandles { | ||
993 | 115 | TextureHandles(): high(0), low(0) {} | ||
994 | 116 | QSGTexture* high; | ||
995 | 117 | QSGTexture* low; | ||
996 | 118 | }; | ||
997 | 119 | |||
998 | 113 | QColor color_; | 120 | QColor color_; |
999 | 114 | QColor gradientColor_; | 121 | QColor gradientColor_; |
1000 | 115 | bool gradientColorSet_; | 122 | bool gradientColorSet_; |
1001 | @@ -124,6 +131,7 @@ | |||
1002 | 124 | float gridUnit_; | 131 | float gridUnit_; |
1003 | 125 | QRectF geometry_; | 132 | QRectF geometry_; |
1004 | 126 | QFlags<DirtyFlags> dirtyFlags_; | 133 | QFlags<DirtyFlags> dirtyFlags_; |
1005 | 134 | static QHash<QOpenGLContext*, TextureHandles> textures_; | ||
1006 | 127 | 135 | ||
1007 | 128 | Q_DISABLE_COPY(ShapeItem) | 136 | Q_DISABLE_COPY(ShapeItem) |
1008 | 129 | }; | 137 | }; |
1009 | 130 | 138 | ||
1010 | === modified file 'modules/Ubuntu/Components/plugin/shapeitemtexture.h' | |||
1011 | --- modules/Ubuntu/Components/plugin/shapeitemtexture.h 2013-01-07 07:59:56 +0000 | |||
1012 | +++ modules/Ubuntu/Components/plugin/shapeitemtexture.h 2014-05-28 18:09:57 +0000 | |||
1013 | @@ -20,7 +20,6 @@ | |||
1014 | 20 | 20 | ||
1015 | 21 | struct TextureData { | 21 | struct TextureData { |
1016 | 22 | const unsigned char* const data; | 22 | const unsigned char* const data; |
1017 | 23 | QSGTexture* texture; | ||
1018 | 24 | int width; | 23 | int width; |
1019 | 25 | int height; | 24 | int height; |
1020 | 26 | int bytesPerPixel; | 25 | int bytesPerPixel; |
1021 | @@ -5160,7 +5159,7 @@ | |||
1022 | 5160 | 5159 | ||
1023 | 5161 | // High resolution shape texture. | 5160 | // High resolution shape texture. |
1024 | 5162 | TextureData shapeTextureHigh __attribute__((aligned(16))) = { | 5161 | TextureData shapeTextureHigh __attribute__((aligned(16))) = { |
1026 | 5163 | shapeTextureHighData, NULL, 256, 128, 4, 32.0f, 64.0f, 18.0f, | 5162 | shapeTextureHighData, 256, 128, 4, 32.0f, 64.0f, 18.0f, |
1027 | 5164 | { | 5163 | { |
1028 | 5165 | { // Medium raw coords. | 5164 | { // Medium raw coords. |
1029 | 5166 | { hh, 0.0f }, { 0.25f-hh, 0.0f }, { 0.25f-hh, 0.0f }, { hh, 0.0f }, | 5165 | { hh, 0.0f }, { 0.25f-hh, 0.0f }, { 0.25f-hh, 0.0f }, { hh, 0.0f }, |
1030 | @@ -6484,7 +6483,7 @@ | |||
1031 | 6484 | 6483 | ||
1032 | 6485 | // Low resolution shape texture. | 6484 | // Low resolution shape texture. |
1033 | 6486 | TextureData shapeTextureLow __attribute__((aligned(16))) = { | 6485 | TextureData shapeTextureLow __attribute__((aligned(16))) = { |
1035 | 6487 | shapeTextureLowData, NULL, 128, 64, 4, 16.0f, 32.0f, 9.0f, | 6486 | shapeTextureLowData, 128, 64, 4, 16.0f, 32.0f, 9.0f, |
1036 | 6488 | { | 6487 | { |
1037 | 6489 | { // Medium raw coords. | 6488 | { // Medium raw coords. |
1038 | 6490 | { hl, 0.0f }, { 0.25f-hl, 0.0f }, { 0.25f-hl, 0.0f }, { hl, 0.0f }, | 6489 | { hl, 0.0f }, { 0.25f-hl, 0.0f }, { 0.25f-hl, 0.0f }, { hl, 0.0f }, |
1039 | 6491 | 6490 | ||
1040 | === added file 'modules/Ubuntu/Components/plugin/sortbehavior.cpp' | |||
1041 | --- modules/Ubuntu/Components/plugin/sortbehavior.cpp 1970-01-01 00:00:00 +0000 | |||
1042 | +++ modules/Ubuntu/Components/plugin/sortbehavior.cpp 2014-05-28 18:09:57 +0000 | |||
1043 | @@ -0,0 +1,47 @@ | |||
1044 | 1 | /* | ||
1045 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
1046 | 3 | * | ||
1047 | 4 | * Authors: | ||
1048 | 5 | * Christian Dywan <christian.dywan@canonical.com> | ||
1049 | 6 | * | ||
1050 | 7 | * This program is free software; you can redistribute it and/or modify | ||
1051 | 8 | * it under the terms of the GNU Lesser General Public License as published by | ||
1052 | 9 | * the Free Software Foundation; version 3. | ||
1053 | 10 | * | ||
1054 | 11 | * This program is distributed in the hope that it will be useful, | ||
1055 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1056 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1057 | 14 | * GNU Lesser General Public License for more details. | ||
1058 | 15 | * | ||
1059 | 16 | * You should have received a copy of the GNU Lesser General Public License | ||
1060 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1061 | 18 | */ | ||
1062 | 19 | |||
1063 | 20 | #include "sortbehavior.h" | ||
1064 | 21 | |||
1065 | 22 | QString | ||
1066 | 23 | SortBehavior::property() const | ||
1067 | 24 | { | ||
1068 | 25 | return m_property; | ||
1069 | 26 | } | ||
1070 | 27 | |||
1071 | 28 | Qt::SortOrder | ||
1072 | 29 | SortBehavior::order() const | ||
1073 | 30 | { | ||
1074 | 31 | return m_order; | ||
1075 | 32 | } | ||
1076 | 33 | |||
1077 | 34 | void | ||
1078 | 35 | SortBehavior::setProperty(const QString& property) | ||
1079 | 36 | { | ||
1080 | 37 | m_property = property; | ||
1081 | 38 | Q_EMIT propertyChanged(); | ||
1082 | 39 | } | ||
1083 | 40 | |||
1084 | 41 | void | ||
1085 | 42 | SortBehavior::setOrder(Qt::SortOrder order) | ||
1086 | 43 | { | ||
1087 | 44 | m_order = order; | ||
1088 | 45 | Q_EMIT orderChanged(); | ||
1089 | 46 | } | ||
1090 | 47 | |||
1091 | 0 | 48 | ||
1092 | === added file 'modules/Ubuntu/Components/plugin/sortbehavior.h' | |||
1093 | --- modules/Ubuntu/Components/plugin/sortbehavior.h 1970-01-01 00:00:00 +0000 | |||
1094 | +++ modules/Ubuntu/Components/plugin/sortbehavior.h 2014-05-28 18:09:57 +0000 | |||
1095 | @@ -0,0 +1,46 @@ | |||
1096 | 1 | /* | ||
1097 | 2 | * Copyright (C) 2014 Canonical, Ltd. | ||
1098 | 3 | * | ||
1099 | 4 | * Authors: | ||
1100 | 5 | * Christian Dywan <christian.dywan@canonical.com> | ||
1101 | 6 | * | ||
1102 | 7 | * This program is free software; you can redistribute it and/or modify | ||
1103 | 8 | * it under the terms of the GNU Lesser General Public License as published by | ||
1104 | 9 | * the Free Software Foundation; version 3. | ||
1105 | 10 | * | ||
1106 | 11 | * This program is distributed in the hope that it will be useful, | ||
1107 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1108 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1109 | 14 | * GNU Lesser General Public License for more details. | ||
1110 | 15 | * | ||
1111 | 16 | * You should have received a copy of the GNU Lesser General Public License | ||
1112 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1113 | 18 | */ | ||
1114 | 19 | |||
1115 | 20 | #ifndef SORTBEHAVIOR_H | ||
1116 | 21 | #define SORTBEHAVIOR_H | ||
1117 | 22 | |||
1118 | 23 | #include <QSortFilterProxyModel> | ||
1119 | 24 | |||
1120 | 25 | class SortBehavior : public QObject { | ||
1121 | 26 | Q_OBJECT | ||
1122 | 27 | |||
1123 | 28 | Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged) | ||
1124 | 29 | Q_PROPERTY(Qt::SortOrder order READ order WRITE setOrder NOTIFY orderChanged) | ||
1125 | 30 | |||
1126 | 31 | public: | ||
1127 | 32 | QString property() const; | ||
1128 | 33 | void setProperty(const QString& property); | ||
1129 | 34 | Qt::SortOrder order() const; | ||
1130 | 35 | void setOrder(Qt::SortOrder order); | ||
1131 | 36 | |||
1132 | 37 | Q_SIGNALS: | ||
1133 | 38 | void propertyChanged(); | ||
1134 | 39 | void orderChanged(); | ||
1135 | 40 | |||
1136 | 41 | private: | ||
1137 | 42 | QString m_property; | ||
1138 | 43 | Qt::SortOrder m_order; | ||
1139 | 44 | }; | ||
1140 | 45 | |||
1141 | 46 | #endif // SORTBEHAVIOR_H | ||
1142 | 0 | 47 | ||
1143 | === added file 'modules/Ubuntu/Components/plugin/sortfiltermodel.cpp' | |||
1144 | --- modules/Ubuntu/Components/plugin/sortfiltermodel.cpp 1970-01-01 00:00:00 +0000 | |||
1145 | +++ modules/Ubuntu/Components/plugin/sortfiltermodel.cpp 2014-05-28 18:09:57 +0000 | |||
1146 | @@ -0,0 +1,252 @@ | |||
1147 | 1 | /* | ||
1148 | 2 | * Copyright (C) 2012-2014 Canonical, Ltd. | ||
1149 | 3 | * | ||
1150 | 4 | * Authors: | ||
1151 | 5 | * Michal Hruby <michal.hruby@canonical.com> | ||
1152 | 6 | * Christian Dywan <christian.dywan@canonical.com> | ||
1153 | 7 | * | ||
1154 | 8 | * This program is free software; you can redistribute it and/or modify | ||
1155 | 9 | * it under the terms of the GNU Lesser General Public License as published by | ||
1156 | 10 | * the Free Software Foundation; version 3. | ||
1157 | 11 | * | ||
1158 | 12 | * This program is distributed in the hope that it will be useful, | ||
1159 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1160 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1161 | 15 | * GNU Lesser General Public License for more details. | ||
1162 | 16 | * | ||
1163 | 17 | * You should have received a copy of the GNU Lesser General Public License | ||
1164 | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1165 | 19 | */ | ||
1166 | 20 | |||
1167 | 21 | #include "sortfiltermodel.h" | ||
1168 | 22 | |||
1169 | 23 | /*! | ||
1170 | 24 | * \qmltype SortFilterModel | ||
1171 | 25 | * \instantiates QSortFilterProxyModelQML | ||
1172 | 26 | * \inqmlmodule Ubuntu.Components 0.1 | ||
1173 | 27 | * \ingroup ubuntu | ||
1174 | 28 | * \brief SortFilterModel sorts and filters rows from an existing model. | ||
1175 | 29 | * | ||
1176 | 30 | * The SortFilterModel takes an existing model such as a ListModel or | ||
1177 | 31 | * any QAbstractItemModel implementation. The original rows and role names | ||
1178 | 32 | * show up in the SortFilterModel with two basic differences. For one if | ||
1179 | 33 | * \l sort.property is set all rows will be sorted. Further more if | ||
1180 | 34 | * \l filter.property is set only rows matching the filter will be in the model. | ||
1181 | 35 | * | ||
1182 | 36 | * Example usage: | ||
1183 | 37 | * \qml | ||
1184 | 38 | * import QtQuick 2.0 | ||
1185 | 39 | * import Ubuntu.Components 1.1 | ||
1186 | 40 | * import Ubuntu.Components.ListItems 1.1 | ||
1187 | 41 | * | ||
1188 | 42 | * MainView { | ||
1189 | 43 | * width: units.gu(80) | ||
1190 | 44 | * height: units.gu(40) | ||
1191 | 45 | * | ||
1192 | 46 | * ListModel { | ||
1193 | 47 | * id: movies | ||
1194 | 48 | * ListElement { | ||
1195 | 49 | * title: "Esign" | ||
1196 | 50 | * producer: "Chris Larkee" | ||
1197 | 51 | * } | ||
1198 | 52 | * ListElement { | ||
1199 | 53 | * title: "Elephants Dream" | ||
1200 | 54 | * producer: "Blender" | ||
1201 | 55 | * } | ||
1202 | 56 | * ListElement { | ||
1203 | 57 | * title: "Big Buck Bunny" | ||
1204 | 58 | * producer: "Blender" | ||
1205 | 59 | * } | ||
1206 | 60 | * } | ||
1207 | 61 | * | ||
1208 | 62 | * SortFilterModel { | ||
1209 | 63 | * id: sortedMovies | ||
1210 | 64 | * model: movies | ||
1211 | 65 | * sort.property: "title" | ||
1212 | 66 | * sort.order: Qt.DescendingOrder | ||
1213 | 67 | * | ||
1214 | 68 | * filter.property: "producer" | ||
1215 | 69 | * filter.pattern: /blender/ | ||
1216 | 70 | * } | ||
1217 | 71 | * | ||
1218 | 72 | * ListView { | ||
1219 | 73 | * model: sortedMovies | ||
1220 | 74 | * anchors.fill: parent | ||
1221 | 75 | * | ||
1222 | 76 | * delegate: Subtitled { | ||
1223 | 77 | * text: title | ||
1224 | 78 | * subText: producer | ||
1225 | 79 | * } | ||
1226 | 80 | * | ||
1227 | 81 | * section.delegate: ListItem.Header { text: i18n.tr(section) } | ||
1228 | 82 | * section.property: "title" | ||
1229 | 83 | * section.criteria: ViewSection.FirstCharacter | ||
1230 | 84 | * } | ||
1231 | 85 | * } | ||
1232 | 86 | * \endqml | ||
1233 | 87 | * | ||
1234 | 88 | * Pay attention to the differences between the original model and the result: | ||
1235 | 89 | * \list | ||
1236 | 90 | * \li Big Buck Bunny will be the first row, because it's sorted by title | ||
1237 | 91 | * \li Esign won't be visible, because it's from the wrong producer | ||
1238 | 92 | * \endlist | ||
1239 | 93 | */ | ||
1240 | 94 | |||
1241 | 95 | |||
1242 | 96 | QSortFilterProxyModelQML::QSortFilterProxyModelQML(QObject *parent) | ||
1243 | 97 | : QSortFilterProxyModel(parent) | ||
1244 | 98 | { | ||
1245 | 99 | // This is virtually always what you want in QML | ||
1246 | 100 | setDynamicSortFilter(true); | ||
1247 | 101 | connect(this, SIGNAL(modelReset()), SIGNAL(countChanged())); | ||
1248 | 102 | connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(countChanged())); | ||
1249 | 103 | connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), SIGNAL(countChanged())); | ||
1250 | 104 | connect(&m_sortBehavior, &SortBehavior::propertyChanged, this, &QSortFilterProxyModelQML::sortChangedInternal); | ||
1251 | 105 | connect(&m_sortBehavior, &SortBehavior::orderChanged, this, &QSortFilterProxyModelQML::sortChangedInternal); | ||
1252 | 106 | connect(&m_filterBehavior, &FilterBehavior::propertyChanged, this, &QSortFilterProxyModelQML::filterChangedInternal); | ||
1253 | 107 | connect(&m_filterBehavior, &FilterBehavior::patternChanged, this, &QSortFilterProxyModelQML::filterChangedInternal); | ||
1254 | 108 | } | ||
1255 | 109 | |||
1256 | 110 | int | ||
1257 | 111 | QSortFilterProxyModelQML::roleByName(const QString& roleName) const | ||
1258 | 112 | { | ||
1259 | 113 | const QHash<int, QByteArray> roles = roleNames(); | ||
1260 | 114 | for(int role = 0; role < roles.count(); role++) | ||
1261 | 115 | if (roles[role] == roleName) | ||
1262 | 116 | return role; | ||
1263 | 117 | return 0; | ||
1264 | 118 | } | ||
1265 | 119 | |||
1266 | 120 | /*! | ||
1267 | 121 | * \qmlproperty string SortFilterModel::sort.property | ||
1268 | 122 | * | ||
1269 | 123 | * If set to a valid role name, all rows will be sorted according to \l sort.order. | ||
1270 | 124 | */ | ||
1271 | 125 | |||
1272 | 126 | /*! | ||
1273 | 127 | * \qmlproperty string SortFilterModel::sort.order | ||
1274 | 128 | * | ||
1275 | 129 | * The order, if \l sort.property is set. | ||
1276 | 130 | * Qt::AscendingOrder sorts results from A to Z or 0 to 9. | ||
1277 | 131 | * Qt::DescendingOrder sorts results from Z to A or 9 to 0. | ||
1278 | 132 | */ | ||
1279 | 133 | |||
1280 | 134 | SortBehavior* | ||
1281 | 135 | QSortFilterProxyModelQML::sortBehavior() | ||
1282 | 136 | { | ||
1283 | 137 | return &m_sortBehavior; | ||
1284 | 138 | } | ||
1285 | 139 | |||
1286 | 140 | /*! | ||
1287 | 141 | * \qmlproperty string SortFilterModel::filter.pattern | ||
1288 | 142 | * | ||
1289 | 143 | * The pattern all rows must match, if \l filter.property is set. | ||
1290 | 144 | * | ||
1291 | 145 | * Some examples: | ||
1292 | 146 | * \list | ||
1293 | 147 | * \li /possible/ matches anywhere in a word, so both "impossible" and "possible". | ||
1294 | 148 | * \li /^sign/ matches "sign". But not "assignment" because ^ means start. | ||
1295 | 149 | * \li /vest$/ matches "safety vest" and "vest" but not "vested". | ||
1296 | 150 | * \endlist | ||
1297 | 151 | * | ||
1298 | 152 | * For more advanced uses it's recommended to read up on Javascript regular expressions. | ||
1299 | 153 | */ | ||
1300 | 154 | |||
1301 | 155 | /*! | ||
1302 | 156 | * \qmlproperty string SortFilterModel::filter.property | ||
1303 | 157 | * | ||
1304 | 158 | * If set to a valid role name, only rows matching \l filter.pattern will be in the model. | ||
1305 | 159 | */ | ||
1306 | 160 | |||
1307 | 161 | FilterBehavior* | ||
1308 | 162 | QSortFilterProxyModelQML::filterBehavior() | ||
1309 | 163 | { | ||
1310 | 164 | return &m_filterBehavior; | ||
1311 | 165 | } | ||
1312 | 166 | |||
1313 | 167 | void | ||
1314 | 168 | QSortFilterProxyModelQML::sortChangedInternal() | ||
1315 | 169 | { | ||
1316 | 170 | setSortRole(roleByName(m_sortBehavior.property())); | ||
1317 | 171 | sort(sortColumn() != -1 ? sortColumn() : 0, m_sortBehavior.order()); | ||
1318 | 172 | Q_EMIT sortChanged(); | ||
1319 | 173 | } | ||
1320 | 174 | |||
1321 | 175 | void | ||
1322 | 176 | QSortFilterProxyModelQML::filterChangedInternal() | ||
1323 | 177 | { | ||
1324 | 178 | setFilterRole(roleByName(m_filterBehavior.property())); | ||
1325 | 179 | setFilterRegExp(m_filterBehavior.pattern()); | ||
1326 | 180 | Q_EMIT filterChanged(); | ||
1327 | 181 | } | ||
1328 | 182 | |||
1329 | 183 | QHash<int, QByteArray> QSortFilterProxyModelQML::roleNames() const | ||
1330 | 184 | { | ||
1331 | 185 | return sourceModel() ? sourceModel()->roleNames() : QHash<int, QByteArray>(); | ||
1332 | 186 | } | ||
1333 | 187 | |||
1334 | 188 | /*! | ||
1335 | 189 | * \qmlproperty QAbstractItemModel SortFilterModel::model | ||
1336 | 190 | * | ||
1337 | 191 | * The source model to sort and/ or filter. | ||
1338 | 192 | */ | ||
1339 | 193 | void | ||
1340 | 194 | QSortFilterProxyModelQML::setModel(QAbstractItemModel *itemModel) | ||
1341 | 195 | { | ||
1342 | 196 | if (itemModel == NULL) { | ||
1343 | 197 | return; | ||
1344 | 198 | } | ||
1345 | 199 | |||
1346 | 200 | if (itemModel != sourceModel()) { | ||
1347 | 201 | if (sourceModel() != NULL) { | ||
1348 | 202 | sourceModel()->disconnect(this); | ||
1349 | 203 | } | ||
1350 | 204 | |||
1351 | 205 | setSourceModel(itemModel); | ||
1352 | 206 | // Roles mapping to role names may change | ||
1353 | 207 | setSortRole(roleByName(m_sortBehavior.property())); | ||
1354 | 208 | setFilterRole(roleByName(m_filterBehavior.property())); | ||
1355 | 209 | Q_EMIT modelChanged(); | ||
1356 | 210 | } | ||
1357 | 211 | } | ||
1358 | 212 | |||
1359 | 213 | QVariantMap | ||
1360 | 214 | QSortFilterProxyModelQML::get(int row) | ||
1361 | 215 | { | ||
1362 | 216 | QVariantMap res; | ||
1363 | 217 | const QHash<int, QByteArray> roles = roleNames(); | ||
1364 | 218 | for(int role = 0; role < roles.count(); role++) | ||
1365 | 219 | res.insert (roles[role], data(row, role)); | ||
1366 | 220 | return res; | ||
1367 | 221 | } | ||
1368 | 222 | |||
1369 | 223 | QVariant | ||
1370 | 224 | QSortFilterProxyModelQML::data(int row, int role) | ||
1371 | 225 | { | ||
1372 | 226 | if (sourceModel() == NULL) { | ||
1373 | 227 | return QVariant(); | ||
1374 | 228 | } | ||
1375 | 229 | |||
1376 | 230 | return index(row, 0).data(role); | ||
1377 | 231 | } | ||
1378 | 232 | |||
1379 | 233 | int | ||
1380 | 234 | QSortFilterProxyModelQML::count() | ||
1381 | 235 | { | ||
1382 | 236 | return rowCount(); | ||
1383 | 237 | } | ||
1384 | 238 | |||
1385 | 239 | bool | ||
1386 | 240 | QSortFilterProxyModelQML::filterAcceptsRow(int sourceRow, | ||
1387 | 241 | const QModelIndex &sourceParent) const | ||
1388 | 242 | { | ||
1389 | 243 | if (filterRegExp().isEmpty()) { | ||
1390 | 244 | return true; | ||
1391 | 245 | } | ||
1392 | 246 | |||
1393 | 247 | bool result = QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent); | ||
1394 | 248 | return result; | ||
1395 | 249 | } | ||
1396 | 250 | |||
1397 | 251 | #include "moc_sortfiltermodel.cpp" | ||
1398 | 252 | |||
1399 | 0 | 253 | ||
1400 | === added file 'modules/Ubuntu/Components/plugin/sortfiltermodel.h' | |||
1401 | --- modules/Ubuntu/Components/plugin/sortfiltermodel.h 1970-01-01 00:00:00 +0000 | |||
1402 | +++ modules/Ubuntu/Components/plugin/sortfiltermodel.h 2014-05-28 18:09:57 +0000 | |||
1403 | @@ -0,0 +1,68 @@ | |||
1404 | 1 | /* | ||
1405 | 2 | * Copyright (C) 2012-2014 Canonical, Ltd. | ||
1406 | 3 | * | ||
1407 | 4 | * Authors: | ||
1408 | 5 | * Michal Hruby <michal.hruby@canonical.com> | ||
1409 | 6 | * Christian Dywan <christian.dywan@canonical.com> | ||
1410 | 7 | * | ||
1411 | 8 | * This program is free software; you can redistribute it and/or modify | ||
1412 | 9 | * it under the terms of the GNU Lesser General Public License as published by | ||
1413 | 10 | * the Free Software Foundation; version 3. | ||
1414 | 11 | * | ||
1415 | 12 | * This program is distributed in the hope that it will be useful, | ||
1416 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1417 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1418 | 15 | * GNU Lesser General Public License for more details. | ||
1419 | 16 | * | ||
1420 | 17 | * You should have received a copy of the GNU Lesser General Public License | ||
1421 | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1422 | 19 | */ | ||
1423 | 20 | |||
1424 | 21 | #ifndef QSORTFILTERPROXYMODELQML_H | ||
1425 | 22 | #define QSORTFILTERPROXYMODELQML_H | ||
1426 | 23 | |||
1427 | 24 | #include <QSortFilterProxyModel> | ||
1428 | 25 | #include "sortbehavior.h" | ||
1429 | 26 | #include "filterbehavior.h" | ||
1430 | 27 | |||
1431 | 28 | class Q_DECL_EXPORT QSortFilterProxyModelQML : public QSortFilterProxyModel | ||
1432 | 29 | { | ||
1433 | 30 | Q_OBJECT | ||
1434 | 31 | |||
1435 | 32 | Q_PROPERTY(QAbstractItemModel* model READ sourceModel WRITE setModel NOTIFY modelChanged) | ||
1436 | 33 | Q_PROPERTY(int count READ count NOTIFY countChanged) | ||
1437 | 34 | Q_PROPERTY(SortBehavior* sort READ sortBehavior NOTIFY sortChanged) | ||
1438 | 35 | Q_PROPERTY(FilterBehavior* filter READ filterBehavior NOTIFY filterChanged) | ||
1439 | 36 | |||
1440 | 37 | public: | ||
1441 | 38 | explicit QSortFilterProxyModelQML(QObject *parent = 0); | ||
1442 | 39 | |||
1443 | 40 | Q_INVOKABLE QVariantMap get(int row); | ||
1444 | 41 | QVariant data(int row, int role); | ||
1445 | 42 | Q_INVOKABLE int count(); | ||
1446 | 43 | virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; | ||
1447 | 44 | |||
1448 | 45 | /* getters */ | ||
1449 | 46 | QHash<int, QByteArray> roleNames() const; | ||
1450 | 47 | |||
1451 | 48 | /* setters */ | ||
1452 | 49 | void setFilterProperty(const QString& property); | ||
1453 | 50 | void setModel(QAbstractItemModel *model); | ||
1454 | 51 | |||
1455 | 52 | Q_SIGNALS: | ||
1456 | 53 | void countChanged(); | ||
1457 | 54 | void modelChanged(); | ||
1458 | 55 | void sortChanged(); | ||
1459 | 56 | void filterChanged(); | ||
1460 | 57 | |||
1461 | 58 | private: | ||
1462 | 59 | SortBehavior m_sortBehavior; | ||
1463 | 60 | SortBehavior* sortBehavior(); | ||
1464 | 61 | void sortChangedInternal(); | ||
1465 | 62 | FilterBehavior m_filterBehavior; | ||
1466 | 63 | FilterBehavior* filterBehavior(); | ||
1467 | 64 | void filterChangedInternal(); | ||
1468 | 65 | int roleByName(const QString& roleName) const; | ||
1469 | 66 | }; | ||
1470 | 67 | |||
1471 | 68 | #endif // QSORTFILTERPROXYMODELQML_H | ||
1472 | 0 | 69 | ||
1473 | === modified file 'modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp' | |||
1474 | --- modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp 2014-02-25 09:14:23 +0000 | |||
1475 | +++ modules/Ubuntu/Components/plugin/thumbnailgenerator.cpp 2014-05-28 18:09:57 +0000 | |||
1476 | @@ -43,12 +43,15 @@ | |||
1477 | 43 | * is the only way around the issue for now. */ | 43 | * is the only way around the issue for now. */ |
1478 | 44 | std::string src_path(QUrl(id).path().toUtf8().data()); | 44 | std::string src_path(QUrl(id).path().toUtf8().data()); |
1479 | 45 | std::string tgt_path; | 45 | std::string tgt_path; |
1480 | 46 | const int xlarge_cutoff = 512; | ||
1481 | 47 | const int large_cutoff = 256; | ||
1482 | 48 | const int small_cutoff = 128; | ||
1483 | 46 | try { | 49 | try { |
1484 | 47 | ThumbnailSize desiredSize; | 50 | ThumbnailSize desiredSize; |
1488 | 48 | const int large_cutoff = 256; | 51 | if(requestedSize.width() > xlarge_cutoff || requestedSize.height() > xlarge_cutoff) { |
1486 | 49 | const int small_cutoff = 128; | ||
1487 | 50 | if(requestedSize.width() > large_cutoff || requestedSize.height() > large_cutoff) { | ||
1489 | 51 | desiredSize = TN_SIZE_ORIGINAL; | 52 | desiredSize = TN_SIZE_ORIGINAL; |
1490 | 53 | } else if(requestedSize.width() > large_cutoff || requestedSize.height() > large_cutoff) { | ||
1491 | 54 | desiredSize = TN_SIZE_XLARGE; | ||
1492 | 52 | } else if(requestedSize.width() > small_cutoff || requestedSize.height() > small_cutoff) { | 55 | } else if(requestedSize.width() > small_cutoff || requestedSize.height() > small_cutoff) { |
1493 | 53 | desiredSize = TN_SIZE_LARGE; | 56 | desiredSize = TN_SIZE_LARGE; |
1494 | 54 | } else { | 57 | } else { |
1495 | 55 | 58 | ||
1496 | === modified file 'modules/Ubuntu/Components/plugin/ucalarm.cpp' | |||
1497 | --- modules/Ubuntu/Components/plugin/ucalarm.cpp 2014-04-23 08:50:20 +0000 | |||
1498 | +++ modules/Ubuntu/Components/plugin/ucalarm.cpp 2014-05-28 18:09:57 +0000 | |||
1499 | @@ -177,6 +177,21 @@ | |||
1500 | 177 | return result; | 177 | return result; |
1501 | 178 | } | 178 | } |
1502 | 179 | 179 | ||
1503 | 180 | // fix lp:1319401 - dayOfWeek omitted if set to other than AutoDetect | ||
1504 | 181 | int dayOfWeek = rawData.date.date().dayOfWeek(); | ||
1505 | 182 | if (!isDaySet(dayOfWeek, rawData.days)) { | ||
1506 | 183 | // dayOfWeek has been set by the user, adjust the date to it | ||
1507 | 184 | int nextOccurrence = nextDayOfWeek(rawData.days, dayOfWeek); | ||
1508 | 185 | if (nextOccurrence < dayOfWeek) { | ||
1509 | 186 | // the starting date should be moved to the next week's occurrence | ||
1510 | 187 | rawData.date = rawData.date.addDays(7 - dayOfWeek + nextOccurrence); | ||
1511 | 188 | } else { | ||
1512 | 189 | // the starting date is still this week | ||
1513 | 190 | rawData.date = rawData.date.addDays(nextOccurrence - dayOfWeek); | ||
1514 | 191 | } | ||
1515 | 192 | rawData.changes |= AlarmData::Date; | ||
1516 | 193 | } | ||
1517 | 194 | |||
1518 | 180 | // start date should be later then the current date/time | 195 | // start date should be later then the current date/time |
1519 | 181 | if (rawData.date <= AlarmData::normalizeDate(QDateTime::currentDateTime())) { | 196 | if (rawData.date <= AlarmData::normalizeDate(QDateTime::currentDateTime())) { |
1520 | 182 | return UCAlarm::EarlyDate; | 197 | return UCAlarm::EarlyDate; |
1521 | @@ -370,10 +385,6 @@ | |||
1522 | 370 | d->rawData.date = AlarmData::normalizeDate(date); | 385 | d->rawData.date = AlarmData::normalizeDate(date); |
1523 | 371 | d->rawData.changes |= AlarmData::Date; | 386 | d->rawData.changes |= AlarmData::Date; |
1524 | 372 | Q_EMIT dateChanged(); | 387 | Q_EMIT dateChanged(); |
1525 | 373 | if (d->rawData.type == UCAlarm::OneTime) { | ||
1526 | 374 | // adjust dayOfWeek as well | ||
1527 | 375 | setDaysOfWeek(UCAlarm::AutoDetect); | ||
1528 | 376 | } | ||
1529 | 377 | } | 388 | } |
1530 | 378 | 389 | ||
1531 | 379 | /*! | 390 | /*! |
1532 | 380 | 391 | ||
1533 | === modified file 'modules/Ubuntu/Components/plugin/ucthemesettings.cpp' | |||
1534 | --- modules/Ubuntu/Components/plugin/ucthemesettings.cpp 2013-10-18 08:56:39 +0000 | |||
1535 | +++ modules/Ubuntu/Components/plugin/ucthemesettings.cpp 2014-05-28 18:09:57 +0000 | |||
1536 | @@ -21,19 +21,20 @@ | |||
1537 | 21 | 21 | ||
1538 | 22 | #include <QtCore/QDir> | 22 | #include <QtCore/QDir> |
1539 | 23 | #include <QtCore/QFile> | 23 | #include <QtCore/QFile> |
1540 | 24 | #include <QtCore/QStandardPaths> | ||
1541 | 24 | 25 | ||
1542 | 25 | /* | 26 | /* |
1544 | 26 | User theme settings are stored in $HOME/.config/ubuntu-ui-toolkit/theme.ini file, which contains | 27 | User theme settings are stored in $XDG_CONFIG_HOME/ubuntu-ui-toolkit/theme.ini file, which contains |
1545 | 27 | the current global theme name. | 28 | the current global theme name. |
1546 | 28 | */ | 29 | */ |
1547 | 29 | 30 | ||
1549 | 30 | const QString SETTINGS_FILE_FORMAT("%1/.config/ubuntu-ui-toolkit/theme.ini"); | 31 | const QString SETTINGS_FILE_FORMAT("%1/ubuntu-ui-toolkit/theme.ini"); |
1550 | 31 | const QString THEME_KEY("theme"); | 32 | const QString THEME_KEY("theme"); |
1551 | 32 | const QString DEFAULT_THEME("Ubuntu.Components.Themes.Ambiance"); | 33 | const QString DEFAULT_THEME("Ubuntu.Components.Themes.Ambiance"); |
1552 | 33 | 34 | ||
1553 | 34 | UCThemeSettings::UCThemeSettings(QObject *parent) : | 35 | UCThemeSettings::UCThemeSettings(QObject *parent) : |
1554 | 35 | QObject(parent), | 36 | QObject(parent), |
1556 | 36 | m_settings(SETTINGS_FILE_FORMAT.arg(QDir::homePath()), QSettings::IniFormat) | 37 | m_settings(SETTINGS_FILE_FORMAT.arg(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)), QSettings::IniFormat) |
1557 | 37 | { | 38 | { |
1558 | 38 | // check if there is a theme settings file, if not, create one | 39 | // check if there is a theme settings file, if not, create one |
1559 | 39 | if (!QFile::exists(m_settings.fileName())) { | 40 | if (!QFile::exists(m_settings.fileName())) { |
1560 | 40 | 41 | ||
1561 | === modified file 'modules/Ubuntu/Layouts/plugin/plugin.pro' | |||
1562 | --- modules/Ubuntu/Layouts/plugin/plugin.pro 2013-11-22 11:15:48 +0000 | |||
1563 | +++ modules/Ubuntu/Layouts/plugin/plugin.pro 2014-05-28 18:09:57 +0000 | |||
1564 | @@ -5,7 +5,7 @@ | |||
1565 | 5 | 5 | ||
1566 | 6 | QMAKE_CXXFLAGS += -Werror | 6 | QMAKE_CXXFLAGS += -Werror |
1567 | 7 | 7 | ||
1569 | 8 | QT += quick-private | 8 | QT += quick-private gui-private |
1570 | 9 | QT += qml-private core-private | 9 | QT += qml-private core-private |
1571 | 10 | 10 | ||
1572 | 11 | equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) { | 11 | equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) { |
1573 | 12 | 12 | ||
1574 | === modified file 'modules/Ubuntu/Layouts/plugin/propertychanges.cpp' | |||
1575 | --- modules/Ubuntu/Layouts/plugin/propertychanges.cpp 2013-06-26 09:58:41 +0000 | |||
1576 | +++ modules/Ubuntu/Layouts/plugin/propertychanges.cpp 2014-05-28 18:09:57 +0000 | |||
1577 | @@ -145,7 +145,7 @@ | |||
1578 | 145 | } | 145 | } |
1579 | 146 | if (fromBinding) { | 146 | if (fromBinding) { |
1580 | 147 | QQmlAbstractBinding *revertedBinding = QQmlPropertyPrivate::setBinding(property, fromBinding); | 147 | QQmlAbstractBinding *revertedBinding = QQmlPropertyPrivate::setBinding(property, fromBinding); |
1582 | 148 | if (revertedBinding && ((revertedBinding != toBinding.data()) || (revertedBinding == toBinding.data() && deleteToBinding))) { | 148 | if (revertedBinding && (revertedBinding != fromBinding) && ((revertedBinding != toBinding.data()) || (revertedBinding == toBinding.data() && deleteToBinding))) { |
1583 | 149 | revertedBinding->destroy(); | 149 | revertedBinding->destroy(); |
1584 | 150 | } | 150 | } |
1585 | 151 | } else if (!toBinding.isNull() && QQmlPropertyPrivate::binding(property) == toBinding.data()) { | 151 | } else if (!toBinding.isNull() && QQmlPropertyPrivate::binding(property) == toBinding.data()) { |
1586 | @@ -222,24 +222,6 @@ | |||
1587 | 222 | { | 222 | { |
1588 | 223 | } | 223 | } |
1589 | 224 | 224 | ||
1590 | 225 | /****************************************************************************** | ||
1591 | 226 | * ReparentChange | ||
1592 | 227 | */ | ||
1593 | 228 | ReparentChange::ReparentChange(QQuickItem *target, const QString &property, QQuickItem *source) | ||
1594 | 229 | : PropertyChange(target, property, QVariant(), Normal) | ||
1595 | 230 | , sourceProperty(source, property, qmlContext(source)) | ||
1596 | 231 | { | ||
1597 | 232 | action.type = PropertyAction::Binding; | ||
1598 | 233 | } | ||
1599 | 234 | |||
1600 | 235 | void ReparentChange::saveState() | ||
1601 | 236 | { | ||
1602 | 237 | action.toValue = sourceProperty.read(); | ||
1603 | 238 | PropertyChange::saveState(); | ||
1604 | 239 | if (sourceProperty.isValid()) { | ||
1605 | 240 | action.setTargetBinding(QQmlPropertyPrivate::binding(sourceProperty), false); | ||
1606 | 241 | } | ||
1607 | 242 | } | ||
1608 | 243 | 225 | ||
1609 | 244 | /****************************************************************************** | 226 | /****************************************************************************** |
1610 | 245 | * ParentChange | 227 | * ParentChange |
1611 | @@ -304,35 +286,31 @@ | |||
1612 | 304 | * ItemStackBackup | 286 | * ItemStackBackup |
1613 | 305 | * High priority change backing up the item's stack position. | 287 | * High priority change backing up the item's stack position. |
1614 | 306 | */ | 288 | */ |
1616 | 307 | ItemStackBackup::ItemStackBackup(QQuickItem *item, QQuickItem *currentLayoutItem, QQuickItem *previousLayoutItem) | 289 | ItemStackBackup::ItemStackBackup(QQuickItem *item) |
1617 | 308 | : PropertyChange(High) | 290 | : PropertyChange(High) |
1618 | 309 | , target(item) | 291 | , target(item) |
1622 | 310 | , currentLayout(currentLayoutItem) | 292 | , prevItem(0) |
1620 | 311 | , previousLayout(previousLayoutItem) | ||
1621 | 312 | , originalStackBefore(0) | ||
1623 | 313 | { | 293 | { |
1624 | 314 | } | 294 | } |
1625 | 315 | 295 | ||
1626 | 316 | void ItemStackBackup::saveState() | 296 | void ItemStackBackup::saveState() |
1627 | 317 | { | 297 | { |
1628 | 318 | QQuickItem *rewindParent = target->parentItem(); | 298 | QQuickItem *rewindParent = target->parentItem(); |
1629 | 299 | if (!rewindParent) { | ||
1630 | 300 | return; | ||
1631 | 301 | } | ||
1632 | 319 | // save original stack position, but detect layout objects! | 302 | // save original stack position, but detect layout objects! |
1633 | 320 | QList<QQuickItem*> children = rewindParent->childItems(); | 303 | QList<QQuickItem*> children = rewindParent->childItems(); |
1642 | 321 | for (int ii = 0; ii < children.count() - 1; ++ii) { | 304 | int index = children.indexOf(target); |
1643 | 322 | if (children.at(ii) == target) { | 305 | if (index > 0) { |
1644 | 323 | originalStackBefore = children.at(ii + 1); | 306 | prevItem = children.at(index - 1); |
1637 | 324 | if (originalStackBefore == currentLayout || originalStackBefore == previousLayout) { | ||
1638 | 325 | originalStackBefore = 0; | ||
1639 | 326 | } | ||
1640 | 327 | break; | ||
1641 | 328 | } | ||
1645 | 329 | } | 307 | } |
1646 | 330 | } | 308 | } |
1647 | 331 | 309 | ||
1648 | 332 | void ItemStackBackup::revert() | 310 | void ItemStackBackup::revert() |
1649 | 333 | { | 311 | { |
1652 | 334 | if (originalStackBefore) { | 312 | if (prevItem) { |
1653 | 335 | target->stackBefore(originalStackBefore); | 313 | target->stackAfter(prevItem); |
1654 | 336 | } | 314 | } |
1655 | 337 | } | 315 | } |
1656 | 338 | 316 | ||
1657 | @@ -459,6 +437,13 @@ | |||
1658 | 459 | return *this; | 437 | return *this; |
1659 | 460 | } | 438 | } |
1660 | 461 | 439 | ||
1661 | 440 | // creates two changes, one for reparenting and one for itemstack backup | ||
1662 | 441 | ChangeList &ChangeList::addParentChange(QQuickItem *item, QQuickItem *newParent, bool topmostItem) | ||
1663 | 442 | { | ||
1664 | 443 | return addChange(new ParentChange(item, newParent, topmostItem)) | ||
1665 | 444 | .addChange(new ItemStackBackup(item)); | ||
1666 | 445 | } | ||
1667 | 446 | |||
1668 | 462 | QList<PropertyChange*> ChangeList::unifiedChanges() | 447 | QList<PropertyChange*> ChangeList::unifiedChanges() |
1669 | 463 | { | 448 | { |
1670 | 464 | QList<PropertyChange*> list; | 449 | QList<PropertyChange*> list; |
1671 | 465 | 450 | ||
1672 | === modified file 'modules/Ubuntu/Layouts/plugin/propertychanges_p.h' | |||
1673 | --- modules/Ubuntu/Layouts/plugin/propertychanges_p.h 2013-06-26 09:58:41 +0000 | |||
1674 | +++ modules/Ubuntu/Layouts/plugin/propertychanges_p.h 2014-05-28 18:09:57 +0000 | |||
1675 | @@ -104,18 +104,6 @@ | |||
1676 | 104 | }; | 104 | }; |
1677 | 105 | 105 | ||
1678 | 106 | 106 | ||
1679 | 107 | class ReparentChange : public PropertyChange | ||
1680 | 108 | { | ||
1681 | 109 | public: | ||
1682 | 110 | ReparentChange(QQuickItem *item, const QString &property, QQuickItem *source); | ||
1683 | 111 | |||
1684 | 112 | protected: | ||
1685 | 113 | virtual void saveState(); | ||
1686 | 114 | |||
1687 | 115 | QQmlProperty sourceProperty; | ||
1688 | 116 | }; | ||
1689 | 117 | |||
1690 | 118 | |||
1691 | 119 | class ParentChange : public PropertyChange | 107 | class ParentChange : public PropertyChange |
1692 | 120 | { | 108 | { |
1693 | 121 | public: | 109 | public: |
1694 | @@ -143,16 +131,14 @@ | |||
1695 | 143 | class ItemStackBackup : public PropertyChange | 131 | class ItemStackBackup : public PropertyChange |
1696 | 144 | { | 132 | { |
1697 | 145 | public: | 133 | public: |
1699 | 146 | ItemStackBackup(QQuickItem *item, QQuickItem *currentLayoutItem, QQuickItem *previousLayoutItem); | 134 | ItemStackBackup(QQuickItem *item); |
1700 | 147 | void apply() {} | 135 | void apply() {} |
1701 | 148 | void revert(); | 136 | void revert(); |
1702 | 149 | 137 | ||
1703 | 150 | protected: | 138 | protected: |
1704 | 151 | virtual void saveState(); | 139 | virtual void saveState(); |
1705 | 152 | QQuickItem *target; | 140 | QQuickItem *target; |
1709 | 153 | QQuickItem *currentLayout; | 141 | QQuickItem *prevItem; |
1707 | 154 | QQuickItem *previousLayout; | ||
1708 | 155 | QQuickItem *originalStackBefore; | ||
1710 | 156 | private: | 142 | private: |
1711 | 157 | friend class ULLayouts; | 143 | friend class ULLayouts; |
1712 | 158 | }; | 144 | }; |
1713 | @@ -214,6 +200,7 @@ | |||
1714 | 214 | void clear(); | 200 | void clear(); |
1715 | 215 | 201 | ||
1716 | 216 | ChangeList &addChange(PropertyChange *change); | 202 | ChangeList &addChange(PropertyChange *change); |
1717 | 203 | ChangeList &addParentChange(QQuickItem *item, QQuickItem *newParent, bool topmostItem); | ||
1718 | 217 | 204 | ||
1719 | 218 | private: | 205 | private: |
1720 | 219 | QList<PropertyChange*> changes[PropertyChange::MaxPriority]; | 206 | QList<PropertyChange*> changes[PropertyChange::MaxPriority]; |
1721 | 220 | 207 | ||
1722 | === modified file 'modules/Ubuntu/Layouts/plugin/ulitemlayout.h' | |||
1723 | --- modules/Ubuntu/Layouts/plugin/ulitemlayout.h 2013-06-06 16:00:10 +0000 | |||
1724 | +++ modules/Ubuntu/Layouts/plugin/ulitemlayout.h 2014-05-28 18:09:57 +0000 | |||
1725 | @@ -26,7 +26,7 @@ | |||
1726 | 26 | Q_OBJECT | 26 | Q_OBJECT |
1727 | 27 | Q_DISABLE_COPY(ULItemLayout) | 27 | Q_DISABLE_COPY(ULItemLayout) |
1728 | 28 | 28 | ||
1730 | 29 | Q_PROPERTY(QString item READ item WRITE setItem) | 29 | Q_PROPERTY(QString item READ item WRITE setItem NOTIFY itemChanged) |
1731 | 30 | 30 | ||
1732 | 31 | public: | 31 | public: |
1733 | 32 | explicit ULItemLayout(QQuickItem *parent = 0); | 32 | explicit ULItemLayout(QQuickItem *parent = 0); |
1734 | @@ -35,6 +35,9 @@ | |||
1735 | 35 | QString item() const; | 35 | QString item() const; |
1736 | 36 | void setItem(const QString &value); | 36 | void setItem(const QString &value); |
1737 | 37 | 37 | ||
1738 | 38 | Q_SIGNALS: | ||
1739 | 39 | void itemChanged(); | ||
1740 | 40 | |||
1741 | 38 | private: | 41 | private: |
1742 | 39 | QString m_itemName; | 42 | QString m_itemName; |
1743 | 40 | }; | 43 | }; |
1744 | 41 | 44 | ||
1745 | === modified file 'modules/Ubuntu/Layouts/plugin/ullayouts.cpp' | |||
1746 | --- modules/Ubuntu/Layouts/plugin/ullayouts.cpp 2014-04-20 19:25:12 +0000 | |||
1747 | +++ modules/Ubuntu/Layouts/plugin/ullayouts.cpp 2014-05-28 18:09:57 +0000 | |||
1748 | @@ -22,15 +22,21 @@ | |||
1749 | 22 | #include "ulconditionallayout.h" | 22 | #include "ulconditionallayout.h" |
1750 | 23 | #include "propertychanges_p.h" | 23 | #include "propertychanges_p.h" |
1751 | 24 | #include <QtQml/QQmlInfo> | 24 | #include <QtQml/QQmlInfo> |
1752 | 25 | #include <QtQuick/private/qquickitem_p.h> | ||
1753 | 25 | 26 | ||
1754 | 26 | ULLayoutsPrivate::ULLayoutsPrivate(ULLayouts *qq) | 27 | ULLayoutsPrivate::ULLayoutsPrivate(ULLayouts *qq) |
1755 | 27 | : QQmlIncubator(Asynchronous) | 28 | : QQmlIncubator(Asynchronous) |
1756 | 28 | , q_ptr(qq) | 29 | , q_ptr(qq) |
1757 | 29 | , currentLayoutItem(0) | 30 | , currentLayoutItem(0) |
1758 | 30 | , previousLayoutItem(0) | 31 | , previousLayoutItem(0) |
1759 | 32 | , contentItem(new QQuickItem) | ||
1760 | 31 | , currentLayoutIndex(-1) | 33 | , currentLayoutIndex(-1) |
1761 | 32 | , ready(false) | 34 | , ready(false) |
1762 | 33 | { | 35 | { |
1763 | 36 | // hidden container for the components that are not laid out | ||
1764 | 37 | // any component not subject of layout is reparented into this component | ||
1765 | 38 | contentItem->setParent(qq); | ||
1766 | 39 | contentItem->setParentItem(qq); | ||
1767 | 34 | } | 40 | } |
1768 | 35 | 41 | ||
1769 | 36 | 42 | ||
1770 | @@ -80,7 +86,6 @@ | |||
1771 | 80 | QQuickItem *item = static_cast<QQuickItem*>(object); | 86 | QQuickItem *item = static_cast<QQuickItem*>(object); |
1772 | 81 | // set disabled and invisible, and set its parent as last action | 87 | // set disabled and invisible, and set its parent as last action |
1773 | 82 | item->setVisible(false); | 88 | item->setVisible(false); |
1774 | 83 | item->setEnabled(false); | ||
1775 | 84 | } | 89 | } |
1776 | 85 | 90 | ||
1777 | 86 | /* | 91 | /* |
1778 | @@ -98,14 +103,16 @@ | |||
1779 | 98 | currentLayoutItem = qobject_cast<QQuickItem*>(object()); | 103 | currentLayoutItem = qobject_cast<QQuickItem*>(object()); |
1780 | 99 | Q_ASSERT(currentLayoutItem); | 104 | Q_ASSERT(currentLayoutItem); |
1781 | 100 | 105 | ||
1782 | 101 | // hide all non-laid out items first | ||
1783 | 102 | hideExcludedItems(); | ||
1784 | 103 | |||
1785 | 104 | //reparent components to be laid out | 106 | //reparent components to be laid out |
1786 | 105 | reparentItems(); | 107 | reparentItems(); |
1787 | 106 | // set parent item, then enable and show layout | 108 | // set parent item, then enable and show layout |
1788 | 107 | changes.addChange(new ParentChange(currentLayoutItem, q, false)); | 109 | changes.addChange(new ParentChange(currentLayoutItem, q, false)); |
1790 | 108 | itemActivate(currentLayoutItem, true); | 110 | |
1791 | 111 | // hide default layout, then show the new one | ||
1792 | 112 | // there's no need to queue these property changes as we do not need | ||
1793 | 113 | // to back up their previosus states | ||
1794 | 114 | contentItem->setVisible(false); | ||
1795 | 115 | currentLayoutItem->setVisible(true); | ||
1796 | 109 | // apply changes | 116 | // apply changes |
1797 | 110 | changes.apply(); | 117 | changes.apply(); |
1798 | 111 | // clear previous layout | 118 | // clear previous layout |
1799 | @@ -114,18 +121,10 @@ | |||
1800 | 114 | 121 | ||
1801 | 115 | Q_EMIT q->currentLayoutChanged(); | 122 | Q_EMIT q->currentLayoutChanged(); |
1802 | 116 | } else if (status == Error) { | 123 | } else if (status == Error) { |
1803 | 117 | Q_Q(ULLayouts); | ||
1804 | 118 | error(q, errors()); | 124 | error(q, errors()); |
1805 | 119 | } | 125 | } |
1806 | 120 | } | 126 | } |
1807 | 121 | 127 | ||
1808 | 122 | void ULLayoutsPrivate::hideExcludedItems() | ||
1809 | 123 | { | ||
1810 | 124 | for (int i = 0; i < excludedFromLayout.count(); i++) { | ||
1811 | 125 | itemActivate(excludedFromLayout[i], false); | ||
1812 | 126 | } | ||
1813 | 127 | } | ||
1814 | 128 | |||
1815 | 129 | /* | 128 | /* |
1816 | 130 | * Re-parent items to the new layout. | 129 | * Re-parent items to the new layout. |
1817 | 131 | */ | 130 | */ |
1818 | @@ -134,26 +133,32 @@ | |||
1819 | 134 | // create copy of items list, to keep track of which ones we change | 133 | // create copy of items list, to keep track of which ones we change |
1820 | 135 | LaidOutItemsMap unusedItems = itemsToLayout; | 134 | LaidOutItemsMap unusedItems = itemsToLayout; |
1821 | 136 | 135 | ||
1833 | 137 | // iterate through the Layout definition to find containers - those Items with | 136 | // iterate through the Layout definition to find containers - ItemLayout items |
1834 | 138 | // ConditionalLayout.items set | 137 | QList<ULItemLayout*> containers = collectContainers(currentLayoutItem); |
1835 | 139 | QList<QQuickItem*> items = currentLayoutItem->findChildren<QQuickItem*>(); | 138 | |
1836 | 140 | // add the root item as that also can be the container | 139 | Q_FOREACH(ULItemLayout *container, containers) { |
1837 | 141 | items.prepend(currentLayoutItem); | 140 | reparentToItemLayout(unusedItems, container); |
1838 | 142 | 141 | } | |
1839 | 143 | Q_FOREACH(QQuickItem *container, items) { | 142 | } |
1840 | 144 | // check whether we have ItemLayout declared | 143 | |
1841 | 145 | ULItemLayout *itemLayout = qobject_cast<ULItemLayout*>(container); | 144 | QList<ULItemLayout*> ULLayoutsPrivate::collectContainers(QQuickItem *fromItem) |
1842 | 146 | if (itemLayout) { | 145 | { |
1843 | 147 | reparentToItemLayout(unusedItems, itemLayout); | 146 | QList<ULItemLayout*> result; |
1844 | 147 | // check first if the fromItem is also a container | ||
1845 | 148 | ULItemLayout *container = qobject_cast<ULItemLayout*>(fromItem); | ||
1846 | 149 | if (container) { | ||
1847 | 150 | result.append(container); | ||
1848 | 151 | } | ||
1849 | 152 | |||
1850 | 153 | // loop through children but exclude nested Layouts | ||
1851 | 154 | QList<QQuickItem*> children = fromItem->childItems(); | ||
1852 | 155 | Q_FOREACH(QQuickItem *child, children) { | ||
1853 | 156 | if (qobject_cast<ULLayouts*>(child)) { | ||
1854 | 157 | continue; | ||
1855 | 148 | } | 158 | } |
1864 | 149 | } | 159 | result.append(collectContainers(child)); |
1865 | 150 | 160 | } | |
1866 | 151 | // hide the rest of the unused ones | 161 | return result; |
1859 | 152 | LaidOutItemsMapIterator i(unusedItems); | ||
1860 | 153 | while (i.hasNext()) { | ||
1861 | 154 | i.next(); | ||
1862 | 155 | itemActivate(i.value(), false); | ||
1863 | 156 | } | ||
1867 | 157 | } | 162 | } |
1868 | 158 | 163 | ||
1869 | 159 | /* | 164 | /* |
1870 | @@ -176,8 +181,7 @@ | |||
1871 | 176 | } | 181 | } |
1872 | 177 | 182 | ||
1873 | 178 | // the component fills the parent | 183 | // the component fills the parent |
1876 | 179 | changes.addChange(new ParentChange(item, fragment, true)); | 184 | changes.addParentChange(item, fragment, true); |
1875 | 180 | changes.addChange(new ItemStackBackup(item, currentLayoutItem, previousLayoutItem)); | ||
1877 | 181 | changes.addChange(new AnchorChange(item, "fill", fragment)); | 185 | changes.addChange(new AnchorChange(item, "fill", fragment)); |
1878 | 182 | changes.addChange(new PropertyChange(item, "anchors.margins", 0)); | 186 | changes.addChange(new PropertyChange(item, "anchors.margins", 0)); |
1879 | 183 | changes.addChange(new PropertyChange(item, "anchors.leftMargin", 0)); | 187 | changes.addChange(new PropertyChange(item, "anchors.leftMargin", 0)); |
1880 | @@ -194,18 +198,6 @@ | |||
1881 | 194 | map.remove(itemName); | 198 | map.remove(itemName); |
1882 | 195 | } | 199 | } |
1883 | 196 | 200 | ||
1884 | 197 | void ULLayoutsPrivate::itemActivate(QQuickItem *item, bool activate) | ||
1885 | 198 | { | ||
1886 | 199 | changes.addChange(new PropertyChange(item, "visible", activate)) | ||
1887 | 200 | .addChange(new PropertyChange(item, "enabled", activate)); | ||
1888 | 201 | } | ||
1889 | 202 | |||
1890 | 203 | // remove the deleted item from the excluded ones | ||
1891 | 204 | void ULLayoutsPrivate::_q_removeExcludedItem(QObject *excludedItem) | ||
1892 | 205 | { | ||
1893 | 206 | excludedFromLayout.removeAll(static_cast<QQuickItem*>(excludedItem)); | ||
1894 | 207 | } | ||
1895 | 208 | |||
1896 | 209 | /* | 201 | /* |
1897 | 210 | * Validates the declared conditional layouts by checking whether they have name | 202 | * Validates the declared conditional layouts by checking whether they have name |
1898 | 211 | * property set and whether the value set is unique, and whether the conditional | 203 | * property set and whether the value set is unique, and whether the conditional |
1899 | @@ -244,44 +236,20 @@ | |||
1900 | 244 | /* | 236 | /* |
1901 | 245 | * Collect items to be laid out. | 237 | * Collect items to be laid out. |
1902 | 246 | */ | 238 | */ |
1904 | 247 | void ULLayoutsPrivate::getLaidOutItems() | 239 | void ULLayoutsPrivate::getLaidOutItems(QQuickItem *container) |
1905 | 248 | { | 240 | { |
1911 | 249 | Q_Q(ULLayouts); | 241 | Q_FOREACH(QQuickItem *child, container->childItems()) { |
1912 | 250 | 242 | // skip nested layouts | |
1913 | 251 | QList<QQuickItem*> items = q->findChildren<QQuickItem*>(); | 243 | if (qobject_cast<ULLayouts*>(child)) { |
1914 | 252 | for (int i = 0; i < items.count(); i++) { | 244 | continue; |
1915 | 253 | QQuickItem *item = items[i]; | 245 | } |
1916 | 254 | ULLayoutsAttached *marker = qobject_cast<ULLayoutsAttached*>( | 246 | ULLayoutsAttached *marker = qobject_cast<ULLayoutsAttached*>( |
1918 | 255 | qmlAttachedPropertiesObject<ULLayouts>(item, false)); | 247 | qmlAttachedPropertiesObject<ULLayouts>(child, false)); |
1919 | 256 | if (marker && !marker->item().isEmpty()) { | 248 | if (marker && !marker->item().isEmpty()) { |
1921 | 257 | itemsToLayout.insert(marker->item(), item); | 249 | itemsToLayout.insert(marker->item(), child); |
1922 | 258 | } else { | 250 | } else { |
1949 | 259 | // the item is not marked to be laid out but one of its parents | 251 | // continue to search in between the child's children |
1950 | 260 | // can be, therefore check | 252 | getLaidOutItems(child); |
1925 | 261 | // check if the item's parent is included in the layout | ||
1926 | 262 | QQuickItem *pl = item->parentItem(); | ||
1927 | 263 | marker = 0; | ||
1928 | 264 | if (!pl && item->parent()) { | ||
1929 | 265 | // this may be an item instance assigned to a property | ||
1930 | 266 | // like "property var anItem: Item {}" | ||
1931 | 267 | // in which case we must get the parent object of it, not the parent item | ||
1932 | 268 | pl = qobject_cast<QQuickItem*>(item->parent()); | ||
1933 | 269 | } | ||
1934 | 270 | while (pl) { | ||
1935 | 271 | marker = qobject_cast<ULLayoutsAttached*>( | ||
1936 | 272 | qmlAttachedPropertiesObject<ULLayouts>(pl, false)); | ||
1937 | 273 | if (marker && !marker->item().isEmpty()) { | ||
1938 | 274 | break; | ||
1939 | 275 | } | ||
1940 | 276 | pl = pl->parentItem(); | ||
1941 | 277 | } | ||
1942 | 278 | if (!marker || (marker && marker->item().isEmpty())) { | ||
1943 | 279 | // remember theese so we hide them once we switch away from default layout | ||
1944 | 280 | excludedFromLayout << item; | ||
1945 | 281 | // and make sure we remove the item from excluded ones in case the item is destroyed | ||
1946 | 282 | QObject::connect(item, SIGNAL(destroyed(QObject*)), | ||
1947 | 283 | q, SLOT(_q_removeExcludedItem(QObject*))); | ||
1948 | 284 | } | ||
1951 | 285 | } | 253 | } |
1952 | 286 | } | 254 | } |
1953 | 287 | } | 255 | } |
1954 | @@ -344,6 +312,9 @@ | |||
1955 | 344 | // revert and clear changes | 312 | // revert and clear changes |
1956 | 345 | changes.revert(); | 313 | changes.revert(); |
1957 | 346 | changes.clear(); | 314 | changes.clear(); |
1958 | 315 | // make contentItem visible | ||
1959 | 316 | |||
1960 | 317 | contentItem->setVisible(true); | ||
1961 | 347 | delete currentLayoutItem; | 318 | delete currentLayoutItem; |
1962 | 348 | currentLayoutItem = 0; | 319 | currentLayoutItem = 0; |
1963 | 349 | currentLayoutIndex = -1; | 320 | currentLayoutIndex = -1; |
1964 | @@ -606,10 +577,18 @@ | |||
1965 | 606 | Q_D(ULLayouts); | 577 | Q_D(ULLayouts); |
1966 | 607 | d->ready = true; | 578 | d->ready = true; |
1967 | 608 | d->validateConditionalLayouts(); | 579 | d->validateConditionalLayouts(); |
1969 | 609 | d->getLaidOutItems(); | 580 | d->getLaidOutItems(d->contentItem); |
1970 | 610 | d->updateLayout(); | 581 | d->updateLayout(); |
1971 | 611 | } | 582 | } |
1972 | 612 | 583 | ||
1973 | 584 | void ULLayouts::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) | ||
1974 | 585 | { | ||
1975 | 586 | Q_D(ULLayouts); | ||
1976 | 587 | QQuickItem::geometryChanged(newGeometry, oldGeometry); | ||
1977 | 588 | // simply update the container's width/height to the new width/height | ||
1978 | 589 | d->contentItem->setSize(newGeometry.size()); | ||
1979 | 590 | } | ||
1980 | 591 | |||
1981 | 613 | /*! | 592 | /*! |
1982 | 614 | * \qmlproperty string Layouts::currentLayout | 593 | * \qmlproperty string Layouts::currentLayout |
1983 | 615 | * The property holds the active layout name. The default layout is identified | 594 | * The property holds the active layout name. The default layout is identified |
1984 | @@ -634,6 +613,17 @@ | |||
1985 | 634 | } | 613 | } |
1986 | 635 | 614 | ||
1987 | 636 | /*! | 615 | /*! |
1988 | 616 | * \internal | ||
1989 | 617 | * Returns the contentItem for internal use. | ||
1990 | 618 | */ | ||
1991 | 619 | QQuickItem *ULLayouts::contentItem() const | ||
1992 | 620 | { | ||
1993 | 621 | Q_D(const ULLayouts); | ||
1994 | 622 | return d->contentItem; | ||
1995 | 623 | } | ||
1996 | 624 | |||
1997 | 625 | |||
1998 | 626 | /*! | ||
1999 | 637 | * \qmlproperty list<ConditionalLayout> Layouts::layouts | 627 | * \qmlproperty list<ConditionalLayout> Layouts::layouts |
2000 | 638 | * The property holds the list of different ConditionalLayout elements. | 628 | * The property holds the list of different ConditionalLayout elements. |
2001 | 639 | */ | 629 | */ |
2002 | @@ -647,4 +637,25 @@ | |||
2003 | 647 | &ULLayoutsPrivate::clear_layouts); | 637 | &ULLayoutsPrivate::clear_layouts); |
2004 | 648 | } | 638 | } |
2005 | 649 | 639 | ||
2006 | 640 | /*! | ||
2007 | 641 | * \internal | ||
2008 | 642 | * Overrides the default data property. | ||
2009 | 643 | */ | ||
2010 | 644 | QQmlListProperty<QObject> ULLayouts::data() | ||
2011 | 645 | { | ||
2012 | 646 | Q_D(ULLayouts); | ||
2013 | 647 | return QQuickItemPrivate::get(d->contentItem)->data(); | ||
2014 | 648 | } | ||
2015 | 649 | |||
2016 | 650 | /*! | ||
2017 | 651 | * \internal | ||
2018 | 652 | * Overrides the default children property. | ||
2019 | 653 | */ | ||
2020 | 654 | QQmlListProperty<QQuickItem> ULLayouts::children() | ||
2021 | 655 | { | ||
2022 | 656 | Q_D(ULLayouts); | ||
2023 | 657 | return QQuickItemPrivate::get(d->contentItem)->children(); | ||
2024 | 658 | } | ||
2025 | 659 | |||
2026 | 660 | |||
2027 | 650 | #include "moc_ullayouts.cpp" | 661 | #include "moc_ullayouts.cpp" |
2028 | 651 | 662 | ||
2029 | === modified file 'modules/Ubuntu/Layouts/plugin/ullayouts.h' | |||
2030 | --- modules/Ubuntu/Layouts/plugin/ullayouts.h 2014-02-18 13:27:23 +0000 | |||
2031 | +++ modules/Ubuntu/Layouts/plugin/ullayouts.h 2014-05-28 18:09:57 +0000 | |||
2032 | @@ -55,7 +55,10 @@ | |||
2033 | 55 | 55 | ||
2034 | 56 | Q_PROPERTY(QString currentLayout READ currentLayout NOTIFY currentLayoutChanged DESIGNABLE false) | 56 | Q_PROPERTY(QString currentLayout READ currentLayout NOTIFY currentLayoutChanged DESIGNABLE false) |
2035 | 57 | Q_PROPERTY(QQmlListProperty<ULConditionalLayout> layouts READ layouts DESIGNABLE false) | 57 | Q_PROPERTY(QQmlListProperty<ULConditionalLayout> layouts READ layouts DESIGNABLE false) |
2037 | 58 | 58 | ||
2038 | 59 | Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false) | ||
2039 | 60 | Q_PROPERTY(QQmlListProperty<QQuickItem> children READ children DESIGNABLE false) | ||
2040 | 61 | Q_CLASSINFO("DefaultProperty", "data") | ||
2041 | 59 | public: | 62 | public: |
2042 | 60 | explicit ULLayouts(QQuickItem *parent = 0); | 63 | explicit ULLayouts(QQuickItem *parent = 0); |
2043 | 61 | ~ULLayouts(); | 64 | ~ULLayouts(); |
2044 | @@ -64,21 +67,23 @@ | |||
2045 | 64 | 67 | ||
2046 | 65 | QString currentLayout() const; | 68 | QString currentLayout() const; |
2047 | 66 | QList<ULConditionalLayout*> layoutList(); | 69 | QList<ULConditionalLayout*> layoutList(); |
2048 | 70 | QQuickItem *contentItem() const; | ||
2049 | 67 | 71 | ||
2050 | 68 | Q_SIGNALS: | 72 | Q_SIGNALS: |
2051 | 69 | void currentLayoutChanged(); | 73 | void currentLayoutChanged(); |
2052 | 70 | 74 | ||
2053 | 71 | protected: | 75 | protected: |
2054 | 72 | void componentComplete(); | 76 | void componentComplete(); |
2055 | 77 | void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); | ||
2056 | 73 | 78 | ||
2057 | 74 | private: | 79 | private: |
2058 | 75 | QQmlListProperty<ULConditionalLayout> layouts(); | 80 | QQmlListProperty<ULConditionalLayout> layouts(); |
2059 | 81 | QQmlListProperty<QObject> data(); | ||
2060 | 82 | QQmlListProperty<QQuickItem> children(); | ||
2061 | 76 | 83 | ||
2062 | 77 | friend class ULConditionalLayout; | 84 | friend class ULConditionalLayout; |
2063 | 78 | Q_DECLARE_PRIVATE(ULLayouts) | 85 | Q_DECLARE_PRIVATE(ULLayouts) |
2064 | 79 | QScopedPointer<ULLayoutsPrivate> d_ptr; | 86 | QScopedPointer<ULLayoutsPrivate> d_ptr; |
2065 | 80 | |||
2066 | 81 | Q_PRIVATE_SLOT(d_func(), void _q_removeExcludedItem(QObject*)) | ||
2067 | 82 | }; | 87 | }; |
2068 | 83 | 88 | ||
2069 | 84 | QML_DECLARE_TYPE(ULLayouts) | 89 | QML_DECLARE_TYPE(ULLayouts) |
2070 | 85 | 90 | ||
2071 | === modified file 'modules/Ubuntu/Layouts/plugin/ullayouts_p.h' | |||
2072 | --- modules/Ubuntu/Layouts/plugin/ullayouts_p.h 2014-02-18 13:27:23 +0000 | |||
2073 | +++ modules/Ubuntu/Layouts/plugin/ullayouts_p.h 2014-05-28 18:09:57 +0000 | |||
2074 | @@ -33,9 +33,8 @@ | |||
2075 | 33 | 33 | ||
2076 | 34 | ULLayoutsPrivate(ULLayouts *qq); | 34 | ULLayoutsPrivate(ULLayouts *qq); |
2077 | 35 | 35 | ||
2078 | 36 | void _q_removeExcludedItem(QObject *excludedItem); | ||
2079 | 37 | void validateConditionalLayouts(); | 36 | void validateConditionalLayouts(); |
2081 | 38 | void getLaidOutItems(); | 37 | void getLaidOutItems(QQuickItem *item); |
2082 | 39 | void updateLayout(); | 38 | void updateLayout(); |
2083 | 40 | 39 | ||
2084 | 41 | static void error(QObject *item, const QString &message); | 40 | static void error(QObject *item, const QString &message); |
2085 | @@ -51,9 +50,9 @@ | |||
2086 | 51 | QList<ULConditionalLayout*> layouts; | 50 | QList<ULConditionalLayout*> layouts; |
2087 | 52 | ChangeList changes; | 51 | ChangeList changes; |
2088 | 53 | LaidOutItemsMap itemsToLayout; | 52 | LaidOutItemsMap itemsToLayout; |
2089 | 54 | QList<QQuickItem*> excludedFromLayout; | ||
2090 | 55 | QQuickItem* currentLayoutItem; | 53 | QQuickItem* currentLayoutItem; |
2091 | 56 | QQuickItem* previousLayoutItem; | 54 | QQuickItem* previousLayoutItem; |
2092 | 55 | QQuickItem* contentItem; | ||
2093 | 57 | int currentLayoutIndex; | 56 | int currentLayoutIndex; |
2094 | 58 | bool ready:1; | 57 | bool ready:1; |
2095 | 59 | 58 | ||
2096 | @@ -64,10 +63,9 @@ | |||
2097 | 64 | static void clear_layouts(QQmlListProperty<ULConditionalLayout>*); | 63 | static void clear_layouts(QQmlListProperty<ULConditionalLayout>*); |
2098 | 65 | 64 | ||
2099 | 66 | void reLayout(); | 65 | void reLayout(); |
2100 | 67 | void hideExcludedItems(); | ||
2101 | 68 | void reparentItems(); | 66 | void reparentItems(); |
2102 | 67 | QList<ULItemLayout*> collectContainers(QQuickItem *fromItem); | ||
2103 | 69 | void reparentToItemLayout(LaidOutItemsMap &map, ULItemLayout *fragment); | 68 | void reparentToItemLayout(LaidOutItemsMap &map, ULItemLayout *fragment); |
2104 | 70 | void itemActivate(QQuickItem *item, bool activate); | ||
2105 | 71 | }; | 69 | }; |
2106 | 72 | 70 | ||
2107 | 73 | #endif // ULLAYOUTS_P_H | 71 | #endif // ULLAYOUTS_P_H |
2108 | 74 | 72 | ||
2109 | === modified file 'po/ca.po' | |||
2110 | --- po/ca.po 2014-05-10 07:55:56 +0000 | |||
2111 | +++ po/ca.po 2014-05-28 18:09:57 +0000 | |||
2112 | @@ -14,8 +14,8 @@ | |||
2113 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2114 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2115 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2118 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2119 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2120 | 19 | 19 | ||
2121 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2122 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2123 | 22 | 22 | ||
2124 | === modified file 'po/de.po' | |||
2125 | --- po/de.po 2014-05-10 07:55:56 +0000 | |||
2126 | +++ po/de.po 2014-05-28 18:09:57 +0000 | |||
2127 | @@ -14,8 +14,8 @@ | |||
2128 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2129 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2130 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2133 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2134 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2135 | 19 | 19 | ||
2136 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2137 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2138 | 22 | 22 | ||
2139 | === modified file 'po/es.po' | |||
2140 | --- po/es.po 2014-05-10 07:55:56 +0000 | |||
2141 | +++ po/es.po 2014-05-28 18:09:57 +0000 | |||
2142 | @@ -14,8 +14,8 @@ | |||
2143 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2144 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2145 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2148 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2149 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2150 | 19 | 19 | ||
2151 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2152 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2153 | 22 | 22 | ||
2154 | === modified file 'po/fi.po' | |||
2155 | --- po/fi.po 2014-05-10 07:55:56 +0000 | |||
2156 | +++ po/fi.po 2014-05-28 18:09:57 +0000 | |||
2157 | @@ -14,8 +14,8 @@ | |||
2158 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2159 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2160 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2163 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2164 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2165 | 19 | 19 | ||
2166 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2167 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2168 | 22 | 22 | ||
2169 | === modified file 'po/fr.po' | |||
2170 | --- po/fr.po 2014-05-10 07:55:56 +0000 | |||
2171 | +++ po/fr.po 2014-05-28 18:09:57 +0000 | |||
2172 | @@ -14,8 +14,8 @@ | |||
2173 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2174 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2175 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2178 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2179 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2180 | 19 | 19 | ||
2181 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2182 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2183 | 22 | 22 | ||
2184 | === modified file 'po/gl.po' | |||
2185 | --- po/gl.po 2014-05-10 07:55:56 +0000 | |||
2186 | +++ po/gl.po 2014-05-28 18:09:57 +0000 | |||
2187 | @@ -14,8 +14,8 @@ | |||
2188 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2189 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2190 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2193 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2194 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2195 | 19 | 19 | ||
2196 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2197 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2198 | 22 | 22 | ||
2199 | === modified file 'po/he.po' | |||
2200 | --- po/he.po 2014-05-10 07:55:56 +0000 | |||
2201 | +++ po/he.po 2014-05-28 18:09:57 +0000 | |||
2202 | @@ -14,8 +14,8 @@ | |||
2203 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2204 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2205 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2208 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2209 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2210 | 19 | 19 | ||
2211 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2212 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2213 | 22 | 22 | ||
2214 | === modified file 'po/hu.po' | |||
2215 | --- po/hu.po 2014-05-10 07:55:56 +0000 | |||
2216 | +++ po/hu.po 2014-05-28 18:09:57 +0000 | |||
2217 | @@ -14,8 +14,8 @@ | |||
2218 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2219 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2220 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2223 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2224 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2225 | 19 | 19 | ||
2226 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2227 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2228 | 22 | 22 | ||
2229 | === modified file 'po/ko.po' | |||
2230 | --- po/ko.po 2014-05-10 07:55:56 +0000 | |||
2231 | +++ po/ko.po 2014-05-28 18:09:57 +0000 | |||
2232 | @@ -14,8 +14,8 @@ | |||
2233 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2234 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2235 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2238 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2239 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2240 | 19 | 19 | ||
2241 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2242 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2243 | 22 | 22 | ||
2244 | === modified file 'po/my.po' | |||
2245 | --- po/my.po 2014-05-10 07:55:56 +0000 | |||
2246 | +++ po/my.po 2014-05-28 18:09:57 +0000 | |||
2247 | @@ -14,8 +14,8 @@ | |||
2248 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2249 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2250 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2253 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2254 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2255 | 19 | 19 | ||
2256 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2257 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2258 | 22 | 22 | ||
2259 | === modified file 'po/nl.po' | |||
2260 | --- po/nl.po 2014-05-10 07:55:56 +0000 | |||
2261 | +++ po/nl.po 2014-05-28 18:09:57 +0000 | |||
2262 | @@ -14,8 +14,8 @@ | |||
2263 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2264 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2265 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2268 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2269 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2270 | 19 | 19 | ||
2271 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2272 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2273 | 22 | 22 | ||
2274 | === modified file 'po/oc.po' | |||
2275 | --- po/oc.po 2014-05-10 07:55:56 +0000 | |||
2276 | +++ po/oc.po 2014-05-28 18:09:57 +0000 | |||
2277 | @@ -14,8 +14,8 @@ | |||
2278 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2279 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2280 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2283 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2284 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2285 | 19 | 19 | ||
2286 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2287 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2288 | 22 | 22 | ||
2289 | === modified file 'po/pt_BR.po' | |||
2290 | --- po/pt_BR.po 2014-05-10 07:55:56 +0000 | |||
2291 | +++ po/pt_BR.po 2014-05-28 18:09:57 +0000 | |||
2292 | @@ -14,8 +14,8 @@ | |||
2293 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2294 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2295 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2298 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2299 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2300 | 19 | 19 | ||
2301 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2302 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2303 | 22 | 22 | ||
2304 | === modified file 'po/sv.po' | |||
2305 | --- po/sv.po 2014-05-10 07:55:56 +0000 | |||
2306 | +++ po/sv.po 2014-05-28 18:09:57 +0000 | |||
2307 | @@ -14,8 +14,8 @@ | |||
2308 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2309 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2310 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2313 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2314 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2315 | 19 | 19 | ||
2316 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2317 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2318 | 22 | 22 | ||
2319 | === modified file 'po/uk.po' | |||
2320 | --- po/uk.po 2014-05-10 07:55:56 +0000 | |||
2321 | +++ po/uk.po 2014-05-28 18:09:57 +0000 | |||
2322 | @@ -14,8 +14,8 @@ | |||
2323 | 14 | "MIME-Version: 1.0\n" | 14 | "MIME-Version: 1.0\n" |
2324 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | 15 | "Content-Type: text/plain; charset=UTF-8\n" |
2325 | 16 | "Content-Transfer-Encoding: 8bit\n" | 16 | "Content-Transfer-Encoding: 8bit\n" |
2328 | 17 | "X-Launchpad-Export-Date: 2014-05-10 07:55+0000\n" | 17 | "X-Launchpad-Export-Date: 2014-05-22 06:44+0000\n" |
2329 | 18 | "X-Generator: Launchpad (build 16996)\n" | 18 | "X-Generator: Launchpad (build 17017)\n" |
2330 | 19 | 19 | ||
2331 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 | 20 | #: examples/ubuntu-ui-toolkit-gallery/Animations.qml:22 |
2332 | 21 | msgid "NumberAnimation" | 21 | msgid "NumberAnimation" |
2333 | 22 | 22 | ||
2334 | === modified file 'tests/autopilot/ubuntuuitoolkit/__init__.py' | |||
2335 | --- tests/autopilot/ubuntuuitoolkit/__init__.py 2014-04-25 18:39:51 +0000 | |||
2336 | +++ tests/autopilot/ubuntuuitoolkit/__init__.py 2014-05-28 18:09:57 +0000 | |||
2337 | @@ -24,14 +24,15 @@ | |||
2338 | 24 | 'environment', | 24 | 'environment', |
2339 | 25 | 'emulators', | 25 | 'emulators', |
2340 | 26 | 'fixture_setup', | 26 | 'fixture_setup', |
2341 | 27 | 'Flickable', | ||
2342 | 28 | 'get_keyboard', | 27 | 'get_keyboard', |
2343 | 29 | 'get_pointing_device', | 28 | 'get_pointing_device', |
2344 | 30 | 'Header', | 29 | 'Header', |
2345 | 31 | 'listitems', | 30 | 'listitems', |
2346 | 32 | 'MainView', | 31 | 'MainView', |
2347 | 33 | 'OptionSelector', | 32 | 'OptionSelector', |
2348 | 33 | 'pickers', | ||
2349 | 34 | 'popups', | 34 | 'popups', |
2350 | 35 | 'QQuickFlickable', | ||
2351 | 35 | 'QQuickListView', | 36 | 'QQuickListView', |
2352 | 36 | 'TabBar', | 37 | 'TabBar', |
2353 | 37 | 'Tabs', | 38 | 'Tabs', |
2354 | @@ -53,14 +54,15 @@ | |||
2355 | 53 | from ubuntuuitoolkit._custom_proxy_objects import ( | 54 | from ubuntuuitoolkit._custom_proxy_objects import ( |
2356 | 54 | check_autopilot_version, | 55 | check_autopilot_version, |
2357 | 55 | CheckBox, | 56 | CheckBox, |
2358 | 56 | Flickable, | ||
2359 | 57 | get_keyboard, | 57 | get_keyboard, |
2360 | 58 | get_pointing_device, | 58 | get_pointing_device, |
2361 | 59 | Header, | 59 | Header, |
2362 | 60 | listitems, | 60 | listitems, |
2363 | 61 | MainView, | 61 | MainView, |
2364 | 62 | OptionSelector, | 62 | OptionSelector, |
2365 | 63 | pickers, | ||
2366 | 63 | popups, | 64 | popups, |
2367 | 65 | QQuickFlickable, | ||
2368 | 64 | QQuickListView, | 66 | QQuickListView, |
2369 | 65 | TabBar, | 67 | TabBar, |
2370 | 66 | Tabs, | 68 | Tabs, |
2371 | 67 | 69 | ||
2372 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py' | |||
2373 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py 2014-04-28 15:39:24 +0000 | |||
2374 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py 2014-05-28 18:09:57 +0000 | |||
2375 | @@ -20,14 +20,15 @@ | |||
2376 | 20 | __all__ = [ | 20 | __all__ = [ |
2377 | 21 | 'check_autopilot_version', | 21 | 'check_autopilot_version', |
2378 | 22 | 'CheckBox', | 22 | 'CheckBox', |
2379 | 23 | 'Flickable', | ||
2380 | 24 | 'get_keyboard', | 23 | 'get_keyboard', |
2381 | 25 | 'get_pointing_device', | 24 | 'get_pointing_device', |
2382 | 26 | 'Header', | 25 | 'Header', |
2383 | 27 | 'listitems', | 26 | 'listitems', |
2384 | 28 | 'MainView', | 27 | 'MainView', |
2385 | 29 | 'OptionSelector', | 28 | 'OptionSelector', |
2386 | 29 | 'pickers', | ||
2387 | 30 | 'popups', | 30 | 'popups', |
2388 | 31 | 'QQuickFlickable', | ||
2389 | 31 | 'QQuickListView', | 32 | 'QQuickListView', |
2390 | 32 | 'TabBar', | 33 | 'TabBar', |
2391 | 33 | 'Tabs', | 34 | 'Tabs', |
2392 | @@ -45,13 +46,14 @@ | |||
2393 | 45 | ToolkitException, | 46 | ToolkitException, |
2394 | 46 | UbuntuUIToolkitCustomProxyObjectBase, | 47 | UbuntuUIToolkitCustomProxyObjectBase, |
2395 | 47 | ) | 48 | ) |
2397 | 48 | from ubuntuuitoolkit._custom_proxy_objects._flickable import Flickable | 49 | from ubuntuuitoolkit._custom_proxy_objects._flickable import QQuickFlickable |
2398 | 49 | from ubuntuuitoolkit._custom_proxy_objects._header import Header | 50 | from ubuntuuitoolkit._custom_proxy_objects._header import Header |
2399 | 50 | from ubuntuuitoolkit._custom_proxy_objects import listitems | 51 | from ubuntuuitoolkit._custom_proxy_objects import listitems |
2400 | 51 | from ubuntuuitoolkit._custom_proxy_objects._mainview import MainView | 52 | from ubuntuuitoolkit._custom_proxy_objects._mainview import MainView |
2401 | 52 | from ubuntuuitoolkit._custom_proxy_objects._optionselector import ( | 53 | from ubuntuuitoolkit._custom_proxy_objects._optionselector import ( |
2402 | 53 | OptionSelector | 54 | OptionSelector |
2403 | 54 | ) | 55 | ) |
2404 | 56 | from ubuntuuitoolkit._custom_proxy_objects import pickers | ||
2405 | 55 | from ubuntuuitoolkit._custom_proxy_objects import popups | 57 | from ubuntuuitoolkit._custom_proxy_objects import popups |
2406 | 56 | from ubuntuuitoolkit._custom_proxy_objects._qquicklistview import ( | 58 | from ubuntuuitoolkit._custom_proxy_objects._qquicklistview import ( |
2407 | 57 | QQuickListView | 59 | QQuickListView |
2408 | 58 | 60 | ||
2409 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py' | |||
2410 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py 2014-04-16 21:13:39 +0000 | |||
2411 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_common.py 2014-05-28 18:09:57 +0000 | |||
2412 | @@ -16,13 +16,21 @@ | |||
2413 | 16 | 16 | ||
2414 | 17 | """Common helpers for Ubuntu UI Toolkit Autopilot custom proxy objects.""" | 17 | """Common helpers for Ubuntu UI Toolkit Autopilot custom proxy objects.""" |
2415 | 18 | 18 | ||
2416 | 19 | import logging | ||
2417 | 19 | from distutils import version | 20 | from distutils import version |
2418 | 20 | 21 | ||
2419 | 21 | import autopilot | 22 | import autopilot |
2421 | 22 | from autopilot import platform, input | 23 | from autopilot import ( |
2422 | 24 | input, | ||
2423 | 25 | logging as autopilot_logging, | ||
2424 | 26 | platform | ||
2425 | 27 | ) | ||
2426 | 23 | from autopilot.introspection import dbus | 28 | from autopilot.introspection import dbus |
2427 | 24 | 29 | ||
2428 | 25 | 30 | ||
2429 | 31 | logger = logging.getLogger(__name__) | ||
2430 | 32 | |||
2431 | 33 | |||
2432 | 26 | class ToolkitException(Exception): | 34 | class ToolkitException(Exception): |
2433 | 27 | """Exception raised when there is an error with the emulator.""" | 35 | """Exception raised when there is an error with the emulator.""" |
2434 | 28 | 36 | ||
2435 | @@ -67,3 +75,39 @@ | |||
2436 | 67 | check_autopilot_version() | 75 | check_autopilot_version() |
2437 | 68 | super(UbuntuUIToolkitCustomProxyObjectBase, self).__init__(*args) | 76 | super(UbuntuUIToolkitCustomProxyObjectBase, self).__init__(*args) |
2438 | 69 | self.pointing_device = get_pointing_device() | 77 | self.pointing_device = get_pointing_device() |
2439 | 78 | |||
2440 | 79 | def is_flickable(self): | ||
2441 | 80 | """Check if the object is flickable. | ||
2442 | 81 | |||
2443 | 82 | If the object has a flicking attribute, we consider it as a flickable. | ||
2444 | 83 | |||
2445 | 84 | :return: True if the object is flickable. False otherwise. | ||
2446 | 85 | |||
2447 | 86 | """ | ||
2448 | 87 | try: | ||
2449 | 88 | self.flicking | ||
2450 | 89 | return True | ||
2451 | 90 | except AttributeError: | ||
2452 | 91 | return False | ||
2453 | 92 | |||
2454 | 93 | @autopilot_logging.log_action(logger.info) | ||
2455 | 94 | def swipe_into_view(self): | ||
2456 | 95 | """Make the object visible. | ||
2457 | 96 | |||
2458 | 97 | Currently it works only when the object needs to be swiped vertically. | ||
2459 | 98 | TODO implement horizontal swiping. --elopio - 2014-03-21 | ||
2460 | 99 | |||
2461 | 100 | """ | ||
2462 | 101 | flickable_parent = self._get_flickable_parent() | ||
2463 | 102 | flickable_parent.swipe_child_into_view(self) | ||
2464 | 103 | |||
2465 | 104 | def _get_flickable_parent(self): | ||
2466 | 105 | parent = self.get_parent() | ||
2467 | 106 | root = self.get_root_instance() | ||
2468 | 107 | while parent.id != root.id: | ||
2469 | 108 | if parent.is_flickable(): | ||
2470 | 109 | return parent | ||
2471 | 110 | parent = parent.get_parent() | ||
2472 | 111 | raise ToolkitException( | ||
2473 | 112 | "The element is not contained in a Flickable so it can't be " | ||
2474 | 113 | "swiped into view.") | ||
2475 | 70 | 114 | ||
2476 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py' | |||
2477 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-04-16 21:13:39 +0000 | |||
2478 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-05-28 18:09:57 +0000 | |||
2479 | @@ -38,21 +38,7 @@ | |||
2480 | 38 | return min(containers_bottom) | 38 | return min(containers_bottom) |
2481 | 39 | 39 | ||
2482 | 40 | 40 | ||
2498 | 41 | class Flickable(_common.UbuntuUIToolkitCustomProxyObjectBase): | 41 | class Scrollable(_common.UbuntuUIToolkitCustomProxyObjectBase): |
2484 | 42 | |||
2485 | 43 | @autopilot_logging.log_action(logger.info) | ||
2486 | 44 | def swipe_child_into_view(self, child): | ||
2487 | 45 | """Make the child visible. | ||
2488 | 46 | |||
2489 | 47 | Currently it works only when the object needs to be swiped vertically. | ||
2490 | 48 | TODO implement horizontal swiping. --elopio - 2014-03-21 | ||
2491 | 49 | |||
2492 | 50 | """ | ||
2493 | 51 | containers = self._get_containers() | ||
2494 | 52 | if not self._is_child_visible(child, containers): | ||
2495 | 53 | self._swipe_non_visible_child_into_view(child, containers) | ||
2496 | 54 | else: | ||
2497 | 55 | logger.debug('The element is already visible.') | ||
2499 | 56 | 42 | ||
2500 | 57 | def _get_containers(self): | 43 | def _get_containers(self): |
2501 | 58 | """Return a list with the containers to take into account when swiping. | 44 | """Return a list with the containers to take into account when swiping. |
2502 | @@ -68,15 +54,19 @@ | |||
2503 | 68 | def _get_top_container(self): | 54 | def _get_top_container(self): |
2504 | 69 | """Return the top-most container with a globalRect.""" | 55 | """Return the top-most container with a globalRect.""" |
2505 | 70 | root = self.get_root_instance() | 56 | root = self.get_root_instance() |
2515 | 71 | containers = [root] | 57 | parent = self.get_parent() |
2516 | 72 | while len(containers) == 1: | 58 | top_container = None |
2517 | 73 | try: | 59 | while parent.id != root.id: |
2518 | 74 | containers[0].globalRect | 60 | if hasattr(parent, 'globalRect'): |
2519 | 75 | return containers[0] | 61 | top_container = parent |
2520 | 76 | except AttributeError: | 62 | |
2521 | 77 | containers = containers[0].get_children() | 63 | parent = parent.get_parent() |
2522 | 78 | 64 | ||
2523 | 79 | raise _common.ToolkitException("Couldn't find the top-most container.") | 65 | if top_container is None: |
2524 | 66 | raise _common.ToolkitException( | ||
2525 | 67 | "Couldn't find the top-most container.") | ||
2526 | 68 | else: | ||
2527 | 69 | return top_container | ||
2528 | 80 | 70 | ||
2529 | 81 | def _is_child_visible(self, child, containers): | 71 | def _is_child_visible(self, child, containers): |
2530 | 82 | """Check if the center of the child is visible. | 72 | """Check if the center of the child is visible. |
2531 | @@ -90,8 +80,38 @@ | |||
2532 | 90 | return (object_center >= visible_top and | 80 | return (object_center >= visible_top and |
2533 | 91 | object_center <= visible_bottom) | 81 | object_center <= visible_bottom) |
2534 | 92 | 82 | ||
2535 | 83 | def _slow_drag(self, start_x, stop_x, start_y, stop_y): | ||
2536 | 84 | # If we drag too fast, we end up scrolling more than what we | ||
2537 | 85 | # should, sometimes missing the element we are looking for. | ||
2538 | 86 | # I found that when the flickDeceleration is 1500, the rate should be | ||
2539 | 87 | # 5 and that when it's 100, the rate should be 1. With those two points | ||
2540 | 88 | # we can get that the following equation. | ||
2541 | 89 | # XXX The deceleration might not be linear with respect to the rate, | ||
2542 | 90 | # but this works for the two types of scrollables we have for now. | ||
2543 | 91 | # --elopio - 2014-05-08 | ||
2544 | 92 | rate = (self.flickDeceleration + 250) / 350 | ||
2545 | 93 | self.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate=rate) | ||
2546 | 94 | |||
2547 | 95 | |||
2548 | 96 | class QQuickFlickable(Scrollable): | ||
2549 | 97 | |||
2550 | 98 | @autopilot_logging.log_action(logger.info) | ||
2551 | 99 | def swipe_child_into_view(self, child): | ||
2552 | 100 | """Make the child visible. | ||
2553 | 101 | |||
2554 | 102 | Currently it works only when the object needs to be swiped vertically. | ||
2555 | 103 | TODO implement horizontal swiping. --elopio - 2014-03-21 | ||
2556 | 104 | |||
2557 | 105 | """ | ||
2558 | 106 | containers = self._get_containers() | ||
2559 | 107 | if not self._is_child_visible(child, containers): | ||
2560 | 108 | self._swipe_non_visible_child_into_view(child, containers) | ||
2561 | 109 | else: | ||
2562 | 110 | logger.debug('The element is already visible.') | ||
2563 | 111 | |||
2564 | 93 | @autopilot_logging.log_action(logger.info) | 112 | @autopilot_logging.log_action(logger.info) |
2565 | 94 | def _swipe_non_visible_child_into_view(self, child, containers): | 113 | def _swipe_non_visible_child_into_view(self, child, containers): |
2566 | 114 | original_content_y = self.contentY | ||
2567 | 95 | while not self._is_child_visible(child, containers): | 115 | while not self._is_child_visible(child, containers): |
2568 | 96 | # Check the direction of the swipe based on the position of the | 116 | # Check the direction of the swipe based on the position of the |
2569 | 97 | # child relative to the immediate flickable container. | 117 | # child relative to the immediate flickable container. |
2570 | @@ -100,6 +120,10 @@ | |||
2571 | 100 | else: | 120 | else: |
2572 | 101 | self._swipe_to_show_more_below(containers) | 121 | self._swipe_to_show_more_below(containers) |
2573 | 102 | 122 | ||
2574 | 123 | if self.contentY == original_content_y: | ||
2575 | 124 | raise _common.ToolkitException( | ||
2576 | 125 | "Couldn't swipe in the flickable.") | ||
2577 | 126 | |||
2578 | 103 | @autopilot_logging.log_action(logger.info) | 127 | @autopilot_logging.log_action(logger.info) |
2579 | 104 | def _swipe_to_show_more_above(self, containers): | 128 | def _swipe_to_show_more_above(self, containers): |
2580 | 105 | if self.atYBeginning: | 129 | if self.atYBeginning: |
2581 | @@ -124,8 +148,12 @@ | |||
2582 | 124 | # bottom. | 148 | # bottom. |
2583 | 125 | top = _get_visible_container_top(containers) + 5 | 149 | top = _get_visible_container_top(containers) + 5 |
2584 | 126 | bottom = _get_visible_container_bottom(containers) - 5 | 150 | bottom = _get_visible_container_bottom(containers) - 5 |
2585 | 151 | |||
2586 | 127 | if direction == 'below': | 152 | if direction == 'below': |
2588 | 128 | start_y = bottom | 153 | # Take into account that swiping from below can open the toolbar or |
2589 | 154 | # trigger the bottom edge gesture. | ||
2590 | 155 | # XXX Do this only if we are close to the bottom edge. | ||
2591 | 156 | start_y = bottom - 20 | ||
2592 | 129 | stop_y = top | 157 | stop_y = top |
2593 | 130 | elif direction == 'above': | 158 | elif direction == 'above': |
2594 | 131 | start_y = top | 159 | start_y = top |
2595 | @@ -137,11 +165,6 @@ | |||
2596 | 137 | self.dragging.wait_for(False) | 165 | self.dragging.wait_for(False) |
2597 | 138 | self.moving.wait_for(False) | 166 | self.moving.wait_for(False) |
2598 | 139 | 167 | ||
2599 | 140 | def _slow_drag(self, start_x, stop_x, start_y, stop_y): | ||
2600 | 141 | # If we drag too fast, we end up scrolling more than what we | ||
2601 | 142 | # should, sometimes missing the element we are looking for. | ||
2602 | 143 | self.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate=5) | ||
2603 | 144 | |||
2604 | 145 | @autopilot_logging.log_action(logger.info) | 168 | @autopilot_logging.log_action(logger.info) |
2605 | 146 | def _scroll_to_top(self): | 169 | def _scroll_to_top(self): |
2606 | 147 | if not self.atYBeginning: | 170 | if not self.atYBeginning: |
2607 | 148 | 171 | ||
2608 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py' | |||
2609 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-05-02 18:55:43 +0000 | |||
2610 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-05-28 18:09:57 +0000 | |||
2611 | @@ -21,6 +21,7 @@ | |||
2612 | 21 | 21 | ||
2613 | 22 | from ubuntuuitoolkit._custom_proxy_objects import ( | 22 | from ubuntuuitoolkit._custom_proxy_objects import ( |
2614 | 23 | _common, | 23 | _common, |
2615 | 24 | _mainview, | ||
2616 | 24 | _tabbar | 25 | _tabbar |
2617 | 25 | ) | 26 | ) |
2618 | 26 | 27 | ||
2619 | @@ -36,9 +37,31 @@ | |||
2620 | 36 | 37 | ||
2621 | 37 | def __init__(self, *args): | 38 | def __init__(self, *args): |
2622 | 38 | super(Header, self).__init__(*args) | 39 | super(Header, self).__init__(*args) |
2624 | 39 | self.pointing_device = _common.get_pointing_device() | 40 | # XXX we need a better way to keep reference to the main view. |
2625 | 41 | # --elopio - 2014-02-26 | ||
2626 | 42 | self.main_view = self.get_root_instance().select_single( | ||
2627 | 43 | _mainview.MainView) | ||
2628 | 44 | |||
2629 | 45 | def _show_if_not_visible(self): | ||
2630 | 46 | if not self._is_visible(): | ||
2631 | 47 | self._show() | ||
2632 | 48 | |||
2633 | 49 | def _is_visible(self): | ||
2634 | 50 | return self.y == 0 | ||
2635 | 51 | |||
2636 | 52 | def _show(self): | ||
2637 | 53 | # FIXME This will fail if the header is not linked to a flickable that | ||
2638 | 54 | # fills the main view. The header has a flickable property but it | ||
2639 | 55 | # can't be read by autopilot. See bug http://pad.lv/1318829 | ||
2640 | 56 | start_x = stop_x = (self.globalRect.x + self.globalRect.width) // 2 | ||
2641 | 57 | start_y = self.main_view.globalRect.y + 5 | ||
2642 | 58 | stop_y = start_y + self.globalRect.height | ||
2643 | 59 | self.pointing_device.drag(start_x, start_y, stop_x, stop_y) | ||
2644 | 60 | self.y.wait_for(0) | ||
2645 | 40 | 61 | ||
2646 | 41 | def click_back_button(self): | 62 | def click_back_button(self): |
2647 | 63 | self._show_if_not_visible() | ||
2648 | 64 | |||
2649 | 42 | if self.useDeprecatedToolbar: | 65 | if self.useDeprecatedToolbar: |
2650 | 43 | raise _common.ToolkitException('Old header has no back button') | 66 | raise _common.ToolkitException('Old header has no back button') |
2651 | 44 | try: | 67 | try: |
2652 | @@ -51,6 +74,8 @@ | |||
2653 | 51 | self.pointing_device.click_object(back_button) | 74 | self.pointing_device.click_object(back_button) |
2654 | 52 | 75 | ||
2655 | 53 | def click_custom_back_button(self): | 76 | def click_custom_back_button(self): |
2656 | 77 | self._show_if_not_visible() | ||
2657 | 78 | |||
2658 | 54 | if self.useDeprecatedToolbar: | 79 | if self.useDeprecatedToolbar: |
2659 | 55 | raise _common.ToolkitException( | 80 | raise _common.ToolkitException( |
2660 | 56 | 'Old header has no custom back button') | 81 | 'Old header has no custom back button') |
2661 | @@ -79,6 +104,8 @@ | |||
2662 | 79 | :raise ToolkitEmulatorException: If the main view has no tabs. | 104 | :raise ToolkitEmulatorException: If the main view has no tabs. |
2663 | 80 | 105 | ||
2664 | 81 | """ | 106 | """ |
2665 | 107 | self._show_if_not_visible() | ||
2666 | 108 | |||
2667 | 82 | if self.useDeprecatedToolbar: | 109 | if self.useDeprecatedToolbar: |
2668 | 83 | self._switch_to_next_tab_in_deprecated_tabbar() | 110 | self._switch_to_next_tab_in_deprecated_tabbar() |
2669 | 84 | else: | 111 | else: |
2670 | @@ -108,6 +135,8 @@ | |||
2671 | 108 | useDeprecatedToolbar is set. | 135 | useDeprecatedToolbar is set. |
2672 | 109 | 136 | ||
2673 | 110 | """ | 137 | """ |
2674 | 138 | self._show_if_not_visible() | ||
2675 | 139 | |||
2676 | 111 | if self.useDeprecatedToolbar: | 140 | if self.useDeprecatedToolbar: |
2677 | 112 | raise _common.ToolkitException( | 141 | raise _common.ToolkitException( |
2678 | 113 | "Header.swtich_to_tab_by_index only works with new header") | 142 | "Header.swtich_to_tab_by_index only works with new header") |
2679 | @@ -145,6 +174,8 @@ | |||
2680 | 145 | name. | 174 | name. |
2681 | 146 | 175 | ||
2682 | 147 | """ | 176 | """ |
2683 | 177 | self._show_if_not_visible() | ||
2684 | 178 | |||
2685 | 148 | button = self._get_action_button(action_object_name) | 179 | button = self._get_action_button(action_object_name) |
2686 | 149 | self.pointing_device.click_object(button) | 180 | self.pointing_device.click_object(button) |
2687 | 150 | 181 | ||
2688 | 151 | 182 | ||
2689 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_mainview.py' | |||
2690 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_mainview.py 2014-04-30 18:17:32 +0000 | |||
2691 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_mainview.py 2014-05-28 18:09:57 +0000 | |||
2692 | @@ -169,7 +169,7 @@ | |||
2693 | 169 | :parameter object_name: The QML objectName property of the popover. | 169 | :parameter object_name: The QML objectName property of the popover. |
2694 | 170 | 170 | ||
2695 | 171 | """ | 171 | """ |
2697 | 172 | return self.select_single( | 172 | return self.wait_select_single( |
2698 | 173 | popups.ActionSelectionPopover, objectName=object_name) | 173 | popups.ActionSelectionPopover, objectName=object_name) |
2699 | 174 | 174 | ||
2700 | 175 | @autopilot_logging.log_action(logger.info) | 175 | @autopilot_logging.log_action(logger.info) |
2701 | 176 | 176 | ||
2702 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py' | |||
2703 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py 2014-04-16 21:13:39 +0000 | |||
2704 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_qquicklistview.py 2014-05-28 18:09:57 +0000 | |||
2705 | @@ -19,22 +19,24 @@ | |||
2706 | 19 | from autopilot import logging as autopilot_logging | 19 | from autopilot import logging as autopilot_logging |
2707 | 20 | from autopilot.introspection import dbus | 20 | from autopilot.introspection import dbus |
2708 | 21 | 21 | ||
2712 | 22 | from ubuntuuitoolkit._custom_proxy_objects import _flickable | 22 | from ubuntuuitoolkit._custom_proxy_objects import _common, _flickable |
2710 | 23 | from ubuntuuitoolkit._custom_proxy_objects import _common | ||
2711 | 24 | |||
2713 | 25 | 23 | ||
2714 | 26 | logger = logging.getLogger(__name__) | 24 | logger = logging.getLogger(__name__) |
2715 | 27 | 25 | ||
2716 | 28 | 26 | ||
2718 | 29 | class QQuickListView(_flickable.Flickable): | 27 | class QQuickListView(_flickable.QQuickFlickable): |
2719 | 30 | 28 | ||
2720 | 31 | @autopilot_logging.log_action(logger.info) | 29 | @autopilot_logging.log_action(logger.info) |
2722 | 32 | def click_element(self, object_name): | 30 | def click_element(self, object_name, direction=None): |
2723 | 33 | """Click an element from the list. | 31 | """Click an element from the list. |
2724 | 34 | 32 | ||
2725 | 35 | It swipes the element into view if it's center is not visible. | 33 | It swipes the element into view if it's center is not visible. |
2726 | 36 | 34 | ||
2727 | 37 | :parameter objectName: The objectName property of the element to click. | 35 | :parameter objectName: The objectName property of the element to click. |
2728 | 36 | :parameter direction: The direction where the element is, it can be | ||
2729 | 37 | either 'above' or 'below'. Default value is None, which means we | ||
2730 | 38 | don't know where the object is and we will need to search the full | ||
2731 | 39 | list. | ||
2732 | 38 | 40 | ||
2733 | 39 | """ | 41 | """ |
2734 | 40 | try: | 42 | try: |
2735 | @@ -42,16 +44,31 @@ | |||
2736 | 42 | except dbus.StateNotFoundError: | 44 | except dbus.StateNotFoundError: |
2737 | 43 | # The element might be on a part of the list that hasn't been | 45 | # The element might be on a part of the list that hasn't been |
2738 | 44 | # created yet. We have to search for it scrolling the entire list. | 46 | # created yet. We have to search for it scrolling the entire list. |
2740 | 45 | element = self._find_element(object_name) | 47 | element = self._find_element(object_name, direction) |
2741 | 46 | self.swipe_child_into_view(element) | 48 | self.swipe_child_into_view(element) |
2742 | 47 | self.pointing_device.click_object(element) | 49 | self.pointing_device.click_object(element) |
2743 | 48 | 50 | ||
2744 | 49 | @autopilot_logging.log_action(logger.info) | 51 | @autopilot_logging.log_action(logger.info) |
2750 | 50 | def _find_element(self, object_name): | 52 | def _find_element(self, object_name, direction=None): |
2751 | 51 | self._scroll_to_top() | 53 | if direction is None: |
2752 | 52 | while not self.atYEnd: | 54 | # We don't know where the object is so we start looking for it from |
2753 | 53 | containers = self._get_containers() | 55 | # the top. |
2754 | 54 | self._swipe_to_show_more_below(containers) | 56 | self._scroll_to_top() |
2755 | 57 | direction = 'below' | ||
2756 | 58 | |||
2757 | 59 | if direction == 'below': | ||
2758 | 60 | fail_condition = lambda: self.atYEnd | ||
2759 | 61 | swipe_method = self._swipe_to_show_more_below | ||
2760 | 62 | elif direction == 'above': | ||
2761 | 63 | fail_condition = lambda: self.atYBeginning | ||
2762 | 64 | swipe_method = self._swipe_to_show_more_above | ||
2763 | 65 | else: | ||
2764 | 66 | raise _common.ToolkitException( | ||
2765 | 67 | 'Invalid direction: {}'.format(direction)) | ||
2766 | 68 | |||
2767 | 69 | containers = self._get_containers() | ||
2768 | 70 | while not fail_condition(): | ||
2769 | 71 | swipe_method(containers) | ||
2770 | 55 | try: | 72 | try: |
2771 | 56 | return self.select_single(objectName=object_name) | 73 | return self.select_single(objectName=object_name) |
2772 | 57 | except dbus.StateNotFoundError: | 74 | except dbus.StateNotFoundError: |
2773 | 58 | 75 | ||
2774 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py' | |||
2775 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py 2014-04-16 21:13:39 +0000 | |||
2776 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_textfield.py 2014-05-28 18:09:57 +0000 | |||
2777 | @@ -81,8 +81,13 @@ | |||
2778 | 81 | self.keyboard.press_and_release('BackSpace') | 81 | self.keyboard.press_and_release('BackSpace') |
2779 | 82 | 82 | ||
2780 | 83 | def _select_all(self): | 83 | def _select_all(self): |
2786 | 84 | self.pointing_device.click_object(self, press_duration=1) | 84 | if not self._is_all_text_selected(): |
2787 | 85 | root = self.get_root_instance() | 85 | self.pointing_device.click_object(self, press_duration=1) |
2788 | 86 | main_view = root.select_single(_mainview.MainView) | 86 | root = self.get_root_instance() |
2789 | 87 | popover = main_view.get_action_selection_popover('text_input_popover') | 87 | main_view = root.select_single(_mainview.MainView) |
2790 | 88 | popover.click_button_by_text('Select All') | 88 | popover = main_view.get_action_selection_popover( |
2791 | 89 | 'text_input_popover') | ||
2792 | 90 | popover.click_button_by_text('Select All') | ||
2793 | 91 | |||
2794 | 92 | def _is_all_text_selected(self): | ||
2795 | 93 | return self.text == self.selectedText | ||
2796 | 89 | 94 | ||
2797 | === added file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/pickers.py' | |||
2798 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/pickers.py 1970-01-01 00:00:00 +0000 | |||
2799 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/pickers.py 2014-05-28 18:09:57 +0000 | |||
2800 | @@ -0,0 +1,255 @@ | |||
2801 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
2802 | 2 | # | ||
2803 | 3 | # Copyright (C) 2014 Canonical Ltd. | ||
2804 | 4 | # | ||
2805 | 5 | # This program is free software; you can redistribute it and/or modify | ||
2806 | 6 | # it under the terms of the GNU Lesser General Public License as published by | ||
2807 | 7 | # the Free Software Foundation; version 3. | ||
2808 | 8 | # | ||
2809 | 9 | # This program is distributed in the hope that it will be useful, | ||
2810 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2811 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2812 | 12 | # GNU Lesser General Public License for more details. | ||
2813 | 13 | # | ||
2814 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
2815 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2816 | 16 | |||
2817 | 17 | import datetime | ||
2818 | 18 | import logging | ||
2819 | 19 | |||
2820 | 20 | from autopilot import logging as autopilot_logging | ||
2821 | 21 | from autopilot.introspection import dbus | ||
2822 | 22 | |||
2823 | 23 | from ubuntuuitoolkit._custom_proxy_objects import ( | ||
2824 | 24 | _common, | ||
2825 | 25 | _flickable, | ||
2826 | 26 | _qquicklistview | ||
2827 | 27 | ) | ||
2828 | 28 | |||
2829 | 29 | |||
2830 | 30 | logger = logging.getLogger(__name__) | ||
2831 | 31 | |||
2832 | 32 | |||
2833 | 33 | class DatePicker(_common.UbuntuUIToolkitCustomProxyObjectBase): | ||
2834 | 34 | """Autopilot helper for the DatePicker component.""" | ||
2835 | 35 | |||
2836 | 36 | @autopilot_logging.log_action(logger.info) | ||
2837 | 37 | def pick_date(self, date): | ||
2838 | 38 | """Pick a date from the date picker. | ||
2839 | 39 | |||
2840 | 40 | :parameter date: The date to pick. | ||
2841 | 41 | :type date: An object with year, month and day attributes, like | ||
2842 | 42 | python's datetime.date. | ||
2843 | 43 | :raises ubuntuuitoolkit.ToolkitException if the mode of the picker | ||
2844 | 44 | doesn't let select a date. | ||
2845 | 45 | |||
2846 | 46 | """ | ||
2847 | 47 | if not self._is_date_picker(): | ||
2848 | 48 | raise _common.ToolkitException( | ||
2849 | 49 | "Can't pick date. The picker mode is: {!r}.".format(self.mode)) | ||
2850 | 50 | if 'Years' in self.mode: | ||
2851 | 51 | self._pick_year(date.year) | ||
2852 | 52 | self.year.wait_for(date.year) | ||
2853 | 53 | if 'Month' in self.mode: | ||
2854 | 54 | # Python's date object starts at one. The model in the date picker | ||
2855 | 55 | # at 0. | ||
2856 | 56 | self._pick_month(date.month - 1) | ||
2857 | 57 | self.month.wait_for(date.month - 1) | ||
2858 | 58 | if 'Day' in self.mode: | ||
2859 | 59 | self._pick_day(date.day) | ||
2860 | 60 | self.day.wait_for(date.day) | ||
2861 | 61 | |||
2862 | 62 | def _is_date_picker(self): | ||
2863 | 63 | mode = self.mode | ||
2864 | 64 | if 'Years' in mode or 'Months' in mode or 'Days' in mode: | ||
2865 | 65 | return True | ||
2866 | 66 | else: | ||
2867 | 67 | return False | ||
2868 | 68 | |||
2869 | 69 | @autopilot_logging.log_action(logger.info) | ||
2870 | 70 | def _pick_year(self, year): | ||
2871 | 71 | picker = self.select_single( | ||
2872 | 72 | 'Picker', objectName='PickerRow_YearPicker') | ||
2873 | 73 | list_view = picker.select_single( | ||
2874 | 74 | _qquicklistview.QQuickListView, objectName='Picker_Linear') | ||
2875 | 75 | self._pick_value(self.year, year, list_view) | ||
2876 | 76 | |||
2877 | 77 | @autopilot_logging.log_action(logger.info) | ||
2878 | 78 | def _pick_month(self, month): | ||
2879 | 79 | self._pick_value_from_path_view('Month', self.month, month) | ||
2880 | 80 | |||
2881 | 81 | @autopilot_logging.log_action(logger.info) | ||
2882 | 82 | def _pick_day(self, day): | ||
2883 | 83 | # Python's date object starts at one. The model in the date picker | ||
2884 | 84 | # at 0. | ||
2885 | 85 | self._pick_value_from_path_view('Day', self.day - 1, day - 1) | ||
2886 | 86 | |||
2887 | 87 | def _pick_value_from_path_view(self, type_, current_value, new_value): | ||
2888 | 88 | picker = self.select_single( | ||
2889 | 89 | 'Picker', objectName='PickerRow_{}Picker'.format(type_)) | ||
2890 | 90 | path_view = picker.select_single( | ||
2891 | 91 | QQuickPathView, objectName='Picker_WrapAround') | ||
2892 | 92 | self._pick_value(current_value, new_value, path_view) | ||
2893 | 93 | |||
2894 | 94 | def _pick_value(self, current_value, new_value, scrollable): | ||
2895 | 95 | if new_value > current_value: | ||
2896 | 96 | direction = 'below' | ||
2897 | 97 | elif new_value < current_value: | ||
2898 | 98 | direction = 'above' | ||
2899 | 99 | else: | ||
2900 | 100 | logger.debug('The value is already selected.') | ||
2901 | 101 | return | ||
2902 | 102 | scrollable.click_element( | ||
2903 | 103 | object_name='PickerRow_PickerLabel{}'.format(new_value), | ||
2904 | 104 | direction=direction) | ||
2905 | 105 | |||
2906 | 106 | def get_date(self): | ||
2907 | 107 | """Return the currently selected date. | ||
2908 | 108 | |||
2909 | 109 | :return: a python datetime.date object with the selected date. | ||
2910 | 110 | |||
2911 | 111 | """ | ||
2912 | 112 | # Python's date object starts at one. The model in the date picker | ||
2913 | 113 | # at 0. | ||
2914 | 114 | return datetime.date(self.year, self.month + 1, self.day) | ||
2915 | 115 | |||
2916 | 116 | @autopilot_logging.log_action(logger.info) | ||
2917 | 117 | def pick_time(self, time): | ||
2918 | 118 | """Pick a time from the date picker. | ||
2919 | 119 | |||
2920 | 120 | :parameter time: The time to pick. | ||
2921 | 121 | :type time: An object with hour, minute and second attributes, like | ||
2922 | 122 | python's datetime.time. | ||
2923 | 123 | :raises ubuntuuitoolkit.ToolkitException if the mode of the picker | ||
2924 | 124 | doesn't let select a time. | ||
2925 | 125 | |||
2926 | 126 | """ | ||
2927 | 127 | if not self._is_time_picker(): | ||
2928 | 128 | raise _common.ToolkitException( | ||
2929 | 129 | "Can't pick time. The picker mode is: {!r}.".format(self.mode)) | ||
2930 | 130 | if 'Hours' in self.mode: | ||
2931 | 131 | self._pick_hour(time.hour) | ||
2932 | 132 | self.hours.wait_for(time.hour) | ||
2933 | 133 | if 'Minutes' in self.mode: | ||
2934 | 134 | self._pick_minute(time.minute) | ||
2935 | 135 | self.minutes.wait_for(time.minute) | ||
2936 | 136 | if 'Seconds' in self.mode: | ||
2937 | 137 | self._pick_second(time.second) | ||
2938 | 138 | self.seconds.wait_for(time.second) | ||
2939 | 139 | |||
2940 | 140 | def _is_time_picker(self): | ||
2941 | 141 | mode = self.mode | ||
2942 | 142 | if 'Hours' in mode or 'Minutes' in mode or 'Seconds' in mode: | ||
2943 | 143 | return True | ||
2944 | 144 | else: | ||
2945 | 145 | return False | ||
2946 | 146 | |||
2947 | 147 | @autopilot_logging.log_action(logger.info) | ||
2948 | 148 | def _pick_hour(self, hour): | ||
2949 | 149 | self._pick_value_from_path_view('Hours', self.hours, hour) | ||
2950 | 150 | |||
2951 | 151 | @autopilot_logging.log_action(logger.info) | ||
2952 | 152 | def _pick_minute(self, minute): | ||
2953 | 153 | self._pick_value_from_path_view('Minutes', self.minutes, minute) | ||
2954 | 154 | |||
2955 | 155 | @autopilot_logging.log_action(logger.info) | ||
2956 | 156 | def _pick_second(self, second): | ||
2957 | 157 | self._pick_value_from_path_view('Seconds', self.seconds, second) | ||
2958 | 158 | |||
2959 | 159 | def get_time(self): | ||
2960 | 160 | """Return the currently selected time. | ||
2961 | 161 | |||
2962 | 162 | :return: a python datetime.time object with the selected time. | ||
2963 | 163 | |||
2964 | 164 | """ | ||
2965 | 165 | return datetime.time(self.hours, self.minutes, self.seconds) | ||
2966 | 166 | |||
2967 | 167 | |||
2968 | 168 | class QQuickPathView(_flickable.Scrollable): | ||
2969 | 169 | |||
2970 | 170 | # TODO make it more general and move it to its own module. | ||
2971 | 171 | # --elopio - 2014-05-06 | ||
2972 | 172 | |||
2973 | 173 | @autopilot_logging.log_action(logger.info) | ||
2974 | 174 | def click_element(self, object_name, direction='below'): | ||
2975 | 175 | try: | ||
2976 | 176 | element = self.select_single(objectName=object_name) | ||
2977 | 177 | except dbus.StateNotFoundError: | ||
2978 | 178 | # The element might be on a part of the list that hasn't been | ||
2979 | 179 | # created yet. We have to search for it scrolling. | ||
2980 | 180 | element = self._find_element(object_name, direction) | ||
2981 | 181 | self.swipe_child_into_view(element) | ||
2982 | 182 | self.pointing_device.click_object(element) | ||
2983 | 183 | |||
2984 | 184 | @autopilot_logging.log_action(logger.info) | ||
2985 | 185 | def _find_element(self, object_name, direction): | ||
2986 | 186 | containers = self._get_containers() | ||
2987 | 187 | for index in range(self.count): | ||
2988 | 188 | if direction == 'below': | ||
2989 | 189 | swipe_method = self._swipe_to_show_one_more_below | ||
2990 | 190 | elif direction == 'above': | ||
2991 | 191 | swipe_method = self._swipe_to_show_one_more_above | ||
2992 | 192 | else: | ||
2993 | 193 | raise _common.ToolkitException( | ||
2994 | 194 | 'Invalid direction: {}'.format(direction)) | ||
2995 | 195 | |||
2996 | 196 | swipe_method(containers) | ||
2997 | 197 | |||
2998 | 198 | try: | ||
2999 | 199 | return self.select_single(objectName=object_name) | ||
3000 | 200 | except dbus.StateNotFoundError: | ||
3001 | 201 | pass | ||
3002 | 202 | raise _common.ToolkitException( | ||
3003 | 203 | 'List element with objectName "{}" not found.'.format(object_name)) | ||
3004 | 204 | |||
3005 | 205 | @autopilot_logging.log_action(logger.info) | ||
3006 | 206 | def _swipe_to_show_one_more_above(self, containers): | ||
3007 | 207 | self._swipe_to_show_one_more('above', containers) | ||
3008 | 208 | |||
3009 | 209 | @autopilot_logging.log_action(logger.info) | ||
3010 | 210 | def _swipe_to_show_one_more_below(self, containers): | ||
3011 | 211 | self._swipe_to_show_one_more('below', containers) | ||
3012 | 212 | |||
3013 | 213 | def _swipe_to_show_one_more(self, direction, containers): | ||
3014 | 214 | start_x = stop_x = self.globalRect.x + (self.globalRect.width // 2) | ||
3015 | 215 | center_y = self.globalRect.y + (self.globalRect.height // 2) | ||
3016 | 216 | # XXX This assumes all the children are of the same height | ||
3017 | 217 | child = self.get_children_by_type('PickerDelegate')[0] | ||
3018 | 218 | top = center_y - (child.globalRect.height // 2) | ||
3019 | 219 | bottom = center_y + (child.globalRect.height // 2) | ||
3020 | 220 | if direction == 'below': | ||
3021 | 221 | start_y = bottom | ||
3022 | 222 | stop_y = top | ||
3023 | 223 | elif direction == 'above': | ||
3024 | 224 | start_y = top | ||
3025 | 225 | stop_y = bottom | ||
3026 | 226 | else: | ||
3027 | 227 | raise _common.ToolkitException( | ||
3028 | 228 | 'Invalid direction {}.'.format(direction)) | ||
3029 | 229 | self._slow_drag(start_x, stop_x, start_y, stop_y) | ||
3030 | 230 | self.dragging.wait_for(False) | ||
3031 | 231 | self.moving.wait_for(False) | ||
3032 | 232 | |||
3033 | 233 | @autopilot_logging.log_action(logger.info) | ||
3034 | 234 | def swipe_child_into_view(self, child): | ||
3035 | 235 | """Make the child visible. | ||
3036 | 236 | |||
3037 | 237 | Currently it works only when the object needs to be swiped vertically. | ||
3038 | 238 | TODO implement horizontal swiping. --elopio - 2014-03-21 | ||
3039 | 239 | |||
3040 | 240 | """ | ||
3041 | 241 | containers = self._get_containers() | ||
3042 | 242 | if not self._is_child_visible(child, containers): | ||
3043 | 243 | self._swipe_non_visible_child_into_view(child, containers) | ||
3044 | 244 | else: | ||
3045 | 245 | logger.debug('The element is already visible.') | ||
3046 | 246 | |||
3047 | 247 | @autopilot_logging.log_action(logger.info) | ||
3048 | 248 | def _swipe_non_visible_child_into_view(self, child, containers): | ||
3049 | 249 | while not self._is_child_visible(child, containers): | ||
3050 | 250 | # Check the direction of the swipe based on the position of the | ||
3051 | 251 | # child relative to the immediate flickable container. | ||
3052 | 252 | if child.globalRect.y < self.globalRect.y: | ||
3053 | 253 | self._swipe_to_show_one_more_above(containers) | ||
3054 | 254 | else: | ||
3055 | 255 | self._swipe_to_show_one_more_below(containers) | ||
3056 | 0 | 256 | ||
3057 | === modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py' | |||
3058 | --- tests/autopilot/ubuntuuitoolkit/emulators.py 2014-04-25 18:39:51 +0000 | |||
3059 | +++ tests/autopilot/ubuntuuitoolkit/emulators.py 2014-05-28 18:09:57 +0000 | |||
3060 | @@ -36,12 +36,12 @@ | |||
3061 | 36 | 'CheckBox', | 36 | 'CheckBox', |
3062 | 37 | 'ComposerSheet', | 37 | 'ComposerSheet', |
3063 | 38 | 'Empty', | 38 | 'Empty', |
3064 | 39 | 'Flickable', | ||
3065 | 40 | 'Header', | 39 | 'Header', |
3066 | 41 | 'ItemSelector', | 40 | 'ItemSelector', |
3067 | 42 | 'MainView', | 41 | 'MainView', |
3068 | 43 | 'MultiValue', | 42 | 'MultiValue', |
3069 | 44 | 'OptionSelector', | 43 | 'OptionSelector', |
3070 | 44 | 'QQuickFlickable', | ||
3071 | 45 | 'QQuickListView', | 45 | 'QQuickListView', |
3072 | 46 | 'SingleControl', | 46 | 'SingleControl', |
3073 | 47 | 'SingleValue', | 47 | 'SingleValue', |
3074 | @@ -61,10 +61,10 @@ | |||
3075 | 61 | get_keyboard, | 61 | get_keyboard, |
3076 | 62 | get_pointing_device, | 62 | get_pointing_device, |
3077 | 63 | CheckBox, | 63 | CheckBox, |
3078 | 64 | Flickable, | ||
3079 | 65 | Header, | 64 | Header, |
3080 | 66 | MainView, | 65 | MainView, |
3081 | 67 | OptionSelector, | 66 | OptionSelector, |
3082 | 67 | QQuickFlickable, | ||
3083 | 68 | QQuickListView, | 68 | QQuickListView, |
3084 | 69 | TabBar, | 69 | TabBar, |
3085 | 70 | Tabs, | 70 | Tabs, |
3086 | 71 | 71 | ||
3087 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py' | |||
3088 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 1970-01-01 00:00:00 +0000 | |||
3089 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 2014-05-28 18:09:57 +0000 | |||
3090 | @@ -0,0 +1,203 @@ | |||
3091 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
3092 | 2 | # | ||
3093 | 3 | # Copyright (C) 2014 Canonical Ltd. | ||
3094 | 4 | # | ||
3095 | 5 | # This program is free software; you can redistribute it and/or modify | ||
3096 | 6 | # it under the terms of the GNU Lesser General Public License as published by | ||
3097 | 7 | # the Free Software Foundation; version 3. | ||
3098 | 8 | # | ||
3099 | 9 | # This program is distributed in the hope that it will be useful, | ||
3100 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3101 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3102 | 12 | # GNU Lesser General Public License for more details. | ||
3103 | 13 | # | ||
3104 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
3105 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3106 | 16 | |||
3107 | 17 | import datetime | ||
3108 | 18 | |||
3109 | 19 | import ubuntuuitoolkit | ||
3110 | 20 | from ubuntuuitoolkit import pickers, tests | ||
3111 | 21 | |||
3112 | 22 | |||
3113 | 23 | class DatePickerBaseTestCase(tests.QMLStringAppTestCase): | ||
3114 | 24 | |||
3115 | 25 | test_qml = (""" | ||
3116 | 26 | import QtQuick 2.0 | ||
3117 | 27 | import Ubuntu.Components 1.1 | ||
3118 | 28 | import Ubuntu.Components.Pickers 1.0 | ||
3119 | 29 | |||
3120 | 30 | MainView { | ||
3121 | 31 | width: units.gu(48) | ||
3122 | 32 | height: units.gu(60) | ||
3123 | 33 | |||
3124 | 34 | Column { | ||
3125 | 35 | DatePicker { | ||
3126 | 36 | id: datePicker | ||
3127 | 37 | objectName: 'datePicker' | ||
3128 | 38 | mode: 'Years|Months|Days' | ||
3129 | 39 | date: { | ||
3130 | 40 | var d = new Date() | ||
3131 | 41 | // Make sure that the picker will have higher and lower values | ||
3132 | 42 | // to select. | ||
3133 | 43 | d.setFullYear(d.getFullYear() + 25) | ||
3134 | 44 | d.setMonth('5') | ||
3135 | 45 | d.setDate('15') | ||
3136 | 46 | return d | ||
3137 | 47 | } | ||
3138 | 48 | } | ||
3139 | 49 | DatePicker { | ||
3140 | 50 | id: timePicker | ||
3141 | 51 | objectName: 'timePicker' | ||
3142 | 52 | mode: 'Hours|Minutes|Seconds' | ||
3143 | 53 | date: { | ||
3144 | 54 | var d = new Date() | ||
3145 | 55 | // Make sure that the picker will have higher and lower values | ||
3146 | 56 | // to select. | ||
3147 | 57 | d.setHours(12) | ||
3148 | 58 | d.setMinutes('30') | ||
3149 | 59 | d.setSeconds('30') | ||
3150 | 60 | return d | ||
3151 | 61 | } | ||
3152 | 62 | } | ||
3153 | 63 | } | ||
3154 | 64 | } | ||
3155 | 65 | """) | ||
3156 | 66 | |||
3157 | 67 | def setUp(self): | ||
3158 | 68 | super(DatePickerBaseTestCase, self).setUp() | ||
3159 | 69 | self.date_picker = self.main_view.select_single( | ||
3160 | 70 | pickers.DatePicker, objectName='datePicker') | ||
3161 | 71 | self.time_picker = self.main_view.select_single( | ||
3162 | 72 | pickers.DatePicker, objectName='timePicker') | ||
3163 | 73 | |||
3164 | 74 | |||
3165 | 75 | class DatePickerTestCase(DatePickerBaseTestCase): | ||
3166 | 76 | |||
3167 | 77 | def test_select_date_picker_must_return_custom_proxy_object(self): | ||
3168 | 78 | self.assertIsInstance( | ||
3169 | 79 | self.date_picker, pickers.DatePicker) | ||
3170 | 80 | |||
3171 | 81 | def test_pick_date_on_time_picker_must_raise_exception(self): | ||
3172 | 82 | error = self.assertRaises( | ||
3173 | 83 | ubuntuuitoolkit.ToolkitException, self.time_picker.pick_date, | ||
3174 | 84 | 'dummy') | ||
3175 | 85 | self.assertEqual( | ||
3176 | 86 | str(error), | ||
3177 | 87 | "Can't pick date. The picker mode is: {!r}.".format( | ||
3178 | 88 | self.time_picker.mode)) | ||
3179 | 89 | |||
3180 | 90 | def test_pick_time_on_date_picker_must_raise_exception(self): | ||
3181 | 91 | error = self.assertRaises( | ||
3182 | 92 | ubuntuuitoolkit.ToolkitException, self.date_picker.pick_time, | ||
3183 | 93 | 'dummy') | ||
3184 | 94 | self.assertEqual( | ||
3185 | 95 | str(error), | ||
3186 | 96 | "Can't pick time. The picker mode is: {!r}.".format( | ||
3187 | 97 | self.date_picker.mode)) | ||
3188 | 98 | |||
3189 | 99 | def test_swipe_to_show_one_more_below_must_select_next_index(self): | ||
3190 | 100 | """Test that we don't end up swiping more than needed. | ||
3191 | 101 | |||
3192 | 102 | This would cause us to miss the element we are looking for, and to have | ||
3193 | 103 | to swipe many times in order to finally click it. | ||
3194 | 104 | |||
3195 | 105 | """ | ||
3196 | 106 | picker = self.main_view.select_single( | ||
3197 | 107 | 'Picker', objectName='PickerRow_DayPicker') | ||
3198 | 108 | path_view = picker.select_single( | ||
3199 | 109 | pickers.QQuickPathView, objectName='Picker_WrapAround') | ||
3200 | 110 | current_index = path_view.currentIndex | ||
3201 | 111 | |||
3202 | 112 | path_view._swipe_to_show_one_more_below(path_view._get_containers()) | ||
3203 | 113 | |||
3204 | 114 | self.assertEqual(path_view.currentIndex, current_index + 1) | ||
3205 | 115 | |||
3206 | 116 | def test_swipe_to_show_one_more_above_must_select_previous_index(self): | ||
3207 | 117 | """Test that we don't end up swiping more than needed. | ||
3208 | 118 | |||
3209 | 119 | This would cause us to miss the element we are looking for, and to have | ||
3210 | 120 | to swipe many times in order to finally click it. | ||
3211 | 121 | |||
3212 | 122 | """ | ||
3213 | 123 | picker = self.main_view.select_single( | ||
3214 | 124 | 'Picker', objectName='PickerRow_DayPicker') | ||
3215 | 125 | path_view = picker.select_single( | ||
3216 | 126 | pickers.QQuickPathView, objectName='Picker_WrapAround') | ||
3217 | 127 | current_index = path_view.currentIndex | ||
3218 | 128 | |||
3219 | 129 | path_view._swipe_to_show_one_more_above(path_view._get_containers()) | ||
3220 | 130 | |||
3221 | 131 | self.assertEqual(path_view.currentIndex, current_index - 1) | ||
3222 | 132 | |||
3223 | 133 | |||
3224 | 134 | class PickDateFromDatePickerTestCase(DatePickerBaseTestCase): | ||
3225 | 135 | |||
3226 | 136 | SELECTED_YEAR = datetime.date.today().year + 25 | ||
3227 | 137 | SELECTED_MONTH = 6 # June | ||
3228 | 138 | SELECTED_DAY = 15 | ||
3229 | 139 | |||
3230 | 140 | scenarios = [ | ||
3231 | 141 | ('higher year', { | ||
3232 | 142 | 'date_to_pick': datetime.date( | ||
3233 | 143 | SELECTED_YEAR + 10, SELECTED_MONTH, SELECTED_DAY)}), | ||
3234 | 144 | ('lower year', { | ||
3235 | 145 | 'date_to_pick': datetime.date( | ||
3236 | 146 | SELECTED_YEAR - 10, SELECTED_MONTH, SELECTED_DAY)}), | ||
3237 | 147 | ('higher month', { | ||
3238 | 148 | 'date_to_pick': datetime.date( | ||
3239 | 149 | SELECTED_YEAR, SELECTED_MONTH + 4, SELECTED_DAY)}), | ||
3240 | 150 | ('lower month', { | ||
3241 | 151 | 'date_to_pick': datetime.date( | ||
3242 | 152 | SELECTED_YEAR, SELECTED_MONTH - 4, SELECTED_DAY)}), | ||
3243 | 153 | ('higher day', { | ||
3244 | 154 | 'date_to_pick': datetime.date( | ||
3245 | 155 | SELECTED_YEAR, SELECTED_MONTH, SELECTED_DAY + 10)}), | ||
3246 | 156 | ('lower day', { | ||
3247 | 157 | 'date_to_pick': datetime.date( | ||
3248 | 158 | SELECTED_YEAR, SELECTED_MONTH, SELECTED_DAY - 10)}), | ||
3249 | 159 | ('change all values', { | ||
3250 | 160 | 'date_to_pick': datetime.date( | ||
3251 | 161 | SELECTED_YEAR - 10, SELECTED_MONTH + 4, SELECTED_DAY - 10)}), | ||
3252 | 162 | ] | ||
3253 | 163 | |||
3254 | 164 | def test_pick_date(self): | ||
3255 | 165 | """Test that picking a date updates the picker.""" | ||
3256 | 166 | self.date_picker.pick_date(self.date_to_pick) | ||
3257 | 167 | self.assertEqual(self.date_picker.get_date(), self.date_to_pick) | ||
3258 | 168 | |||
3259 | 169 | |||
3260 | 170 | class PickTimeFromDatePickerTestCase(DatePickerBaseTestCase): | ||
3261 | 171 | |||
3262 | 172 | SELECTED_HOUR = 12 | ||
3263 | 173 | SELECTED_MINUTE = 30 | ||
3264 | 174 | SELECTED_SECOND = 30 | ||
3265 | 175 | |||
3266 | 176 | scenarios = [ | ||
3267 | 177 | ('higher hour', { | ||
3268 | 178 | 'time_to_pick': datetime.time( | ||
3269 | 179 | SELECTED_HOUR + 6, SELECTED_MINUTE, SELECTED_SECOND)}), | ||
3270 | 180 | ('lower hour', { | ||
3271 | 181 | 'time_to_pick': datetime.time( | ||
3272 | 182 | SELECTED_HOUR - 6, SELECTED_MINUTE, SELECTED_SECOND)}), | ||
3273 | 183 | ('higher minute', { | ||
3274 | 184 | 'time_to_pick': datetime.time( | ||
3275 | 185 | SELECTED_HOUR, SELECTED_MINUTE + 10, SELECTED_SECOND)}), | ||
3276 | 186 | ('lower minute', { | ||
3277 | 187 | 'time_to_pick': datetime.time( | ||
3278 | 188 | SELECTED_HOUR, SELECTED_MINUTE - 10, SELECTED_SECOND)}), | ||
3279 | 189 | ('higher second', { | ||
3280 | 190 | 'time_to_pick': datetime.time( | ||
3281 | 191 | SELECTED_HOUR, SELECTED_MINUTE, SELECTED_SECOND + 10)}), | ||
3282 | 192 | ('lower second', { | ||
3283 | 193 | 'time_to_pick': datetime.time( | ||
3284 | 194 | SELECTED_HOUR, SELECTED_MINUTE, SELECTED_SECOND - 10)}), | ||
3285 | 195 | ('change all values', { | ||
3286 | 196 | 'time_to_pick': datetime.time( | ||
3287 | 197 | SELECTED_HOUR + 6, SELECTED_MINUTE - 10, | ||
3288 | 198 | SELECTED_SECOND + 10)}), | ||
3289 | 199 | ] | ||
3290 | 200 | |||
3291 | 201 | def test_pick_time(self): | ||
3292 | 202 | self.time_picker.pick_time(self.time_to_pick) | ||
3293 | 203 | self.assertEqual(self.time_picker.get_time(), self.time_to_pick) | ||
3294 | 0 | 204 | ||
3295 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py' | |||
3296 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 1970-01-01 00:00:00 +0000 | |||
3297 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-05-28 18:09:57 +0000 | |||
3298 | @@ -0,0 +1,201 @@ | |||
3299 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
3300 | 2 | # | ||
3301 | 3 | # Copyright (C) 2014 Canonical Ltd. | ||
3302 | 4 | # | ||
3303 | 5 | # This program is free software; you can redistribute it and/or modify | ||
3304 | 6 | # it under the terms of the GNU Lesser General Public License as published by | ||
3305 | 7 | # the Free Software Foundation; version 3. | ||
3306 | 8 | # | ||
3307 | 9 | # This program is distributed in the hope that it will be useful, | ||
3308 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3309 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3310 | 12 | # GNU Lesser General Public License for more details. | ||
3311 | 13 | # | ||
3312 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
3313 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3314 | 16 | |||
3315 | 17 | |||
3316 | 18 | import testtools | ||
3317 | 19 | |||
3318 | 20 | import ubuntuuitoolkit | ||
3319 | 21 | from ubuntuuitoolkit import tests | ||
3320 | 22 | from ubuntuuitoolkit._custom_proxy_objects import _common | ||
3321 | 23 | |||
3322 | 24 | |||
3323 | 25 | class FlickableTestCase(testtools.TestCase): | ||
3324 | 26 | |||
3325 | 27 | def test_get_unity_top_container(self): | ||
3326 | 28 | """Test that we can get the top cointainer in Unity.""" | ||
3327 | 29 | # This tests bug http://pad.lv/1314390 | ||
3328 | 30 | # On Unity, the top container is not the first child as it is in all | ||
3329 | 31 | # the apps that have a MainView. This makes the first implementation of | ||
3330 | 32 | # _get_top_container fail. Instead of going from the top looking for | ||
3331 | 33 | # a container, we should start from the flickable until we find the | ||
3332 | 34 | # top-most container. | ||
3333 | 35 | # FIXME we are faking the QML tree because we have no way to launch | ||
3334 | 36 | # the app with a tree like the one in Unity8. kalikiana has a branch | ||
3335 | 37 | # with an alternate launcher that will let us clean this test. | ||
3336 | 38 | # --elopio - 2014-05-15. | ||
3337 | 39 | RootClass = type('obj', (object,), {'id': 'root'}) | ||
3338 | 40 | mock_root_instance = RootClass() | ||
3339 | 41 | # We consider a container is an object with a globalRect. | ||
3340 | 42 | MockNonContainerClass = type('obj', (object,), {}) | ||
3341 | 43 | mock_non_container = MockNonContainerClass() | ||
3342 | 44 | MockContainerClass = type( | ||
3343 | 45 | 'obj', (object,), {'id': 'container', 'globalRect': 'dummy'}) | ||
3344 | 46 | mock_container = MockContainerClass() | ||
3345 | 47 | mock_container.get_parent = lambda: mock_root_instance | ||
3346 | 48 | |||
3347 | 49 | # The root instance has two children. This exposes the bug. | ||
3348 | 50 | mock_root_instance.get_children = lambda: [ | ||
3349 | 51 | mock_non_container, mock_container] | ||
3350 | 52 | |||
3351 | 53 | dummy_state = {'id': '10'} | ||
3352 | 54 | flickable = ubuntuuitoolkit.QQuickFlickable( | ||
3353 | 55 | dummy_state, '/dummy'.encode(), 'dummy') | ||
3354 | 56 | |||
3355 | 57 | flickable.get_root_instance = lambda: mock_root_instance | ||
3356 | 58 | # The top container of the flickable is its immediate parent. | ||
3357 | 59 | flickable.get_parent = lambda: mock_container | ||
3358 | 60 | |||
3359 | 61 | top_container = flickable._get_top_container() | ||
3360 | 62 | self.assertEqual(top_container, mock_container) | ||
3361 | 63 | |||
3362 | 64 | def test_is_flickable_with_flicking_property_must_return_true(self): | ||
3363 | 65 | """is_flickable returns True if flickable property exists.""" | ||
3364 | 66 | dummy_id = (0, 0) | ||
3365 | 67 | dummy_flicking = (0, 'dummy') | ||
3366 | 68 | state_with_flicking = {'id': dummy_id, 'flicking': dummy_flicking} | ||
3367 | 69 | element = _common.UbuntuUIToolkitCustomProxyObjectBase( | ||
3368 | 70 | state_with_flicking, '/dummy'.encode(), 'dummy') | ||
3369 | 71 | with element.no_automatic_refreshing(): | ||
3370 | 72 | self.assertTrue(element.is_flickable()) | ||
3371 | 73 | |||
3372 | 74 | def test_is_flickable_without_flicking_property_must_return_false(self): | ||
3373 | 75 | """is_flickable returns False if flickable property doesn't exist.""" | ||
3374 | 76 | dummy_id = (0, 0) | ||
3375 | 77 | state_without_flicking = {'id': dummy_id} | ||
3376 | 78 | element = _common.UbuntuUIToolkitCustomProxyObjectBase( | ||
3377 | 79 | state_without_flicking, '/dummy'.encode(), 'dummy') | ||
3378 | 80 | with element.no_automatic_refreshing(): | ||
3379 | 81 | self.assertFalse(element.is_flickable()) | ||
3380 | 82 | |||
3381 | 83 | |||
3382 | 84 | class IsFlickableTestCase(tests.QMLStringAppTestCase): | ||
3383 | 85 | """Functional test to check that is_flickable returns the right value. | ||
3384 | 86 | |||
3385 | 87 | We already have tests for is_flickable with mocks, so here we just check | ||
3386 | 88 | with some real elements. | ||
3387 | 89 | |||
3388 | 90 | """ | ||
3389 | 91 | |||
3390 | 92 | test_qml = (""" | ||
3391 | 93 | import QtQuick 2.0 | ||
3392 | 94 | import Ubuntu.Components 0.1 | ||
3393 | 95 | import Ubuntu.Components.ListItems 0.1 as ListItem | ||
3394 | 96 | |||
3395 | 97 | MainView { | ||
3396 | 98 | objectName: 'mainView' | ||
3397 | 99 | width: units.gu(48) | ||
3398 | 100 | height: units.gu(60) | ||
3399 | 101 | |||
3400 | 102 | Flickable { | ||
3401 | 103 | objectName: 'flickable' | ||
3402 | 104 | } | ||
3403 | 105 | ListView { | ||
3404 | 106 | objectName: 'listView' | ||
3405 | 107 | } | ||
3406 | 108 | Label { | ||
3407 | 109 | objectName: 'label' | ||
3408 | 110 | } | ||
3409 | 111 | } | ||
3410 | 112 | """) | ||
3411 | 113 | |||
3412 | 114 | scenarios = [ | ||
3413 | 115 | ('main view', dict(object_name='mainView', is_flickable=False)), | ||
3414 | 116 | ('flickable', dict(object_name='flickable', is_flickable=True)), | ||
3415 | 117 | ('list view', dict(object_name='listView', is_flickable=True)), | ||
3416 | 118 | ('label', dict(object_name='label', is_flickable=False)) | ||
3417 | 119 | ] | ||
3418 | 120 | |||
3419 | 121 | def test_is_flickable(self): | ||
3420 | 122 | """Test that is_flickable identifies the elements correctly.""" | ||
3421 | 123 | element = self.app.select_single(objectName=self.object_name) | ||
3422 | 124 | self.assertEqual(element.is_flickable(), self.is_flickable) | ||
3423 | 125 | |||
3424 | 126 | |||
3425 | 127 | class SwipeIntoViewTestCase(tests.QMLStringAppTestCase): | ||
3426 | 128 | |||
3427 | 129 | test_qml = (""" | ||
3428 | 130 | import QtQuick 2.0 | ||
3429 | 131 | import Ubuntu.Components 0.1 | ||
3430 | 132 | |||
3431 | 133 | MainView { | ||
3432 | 134 | width: units.gu(48) | ||
3433 | 135 | height: units.gu(60) | ||
3434 | 136 | |||
3435 | 137 | Label { | ||
3436 | 138 | id: clickedLabel | ||
3437 | 139 | objectName: "clickedLabel" | ||
3438 | 140 | text: "No element clicked." | ||
3439 | 141 | } | ||
3440 | 142 | |||
3441 | 143 | Flickable { | ||
3442 | 144 | anchors { | ||
3443 | 145 | fill: parent | ||
3444 | 146 | topMargin: clickedLabel.height | ||
3445 | 147 | // It can't be at the bottom, or the toolbar will be opened | ||
3446 | 148 | // when we try to click it. | ||
3447 | 149 | bottomMargin: units.gu(10) | ||
3448 | 150 | } | ||
3449 | 151 | objectName: 'flickable' | ||
3450 | 152 | height: units.gu(60) | ||
3451 | 153 | contentHeight: bottomButton.y + bottomButton.height | ||
3452 | 154 | |||
3453 | 155 | Button { | ||
3454 | 156 | id: topButton | ||
3455 | 157 | objectName: 'topButton' | ||
3456 | 158 | text: 'Top button' | ||
3457 | 159 | onClicked: clickedLabel.text = objectName | ||
3458 | 160 | } | ||
3459 | 161 | Rectangle { | ||
3460 | 162 | id: emptyRectangle | ||
3461 | 163 | height: units.gu(80) | ||
3462 | 164 | anchors.top: topButton.bottom | ||
3463 | 165 | } | ||
3464 | 166 | Button { | ||
3465 | 167 | id: bottomButton | ||
3466 | 168 | objectName: 'bottomButton' | ||
3467 | 169 | text: 'Bottom button' | ||
3468 | 170 | onClicked: clickedLabel.text = objectName | ||
3469 | 171 | anchors.top: emptyRectangle.bottom | ||
3470 | 172 | } | ||
3471 | 173 | } | ||
3472 | 174 | } | ||
3473 | 175 | """) | ||
3474 | 176 | |||
3475 | 177 | def setUp(self): | ||
3476 | 178 | super(SwipeIntoViewTestCase, self).setUp() | ||
3477 | 179 | self.label = self.main_view.select_single( | ||
3478 | 180 | 'Label', objectName='clickedLabel') | ||
3479 | 181 | self.assertEqual(self.label.text, 'No element clicked.') | ||
3480 | 182 | |||
3481 | 183 | def test_swipe_to_bottom(self): | ||
3482 | 184 | self.main_view.close_toolbar() | ||
3483 | 185 | |||
3484 | 186 | button = self.main_view.select_single(objectName='bottomButton') | ||
3485 | 187 | button.swipe_into_view() | ||
3486 | 188 | |||
3487 | 189 | self.pointing_device.click_object(button) | ||
3488 | 190 | self.assertEqual(self.label.text, 'bottomButton') | ||
3489 | 191 | |||
3490 | 192 | def test_swipe_to_top(self): | ||
3491 | 193 | self.main_view.close_toolbar() | ||
3492 | 194 | bottomButton = self.main_view.select_single(objectName='bottomButton') | ||
3493 | 195 | bottomButton.swipe_into_view() | ||
3494 | 196 | |||
3495 | 197 | topButton = self.main_view.select_single(objectName='topButton') | ||
3496 | 198 | topButton.swipe_into_view() | ||
3497 | 199 | |||
3498 | 200 | self.pointing_device.click_object(topButton) | ||
3499 | 201 | self.assertEqual(self.label.text, 'topButton') | ||
3500 | 0 | 202 | ||
3501 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py' | |||
3502 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-05-10 21:52:19 +0000 | |||
3503 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-05-28 18:09:57 +0000 | |||
3504 | @@ -22,7 +22,7 @@ | |||
3505 | 22 | 22 | ||
3506 | 23 | test_qml = (""" | 23 | test_qml = (""" |
3507 | 24 | import QtQuick 2.0 | 24 | import QtQuick 2.0 |
3509 | 25 | import Ubuntu.Components 0.1 | 25 | import Ubuntu.Components 1.1 |
3510 | 26 | 26 | ||
3511 | 27 | MainView { | 27 | MainView { |
3512 | 28 | width: units.gu(48) | 28 | width: units.gu(48) |
3513 | @@ -33,11 +33,46 @@ | |||
3514 | 33 | Page { | 33 | Page { |
3515 | 34 | title: "Test title" | 34 | title: "Test title" |
3516 | 35 | 35 | ||
3522 | 36 | Label { | 36 | Flickable { |
3523 | 37 | id: label | 37 | anchors.fill: parent |
3524 | 38 | objectName: "clicked_label" | 38 | contentHeight: units.gu(120) |
3525 | 39 | anchors.centerIn: parent | 39 | objectName: "header_test_flickable" |
3526 | 40 | text: "No button clicked." | 40 | |
3527 | 41 | Label { | ||
3528 | 42 | id: label | ||
3529 | 43 | objectName: "clicked_label" | ||
3530 | 44 | anchors { | ||
3531 | 45 | top: parent.top | ||
3532 | 46 | horizontalCenter: parent.horizontalCenter | ||
3533 | 47 | } | ||
3534 | 48 | text: "No button clicked." | ||
3535 | 49 | } | ||
3536 | 50 | |||
3537 | 51 | Button { | ||
3538 | 52 | objectName: "hide_actions_button" | ||
3539 | 53 | anchors { | ||
3540 | 54 | top: label.bottom | ||
3541 | 55 | topMargin: units.gu(5) | ||
3542 | 56 | horizontalCenter: parent.horizontalCenter | ||
3543 | 57 | } | ||
3544 | 58 | text: "Hide some actions" | ||
3545 | 59 | onClicked: { | ||
3546 | 60 | cancelAction.visible = false; | ||
3547 | 61 | for (var i=0; i < 3; i++) { | ||
3548 | 62 | buttonRepeater.itemAt(i).action.visible = false; | ||
3549 | 63 | } | ||
3550 | 64 | // only three of five visible actions left | ||
3551 | 65 | } | ||
3552 | 66 | } | ||
3553 | 67 | Label { | ||
3554 | 68 | id: endLabel | ||
3555 | 69 | objectName: "end_label" | ||
3556 | 70 | anchors { | ||
3557 | 71 | bottom: parent.bottom | ||
3558 | 72 | horizontalCenter: parent.horizontalCenter | ||
3559 | 73 | } | ||
3560 | 74 | text: "The end." | ||
3561 | 75 | } | ||
3562 | 41 | } | 76 | } |
3563 | 42 | 77 | ||
3564 | 43 | tools: ToolbarItems { | 78 | tools: ToolbarItems { |
3565 | @@ -62,22 +97,6 @@ | |||
3566 | 62 | } | 97 | } |
3567 | 63 | } | 98 | } |
3568 | 64 | } | 99 | } |
3569 | 65 | |||
3570 | 66 | Button { | ||
3571 | 67 | objectName: "hide_actions_button" | ||
3572 | 68 | anchors { | ||
3573 | 69 | bottom: parent.bottom | ||
3574 | 70 | horizontalCenter: parent.horizontalCenter | ||
3575 | 71 | } | ||
3576 | 72 | text: "Hide some actions" | ||
3577 | 73 | onClicked: { | ||
3578 | 74 | cancelAction.visible = false; | ||
3579 | 75 | for (var i=0; i < 3; i++) { | ||
3580 | 76 | buttonRepeater.itemAt(i).action.visible = false; | ||
3581 | 77 | } | ||
3582 | 78 | // only three of five visible actions left | ||
3583 | 79 | } | ||
3584 | 80 | } | ||
3585 | 81 | } | 100 | } |
3586 | 82 | } | 101 | } |
3587 | 83 | """) | 102 | """) |
3588 | @@ -95,8 +114,8 @@ | |||
3589 | 95 | self.assertEqual(self.header.title, "Test title") | 114 | self.assertEqual(self.header.title, "Test title") |
3590 | 96 | 115 | ||
3591 | 97 | def test_click_header_action_button(self): | 116 | def test_click_header_action_button(self): |
3594 | 98 | self.header.click_action_button('action1') | 117 | self.header.click_action_button('action0') |
3595 | 99 | self.assertEqual(self.label.text, 'Button 1 clicked.') | 118 | self.assertEqual(self.label.text, 'Button 0 clicked.') |
3596 | 100 | 119 | ||
3597 | 101 | def test_click_header_overflow_action_button(self): | 120 | def test_click_header_overflow_action_button(self): |
3598 | 102 | # custom back button and first action button go in the header | 121 | # custom back button and first action button go in the header |
3599 | @@ -117,6 +136,13 @@ | |||
3600 | 117 | self.header.click_custom_back_button() | 136 | self.header.click_custom_back_button() |
3601 | 118 | self.assertEqual(self.label.text, 'Cancel button clicked.') | 137 | self.assertEqual(self.label.text, 'Cancel button clicked.') |
3602 | 119 | 138 | ||
3603 | 139 | def test_click_header_action_button_with_hidden_header(self): | ||
3604 | 140 | bottom_label = self.main_view.select_single(objectName='end_label') | ||
3605 | 141 | bottom_label.swipe_into_view() | ||
3606 | 142 | self.assertFalse(self.header._is_visible()) | ||
3607 | 143 | self.header.click_action_button('action0') | ||
3608 | 144 | self.assertEqual(self.label.text, 'Button 0 clicked.') | ||
3609 | 145 | |||
3610 | 120 | def test_overflow_button(self): | 146 | def test_overflow_button(self): |
3611 | 121 | # there are 5 actions plus a custom back action | 147 | # there are 5 actions plus a custom back action |
3612 | 122 | overflow_button = self.header.select_single( | 148 | overflow_button = self.header.select_single( |
3613 | 123 | 149 | ||
3614 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textfield.py' | |||
3615 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textfield.py 2014-04-17 01:06:31 +0000 | |||
3616 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_textfield.py 2014-05-28 18:09:57 +0000 | |||
3617 | @@ -14,6 +14,13 @@ | |||
3618 | 14 | # You should have received a copy of the GNU Lesser General Public License | 14 | # You should have received a copy of the GNU Lesser General Public License |
3619 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
3620 | 16 | 16 | ||
3621 | 17 | try: | ||
3622 | 18 | from unittest import mock | ||
3623 | 19 | except ImportError: | ||
3624 | 20 | import mock | ||
3625 | 21 | |||
3626 | 22 | from autopilot import platform | ||
3627 | 23 | |||
3628 | 17 | import ubuntuuitoolkit | 24 | import ubuntuuitoolkit |
3629 | 18 | from ubuntuuitoolkit import tests | 25 | from ubuntuuitoolkit import tests |
3630 | 19 | 26 | ||
3631 | @@ -91,3 +98,23 @@ | |||
3632 | 91 | self.assertTrue(self.simple_text_field.is_empty()) | 98 | self.assertTrue(self.simple_text_field.is_empty()) |
3633 | 92 | self.simple_text_field.write('test') | 99 | self.simple_text_field.write('test') |
3634 | 93 | self.assertFalse(self.simple_text_field.is_empty()) | 100 | self.assertFalse(self.simple_text_field.is_empty()) |
3635 | 101 | |||
3636 | 102 | def test_select_all_selects_all_text(self): | ||
3637 | 103 | if platform.model() != 'Desktop': | ||
3638 | 104 | self.skipTest('Select all is not yet implemented on the phone.') | ||
3639 | 105 | self.simple_text_field.write('Text to select.') | ||
3640 | 106 | self.simple_text_field._select_all() | ||
3641 | 107 | |||
3642 | 108 | self.assertTrue(self.simple_text_field._is_all_text_selected()) | ||
3643 | 109 | |||
3644 | 110 | def test_select_all_when_already_selected_must_do_nothing(self): | ||
3645 | 111 | """Test for select all the text when it's already selected.""" | ||
3646 | 112 | if platform.model() != 'Desktop': | ||
3647 | 113 | self.skipTest('Select all is not yet implemented on the phone.') | ||
3648 | 114 | self.simple_text_field.write('Text to select.') | ||
3649 | 115 | self.simple_text_field._select_all() | ||
3650 | 116 | with mock.patch.object( | ||
3651 | 117 | self.simple_text_field, 'pointing_device') as mock_device: | ||
3652 | 118 | self.simple_text_field._select_all() | ||
3653 | 119 | |||
3654 | 120 | self.assertFalse(mock_device.called) | ||
3655 | 94 | 121 | ||
3656 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py' | |||
3657 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2014-01-13 15:31:14 +0000 | |||
3658 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2014-05-28 18:09:57 +0000 | |||
3659 | @@ -75,6 +75,10 @@ | |||
3660 | 75 | # TODO: check for properties | 75 | # TODO: check for properties |
3661 | 76 | 76 | ||
3662 | 77 | def test_ubuntushape(self): | 77 | def test_ubuntushape(self): |
3663 | 78 | # Flaky test case | ||
3664 | 79 | # FIXME: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1308979 | ||
3665 | 80 | return | ||
3666 | 81 | |||
3667 | 78 | item = "Ubuntu Shape" | 82 | item = "Ubuntu Shape" |
3668 | 79 | self.loadItem(item) | 83 | self.loadItem(item) |
3669 | 80 | self.checkPageHeader(item) | 84 | self.checkPageHeader(item) |
3670 | 81 | 85 | ||
3671 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py' | |||
3672 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2013-11-08 09:19:02 +0000 | |||
3673 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2014-05-28 18:09:57 +0000 | |||
3674 | @@ -1,6 +1,6 @@ | |||
3675 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
3676 | 2 | # | 2 | # |
3678 | 3 | # Copyright (C) 2012, 2013 Canonical Ltd. | 3 | # Copyright (C) 2012, 2013, 2014 Canonical Ltd. |
3679 | 4 | # | 4 | # |
3680 | 5 | # This program is free software; you can redistribute it and/or modify | 5 | # This program is free software; you can redistribute it and/or modify |
3681 | 6 | # it under the terms of the GNU Lesser General Public License as published by | 6 | # it under the terms of the GNU Lesser General Public License as published by |
3682 | @@ -14,85 +14,52 @@ | |||
3683 | 14 | # You should have received a copy of the GNU Lesser General Public License | 14 | # You should have received a copy of the GNU Lesser General Public License |
3684 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
3685 | 16 | 16 | ||
3691 | 17 | """Tests for the Ubuntu UI Toolkit Gallery - OptionSelector component""" | 17 | """Tests for the Ubuntu UI Toolkit Gallery - OptionSelector component.""" |
3692 | 18 | import time | 18 | |
3693 | 19 | from autopilot.matchers import Eventually | 19 | import ubuntuuitoolkit |
3689 | 20 | from testtools.matchers import Equals | ||
3690 | 21 | from ubuntuuitoolkit.tests import FlickDirection | ||
3694 | 22 | from ubuntuuitoolkit.tests.gallery import GalleryTestCase | 20 | from ubuntuuitoolkit.tests.gallery import GalleryTestCase |
3695 | 23 | 21 | ||
3696 | 24 | 22 | ||
3771 | 25 | class OptionSelectorTests(GalleryTestCase): | 23 | class OptionSelectorTestCase(GalleryTestCase): |
3772 | 26 | """Generic tests for the Gallery""" | 24 | |
3773 | 27 | 25 | def setUp(self): | |
3774 | 28 | def test_optionselector_collapsed(self): | 26 | super(OptionSelectorTestCase, self).setUp() |
3775 | 29 | item = "Option Selector" | 27 | item = "Option Selector" |
3776 | 30 | self.loadItem(item) | 28 | self.loadItem(item) |
3777 | 31 | self.checkPageHeader(item) | 29 | self.checkPageHeader(item) |
3778 | 32 | collapsed = self.getObject("optionselector_collapsed") | 30 | |
3779 | 33 | styleditem = collapsed.select_single('StyledItem', | 31 | def test_select_option_from_collapsed_optionselector(self): |
3780 | 34 | objectName='listContainer') | 32 | collapsed_option_selector = self.main_view.select_single( |
3781 | 35 | 33 | ubuntuuitoolkit.OptionSelector, | |
3782 | 36 | self.assertThat(collapsed.selectedIndex, Equals(0)) | 34 | objectName='optionselector_collapsed') |
3783 | 37 | self.pointing_device.click_object(collapsed) | 35 | |
3784 | 38 | self.assertThat(styleditem.currentlyExpanded, Eventually(Equals(True))) | 36 | self.assertEqual( |
3785 | 39 | #try to search the following list entry few times | 37 | collapsed_option_selector.get_selected_text(), 'Value 1') |
3786 | 40 | #as it may not be available immediately. | 38 | |
3787 | 41 | for t in range(0, 9): | 39 | collapsed_option_selector.select_option('Label', text='Value 4') |
3788 | 42 | try: | 40 | self.assertEqual(collapsed_option_selector.get_selected_index(), 3) |
3789 | 43 | selectedValue = collapsed.select_single('Label', | 41 | |
3790 | 44 | text='Value 4') | 42 | def test_select_option_from_expanded_optionselector(self): |
3791 | 45 | self.assertIsNotNone(selectedValue) | 43 | expanded_option_selector = self.main_view.select_single( |
3792 | 46 | except: | 44 | ubuntuuitoolkit.OptionSelector, |
3793 | 47 | time.sleep(1) | 45 | objectName='optionselector_expanded') |
3794 | 48 | 46 | ||
3795 | 49 | self.pointing_device.click_object(selectedValue) | 47 | self.assertEqual( |
3796 | 50 | self.assertThat(collapsed.selectedIndex, Eventually(Equals(3))) | 48 | expanded_option_selector.get_selected_text(), 'Value 1') |
3797 | 51 | self.assertThat(styleditem.currentlyExpanded, | 49 | |
3798 | 52 | Eventually(Equals(False))) | 50 | expanded_option_selector.select_option('Label', text='Value 4') |
3799 | 53 | 51 | self.assertEqual(expanded_option_selector.get_selected_index(), 3) | |
3800 | 54 | def test_optionselector_expanded(self): | 52 | |
3801 | 55 | item = "Option Selector" | 53 | def test_select_option_from_optionselector_with_custom_model(self): |
3802 | 56 | self.loadItem(item) | 54 | option_selector_with_custom_model = self.main_view.select_single( |
3803 | 57 | self.checkPageHeader(item) | 55 | ubuntuuitoolkit.OptionSelector, |
3804 | 58 | expanded = self.getObject("optionselector_expanded") | 56 | objectName='optionselector_custommodel') |
3805 | 59 | 57 | option_selector_with_custom_model.swipe_into_view() | |
3806 | 60 | self.assertThat(expanded.selectedIndex, Equals(0)) | 58 | |
3807 | 61 | selectedValue = expanded.select_single('Label', text='Value 4') | 59 | self.assertEqual( |
3808 | 62 | self.assertIsNotNone(selectedValue) | 60 | option_selector_with_custom_model.get_selected_index(), 0) |
3809 | 63 | self.pointing_device.click_object(selectedValue) | 61 | |
3810 | 64 | self.assertThat(expanded.selectedIndex, Eventually(Equals(3))) | 62 | option_selector_with_custom_model.select_option( |
3811 | 65 | 63 | 'Label', text='Name 4') | |
3812 | 66 | selectedValue = expanded.select_single('Label', text='Value 1') | 64 | self.assertEqual( |
3813 | 67 | self.assertIsNotNone(selectedValue) | 65 | option_selector_with_custom_model.get_selected_index(), 3) |
3740 | 68 | self.pointing_device.click_object(selectedValue) | ||
3741 | 69 | self.assertThat(expanded.selectedIndex, Eventually(Equals(0))) | ||
3742 | 70 | |||
3743 | 71 | def test_optionselector_custommodel(self): | ||
3744 | 72 | item = "Option Selector" | ||
3745 | 73 | self.loadItem(item) | ||
3746 | 74 | self.checkPageHeader(item) | ||
3747 | 75 | |||
3748 | 76 | custommodel = self.getObject("optionselector_custommodel") | ||
3749 | 77 | flickable = self.main_view.select_single('QQuickFlickable') | ||
3750 | 78 | self.assertIsNotNone(flickable) | ||
3751 | 79 | |||
3752 | 80 | #Flick upward to reveal the hidden ui element. | ||
3753 | 81 | self.reveal_item_by_flick(custommodel, flickable, FlickDirection.UP) | ||
3754 | 82 | self.assertThat(flickable.flicking, Eventually(Equals(False))) | ||
3755 | 83 | |||
3756 | 84 | self.assertThat(custommodel.selectedIndex, Equals(0)) | ||
3757 | 85 | selectedValue = custommodel.select_single('Label', text='Name 4') | ||
3758 | 86 | self.assertIsNotNone(selectedValue) | ||
3759 | 87 | self.pointing_device.click_object(selectedValue) | ||
3760 | 88 | self.assertThat(custommodel.selectedIndex, Eventually(Equals(3))) | ||
3761 | 89 | |||
3762 | 90 | selectedValue = custommodel.select_single('Label', text='Name 1') | ||
3763 | 91 | self.assertIsNotNone(selectedValue) | ||
3764 | 92 | self.pointing_device.click_object(selectedValue) | ||
3765 | 93 | self.assertThat(custommodel.selectedIndex, Eventually(Equals(0))) | ||
3766 | 94 | |||
3767 | 95 | #scroll the page downward now. | ||
3768 | 96 | collapsed = self.getObject("optionselector_collapsed") | ||
3769 | 97 | self.reveal_item_by_flick(collapsed, flickable, FlickDirection.DOWN) | ||
3770 | 98 | self.assertThat(flickable.flicking, Eventually(Equals(False))) | ||
3814 | 99 | 66 | ||
3815 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py' | |||
3816 | --- tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-04-28 15:39:24 +0000 | |||
3817 | +++ tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-05-28 18:09:57 +0000 | |||
3818 | @@ -32,7 +32,7 @@ | |||
3819 | 32 | 32 | ||
3820 | 33 | symbols_retaining_name = [ | 33 | symbols_retaining_name = [ |
3821 | 34 | 'check_autopilot_version', 'get_keyboard', 'get_pointing_device', | 34 | 'check_autopilot_version', 'get_keyboard', 'get_pointing_device', |
3823 | 35 | 'CheckBox', 'Flickable', 'Header', 'MainView', 'OptionSelector', | 35 | 'CheckBox', 'Header', 'MainView', 'OptionSelector', 'QQuickFlickable', |
3824 | 36 | 'QQuickListView', 'TabBar', 'Tabs', 'TextField', 'Toolbar', | 36 | 'QQuickListView', 'TabBar', 'Tabs', 'TextField', 'Toolbar', |
3825 | 37 | ] | 37 | ] |
3826 | 38 | 38 | ||
3827 | 39 | 39 | ||
3828 | === modified file 'tests/qmlapicheck.py' | |||
3829 | --- tests/qmlapicheck.py 2014-04-24 09:18:38 +0000 | |||
3830 | +++ tests/qmlapicheck.py 2014-05-28 18:09:57 +0000 | |||
3831 | @@ -130,10 +130,10 @@ | |||
3832 | 130 | if '{' in line and '}' in line: | 130 | if '{' in line and '}' in line: |
3833 | 131 | if filetype == 'qmltypes' and not in_builtin_type: | 131 | if filetype == 'qmltypes' and not in_builtin_type: |
3834 | 132 | print(' ' + line.strip()) | 132 | print(' ' + line.strip()) |
3836 | 133 | continue | 133 | continue |
3837 | 134 | 134 | ||
3838 | 135 | # End of function/ signal/ Item block | 135 | # End of function/ signal/ Item block |
3840 | 136 | if '}' in line: | 136 | if '}' in line and not '{' in line: |
3841 | 137 | in_block -= 1 | 137 | in_block -= 1 |
3842 | 138 | block_meta = {} | 138 | block_meta = {} |
3843 | 139 | if in_block == 1 and in_builtin_type: | 139 | if in_block == 1 and in_builtin_type: |
3844 | @@ -143,7 +143,7 @@ | |||
3845 | 143 | # Only root "Item {" is inspected for QML, otherwise all children | 143 | # Only root "Item {" is inspected for QML, otherwise all children |
3846 | 144 | if in_block == 1 or filetype == 'qmltypes': | 144 | if in_block == 1 or filetype == 'qmltypes': |
3847 | 145 | # Left hand side specifies a keyword, a type and a variable name | 145 | # Left hand side specifies a keyword, a type and a variable name |
3849 | 146 | declaration = line.split(':')[0] | 146 | declaration = line.split(':', 1)[0] |
3850 | 147 | words = declaration.strip().split(' ') | 147 | words = declaration.strip().split(' ') |
3851 | 148 | # Skip types with prefixes considered builtin | 148 | # Skip types with prefixes considered builtin |
3852 | 149 | if filetype == 'qmltypes' and words[0] == 'name': | 149 | if filetype == 'qmltypes' and words[0] == 'name': |
3853 | @@ -175,7 +175,8 @@ | |||
3854 | 175 | for word in words: | 175 | for word in words: |
3855 | 176 | if word in keywords: | 176 | if word in keywords: |
3856 | 177 | if filetype == 'qml': | 177 | if filetype == 'qml': |
3858 | 178 | signature = declaration.split('{')[0].strip() | 178 | separator = '{' if 'function' in declaration else ':' |
3859 | 179 | signature = declaration.split(separator, 1)[0].strip() | ||
3860 | 179 | if 'alias' in line: | 180 | if 'alias' in line: |
3861 | 180 | no_mods = signature | 181 | no_mods = signature |
3862 | 181 | for mod in ['readonly', 'default']: | 182 | for mod in ['readonly', 'default']: |
3863 | @@ -198,7 +199,7 @@ | |||
3864 | 198 | break | 199 | break |
3865 | 199 | 200 | ||
3866 | 200 | # Start of function/ signal/ Item block | 201 | # Start of function/ signal/ Item block |
3868 | 201 | if '{' in line: | 202 | if '{' in line and not '}' in line: |
3869 | 202 | in_block += 1 | 203 | in_block += 1 |
3870 | 203 | block_meta = {} | 204 | block_meta = {} |
3871 | 204 | # The parent type can affect API | 205 | # The parent type can affect API |
3872 | 205 | 206 | ||
3873 | === modified file 'tests/resources/alarm/Alarms.qml' | |||
3874 | --- tests/resources/alarm/Alarms.qml 2014-04-23 08:50:20 +0000 | |||
3875 | +++ tests/resources/alarm/Alarms.qml 2014-05-28 18:09:57 +0000 | |||
3876 | @@ -113,7 +113,7 @@ | |||
3877 | 113 | id: days | 113 | id: days |
3878 | 114 | text: "Occurence" | 114 | text: "Occurence" |
3879 | 115 | values: getValues() | 115 | values: getValues() |
3881 | 116 | visible: recurence.selectedIndex == 2 | 116 | visible: recurence.selectedIndex !== 1 |
3882 | 117 | onClicked: { | 117 | onClicked: { |
3883 | 118 | PopupUtils.open(Qt.resolvedUrl("AlarmDays.qml"), days, {"alarm": alarm}); | 118 | PopupUtils.open(Qt.resolvedUrl("AlarmDays.qml"), days, {"alarm": alarm}); |
3884 | 119 | } | 119 | } |
3885 | 120 | 120 | ||
3886 | === added file 'tests/resources/toolbar/header.qml' | |||
3887 | --- tests/resources/toolbar/header.qml 1970-01-01 00:00:00 +0000 | |||
3888 | +++ tests/resources/toolbar/header.qml 2014-05-28 18:09:57 +0000 | |||
3889 | @@ -0,0 +1,143 @@ | |||
3890 | 1 | /* | ||
3891 | 2 | * Copyright (C) 2013-2014 Canonical Ltd. | ||
3892 | 3 | * | ||
3893 | 4 | * This program is free software; you can redistribute it and/or modify | ||
3894 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
3895 | 6 | * the Free Software Foundation; version 3. | ||
3896 | 7 | * | ||
3897 | 8 | * This program is distributed in the hope that it will be useful, | ||
3898 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3899 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3900 | 11 | * GNU Lesser General Public License for more details. | ||
3901 | 12 | * | ||
3902 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
3903 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3904 | 15 | */ | ||
3905 | 16 | |||
3906 | 17 | import QtQuick 2.0 | ||
3907 | 18 | import Ubuntu.Components 1.1 | ||
3908 | 19 | |||
3909 | 20 | MainView { | ||
3910 | 21 | id: mainView | ||
3911 | 22 | width: units.gu(40) | ||
3912 | 23 | height: units.gu(50) | ||
3913 | 24 | |||
3914 | 25 | PageStack { | ||
3915 | 26 | id: stack | ||
3916 | 27 | |||
3917 | 28 | Component.onCompleted: stack.push(tabs) | ||
3918 | 29 | Tabs { | ||
3919 | 30 | id: tabs | ||
3920 | 31 | Tab { | ||
3921 | 32 | title: "Tab 1" | ||
3922 | 33 | page: Page { | ||
3923 | 34 | Button { | ||
3924 | 35 | anchors.centerIn: parent | ||
3925 | 36 | text: "Click me" | ||
3926 | 37 | onTriggered: stack.push(pageOnStack) | ||
3927 | 38 | } | ||
3928 | 39 | tools: ToolbarItems { | ||
3929 | 40 | ToolbarButton { | ||
3930 | 41 | action: Action { | ||
3931 | 42 | iconName: "settings" | ||
3932 | 43 | text: "Settings" | ||
3933 | 44 | } | ||
3934 | 45 | } | ||
3935 | 46 | } | ||
3936 | 47 | } | ||
3937 | 48 | } | ||
3938 | 49 | Tab { | ||
3939 | 50 | title: "Tab 2" | ||
3940 | 51 | page: Page { | ||
3941 | 52 | Label { | ||
3942 | 53 | anchors.centerIn: parent | ||
3943 | 54 | text: "Second tab" | ||
3944 | 55 | } | ||
3945 | 56 | |||
3946 | 57 | tools: ToolbarItems { | ||
3947 | 58 | ToolbarButton { | ||
3948 | 59 | action: Action { | ||
3949 | 60 | iconName: "search" | ||
3950 | 61 | text: "Search" | ||
3951 | 62 | } | ||
3952 | 63 | } | ||
3953 | 64 | ToolbarButton { | ||
3954 | 65 | action: Action { | ||
3955 | 66 | iconName: "contact" | ||
3956 | 67 | text: "Contacts" | ||
3957 | 68 | } | ||
3958 | 69 | } | ||
3959 | 70 | ToolbarButton { | ||
3960 | 71 | action: Action { | ||
3961 | 72 | iconName: "share" | ||
3962 | 73 | text: "Share" | ||
3963 | 74 | } | ||
3964 | 75 | } | ||
3965 | 76 | ToolbarButton { | ||
3966 | 77 | action: Action { | ||
3967 | 78 | iconName: "select" | ||
3968 | 79 | text: "Select" | ||
3969 | 80 | } | ||
3970 | 81 | } | ||
3971 | 82 | } | ||
3972 | 83 | } | ||
3973 | 84 | } | ||
3974 | 85 | Tab { | ||
3975 | 86 | title: "Tab 3" | ||
3976 | 87 | page: Page { | ||
3977 | 88 | Switch { | ||
3978 | 89 | id: newHeaderSwitch | ||
3979 | 90 | anchors.centerIn: parent | ||
3980 | 91 | checked: !mainView.useDeprecatedToolbar | ||
3981 | 92 | onTriggered: { | ||
3982 | 93 | mainView.useDeprecatedToolbar = !checked; | ||
3983 | 94 | } | ||
3984 | 95 | } | ||
3985 | 96 | Label { | ||
3986 | 97 | anchors { | ||
3987 | 98 | horizontalCenter: parent.horizontalCenter | ||
3988 | 99 | bottom: newHeaderSwitch.top | ||
3989 | 100 | bottomMargin: units.gu(1) | ||
3990 | 101 | } | ||
3991 | 102 | text: "Use new header" | ||
3992 | 103 | } | ||
3993 | 104 | tools: ToolbarItems { | ||
3994 | 105 | ToolbarButton { | ||
3995 | 106 | action: Action { | ||
3996 | 107 | iconName: "camera-flip" | ||
3997 | 108 | text: "hello" | ||
3998 | 109 | } | ||
3999 | 110 | } | ||
4000 | 111 | } | ||
4001 | 112 | |||
4002 | 113 | } | ||
4003 | 114 | } | ||
4004 | 115 | Tab { | ||
4005 | 116 | title: "Tab 4" | ||
4006 | 117 | page: Page { } | ||
4007 | 118 | } | ||
4008 | 119 | Tab { | ||
4009 | 120 | title: "Tab 5" | ||
4010 | 121 | page: Page { } | ||
4011 | 122 | } | ||
4012 | 123 | } | ||
4013 | 124 | } | ||
4014 | 125 | |||
4015 | 126 | Page { | ||
4016 | 127 | id: pageOnStack | ||
4017 | 128 | visible: false | ||
4018 | 129 | title: "Stacked page" | ||
4019 | 130 | Label { | ||
4020 | 131 | anchors.centerIn: parent | ||
4021 | 132 | text: "Use back button to return" | ||
4022 | 133 | } | ||
4023 | 134 | tools: ToolbarItems { | ||
4024 | 135 | ToolbarButton { | ||
4025 | 136 | action: Action { | ||
4026 | 137 | iconName: "search" | ||
4027 | 138 | text: "Search" | ||
4028 | 139 | } | ||
4029 | 140 | } | ||
4030 | 141 | } | ||
4031 | 142 | } | ||
4032 | 143 | } | ||
4033 | 0 | 144 | ||
4034 | === modified file 'tests/unit/tst_alarms/tst_alarms.cpp' | |||
4035 | --- tests/unit/tst_alarms/tst_alarms.cpp 2014-04-10 09:53:26 +0000 | |||
4036 | +++ tests/unit/tst_alarms/tst_alarms.cpp 2014-05-28 18:09:57 +0000 | |||
4037 | @@ -354,6 +354,7 @@ | |||
4038 | 354 | waitForRequest(&alarm); | 354 | waitForRequest(&alarm); |
4039 | 355 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); | 355 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); |
4040 | 356 | QVERIFY(containsAlarm(&alarm)); | 356 | QVERIFY(containsAlarm(&alarm)); |
4041 | 357 | QSKIP("https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1322558"); | ||
4042 | 357 | 358 | ||
4043 | 358 | alarm.setDate(alarm.date().addDays(1)); | 359 | alarm.setDate(alarm.date().addDays(1)); |
4044 | 359 | alarm.save(); | 360 | alarm.save(); |
4045 | @@ -456,6 +457,51 @@ | |||
4046 | 456 | QVERIFY(srcDate.timeZone() != dstDate.timeZone()); | 457 | QVERIFY(srcDate.timeZone() != dstDate.timeZone()); |
4047 | 457 | } | 458 | } |
4048 | 458 | 459 | ||
4049 | 460 | void test_oneTime_dow_data() { | ||
4050 | 461 | QTest::addColumn<QString>("message"); | ||
4051 | 462 | QTest::addColumn<int>("dow"); | ||
4052 | 463 | |||
4053 | 464 | QTest::newRow("Monday") << "Monday" << (int)UCAlarm::Monday; | ||
4054 | 465 | QTest::newRow("Tuesday") << "Tuesday" << (int)UCAlarm::Tuesday; | ||
4055 | 466 | QTest::newRow("Wednesday") << "Wednesday" << (int)UCAlarm::Wednesday; | ||
4056 | 467 | QTest::newRow("Thursday") << "Thursday" << (int)UCAlarm::Thursday; | ||
4057 | 468 | QTest::newRow("Friday") << "Friday" << (int)UCAlarm::Friday; | ||
4058 | 469 | QTest::newRow("Saturday") << "Saturday" << (int)UCAlarm::Saturday; | ||
4059 | 470 | QTest::newRow("Sunday") << "Sunday" << (int)UCAlarm::Sunday; | ||
4060 | 471 | } | ||
4061 | 472 | void test_oneTime_dow() { | ||
4062 | 473 | QFETCH(QString, message); | ||
4063 | 474 | QFETCH(int, dow); | ||
4064 | 475 | |||
4065 | 476 | UCAlarm alarm(QDateTime::currentDateTime().addSecs(3600), "test_oneTime_dow_" + message); | ||
4066 | 477 | alarm.setDaysOfWeek((UCAlarm::DaysOfWeek)dow); | ||
4067 | 478 | alarm.save(); | ||
4068 | 479 | waitForRequest(&alarm); | ||
4069 | 480 | QCOMPARE(alarm.error(), (int)UCAlarm::NoError); | ||
4070 | 481 | QVERIFY(containsAlarm(&alarm)); | ||
4071 | 482 | } | ||
4072 | 483 | |||
4073 | 484 | void test_oneTime_setDate_does_not_change_dow_data() { | ||
4074 | 485 | QTest::addColumn<QString>("message"); | ||
4075 | 486 | QTest::addColumn<int>("dow"); | ||
4076 | 487 | |||
4077 | 488 | QTest::newRow("Monday") << "Monday" << (int)UCAlarm::Monday; | ||
4078 | 489 | QTest::newRow("Tuesday") << "Tuesday" << (int)UCAlarm::Tuesday; | ||
4079 | 490 | QTest::newRow("Wednesday") << "Wednesday" << (int)UCAlarm::Wednesday; | ||
4080 | 491 | QTest::newRow("Thursday") << "Thursday" << (int)UCAlarm::Thursday; | ||
4081 | 492 | QTest::newRow("Friday") << "Friday" << (int)UCAlarm::Friday; | ||
4082 | 493 | QTest::newRow("Saturday") << "Saturday" << (int)UCAlarm::Saturday; | ||
4083 | 494 | QTest::newRow("Sunday") << "Sunday" << (int)UCAlarm::Sunday; | ||
4084 | 495 | } | ||
4085 | 496 | void test_oneTime_setDate_does_not_change_dow() { | ||
4086 | 497 | QFETCH(QString, message); | ||
4087 | 498 | QFETCH(int, dow); | ||
4088 | 499 | |||
4089 | 500 | UCAlarm alarm(QDateTime::currentDateTime(), "test_oneTime_setDate_does_not_change_dow_" + message); | ||
4090 | 501 | alarm.setDaysOfWeek((UCAlarm::DaysOfWeek)dow); | ||
4091 | 502 | alarm.setDate(QDateTime::currentDateTime().addSecs(3600)); | ||
4092 | 503 | QCOMPARE((int)alarm.daysOfWeek(), dow); | ||
4093 | 504 | } | ||
4094 | 459 | }; | 505 | }; |
4095 | 460 | 506 | ||
4096 | 461 | QTEST_MAIN(tst_UCAlarms) | 507 | QTEST_MAIN(tst_UCAlarms) |
4097 | 462 | 508 | ||
4098 | === modified file 'tests/unit/tst_components/tst_label.qml' | |||
4099 | --- tests/unit/tst_components/tst_label.qml 2014-04-23 08:50:20 +0000 | |||
4100 | +++ tests/unit/tst_components/tst_label.qml 2014-05-28 18:09:57 +0000 | |||
4101 | @@ -44,7 +44,7 @@ | |||
4102 | 44 | } | 44 | } |
4103 | 45 | 45 | ||
4104 | 46 | function test_fontWeight() { | 46 | function test_fontWeight() { |
4106 | 47 | compare(textCustom.font.weight, Font.Normal, "font.weight is 'normal' by default") | 47 | compare(textCustom.font.weight, Font.Light, "font.weight is 'light' by default") |
4107 | 48 | 48 | ||
4108 | 49 | var fontWeights = [ Font.Light, Font.Normal, Font.DemiBold, Font.Bold, Font.Black ] | 49 | var fontWeights = [ Font.Light, Font.Normal, Font.DemiBold, Font.Bold, Font.Black ] |
4109 | 50 | 50 | ||
4110 | 51 | 51 | ||
4111 | === added file 'tests/unit/tst_components/tst_sortfiltermodel.qml' | |||
4112 | --- tests/unit/tst_components/tst_sortfiltermodel.qml 1970-01-01 00:00:00 +0000 | |||
4113 | +++ tests/unit/tst_components/tst_sortfiltermodel.qml 2014-05-28 18:09:57 +0000 | |||
4114 | @@ -0,0 +1,123 @@ | |||
4115 | 1 | /* | ||
4116 | 2 | * Copyright 2014 Canonical Ltd. | ||
4117 | 3 | * | ||
4118 | 4 | * This program is free software; you can redistribute it and/or modify | ||
4119 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
4120 | 6 | * the Free Software Foundation; version 3. | ||
4121 | 7 | * | ||
4122 | 8 | * This program is distributed in the hope that it will be useful, | ||
4123 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4124 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4125 | 11 | * GNU Lesser General Public License for more details. | ||
4126 | 12 | * | ||
4127 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4128 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4129 | 15 | */ | ||
4130 | 16 | |||
4131 | 17 | import QtQuick 2.0 | ||
4132 | 18 | import QtTest 1.0 | ||
4133 | 19 | import Ubuntu.Components 1.1 | ||
4134 | 20 | |||
4135 | 21 | TestCase { | ||
4136 | 22 | name: "SortFilterModel" | ||
4137 | 23 | |||
4138 | 24 | ListModel { | ||
4139 | 25 | id: things | ||
4140 | 26 | ListElement { foo: "pub"; alpha: "bee"; num: 200 } | ||
4141 | 27 | ListElement { foo: "den"; alpha: "cow"; num: 300 } | ||
4142 | 28 | ListElement { foo: "bar"; alpha: "ant"; num: 100 } | ||
4143 | 29 | } | ||
4144 | 30 | |||
4145 | 31 | SortFilterModel { | ||
4146 | 32 | id: unmodified | ||
4147 | 33 | model: things | ||
4148 | 34 | } | ||
4149 | 35 | |||
4150 | 36 | SortFilterModel { | ||
4151 | 37 | id: alphabetic | ||
4152 | 38 | model: things | ||
4153 | 39 | sort.property: "alpha" | ||
4154 | 40 | } | ||
4155 | 41 | |||
4156 | 42 | SortFilterModel { | ||
4157 | 43 | id: alphaSecond | ||
4158 | 44 | model: things | ||
4159 | 45 | sort.property: "foo" | ||
4160 | 46 | } | ||
4161 | 47 | |||
4162 | 48 | SortFilterModel { | ||
4163 | 49 | id: alphabeticRe | ||
4164 | 50 | model: things | ||
4165 | 51 | sort.property: "alpha" | ||
4166 | 52 | sort.order: Qt.DescendingOrder | ||
4167 | 53 | } | ||
4168 | 54 | |||
4169 | 55 | SortFilterModel { | ||
4170 | 56 | id: numeric | ||
4171 | 57 | model: things | ||
4172 | 58 | sort.property: "num" | ||
4173 | 59 | } | ||
4174 | 60 | |||
4175 | 61 | SortFilterModel { | ||
4176 | 62 | id: numericRe | ||
4177 | 63 | model: things | ||
4178 | 64 | sort.property: "num" | ||
4179 | 65 | sort.order: Qt.DescendingOrder | ||
4180 | 66 | } | ||
4181 | 67 | |||
4182 | 68 | SortFilterModel { | ||
4183 | 69 | id: bee | ||
4184 | 70 | model: things | ||
4185 | 71 | filter.property: "alpha" | ||
4186 | 72 | filter.pattern: /e/ | ||
4187 | 73 | } | ||
4188 | 74 | |||
4189 | 75 | function test_passthrough() { | ||
4190 | 76 | compare(unmodified.count, things.count) | ||
4191 | 77 | } | ||
4192 | 78 | |||
4193 | 79 | function test_sort() { | ||
4194 | 80 | // Default is Ascending | ||
4195 | 81 | compare(alphabetic.sort.order, Qt.AscendingOrder) | ||
4196 | 82 | compare(alphabetic.get(0).alpha, "ant") | ||
4197 | 83 | compare(alphabetic.get(1).alpha, "bee") | ||
4198 | 84 | compare(alphabetic.get(2).alpha, "cow") | ||
4199 | 85 | |||
4200 | 86 | // Ensure different columns work also | ||
4201 | 87 | compare(alphaSecond.get(0).foo, "bar") | ||
4202 | 88 | |||
4203 | 89 | // Descending | ||
4204 | 90 | compare(alphabeticRe.sort.order, Qt.DescendingOrder) | ||
4205 | 91 | compare(alphabeticRe.get(0).alpha, "cow") | ||
4206 | 92 | compare(alphabeticRe.get(1).alpha, "bee") | ||
4207 | 93 | compare(alphabeticRe.get(2).alpha, "ant") | ||
4208 | 94 | |||
4209 | 95 | // Numbers | ||
4210 | 96 | compare(numeric.get(0).num, 100) | ||
4211 | 97 | compare(numericRe.get(0).num, 300) | ||
4212 | 98 | |||
4213 | 99 | // Changing roles | ||
4214 | 100 | alphabetic.sort.property = "foo" | ||
4215 | 101 | compare(alphabetic.get(0).foo, "bar") | ||
4216 | 102 | compare(alphabetic.get(1).foo, "den") | ||
4217 | 103 | compare(alphabetic.get(2).foo, "pub") | ||
4218 | 104 | // Sanity check | ||
4219 | 105 | compare(alphabetic.get(1).alpha, "cow") | ||
4220 | 106 | // change again | ||
4221 | 107 | alphabetic.sort.property = "num" | ||
4222 | 108 | compare(alphabetic.get(0).num, 100) | ||
4223 | 109 | compare(alphabetic.get(1).num, 200) | ||
4224 | 110 | compare(alphabetic.get(2).num, 300) | ||
4225 | 111 | // Sanity check | ||
4226 | 112 | compare(alphabetic.get(2).alpha, "cow") | ||
4227 | 113 | } | ||
4228 | 114 | |||
4229 | 115 | function test_filter() { | ||
4230 | 116 | // Default is an empty pattern | ||
4231 | 117 | compare(unmodified.filter.pattern, RegExp()) | ||
4232 | 118 | |||
4233 | 119 | // Filter | ||
4234 | 120 | compare(bee.count, 1) | ||
4235 | 121 | compare(bee.get(0).alpha, "bee") | ||
4236 | 122 | } | ||
4237 | 123 | } | ||
4238 | 0 | 124 | ||
4239 | === modified file 'tests/unit/tst_components/tst_toolbaritems.qml' | |||
4240 | --- tests/unit/tst_components/tst_toolbaritems.qml 2014-04-23 08:50:20 +0000 | |||
4241 | +++ tests/unit/tst_components/tst_toolbaritems.qml 2014-05-28 18:09:57 +0000 | |||
4242 | @@ -23,6 +23,7 @@ | |||
4243 | 23 | height: 200 | 23 | height: 200 |
4244 | 24 | 24 | ||
4245 | 25 | MainView { | 25 | MainView { |
4246 | 26 | id: mainView | ||
4247 | 26 | anchors.fill: parent | 27 | anchors.fill: parent |
4248 | 27 | PageStack { | 28 | PageStack { |
4249 | 28 | id: pageStack0 | 29 | id: pageStack0 |
4250 | @@ -37,7 +38,8 @@ | |||
4251 | 37 | 38 | ||
4252 | 38 | Page { | 39 | Page { |
4253 | 39 | id: page1 | 40 | id: page1 |
4255 | 40 | tools: ToolbarItems { | 41 | tools: toolbarItems |
4256 | 42 | ToolbarItems { | ||
4257 | 41 | id: toolbarItems | 43 | id: toolbarItems |
4258 | 42 | ToolbarButton { | 44 | ToolbarButton { |
4259 | 43 | id: button | 45 | id: button |
4260 | @@ -94,5 +96,12 @@ | |||
4261 | 94 | pageStack0.pop(); | 96 | pageStack0.pop(); |
4262 | 95 | compare(pageStack0.depth, 0, "pageStack is empty after popping both pages"); | 97 | compare(pageStack0.depth, 0, "pageStack is empty after popping both pages"); |
4263 | 96 | } | 98 | } |
4264 | 99 | |||
4265 | 100 | function test_visible() { | ||
4266 | 101 | compare(toolbarItems.visible, true, "Toolbar items are visible when in toolbar"); | ||
4267 | 102 | mainView.useDeprecatedToolbar = false; | ||
4268 | 103 | compare(toolbarItems.visible, false, "Toolbar items are invisible when not using deprecated toolbar"); | ||
4269 | 104 | mainView.useDeprecatedToolbar = true; | ||
4270 | 105 | } | ||
4271 | 97 | } | 106 | } |
4272 | 98 | } | 107 | } |
4273 | 99 | 108 | ||
4274 | === removed directory 'tests/unit/tst_i18n/appropriate/localizedApp' | |||
4275 | === renamed directory 'tests/unit/tst_i18n/appropriate' => 'tests/unit/tst_i18n/localizedApp' | |||
4276 | === added directory 'tests/unit/tst_i18n/localizedApp/.click' | |||
4277 | === added file 'tests/unit/tst_i18n/localizedApp/.click/status' | |||
4278 | --- tests/unit/tst_i18n/localizedApp/.click/status 1970-01-01 00:00:00 +0000 | |||
4279 | +++ tests/unit/tst_i18n/localizedApp/.click/status 2014-05-28 18:09:57 +0000 | |||
4280 | @@ -0,0 +1,1 @@ | |||
4281 | 1 | Package: localizedApp | ||
4282 | 0 | 2 | ||
4283 | === added directory 'tests/unit/tst_i18n/localizedApp/share' | |||
4284 | === renamed directory 'tests/unit/tst_i18n/appropriate/locale' => 'tests/unit/tst_i18n/localizedApp/share/locale' | |||
4285 | === modified file 'tests/unit/tst_i18n/src/tst_i18n.cpp' | |||
4286 | --- tests/unit/tst_i18n/src/tst_i18n.cpp 2013-12-13 15:37:31 +0000 | |||
4287 | +++ tests/unit/tst_i18n/src/tst_i18n.cpp 2014-05-28 18:09:57 +0000 | |||
4288 | @@ -76,19 +76,11 @@ | |||
4289 | 76 | { | 76 | { |
4290 | 77 | // Set test locale folder in the environment | 77 | // Set test locale folder in the environment |
4291 | 78 | // Using setenv because QProcessEnvironment ignores changes | 78 | // Using setenv because QProcessEnvironment ignores changes |
4295 | 79 | QString wrongDataFolder(QCoreApplication::applicationDirPath() + "/diversion"); | 79 | QString testAppDir(QCoreApplication::applicationDirPath() + "/localizedApp"); |
4296 | 80 | QString testDataFolder(QCoreApplication::applicationDirPath() + "/appropriate"); | 80 | setenv("APP_DIR", testAppDir.toUtf8(), 1); |
4294 | 81 | setenv("XDG_DATA_DIRS", (wrongDataFolder + ":" + testDataFolder).toUtf8(), 1); | ||
4297 | 82 | 81 | ||
4298 | 83 | // Verify that we set it correctly | 82 | // Verify that we set it correctly |
4307 | 84 | QString dataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, | 83 | QVERIFY(QFileInfo(testAppDir + "/share/locale/en/LC_MESSAGES/localizedApp.mo").exists()); |
4300 | 85 | "localizedApp", QStandardPaths::LocateDirectory)); | ||
4301 | 86 | QDir dataDir(dataPath); | ||
4302 | 87 | QVERIFY(dataDir.cdUp()); | ||
4303 | 88 | QVERIFY(dataDir.cd("locale")); | ||
4304 | 89 | QString doubleCheckLocalePath(dataDir.path()); | ||
4305 | 90 | QCOMPARE(doubleCheckLocalePath, testDataFolder + "/locale"); | ||
4306 | 91 | QVERIFY(QFileInfo(testDataFolder + "/locale/en/LC_MESSAGES/localizedApp.mo").exists()); | ||
4308 | 92 | 84 | ||
4309 | 93 | QString modules("../../../modules"); | 85 | QString modules("../../../modules"); |
4310 | 94 | QVERIFY(QDir(modules).exists()); | 86 | QVERIFY(QDir(modules).exists()); |
4311 | @@ -128,12 +120,8 @@ | |||
4312 | 128 | 120 | ||
4313 | 129 | // Was the locale folder detected and set? | 121 | // Was the locale folder detected and set? |
4314 | 130 | QString boundDomain(C::bindtextdomain(i18n->domain().toUtf8(), ((const char*)0))); | 122 | QString boundDomain(C::bindtextdomain(i18n->domain().toUtf8(), ((const char*)0))); |
4321 | 131 | QString dataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, | 123 | QString testAppDir(QCoreApplication::applicationDirPath() + "/localizedApp"); |
4322 | 132 | i18n->domain(), QStandardPaths::LocateDirectory)); | 124 | QString expectedLocalePath(QDir(testAppDir).filePath("share/locale")); |
4317 | 133 | QDir dataDir(dataPath); | ||
4318 | 134 | QVERIFY(dataDir.cdUp()); | ||
4319 | 135 | QVERIFY(dataDir.cd("locale")); | ||
4320 | 136 | QString expectedLocalePath(dataDir.path()); | ||
4323 | 137 | QCOMPARE(boundDomain, expectedLocalePath); | 125 | QCOMPARE(boundDomain, expectedLocalePath); |
4324 | 138 | // Is the domain gettext uses correct? | 126 | // Is the domain gettext uses correct? |
4325 | 139 | QString gettextDomain(C::textdomain(((const char*)0))); | 127 | QString gettextDomain(C::textdomain(((const char*)0))); |
4326 | 140 | 128 | ||
4327 | === modified file 'tests/unit/tst_i18n/tst_i18n.pro' | |||
4328 | --- tests/unit/tst_i18n/tst_i18n.pro 2013-12-13 15:37:31 +0000 | |||
4329 | +++ tests/unit/tst_i18n/tst_i18n.pro 2014-05-28 18:09:57 +0000 | |||
4330 | @@ -2,7 +2,7 @@ | |||
4331 | 2 | QT += gui | 2 | QT += gui |
4332 | 3 | DEFINES += SRCDIR=\\\"$$PWD/\\\" | 3 | DEFINES += SRCDIR=\\\"$$PWD/\\\" |
4333 | 4 | 4 | ||
4335 | 5 | system(msgfmt po/en_US.po -o appropriate/locale/en/LC_MESSAGES/localizedApp.mo) | 5 | system(msgfmt po/en_US.po -o localizedApp/share/locale/en/LC_MESSAGES/localizedApp.mo) |
4336 | 6 | 6 | ||
4337 | 7 | SOURCES += \ | 7 | SOURCES += \ |
4338 | 8 | src\/tst_i18n.cpp | 8 | src\/tst_i18n.cpp |
4339 | 9 | 9 | ||
4340 | === modified file 'tests/unit_x11/tst_components/tst_datepicker.qml' | |||
4341 | --- tests/unit_x11/tst_components/tst_datepicker.qml 2014-05-05 17:45:45 +0000 | |||
4342 | +++ tests/unit_x11/tst_components/tst_datepicker.qml 2014-05-28 18:09:57 +0000 | |||
4343 | @@ -59,7 +59,7 @@ | |||
4344 | 59 | function getPickerLabel(picker, name) { | 59 | function getPickerLabel(picker, name) { |
4345 | 60 | var pickerItem = findChild(picker, name); | 60 | var pickerItem = findChild(picker, name); |
4346 | 61 | var pickerCurrent = findChild(pickerItem, "Picker_ViewLoader"); | 61 | var pickerCurrent = findChild(pickerItem, "Picker_ViewLoader"); |
4348 | 62 | return findChild(pickerCurrent.item.currentItem, "PickerRow_PickerLabel"); | 62 | return pickerCurrent.item.currentItem.children[2]; |
4349 | 63 | } | 63 | } |
4350 | 64 | function getPickerModel(picker, name) { | 64 | function getPickerModel(picker, name) { |
4351 | 65 | var pickerItem = findInvisibleChild(picker, name); | 65 | var pickerItem = findInvisibleChild(picker, name); |
4352 | 66 | 66 | ||
4353 | === added file 'tests/unit_x11/tst_layouts/NestedVisibility.qml' | |||
4354 | --- tests/unit_x11/tst_layouts/NestedVisibility.qml 1970-01-01 00:00:00 +0000 | |||
4355 | +++ tests/unit_x11/tst_layouts/NestedVisibility.qml 2014-05-28 18:09:57 +0000 | |||
4356 | @@ -0,0 +1,163 @@ | |||
4357 | 1 | /* | ||
4358 | 2 | * Copyright 2014 Canonical Ltd. | ||
4359 | 3 | * | ||
4360 | 4 | * This program is free software; you can redistribute it and/or modify | ||
4361 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
4362 | 6 | * the Free Software Foundation; version 3. | ||
4363 | 7 | * | ||
4364 | 8 | * This program is distributed in the hope that it will be useful, | ||
4365 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4366 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4367 | 11 | * GNU Lesser General Public License for more details. | ||
4368 | 12 | * | ||
4369 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4370 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4371 | 15 | */ | ||
4372 | 16 | |||
4373 | 17 | import QtQuick 2.0 | ||
4374 | 18 | import Ubuntu.Components 1.1 | ||
4375 | 19 | import Ubuntu.Layouts 1.0 | ||
4376 | 20 | |||
4377 | 21 | MainView { | ||
4378 | 22 | id: main | ||
4379 | 23 | objectName: "mainView" | ||
4380 | 24 | applicationName: "test-app" | ||
4381 | 25 | |||
4382 | 26 | /* | ||
4383 | 27 | This property enables the application to change orientation | ||
4384 | 28 | when the device is rotated. The default is false. | ||
4385 | 29 | */ | ||
4386 | 30 | automaticOrientation: true // TODO: support wide aspect ratios, esp. on prepareGamePage | ||
4387 | 31 | |||
4388 | 32 | width: units.gu(40) | ||
4389 | 33 | height: units.gu(75) | ||
4390 | 34 | |||
4391 | 35 | function phoneLayout() { | ||
4392 | 36 | width = units.gu(50); | ||
4393 | 37 | } | ||
4394 | 38 | function tabletPortraitLayout() { | ||
4395 | 39 | width = units.gu(70); | ||
4396 | 40 | } | ||
4397 | 41 | function tabletLandscapeLayout() { | ||
4398 | 42 | width = units.gu(100); | ||
4399 | 43 | } | ||
4400 | 44 | |||
4401 | 45 | PageStack { | ||
4402 | 46 | Component.onCompleted: push(testPage) | ||
4403 | 47 | |||
4404 | 48 | Page { | ||
4405 | 49 | title: i18n.tr("Conditional Layouts with PageStack") | ||
4406 | 50 | id: testPage | ||
4407 | 51 | visible: false | ||
4408 | 52 | |||
4409 | 53 | Layouts { | ||
4410 | 54 | id: layouts | ||
4411 | 55 | objectName: "mainLayout" | ||
4412 | 56 | width: parent.width | ||
4413 | 57 | height: parent.height | ||
4414 | 58 | layouts: [ | ||
4415 | 59 | ConditionalLayout { | ||
4416 | 60 | name: "tabletPortrait" | ||
4417 | 61 | when: main.width > units.gu(50) | ||
4418 | 62 | Layouts { | ||
4419 | 63 | anchors.fill: parent | ||
4420 | 64 | objectName: "nestedLayout" | ||
4421 | 65 | layouts: [ | ||
4422 | 66 | ConditionalLayout { | ||
4423 | 67 | name: "tabletLandscape" | ||
4424 | 68 | when: main.width > units.gu(70) | ||
4425 | 69 | Row { | ||
4426 | 70 | objectName: "tabletLandscape" | ||
4427 | 71 | anchors.fill: parent | ||
4428 | 72 | Rectangle { | ||
4429 | 73 | height: parent.height | ||
4430 | 74 | color: "white" | ||
4431 | 75 | width: parent.width / 5 | ||
4432 | 76 | } | ||
4433 | 77 | Flow { | ||
4434 | 78 | spacing: units.gu(2) | ||
4435 | 79 | ItemLayout { | ||
4436 | 80 | objectName: "nestedMagentaContainer" | ||
4437 | 81 | item: "mainMagenta" | ||
4438 | 82 | width: units.gu(20) | ||
4439 | 83 | height: width | ||
4440 | 84 | } | ||
4441 | 85 | ItemLayout { | ||
4442 | 86 | objectName: "nestedGreenContainer" | ||
4443 | 87 | item: "mainGreen" | ||
4444 | 88 | width: units.gu(60) | ||
4445 | 89 | height: width | ||
4446 | 90 | } | ||
4447 | 91 | } | ||
4448 | 92 | } | ||
4449 | 93 | } | ||
4450 | 94 | ] | ||
4451 | 95 | // Default layout, but can have ItemLayouts | ||
4452 | 96 | // as those will belong to the previous Layouts | ||
4453 | 97 | // and attaching Layouts.item we can layout it further | ||
4454 | 98 | Flow { | ||
4455 | 99 | objectName: "tabletPortrait" | ||
4456 | 100 | anchors.fill: parent | ||
4457 | 101 | ItemLayout { | ||
4458 | 102 | objectName: "greenContainer" | ||
4459 | 103 | item: "mainGreen" | ||
4460 | 104 | width: units.gu(40) | ||
4461 | 105 | height: width | ||
4462 | 106 | Layouts.item: item | ||
4463 | 107 | } | ||
4464 | 108 | ItemLayout { | ||
4465 | 109 | objectName: "magentaContainer" | ||
4466 | 110 | item: "mainMagenta" | ||
4467 | 111 | width: units.gu(60) | ||
4468 | 112 | height: width | ||
4469 | 113 | Layouts.item: item | ||
4470 | 114 | } | ||
4471 | 115 | } | ||
4472 | 116 | } | ||
4473 | 117 | } | ||
4474 | 118 | ] | ||
4475 | 119 | |||
4476 | 120 | // default layout for mainLayout | ||
4477 | 121 | Flow { | ||
4478 | 122 | objectName: "mainDefaultLayout" | ||
4479 | 123 | anchors.fill: parent | ||
4480 | 124 | Rectangle { | ||
4481 | 125 | objectName: "mainRed" | ||
4482 | 126 | width: units.gu(15) | ||
4483 | 127 | height: width | ||
4484 | 128 | color: "red" | ||
4485 | 129 | Layouts.item: "mainRed" | ||
4486 | 130 | } | ||
4487 | 131 | Rectangle { | ||
4488 | 132 | objectName: "mainGreen" | ||
4489 | 133 | width: units.gu(15) | ||
4490 | 134 | height: width | ||
4491 | 135 | color: "green" | ||
4492 | 136 | Layouts.item: "mainGreen" | ||
4493 | 137 | } | ||
4494 | 138 | Rectangle { | ||
4495 | 139 | objectName: "mainBlue" | ||
4496 | 140 | width: units.gu(15) | ||
4497 | 141 | height: width | ||
4498 | 142 | color: "blue" | ||
4499 | 143 | Layouts.item: "mainBlue" | ||
4500 | 144 | } | ||
4501 | 145 | Rectangle { | ||
4502 | 146 | objectName: "mainMagenta" | ||
4503 | 147 | width: units.gu(15) | ||
4504 | 148 | height: width | ||
4505 | 149 | color: "magenta" | ||
4506 | 150 | Layouts.item: "mainMagenta" | ||
4507 | 151 | } | ||
4508 | 152 | Rectangle { | ||
4509 | 153 | objectName: "mainHidden" | ||
4510 | 154 | width: units.gu(15) | ||
4511 | 155 | height: width | ||
4512 | 156 | color: "yellow" | ||
4513 | 157 | visible: false | ||
4514 | 158 | } | ||
4515 | 159 | } | ||
4516 | 160 | } | ||
4517 | 161 | } | ||
4518 | 162 | } | ||
4519 | 163 | } | ||
4520 | 0 | 164 | ||
4521 | === added file 'tests/unit_x11/tst_layouts/Visibility.qml' | |||
4522 | --- tests/unit_x11/tst_layouts/Visibility.qml 1970-01-01 00:00:00 +0000 | |||
4523 | +++ tests/unit_x11/tst_layouts/Visibility.qml 2014-05-28 18:09:57 +0000 | |||
4524 | @@ -0,0 +1,84 @@ | |||
4525 | 1 | /* | ||
4526 | 2 | * Copyright 2014 Canonical Ltd. | ||
4527 | 3 | * | ||
4528 | 4 | * This program is free software; you can redistribute it and/or modify | ||
4529 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
4530 | 6 | * the Free Software Foundation; version 3. | ||
4531 | 7 | * | ||
4532 | 8 | * This program is distributed in the hope that it will be useful, | ||
4533 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4534 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4535 | 11 | * GNU Lesser General Public License for more details. | ||
4536 | 12 | * | ||
4537 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
4538 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4539 | 15 | */ | ||
4540 | 16 | |||
4541 | 17 | import QtQuick 2.0 | ||
4542 | 18 | import Ubuntu.Components 1.1 | ||
4543 | 19 | import Ubuntu.Layouts 1.0 | ||
4544 | 20 | |||
4545 | 21 | MainView { | ||
4546 | 22 | id: main | ||
4547 | 23 | objectName: "mainView" | ||
4548 | 24 | applicationName: "test-app" | ||
4549 | 25 | |||
4550 | 26 | /* | ||
4551 | 27 | This property enables the application to change orientation | ||
4552 | 28 | when the device is rotated. The default is false. | ||
4553 | 29 | */ | ||
4554 | 30 | automaticOrientation: true // TODO: support wide aspect ratios, esp. on prepareGamePage | ||
4555 | 31 | |||
4556 | 32 | property bool boundValue: true | ||
4557 | 33 | |||
4558 | 34 | width: units.gu(100) | ||
4559 | 35 | height: units.gu(75) | ||
4560 | 36 | |||
4561 | 37 | function portraitLayout() { | ||
4562 | 38 | width = units.gu(50); | ||
4563 | 39 | } | ||
4564 | 40 | function landscapeLayout() { | ||
4565 | 41 | width = units.gu(100); | ||
4566 | 42 | } | ||
4567 | 43 | |||
4568 | 44 | PageStack { | ||
4569 | 45 | Component.onCompleted: push(testPage) | ||
4570 | 46 | |||
4571 | 47 | Page { | ||
4572 | 48 | title: i18n.tr("Conditional Layouts with PageStack") | ||
4573 | 49 | id: testPage | ||
4574 | 50 | visible: false | ||
4575 | 51 | |||
4576 | 52 | Layouts { | ||
4577 | 53 | id: layouts | ||
4578 | 54 | objectName: "layoutManager" | ||
4579 | 55 | width: parent.width | ||
4580 | 56 | height: parent.height | ||
4581 | 57 | layouts: [ | ||
4582 | 58 | ConditionalLayout { | ||
4583 | 59 | name: "wide" | ||
4584 | 60 | when: layouts.width < units.gu(60) | ||
4585 | 61 | UbuntuShape { | ||
4586 | 62 | width: units.gu(20) | ||
4587 | 63 | height: units.gu(20) | ||
4588 | 64 | color: "red" | ||
4589 | 65 | Label { text: "wide" } | ||
4590 | 66 | } | ||
4591 | 67 | } | ||
4592 | 68 | ] | ||
4593 | 69 | |||
4594 | 70 | // This is a default layout. | ||
4595 | 71 | // When using a PageStack and layouts is not empty, it won't display or switch to the default layout. | ||
4596 | 72 | // However it only works when putting it into the layouts list with an inversed condition. | ||
4597 | 73 | UbuntuShape { | ||
4598 | 74 | objectName: "DefaultLayout" | ||
4599 | 75 | width: units.gu(20) | ||
4600 | 76 | height: units.gu(20) | ||
4601 | 77 | color: "green" | ||
4602 | 78 | visible: main.boundValue | ||
4603 | 79 | Label { text: "default" } | ||
4604 | 80 | } | ||
4605 | 81 | } | ||
4606 | 82 | } | ||
4607 | 83 | } | ||
4608 | 84 | } | ||
4609 | 0 | 85 | ||
4610 | === modified file 'tests/unit_x11/tst_layouts/tst_layouts.cpp' | |||
4611 | --- tests/unit_x11/tst_layouts/tst_layouts.cpp 2014-03-19 12:48:33 +0000 | |||
4612 | +++ tests/unit_x11/tst_layouts/tst_layouts.cpp 2014-05-28 18:09:57 +0000 | |||
4613 | @@ -72,6 +72,25 @@ | |||
4614 | 72 | return (children.count() > 0) ? children[0] : 0; | 72 | return (children.count() > 0) ? children[0] : 0; |
4615 | 73 | } | 73 | } |
4616 | 74 | 74 | ||
4617 | 75 | bool hasChildItem(QQuickItem *child, QQuickItem *parent) | ||
4618 | 76 | { | ||
4619 | 77 | QQuickItem *pl = child->parentItem(); | ||
4620 | 78 | while (pl) { | ||
4621 | 79 | if (pl == parent) { | ||
4622 | 80 | return true; | ||
4623 | 81 | } | ||
4624 | 82 | pl = pl->parentItem(); | ||
4625 | 83 | } | ||
4626 | 84 | return false; | ||
4627 | 85 | } | ||
4628 | 86 | |||
4629 | 87 | QQuickItem *prevSibling(QQuickItem *item) | ||
4630 | 88 | { | ||
4631 | 89 | QList<QQuickItem*> children = item->parentItem()->childItems(); | ||
4632 | 90 | int index = children.indexOf(item); | ||
4633 | 91 | return (index > 0) ? children.at(index - 1) : 0; | ||
4634 | 92 | } | ||
4635 | 93 | |||
4636 | 75 | 94 | ||
4637 | 76 | private Q_SLOTS: | 95 | private Q_SLOTS: |
4638 | 77 | void initTestCase() | 96 | void initTestCase() |
4639 | @@ -419,16 +438,16 @@ | |||
4640 | 419 | 438 | ||
4641 | 420 | void testCase_AnchorFilledReparenting() | 439 | void testCase_AnchorFilledReparenting() |
4642 | 421 | { | 440 | { |
4644 | 422 | QScopedPointer<QQuickView> view(loadTest("AnchorFilledReparenting.qml")); | 441 | QScopedPointer<UbuntuTestCase> view(new UbuntuTestCase("AnchorFilledReparenting.qml")); |
4645 | 423 | QVERIFY(view); | 442 | QVERIFY(view); |
4646 | 424 | QQuickItem *root = view->rootObject(); | 443 | QQuickItem *root = view->rootObject(); |
4647 | 425 | QVERIFY(root); | 444 | QVERIFY(root); |
4648 | 426 | 445 | ||
4650 | 427 | QQuickItem *layout = testItem(root, "layoutManager"); | 446 | ULLayouts *layout = view->findItem<ULLayouts*>("layoutManager"); |
4651 | 428 | QVERIFY(layout); | 447 | QVERIFY(layout); |
4652 | 429 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); | 448 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); |
4653 | 430 | 449 | ||
4655 | 431 | QQuickItem *item = testItem(root, "testItem"); | 450 | QQuickItem *item = view->findItem<QQuickItem*>("testItem"); |
4656 | 432 | QVERIFY(item); | 451 | QVERIFY(item); |
4657 | 433 | 452 | ||
4658 | 434 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); | 453 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); |
4659 | @@ -436,27 +455,27 @@ | |||
4660 | 436 | 455 | ||
4661 | 437 | root->setWidth(root->width() + 100); | 456 | root->setWidth(root->width() + 100); |
4662 | 438 | layoutChangeSpy.wait(100); | 457 | layoutChangeSpy.wait(100); |
4664 | 439 | QQuickItem *testLayout = testItem(root, "testLayout"); | 458 | QQuickItem *testLayout = view->findItem<QQuickItem*>("testLayout"); |
4665 | 440 | QVERIFY(testLayout); | 459 | QVERIFY(testLayout); |
4666 | 441 | QCOMPARE(anchors->fill(), testLayout); | 460 | QCOMPARE(anchors->fill(), testLayout); |
4667 | 442 | 461 | ||
4668 | 443 | root->setWidth(root->width() - 100); | 462 | root->setWidth(root->width() - 100); |
4669 | 444 | layoutChangeSpy.wait(100); | 463 | layoutChangeSpy.wait(100); |
4671 | 445 | QCOMPARE(anchors->fill(), layout); | 464 | QCOMPARE(anchors->fill(), layout->contentItem()); |
4672 | 446 | } | 465 | } |
4673 | 447 | 466 | ||
4674 | 448 | void testCase_AnchorFilledMargins() | 467 | void testCase_AnchorFilledMargins() |
4675 | 449 | { | 468 | { |
4677 | 450 | QScopedPointer<QQuickView> view(loadTest("AnchorFilledMargins.qml")); | 469 | QScopedPointer<UbuntuTestCase> view(new UbuntuTestCase("AnchorFilledMargins.qml")); |
4678 | 451 | QVERIFY(view); | 470 | QVERIFY(view); |
4679 | 452 | QQuickItem *root = view->rootObject(); | 471 | QQuickItem *root = view->rootObject(); |
4680 | 453 | QVERIFY(root); | 472 | QVERIFY(root); |
4681 | 454 | 473 | ||
4683 | 455 | QQuickItem *layout = testItem(root, "layoutManager"); | 474 | ULLayouts *layout = view->findItem<ULLayouts*>("layoutManager"); |
4684 | 456 | QVERIFY(layout); | 475 | QVERIFY(layout); |
4685 | 457 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); | 476 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); |
4686 | 458 | 477 | ||
4688 | 459 | QQuickItem *item = testItem(root, "testItem"); | 478 | QQuickItem *item = view->findItem<QQuickItem*>("testItem"); |
4689 | 460 | QVERIFY(item); | 479 | QVERIFY(item); |
4690 | 461 | 480 | ||
4691 | 462 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); | 481 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); |
4692 | @@ -465,29 +484,29 @@ | |||
4693 | 465 | root->setWidth(root->width() + 100); | 484 | root->setWidth(root->width() + 100); |
4694 | 466 | layoutChangeSpy.wait(100); | 485 | layoutChangeSpy.wait(100); |
4695 | 467 | 486 | ||
4697 | 468 | QQuickItem *testLayout = testItem(root, "testLayout"); | 487 | QQuickItem *testLayout = view->findItem<QQuickItem*>("testLayout"); |
4698 | 469 | QVERIFY(testLayout); | 488 | QVERIFY(testLayout); |
4699 | 470 | QCOMPARE(anchors->fill(), testLayout); | 489 | QCOMPARE(anchors->fill(), testLayout); |
4700 | 471 | QCOMPARE(anchors->margins(), 0.0); | 490 | QCOMPARE(anchors->margins(), 0.0); |
4701 | 472 | 491 | ||
4702 | 473 | root->setWidth(root->width() - 100); | 492 | root->setWidth(root->width() - 100); |
4703 | 474 | layoutChangeSpy.wait(100); | 493 | layoutChangeSpy.wait(100); |
4705 | 475 | QCOMPARE(anchors->fill(), layout); | 494 | QCOMPARE(anchors->fill(), layout->contentItem()); |
4706 | 476 | QCOMPARE(anchors->margins(), 10.0); | 495 | QCOMPARE(anchors->margins(), 10.0); |
4707 | 477 | } | 496 | } |
4708 | 478 | 497 | ||
4709 | 479 | void testCase_AnchorFilledSeparateMargins() | 498 | void testCase_AnchorFilledSeparateMargins() |
4710 | 480 | { | 499 | { |
4712 | 481 | QScopedPointer<QQuickView> view(loadTest("AnchorFilledSeparateMargins.qml")); | 500 | QScopedPointer<UbuntuTestCase> view(new UbuntuTestCase("AnchorFilledSeparateMargins.qml")); |
4713 | 482 | QVERIFY(view); | 501 | QVERIFY(view); |
4714 | 483 | QQuickItem *root = view->rootObject(); | 502 | QQuickItem *root = view->rootObject(); |
4715 | 484 | QVERIFY(root); | 503 | QVERIFY(root); |
4716 | 485 | 504 | ||
4718 | 486 | QQuickItem *layout = testItem(root, "layoutManager"); | 505 | ULLayouts *layout = view->findItem<ULLayouts*>("layoutManager"); |
4719 | 487 | QVERIFY(layout); | 506 | QVERIFY(layout); |
4720 | 488 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); | 507 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); |
4721 | 489 | 508 | ||
4723 | 490 | QQuickItem *item = testItem(root, "testItem"); | 509 | QQuickItem *item = view->findItem<QQuickItem*>("testItem"); |
4724 | 491 | QVERIFY(item); | 510 | QVERIFY(item); |
4725 | 492 | 511 | ||
4726 | 493 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); | 512 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); |
4727 | @@ -496,7 +515,7 @@ | |||
4728 | 496 | root->setWidth(root->width() + 100); | 515 | root->setWidth(root->width() + 100); |
4729 | 497 | layoutChangeSpy.wait(100); | 516 | layoutChangeSpy.wait(100); |
4730 | 498 | 517 | ||
4732 | 499 | QQuickItem *testLayout = testItem(root, "testLayout"); | 518 | QQuickItem *testLayout = view->findItem<QQuickItem*>("testLayout"); |
4733 | 500 | QVERIFY(testLayout); | 519 | QVERIFY(testLayout); |
4734 | 501 | QCOMPARE(anchors->fill(), testLayout); | 520 | QCOMPARE(anchors->fill(), testLayout); |
4735 | 502 | QCOMPARE(anchors->margins(), 0.0); | 521 | QCOMPARE(anchors->margins(), 0.0); |
4736 | @@ -507,7 +526,7 @@ | |||
4737 | 507 | 526 | ||
4738 | 508 | root->setWidth(root->width() - 100); | 527 | root->setWidth(root->width() - 100); |
4739 | 509 | layoutChangeSpy.wait(100); | 528 | layoutChangeSpy.wait(100); |
4741 | 510 | QCOMPARE(anchors->fill(), layout); | 529 | QCOMPARE(anchors->fill(), layout->contentItem()); |
4742 | 511 | QCOMPARE(anchors->leftMargin(), 10.0); | 530 | QCOMPARE(anchors->leftMargin(), 10.0); |
4743 | 512 | QCOMPARE(anchors->topMargin(), 20.0); | 531 | QCOMPARE(anchors->topMargin(), 20.0); |
4744 | 513 | QCOMPARE(anchors->rightMargin(), 30.0); | 532 | QCOMPARE(anchors->rightMargin(), 30.0); |
4745 | @@ -516,16 +535,16 @@ | |||
4746 | 516 | 535 | ||
4747 | 517 | void testCase_AnchorCenteredInDefault() | 536 | void testCase_AnchorCenteredInDefault() |
4748 | 518 | { | 537 | { |
4750 | 519 | QScopedPointer<QQuickView> view(loadTest("AnchorCenteredInDefault.qml")); | 538 | QScopedPointer<UbuntuTestCase> view(new UbuntuTestCase("AnchorCenteredInDefault.qml")); |
4751 | 520 | QVERIFY(view); | 539 | QVERIFY(view); |
4752 | 521 | QQuickItem *root = view->rootObject(); | 540 | QQuickItem *root = view->rootObject(); |
4753 | 522 | QVERIFY(root); | 541 | QVERIFY(root); |
4754 | 523 | 542 | ||
4756 | 524 | QQuickItem *layout = testItem(root, "layoutManager"); | 543 | ULLayouts *layout = view->findItem<ULLayouts*>("layoutManager"); |
4757 | 525 | QVERIFY(layout); | 544 | QVERIFY(layout); |
4758 | 526 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); | 545 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); |
4759 | 527 | 546 | ||
4761 | 528 | QQuickItem *item = testItem(root, "testItem"); | 547 | QQuickItem *item = view->findItem<QQuickItem*>("testItem"); |
4762 | 529 | QVERIFY(item); | 548 | QVERIFY(item); |
4763 | 530 | 549 | ||
4764 | 531 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); | 550 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); |
4765 | @@ -533,335 +552,335 @@ | |||
4766 | 533 | 552 | ||
4767 | 534 | root->setWidth(root->width() + 100); | 553 | root->setWidth(root->width() + 100); |
4768 | 535 | layoutChangeSpy.wait(100); | 554 | layoutChangeSpy.wait(100); |
4770 | 536 | QQuickItem *testLayout = testItem(root, "testLayout"); | 555 | QQuickItem *testLayout = view->findItem<QQuickItem*>("testLayout"); |
4771 | 537 | QVERIFY(testLayout); | 556 | QVERIFY(testLayout); |
4772 | 538 | QCOMPARE(anchors->fill(), testLayout); | 557 | QCOMPARE(anchors->fill(), testLayout); |
4773 | 539 | 558 | ||
4774 | 540 | root->setWidth(root->width() - 100); | 559 | root->setWidth(root->width() - 100); |
4775 | 541 | layoutChangeSpy.wait(100); | 560 | layoutChangeSpy.wait(100); |
4777 | 542 | QCOMPARE(anchors->centerIn(), layout); | 561 | QCOMPARE(anchors->centerIn(), layout->contentItem()); |
4778 | 543 | } | 562 | } |
4779 | 544 | 563 | ||
4780 | 545 | void testCase_AnchorVerticalCenter() | 564 | void testCase_AnchorVerticalCenter() |
4781 | 546 | { | 565 | { |
4783 | 547 | QScopedPointer<QQuickView> view(loadTest("AnchorVerticalCenter.qml")); | 566 | QScopedPointer<UbuntuTestCase> view(new UbuntuTestCase("AnchorVerticalCenter.qml")); |
4784 | 548 | QVERIFY(view); | 567 | QVERIFY(view); |
4785 | 549 | QQuickItem *root = view->rootObject(); | 568 | QQuickItem *root = view->rootObject(); |
4786 | 550 | QVERIFY(root); | 569 | QVERIFY(root); |
4787 | 551 | 570 | ||
4789 | 552 | QQuickItem *layout = testItem(root, "layoutManager"); | 571 | ULLayouts *layout = view->findItem<ULLayouts*>("layoutManager"); |
4790 | 553 | QVERIFY(layout); | 572 | QVERIFY(layout); |
4791 | 554 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); | 573 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); |
4792 | 555 | 574 | ||
4794 | 556 | QQuickItem *item = testItem(root, "testItem"); | 575 | QQuickItem *item = view->findItem<QQuickItem*>("testItem"); |
4795 | 557 | QVERIFY(item); | 576 | QVERIFY(item); |
4796 | 558 | 577 | ||
4797 | 559 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); | 578 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); |
4798 | 560 | QVERIFY(anchors); | 579 | QVERIFY(anchors); |
4799 | 561 | 580 | ||
4801 | 562 | QCOMPARE(anchors->verticalCenter().item, layout); | 581 | QCOMPARE(anchors->verticalCenter().item, layout->contentItem()); |
4802 | 563 | 582 | ||
4803 | 564 | root->setWidth(root->width() + 100); | 583 | root->setWidth(root->width() + 100); |
4804 | 565 | layoutChangeSpy.wait(100); | 584 | layoutChangeSpy.wait(100); |
4806 | 566 | QQuickItem *testLayout = testItem(root, "testLayout"); | 585 | QQuickItem *testLayout = view->findItem<QQuickItem*>("testLayout"); |
4807 | 567 | QVERIFY(testLayout); | 586 | QVERIFY(testLayout); |
4808 | 568 | QCOMPARE(anchors->fill(), testLayout); | 587 | QCOMPARE(anchors->fill(), testLayout); |
4809 | 569 | 588 | ||
4810 | 570 | root->setWidth(root->width() - 100); | 589 | root->setWidth(root->width() - 100); |
4811 | 571 | layoutChangeSpy.wait(100); | 590 | layoutChangeSpy.wait(100); |
4813 | 572 | QCOMPARE(anchors->verticalCenter().item, layout); | 591 | QCOMPARE(anchors->verticalCenter().item, layout->contentItem()); |
4814 | 573 | } | 592 | } |
4815 | 574 | 593 | ||
4816 | 575 | void testCase_AnchorVerticalCenterOffset() | 594 | void testCase_AnchorVerticalCenterOffset() |
4817 | 576 | { | 595 | { |
4819 | 577 | QScopedPointer<QQuickView> view(loadTest("AnchorVerticalCenterOffset.qml")); | 596 | QScopedPointer<UbuntuTestCase> view(new UbuntuTestCase("AnchorVerticalCenterOffset.qml")); |
4820 | 578 | QVERIFY(view); | 597 | QVERIFY(view); |
4821 | 579 | QQuickItem *root = view->rootObject(); | 598 | QQuickItem *root = view->rootObject(); |
4822 | 580 | QVERIFY(root); | 599 | QVERIFY(root); |
4823 | 581 | 600 | ||
4825 | 582 | QQuickItem *layout = testItem(root, "layoutManager"); | 601 | ULLayouts *layout = view->findItem<ULLayouts*>("layoutManager"); |
4826 | 583 | QVERIFY(layout); | 602 | QVERIFY(layout); |
4827 | 584 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); | 603 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); |
4828 | 585 | 604 | ||
4830 | 586 | QQuickItem *item = testItem(root, "testItem"); | 605 | QQuickItem *item = view->findItem<QQuickItem*>("testItem"); |
4831 | 587 | QVERIFY(item); | 606 | QVERIFY(item); |
4832 | 588 | 607 | ||
4833 | 589 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); | 608 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); |
4834 | 590 | QVERIFY(anchors); | 609 | QVERIFY(anchors); |
4835 | 591 | 610 | ||
4837 | 592 | QCOMPARE(anchors->verticalCenter().item, layout); | 611 | QCOMPARE(anchors->verticalCenter().item, layout->contentItem()); |
4838 | 593 | QCOMPARE(anchors->verticalCenterOffset(), 50.0); | 612 | QCOMPARE(anchors->verticalCenterOffset(), 50.0); |
4839 | 594 | 613 | ||
4840 | 595 | root->setWidth(root->width() + 100); | 614 | root->setWidth(root->width() + 100); |
4841 | 596 | layoutChangeSpy.wait(100); | 615 | layoutChangeSpy.wait(100); |
4843 | 597 | QQuickItem *testLayout = qobject_cast<QQuickItem*>(testItem(root, "testLayout")); | 616 | QQuickItem *testLayout = view->findItem<QQuickItem*>("testLayout"); |
4844 | 598 | QVERIFY(testLayout); | 617 | QVERIFY(testLayout); |
4845 | 599 | QCOMPARE(anchors->fill(), testLayout); | 618 | QCOMPARE(anchors->fill(), testLayout); |
4846 | 600 | // no need to check offset as it does not affect the fill | 619 | // no need to check offset as it does not affect the fill |
4847 | 601 | 620 | ||
4848 | 602 | root->setWidth(root->width() - 100); | 621 | root->setWidth(root->width() - 100); |
4849 | 603 | layoutChangeSpy.wait(100); | 622 | layoutChangeSpy.wait(100); |
4851 | 604 | QCOMPARE(anchors->verticalCenter().item, layout); | 623 | QCOMPARE(anchors->verticalCenter().item, layout->contentItem()); |
4852 | 605 | QCOMPARE(anchors->verticalCenterOffset(), 50.0); | 624 | QCOMPARE(anchors->verticalCenterOffset(), 50.0); |
4853 | 606 | } | 625 | } |
4854 | 607 | 626 | ||
4855 | 608 | void testCase_AnchorHorizontalCenter() | 627 | void testCase_AnchorHorizontalCenter() |
4856 | 609 | { | 628 | { |
4858 | 610 | QScopedPointer<QQuickView> view(loadTest("AnchorHorizontalCenter.qml")); | 629 | QScopedPointer<UbuntuTestCase> view(new UbuntuTestCase("AnchorHorizontalCenter.qml")); |
4859 | 611 | QVERIFY(view); | 630 | QVERIFY(view); |
4860 | 612 | QQuickItem *root = view->rootObject(); | 631 | QQuickItem *root = view->rootObject(); |
4861 | 613 | QVERIFY(root); | 632 | QVERIFY(root); |
4862 | 614 | 633 | ||
4864 | 615 | QQuickItem *layout = testItem(root, "layoutManager"); | 634 | ULLayouts *layout = view->findItem<ULLayouts*>("layoutManager"); |
4865 | 616 | QVERIFY(layout); | 635 | QVERIFY(layout); |
4866 | 617 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); | 636 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); |
4867 | 618 | 637 | ||
4869 | 619 | QQuickItem *item = testItem(root, "testItem"); | 638 | QQuickItem *item = view->findItem<QQuickItem*>("testItem"); |
4870 | 620 | QVERIFY(item); | 639 | QVERIFY(item); |
4871 | 621 | 640 | ||
4872 | 622 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); | 641 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); |
4873 | 623 | QVERIFY(anchors); | 642 | QVERIFY(anchors); |
4874 | 624 | 643 | ||
4876 | 625 | QCOMPARE(anchors->horizontalCenter().item, layout); | 644 | QCOMPARE(anchors->horizontalCenter().item, layout->contentItem()); |
4877 | 626 | 645 | ||
4878 | 627 | root->setWidth(root->width() + 100); | 646 | root->setWidth(root->width() + 100); |
4879 | 628 | layoutChangeSpy.wait(100); | 647 | layoutChangeSpy.wait(100); |
4881 | 629 | QQuickItem *testLayout = testItem(root, "testLayout"); | 648 | QQuickItem *testLayout = view->findItem<QQuickItem*>("testLayout"); |
4882 | 630 | QVERIFY(testLayout); | 649 | QVERIFY(testLayout); |
4883 | 631 | QCOMPARE(anchors->fill(), testLayout); | 650 | QCOMPARE(anchors->fill(), testLayout); |
4884 | 632 | 651 | ||
4885 | 633 | root->setWidth(root->width() - 100); | 652 | root->setWidth(root->width() - 100); |
4886 | 634 | layoutChangeSpy.wait(100); | 653 | layoutChangeSpy.wait(100); |
4888 | 635 | QCOMPARE(anchors->horizontalCenter().item, layout); | 654 | QCOMPARE(anchors->horizontalCenter().item, layout->contentItem()); |
4889 | 636 | } | 655 | } |
4890 | 637 | 656 | ||
4891 | 638 | void testCase_AnchorHorizontalCenterOffset() | 657 | void testCase_AnchorHorizontalCenterOffset() |
4892 | 639 | { | 658 | { |
4894 | 640 | QScopedPointer<QQuickView> view(loadTest("AnchorHorizontalCenterOffset.qml")); | 659 | QScopedPointer<UbuntuTestCase> view(new UbuntuTestCase("AnchorHorizontalCenterOffset.qml")); |
4895 | 641 | QVERIFY(view); | 660 | QVERIFY(view); |
4896 | 642 | QQuickItem *root = view->rootObject(); | 661 | QQuickItem *root = view->rootObject(); |
4897 | 643 | QVERIFY(root); | 662 | QVERIFY(root); |
4898 | 644 | 663 | ||
4900 | 645 | QQuickItem *layout = testItem(root, "layoutManager"); | 664 | ULLayouts *layout = view->findItem<ULLayouts*>("layoutManager"); |
4901 | 646 | QVERIFY(layout); | 665 | QVERIFY(layout); |
4902 | 647 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); | 666 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); |
4903 | 648 | 667 | ||
4905 | 649 | QQuickItem *item = testItem(root, "testItem"); | 668 | QQuickItem *item = view->findItem<QQuickItem*>("testItem"); |
4906 | 650 | QVERIFY(item); | 669 | QVERIFY(item); |
4907 | 651 | 670 | ||
4908 | 652 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); | 671 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); |
4909 | 653 | QVERIFY(anchors); | 672 | QVERIFY(anchors); |
4910 | 654 | 673 | ||
4912 | 655 | QCOMPARE(anchors->horizontalCenter().item, layout); | 674 | QCOMPARE(anchors->horizontalCenter().item, layout->contentItem()); |
4913 | 656 | QCOMPARE(anchors->horizontalCenterOffset(), 50.0); | 675 | QCOMPARE(anchors->horizontalCenterOffset(), 50.0); |
4914 | 657 | 676 | ||
4915 | 658 | root->setWidth(root->width() + 100); | 677 | root->setWidth(root->width() + 100); |
4916 | 659 | layoutChangeSpy.wait(100); | 678 | layoutChangeSpy.wait(100); |
4918 | 660 | QQuickItem *testLayout = testItem(root, "testLayout"); | 679 | QQuickItem *testLayout = view->findItem<QQuickItem*>("testLayout"); |
4919 | 661 | QVERIFY(testLayout); | 680 | QVERIFY(testLayout); |
4920 | 662 | QCOMPARE(anchors->fill(), testLayout); | 681 | QCOMPARE(anchors->fill(), testLayout); |
4921 | 663 | // no need to check offset as it does not affect the fill | 682 | // no need to check offset as it does not affect the fill |
4922 | 664 | 683 | ||
4923 | 665 | root->setWidth(root->width() - 100); | 684 | root->setWidth(root->width() - 100); |
4924 | 666 | layoutChangeSpy.wait(100); | 685 | layoutChangeSpy.wait(100); |
4926 | 667 | QCOMPARE(anchors->horizontalCenter().item, layout); | 686 | QCOMPARE(anchors->horizontalCenter().item, layout->contentItem()); |
4927 | 668 | QCOMPARE(anchors->horizontalCenterOffset(), 50.0); | 687 | QCOMPARE(anchors->horizontalCenterOffset(), 50.0); |
4928 | 669 | } | 688 | } |
4929 | 670 | 689 | ||
4930 | 671 | void testCase_AnchorCenterWithOffset() | 690 | void testCase_AnchorCenterWithOffset() |
4931 | 672 | { | 691 | { |
4933 | 673 | QScopedPointer<QQuickView> view(loadTest("AnchorCenterWithOffset.qml")); | 692 | QScopedPointer<UbuntuTestCase> view(new UbuntuTestCase("AnchorCenterWithOffset.qml")); |
4934 | 674 | QVERIFY(view); | 693 | QVERIFY(view); |
4935 | 675 | QQuickItem *root = view->rootObject(); | 694 | QQuickItem *root = view->rootObject(); |
4936 | 676 | QVERIFY(root); | 695 | QVERIFY(root); |
4937 | 677 | 696 | ||
4939 | 678 | QQuickItem *layout = testItem(root, "layoutManager"); | 697 | ULLayouts *layout = view->findItem<ULLayouts*>("layoutManager"); |
4940 | 679 | QVERIFY(layout); | 698 | QVERIFY(layout); |
4941 | 680 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); | 699 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); |
4942 | 681 | 700 | ||
4944 | 682 | QQuickItem *item = testItem(root, "testItem"); | 701 | QQuickItem *item = view->findItem<QQuickItem*>("testItem"); |
4945 | 683 | QVERIFY(item); | 702 | QVERIFY(item); |
4946 | 684 | 703 | ||
4947 | 685 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); | 704 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); |
4948 | 686 | QVERIFY(anchors); | 705 | QVERIFY(anchors); |
4949 | 687 | 706 | ||
4951 | 688 | QCOMPARE(anchors->centerIn(), layout); | 707 | QCOMPARE(anchors->centerIn(), layout->contentItem()); |
4952 | 689 | QCOMPARE(anchors->verticalCenterOffset(), 50.0); | 708 | QCOMPARE(anchors->verticalCenterOffset(), 50.0); |
4953 | 690 | QCOMPARE(anchors->horizontalCenterOffset(), 40.0); | 709 | QCOMPARE(anchors->horizontalCenterOffset(), 40.0); |
4954 | 691 | 710 | ||
4955 | 692 | root->setWidth(root->width() + 100); | 711 | root->setWidth(root->width() + 100); |
4956 | 693 | layoutChangeSpy.wait(100); | 712 | layoutChangeSpy.wait(100); |
4958 | 694 | QQuickItem *testLayout = testItem(root, "testLayout"); | 713 | QQuickItem *testLayout = view->findItem<QQuickItem*>("testLayout"); |
4959 | 695 | QVERIFY(testLayout); | 714 | QVERIFY(testLayout); |
4960 | 696 | QCOMPARE(anchors->fill(), testLayout); | 715 | QCOMPARE(anchors->fill(), testLayout); |
4961 | 697 | // no need to check offsets as it does not affect the fill | 716 | // no need to check offsets as it does not affect the fill |
4962 | 698 | 717 | ||
4963 | 699 | root->setWidth(root->width() - 100); | 718 | root->setWidth(root->width() - 100); |
4964 | 700 | layoutChangeSpy.wait(100); | 719 | layoutChangeSpy.wait(100); |
4966 | 701 | QCOMPARE(anchors->centerIn(), layout); | 720 | QCOMPARE(anchors->centerIn(), layout->contentItem()); |
4967 | 702 | QCOMPARE(anchors->verticalCenterOffset(), 50.0); | 721 | QCOMPARE(anchors->verticalCenterOffset(), 50.0); |
4968 | 703 | QCOMPARE(anchors->horizontalCenterOffset(), 40.0); | 722 | QCOMPARE(anchors->horizontalCenterOffset(), 40.0); |
4969 | 704 | } | 723 | } |
4970 | 705 | 724 | ||
4971 | 706 | void testCase_AnchorLeft() | 725 | void testCase_AnchorLeft() |
4972 | 707 | { | 726 | { |
4974 | 708 | QScopedPointer<QQuickView> view(loadTest("AnchorLeft.qml")); | 727 | QScopedPointer<UbuntuTestCase> view(new UbuntuTestCase("AnchorLeft.qml")); |
4975 | 709 | QVERIFY(view); | 728 | QVERIFY(view); |
4976 | 710 | QQuickItem *root = view->rootObject(); | 729 | QQuickItem *root = view->rootObject(); |
4977 | 711 | QVERIFY(root); | 730 | QVERIFY(root); |
4978 | 712 | 731 | ||
4980 | 713 | QQuickItem *layout = testItem(root, "layoutManager"); | 732 | ULLayouts *layout = view->findItem<ULLayouts*>("layoutManager"); |
4981 | 714 | QVERIFY(layout); | 733 | QVERIFY(layout); |
4982 | 715 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); | 734 | QSignalSpy layoutChangeSpy(layout, SIGNAL(currentLayoutChanged())); |
4983 | 716 | 735 | ||
4985 | 717 | QQuickItem *item = testItem(root, "testItem"); | 736 | QQuickItem *item = view->findItem<QQuickItem*>("testItem"); |
4986 | 718 | QVERIFY(item); | 737 | QVERIFY(item); |
4987 | 719 | 738 | ||
4988 | 720 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); | 739 | QQuickAnchors *anchors = item->property("anchors").value<QQuickAnchors*>(); |
4989 | 721 | QVERIFY(anchors); | 740 | QVERIFY(anchors); |
4990 | 722 | 741 | ||
4992 | 723 | QCOMPARE(anchors->left().item, layout); | 742 | QCOMPARE(anchors->left().item, layout->contentItem()); |
4993 | 724 | QCOMPARE(anchors->leftMargin(), 10.0); | 743 | QCOMPARE(anchors->leftMargin(), 10.0); |
4994 | 725 | 744 | ||
4995 | 726 | root->setWidth(root->width() + 100); | 745 | root->setWidth(root->width() + 100); |
4996 | 727 | layoutChangeSpy.wait(100); | 746 | layoutChangeSpy.wait(100); |
4998 | 728 | QQuickItem *testLayout = testItem(root, "testLayout"); | 747 | QQuickItem *testLayout = view->findItem<QQuickItem*>("testLayout"); |
4999 | 729 | QVERIFY(testLayout); | 748 | QVERIFY(testLayout); |
5000 | 730 | QCOMPARE(anchors->fill(), testLayout); | 749 | QCOMPARE(anchors->fill(), testLayout); |