Merge lp:~mterry/ubuntu-ui-toolkit/monitor-only into lp:ubuntu-ui-toolkit
- monitor-only
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~mterry/ubuntu-ui-toolkit/monitor-only |
Merge into: | lp:ubuntu-ui-toolkit |
Diff against target: |
3287 lines (+1254/-304) 71 files modified
apicheck/apicheck.cpp (+10/-0) components.api (+55/-51) debian/control (+9/-0) debian/libubuntugestures5-private-dev.install (+3/-0) documentation/ubuntu-components.qdoc (+1/-1) documentation/ubuntu-ui-toolkit-common.qdocconf (+1/-1) examples/ubuntu-ui-toolkit-gallery/Buttons.qml (+2/-2) examples/ubuntu-ui-toolkit-gallery/Label.qml (+6/-6) examples/ubuntu-ui-toolkit-gallery/MainPage.qml (+17/-27) examples/ubuntu-ui-toolkit-gallery/UbuntuListViews.qml (+7/-3) src/Ubuntu/Components/1.2/TextField.qml (+1/-1) src/Ubuntu/Components/1.3/AdaptivePageLayout.qml (+1/-0) src/Ubuntu/Components/1.3/AppHeader.qml (+5/-0) src/Ubuntu/Components/1.3/MainView.qml (+5/-21) src/Ubuntu/Components/1.3/TextField.qml (+19/-1) src/Ubuntu/Components/1.3/UbuntuListView.qml (+178/-9) src/Ubuntu/Components/1.3/UbuntuListView11.qdoc (+0/-38) src/Ubuntu/Components/ComponentModule.pro (+0/-2) src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml (+1/-1) src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml (+9/-0) src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml (+4/-2) src/Ubuntu/Components/plugin/plugin.cpp (+3/-1) src/Ubuntu/Components/plugin/plugin.pri (+1/-4) src/Ubuntu/Components/plugin/privates/threelabelsslot_p.cpp (+10/-7) src/Ubuntu/Components/plugin/privates/threelabelsslot_p.h (+3/-1) src/Ubuntu/Components/plugin/quickutils.cpp (+2/-1) src/Ubuntu/Components/plugin/quickutils.h (+7/-0) src/Ubuntu/Components/plugin/ucaction.cpp (+114/-16) src/Ubuntu/Components/plugin/ucaction.h (+8/-1) src/Ubuntu/Components/plugin/ucbottomedge.cpp (+1/-1) src/Ubuntu/Components/plugin/ucbottomedgehint.cpp (+1/-1) src/Ubuntu/Components/plugin/ucfontutils.h (+6/-6) src/Ubuntu/Components/plugin/uclistitemlayout.cpp (+80/-4) src/Ubuntu/Components/plugin/ucqquickimageextension.cpp (+11/-5) src/Ubuntu/Components/plugin/ucscalingimageprovider.cpp (+3/-1) src/Ubuntu/Components/qmldir (+1/-1) src/Ubuntu/Test/plugin/plugin.pri (+2/-1) src/Ubuntu/Test/plugin/uctestextras.cpp (+18/-0) src/Ubuntu/Test/plugin/uctestextras.h (+2/-0) src/Ubuntu/UbuntuGestures/UbuntuGestures.pro (+6/-0) src/Ubuntu/UbuntuGestures/damper.cpp (+1/-1) src/Ubuntu/UbuntuGestures/ucswipearea.cpp (+58/-13) src/Ubuntu/UbuntuGestures/ucswipearea_p.h (+7/-3) src/Ubuntu/UbuntuGestures/ucswipearea_p_p.h (+8/-6) tests/api/Extinct/Animals/AnimalModule.pro (+1/-1) tests/api/Extinct/Animals/plugin/plugin.cpp (+2/-0) tests/api/Extinct/Animals/plugin/plugin.pri (+2/-0) tests/api/Extinct/Animals/plugin/tarpan.cpp (+59/-0) tests/api/Extinct/Animals/plugin/tarpan.h (+46/-0) tests/api/Extinct/Animals/qmldir (+1/-1) tests/api/components.api (+11/-8) tests/autopilot/ubuntuuitoolkit/__init__.py (+2/-0) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py (+3/-1) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_ubuntulistview.py (+4/-0) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py (+1/-1) tests/uitk_test_plan.sh (+1/-0) tests/unit/plugin_dependency.pri (+1/-1) tests/unit/runtest.sh (+1/-1) tests/unit/tst_components/tst_fontutils.qml (+13/-14) tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp (+1/-1) tests/unit_x11/tst_bottomedge/tst_bottomedge.pro (+1/-1) tests/unit_x11/tst_components/battery-100-charging.svg (+25/-0) tests/unit_x11/tst_components/shape.svg (+77/-0) tests/unit_x11/tst_components/tst_imageprovider.qml (+29/-4) tests/unit_x11/tst_components/tst_pagestack.qml (+6/-0) tests/unit_x11/tst_components/tst_scrollbar.qml (+67/-25) tests/unit_x11/tst_components/tst_shortcuts.qml (+58/-0) tests/unit_x11/tst_components/tst_slotslayout.qml (+47/-2) tests/unit_x11/tst_components/tst_ubuntulistview13.qml (+105/-0) tests/unit_x11/tst_swipearea/tst_swipearea.cpp (+2/-2) tests/unit_x11/tst_swipearea/tst_swipearea.pro (+1/-1) |
To merge this branch: | bzr merge lp:~mterry/ubuntu-ui-toolkit/monitor-only |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zsombor Egri | Needs Fixing | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+280923@code.launchpad.net |
This proposal has been superseded by a proposal from 2016-01-08.
Commit message
Add monitorOnly field to SwipeArea.
This field controls whether the SwipeArea takes ownership of the gestures it observes.
Description of the change
From linked bug:
== Ask ==
I want to add SwipeArea.
I have a specific need for it, but it might be a generally useful thing?
== Backstory ==
Recently, the UITK got SwipeArea, which is great. In unity8, I'm working on a redesign of the edge introduction tutorial on first boot of your device.
There's a part of it where we put a shell-wide overlay on top of the screen that says "Swipe from the bottom to do ..." and this should fade out as the user swipes up (but should do the right thing if the drag isn't completed or is held in place).
One way to do this would be to communicate with the app. But that's a lot of infrastructure for one little feature. And this feature might be short-lived, because eventually we're going to try to move those "coach mark" help screens in the UITK as well for apps to use themselves. But for now, the shell is showing the bottom edge coach mark for a select few apps.
So another easy way to do it is to be able to monitor the user's drag, but not interfere with it. So the shell can see what the drag is doing, but the app still does the drag itself.
== Next Steps ==
I'd like this branch reviewed for sanity, to see if it's something you folks are OK with. It's missing tests, but I'm waiting to add those until you all let me know it wouldn't be wasted effort. :)
PS Jenkins bot (ps-jenkins) wrote : | # |
- 1273. By Michael Terry
-
Update components.api
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1273
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1274. By Michael Terry
-
Merge from trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1274
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1275. By Michael Terry
-
Fix build
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1275
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Zsombor Egri (zsombi) wrote : | # |
I think grabGesture as property name would be better than monitorOnly.
Secondly, please submit your MR agains UITK staging lp:ubuntu-ui-toolkit/staging.
- 1276. By Michael Terry
-
Switch property name to grabGesture
- 1277. By Michael Terry
-
Merge staging
- 1278. By Michael Terry
-
Fix components.api
- 1279. By Michael Terry
-
Merge from staging
- 1280. By Michael Terry
-
Fix style
- 1281. By Michael Terry
-
Add a couple grabGesture tests
Unmerged revisions
Preview Diff
1 | === modified file 'apicheck/apicheck.cpp' |
2 | --- apicheck/apicheck.cpp 2015-12-02 09:22:28 +0000 |
3 | +++ apicheck/apicheck.cpp 2016-01-08 17:10:46 +0000 |
4 | @@ -484,6 +484,10 @@ |
5 | writeMetaContent(&object, mainMeta, &knownAttributes); |
6 | |
7 | object["namespace"] = nameSpace; |
8 | + // The QML class name derived from the filename is used by AP. |
9 | + QString className(QFileInfo(filename).baseName()); |
10 | + if (typeName != className) |
11 | + object["className"] = className; |
12 | json->insert(id, object); |
13 | } |
14 | |
15 | @@ -552,6 +556,10 @@ |
16 | return; |
17 | } |
18 | |
19 | + // The C++ class is used by AP. |
20 | + QString className(meta->className()); |
21 | + if (!(isSingleton || isUncreatable || exportStrings.empty())) |
22 | + object["className"] = className; |
23 | json->insert(id, object); |
24 | } |
25 | |
26 | @@ -1102,6 +1110,8 @@ |
27 | QString signature(exports); |
28 | if (object.contains("namespace")) |
29 | signature = object.take("namespace").toString() + "." + signature; |
30 | + if (object.contains("className")) |
31 | + signature += " " + object.take("className").toString(); |
32 | QString prototype(object.take("prototype").toString()); |
33 | if (!prototype.isEmpty()) |
34 | signature += ": " + convertToId(prototype); |
35 | |
36 | === modified file 'components.api' |
37 | --- components.api 2015-12-17 09:15:45 +0000 |
38 | +++ components.api 2016-01-08 17:10:46 +0000 |
39 | @@ -3,12 +3,12 @@ |
40 | signal clicked() |
41 | signal pressAndHold() |
42 | property bool pressed |
43 | -Ubuntu.Components.AbstractButton 1.3: ActionItem |
44 | +Ubuntu.Components.AbstractButton 1.3 UCAbstractButton: ActionItem |
45 | readonly property bool hovered |
46 | signal clicked() |
47 | signal pressAndHold() |
48 | readonly property bool pressed |
49 | -Ubuntu.Components.Action 1.3 1.0 0.1: QtObject |
50 | +Ubuntu.Components.Action 1.3 1.0 0.1 UCAction: QtObject |
51 | property string description |
52 | property bool enabled |
53 | property string iconName |
54 | @@ -40,12 +40,12 @@ |
55 | property string overflowIconName |
56 | property url overflowIconSource |
57 | property string overflowText |
58 | -Ubuntu.Components.ActionContext 1.0 0.1: QtObject |
59 | +Ubuntu.Components.ActionContext 1.0 0.1 UCActionContext: QtObject |
60 | default property list<Action> actions |
61 | property bool active |
62 | function addAction(Action action) |
63 | function removeAction(Action action) |
64 | -Ubuntu.Components.ActionItem 1.0 0.1: StyledItem |
65 | +Ubuntu.Components.ActionItem 1.0 0.1 UCActionItem: StyledItem |
66 | property Action action |
67 | property string iconName |
68 | property url iconSource |
69 | @@ -59,7 +59,7 @@ |
70 | Ubuntu.Components.ActionList 1.3: QtObject |
71 | property list<Action> actions |
72 | default property list<Action> children |
73 | -Ubuntu.Components.ActionManager 1.0 0.1: QtObject |
74 | +Ubuntu.Components.ActionManager 1.0 0.1 UCActionManager: QtObject |
75 | default property list<Action> actions |
76 | readonly property ActionContext globalContext |
77 | property list<ActionContext> localContexts |
78 | @@ -90,7 +90,7 @@ |
79 | function var removePages(var page) |
80 | property Page primaryPage |
81 | property var primaryPageSource |
82 | -Ubuntu.Components.Alarm 1.0 0.1: QtObject |
83 | +Ubuntu.Components.Alarm 1.0 0.1 UCAlarm: QtObject |
84 | property QDateTime date |
85 | property DaysOfWeek daysOfWeek |
86 | property bool enabled |
87 | @@ -144,17 +144,17 @@ |
88 | Fail |
89 | InProgress |
90 | Ready |
91 | -Ubuntu.Components.AlarmModel 1.0 0.1: QAbstractListModel |
92 | +Ubuntu.Components.AlarmModel 1.0 0.1 UCAlarmModel: QAbstractListModel |
93 | readonly property int count |
94 | function refresh() 1.0 |
95 | function UCAlarm* get(int index) |
96 | -Ubuntu.Components.Argument 1.0 0.1: QtObject |
97 | +Ubuntu.Components.Argument 1.0 0.1 UCArgument: QtObject |
98 | property string help |
99 | function var at(int i) |
100 | property string name |
101 | property bool required |
102 | property QStringList valueNames |
103 | -Ubuntu.Components.Arguments 1.0 0.1: QtObject |
104 | +Ubuntu.Components.Arguments 1.0 0.1 UCArguments: QtObject |
105 | default property list<Argument> arguments |
106 | property Argument defaultArgument |
107 | readonly property bool error |
108 | @@ -175,7 +175,7 @@ |
109 | property var icon |
110 | property bool iconFrame |
111 | property bool progression |
112 | -Ubuntu.Components.BottomEdge 1.3: StyledItem |
113 | +Ubuntu.Components.BottomEdge 1.3 UCBottomEdge: StyledItem |
114 | readonly property BottomEdgeRegion activeRegion |
115 | property Component contentComponent |
116 | readonly property Item contentItem |
117 | @@ -205,7 +205,7 @@ |
118 | Committed |
119 | Hidden |
120 | Revealed |
121 | -Ubuntu.Components.BottomEdgeHint 1.3: ActionItem |
122 | +Ubuntu.Components.BottomEdgeHint 1.3 UCBottomEdgeHint: ActionItem |
123 | property int deactivateTimeout |
124 | property Flickable flickable |
125 | signal clicked() |
126 | @@ -216,7 +216,7 @@ |
127 | Hidden |
128 | Inactive |
129 | Locked |
130 | -Ubuntu.Components.BottomEdgeRegion 1.3: QtObject |
131 | +Ubuntu.Components.BottomEdgeRegion 1.3 UCBottomEdgeRegion: QtObject |
132 | property Component contentComponent |
133 | property url contentUrl |
134 | property bool enabled |
135 | @@ -225,7 +225,7 @@ |
136 | signal exited() |
137 | signal dragEnded() |
138 | property double to |
139 | -Ubuntu.Components.Styles.BottomEdgeStyle 1.3: Item |
140 | +Ubuntu.Components.Styles.BottomEdgeStyle 1.3 UCBottomEdgeStyle: Item |
141 | property Item contentItem |
142 | property Item panel |
143 | property Animation panelAnimation |
144 | @@ -299,22 +299,22 @@ |
145 | Ubuntu.Components.Popups.ComposerSheet 1.3: SheetBase |
146 | signal cancelClicked() |
147 | signal confirmClicked() |
148 | -Ubuntu.Layouts.ConditionalLayout 1.0 0.1: QtObject |
149 | +Ubuntu.Layouts.ConditionalLayout 1.0 0.1 ULConditionalLayout: QtObject |
150 | default property Component layout |
151 | property string name |
152 | property QQmlBinding when |
153 | -Ubuntu.PerformanceMetrics.CpuUsage 1.0 0.1: Item |
154 | +Ubuntu.PerformanceMetrics.CpuUsage 1.0 0.1 UPMCpuUsage: Item |
155 | readonly property UPMGraphModel graphModel |
156 | property int period |
157 | property int samplingInterval |
158 | -Ubuntu.Components.CrossFadeImage 1.0 0.1: Item |
159 | +Ubuntu.Components.CrossFadeImage 1.0 0.1 CrossFadeImage10: Item |
160 | property int fadeDuration |
161 | property int fillMode |
162 | readonly property bool running |
163 | property url source |
164 | property QSizeF sourceSize |
165 | readonly property int status |
166 | -Ubuntu.Components.CrossFadeImage 1.1: Item |
167 | +Ubuntu.Components.CrossFadeImage 1.1 CrossFadeImage11: Item |
168 | property int fadeDuration |
169 | property string fadeStyle |
170 | property int fillMode |
171 | @@ -468,7 +468,7 @@ |
172 | readonly property bool enabled |
173 | function play(var customEffect) |
174 | function play() |
175 | -Ubuntu.Components.ListItems.Header 1.0 0.1: Item |
176 | +Ubuntu.Components.ListItems.Header 1.0 0.1 ListItemHeader: Item |
177 | property string text |
178 | Ubuntu.Components.Header 1.0 0.1: AppHeader |
179 | property string _for_autopilot |
180 | @@ -486,9 +486,9 @@ |
181 | property var tabsModel |
182 | property string title |
183 | property bool useDeprecatedToolbar |
184 | -Ubuntu.Components.ListItems.Header 1.3: Item |
185 | +Ubuntu.Components.ListItems.Header 1.3 ListItemHeader: Item |
186 | property string text |
187 | -Ubuntu.Components.Header 1.3: StyledItem |
188 | +Ubuntu.Components.Header 1.3 UCHeader: StyledItem |
189 | property bool exposed |
190 | property Flickable flickable |
191 | readonly property bool moving |
192 | @@ -498,12 +498,12 @@ |
193 | property string name |
194 | Ubuntu.Components.Icon 1.1: Icon |
195 | property url source |
196 | -Ubuntu.Components.InverseMouse 1.0 0.1: Mouse |
197 | -Ubuntu.Components.InverseMouseArea 1.0 0.1: MouseArea |
198 | +Ubuntu.Components.InverseMouse 1.0 0.1 UCInverseMouse: Mouse |
199 | +Ubuntu.Components.InverseMouseArea 1.0 0.1 InverseMouseAreaType: MouseArea |
200 | function bool contains(QPointF point) |
201 | property Item sensingArea |
202 | property bool topmostItem |
203 | -Ubuntu.Layouts.ItemLayout 1.0 0.1: Item |
204 | +Ubuntu.Layouts.ItemLayout 1.0 0.1 ULItemLayout: Item |
205 | property string item |
206 | Ubuntu.Components.ListItems.ItemSelector 1.0 0.1: Empty |
207 | property bool colourImage |
208 | @@ -531,7 +531,7 @@ |
209 | property int selectedIndex |
210 | Ubuntu.Components.Label 1.0 0.1: Text |
211 | property string fontSize |
212 | -Ubuntu.Components.Label 1.3: Text |
213 | +Ubuntu.Components.Label 1.3 UCLabel: Text |
214 | property string fontSize |
215 | property TextSize textSize |
216 | Ubuntu.Components.Label.TextSize: Enum |
217 | @@ -541,10 +541,10 @@ |
218 | XLarge |
219 | XSmall |
220 | XxSmall |
221 | -Ubuntu.Layouts.Layouts 1.0 0.1: Item |
222 | +Ubuntu.Layouts.Layouts 1.0 0.1 ULLayouts: Item |
223 | readonly property string currentLayout |
224 | property list<ConditionalLayout> layouts |
225 | -Ubuntu.Components.ListItem 1.3 1.2: StyledItem |
226 | +Ubuntu.Components.ListItem 1.3 1.2 UCListItem: StyledItem |
227 | property Action action |
228 | property color color |
229 | readonly property Item contentItem |
230 | @@ -567,7 +567,7 @@ |
231 | property bool swipeEnabled 1.3 |
232 | readonly property bool swiped 1.3 |
233 | property ListItemActions trailingActions |
234 | -Ubuntu.Components.ListItemActions 1.2: QtObject |
235 | +Ubuntu.Components.ListItemActions 1.2 UCListItemActions: QtObject |
236 | property list<Action> actions |
237 | default property list<QtObject> data |
238 | property Component delegate |
239 | @@ -582,11 +582,11 @@ |
240 | Dropped |
241 | Moving |
242 | Started |
243 | -Ubuntu.Components.ListItemLayout 1.3: SlotsLayout |
244 | +Ubuntu.Components.ListItemLayout 1.3 UCListItemLayout: SlotsLayout |
245 | readonly property Label subtitle |
246 | readonly property Label summary |
247 | readonly property Label title |
248 | -Ubuntu.Components.Styles.ListItemStyle 1.3 1.2: Item |
249 | +Ubuntu.Components.Styles.ListItemStyle 1.3 1.2 UCListItemStyle: Item |
250 | readonly property bool animatePanels |
251 | property Item dragPanel |
252 | property PropertyAnimation dropAnimation |
253 | @@ -595,7 +595,7 @@ |
254 | function swipeEvent(SwipeEvent event) |
255 | function rebound() |
256 | property Animation snapAnimation |
257 | -Ubuntu.Components.LiveTimer 1.3: QtObject |
258 | +Ubuntu.Components.LiveTimer 1.3 LiveTimer: QtObject |
259 | property Frequency frequency |
260 | signal trigger() |
261 | property QDateTime relativeTime |
262 | @@ -609,7 +609,7 @@ |
263 | property bool automaticOrientation |
264 | default property list<QtObject> contentsItem |
265 | property bool useDeprecatedToolbar |
266 | -Ubuntu.Components.MainView 1.2: MainViewBase |
267 | +Ubuntu.Components.MainView 1.2 MainView12: MainViewBase |
268 | property bool automaticOrientation |
269 | default property list<QtObject> contentsItem |
270 | Ubuntu.Components.MainView 1.3: MainViewBase |
271 | @@ -620,14 +620,14 @@ |
272 | function double lerp(double delta, double from, double to) |
273 | function double projectValue(double x, double xmin, double xmax, double ymin, double ymax) |
274 | function double clampAndProject(double x, double xmin, double xmax, double ymin, double ymax) |
275 | -Ubuntu.Components.MimeData 1.0 0.1: QtObject |
276 | +Ubuntu.Components.MimeData 1.0 0.1 QQuickMimeData: QtObject |
277 | property color color |
278 | property var data |
279 | readonly property QStringList formats |
280 | property string html |
281 | property string text |
282 | property list<url> urls |
283 | -Ubuntu.Components.Mouse 1.0 0.1: QtObject |
284 | +Ubuntu.Components.Mouse 1.0 0.1 UCMouse: QtObject |
285 | readonly property Qt.MouseButtons acceptedButtons |
286 | property int clickAndHoldThreshold |
287 | property bool enabled |
288 | @@ -707,12 +707,12 @@ |
289 | property int orientationAngle |
290 | readonly property bool rotating |
291 | property bool transitionEnabled |
292 | -Ubuntu.Components.Page 1.0 0.1: PageTreeNode |
293 | +Ubuntu.Components.Page 1.0 0.1 Page10: PageTreeNode |
294 | property list<Action> actions |
295 | property Flickable flickable |
296 | property string title |
297 | property Item tools |
298 | -Ubuntu.Components.Page 1.1: Page10 |
299 | +Ubuntu.Components.Page 1.1 Page11: Page10 |
300 | readonly property PageHeadConfiguration head |
301 | Ubuntu.Components.Page 1.3: PageTreeNode |
302 | property Flickable flickable |
303 | @@ -810,7 +810,7 @@ |
304 | function var push(var page, var properties) |
305 | function var pop() |
306 | function var clear() |
307 | -Ubuntu.Components.PageTreeNode 1.3: StyledItem |
308 | +Ubuntu.Components.PageTreeNode 1.3 UCPageTreeNode: StyledItem |
309 | property bool active |
310 | readonly property Item activeLeafNode |
311 | property bool isLeaf |
312 | @@ -965,7 +965,7 @@ |
313 | property double value |
314 | Ubuntu.Components.ProgressionSlot 1.3: Icon |
315 | property url source |
316 | -Ubuntu.Components.ProportionalShape 1.3: UbuntuShape |
317 | +Ubuntu.Components.ProportionalShape 1.3 UCProportionalShape: UbuntuShape |
318 | Ubuntu.Components.PullToRefresh 1.1: StyledItem |
319 | property Component content |
320 | signal refresh() |
321 | @@ -984,7 +984,7 @@ |
322 | property double activationThreshold |
323 | property Component defaultContent |
324 | property bool releaseToRefresh |
325 | -Ubuntu.PerformanceMetrics.RenderingTimes 1.0 0.1: Item |
326 | +Ubuntu.PerformanceMetrics.RenderingTimes 1.0 0.1 UPMRenderingTimes: Item |
327 | readonly property UPMGraphModel graphModel |
328 | signal frameRendered(qlonglong renderTime) |
329 | property int period |
330 | @@ -1004,7 +1004,7 @@ |
331 | property list<Action> actions |
332 | property var model |
333 | property int selectedIndex |
334 | -Ubuntu.Components.ServiceProperties 1.1: QtObject |
335 | +Ubuntu.Components.ServiceProperties 1.1 UCServiceProperties: QtObject |
336 | property string adaptorInterface 1.1 |
337 | readonly property string error 1.1 |
338 | property string path 1.1 |
339 | @@ -1062,7 +1062,7 @@ |
340 | property bool overrideVerticalPositioning |
341 | readonly property SlotsLayoutPadding padding |
342 | property SlotsLayout.UCSlotPosition position |
343 | -Ubuntu.Components.SlotsLayout 1.3: Item |
344 | +Ubuntu.Components.SlotsLayout 1.3 UCSlotsLayout: Item |
345 | property Item mainSlot |
346 | readonly property SlotsLayoutPadding padding |
347 | Ubuntu.Components.SlotsLayout.UCSlotPosition: Enum |
348 | @@ -1078,7 +1078,7 @@ |
349 | Ubuntu.Components.SortBehavior 1.1: QtObject |
350 | property Qt.SortOrder order |
351 | property string property |
352 | -Ubuntu.Components.SortFilterModel 1.1: QSortFilterProxyModel |
353 | +Ubuntu.Components.SortFilterModel 1.1 QSortFilterProxyModelQML: QSortFilterProxyModel |
354 | readonly property int count |
355 | readonly property FilterBehavior filter |
356 | function QVariantMap get(int row) |
357 | @@ -1099,10 +1099,10 @@ |
358 | property var icon |
359 | property bool iconFrame |
360 | property bool progression |
361 | -Ubuntu.Components.StateSaver 1.0 0.1: QtObject |
362 | -Ubuntu.Components.StyleHints 1.3: QtObject |
363 | +Ubuntu.Components.StateSaver 1.0 0.1 UCStateSaver: QtObject |
364 | +Ubuntu.Components.StyleHints 1.3 UCStyleHints: QtObject |
365 | property bool ignoreUnknownProperties |
366 | -Ubuntu.Components.StyledItem 1.3 1.3 1.1 1.0 0.1: Item |
367 | +Ubuntu.Components.StyledItem 1.3 1.3 1.1 1.0 0.1 UCStyledItemBase: Item |
368 | property bool activeFocusOnPress 1.3 |
369 | readonly property bool keyNavigationFocus 1.3 |
370 | signal activeFocusOnTabChanged2() 1.3 |
371 | @@ -1115,7 +1115,7 @@ |
372 | property string subText |
373 | Ubuntu.Components.ListItems.Subtitled 1.3: Base |
374 | property string subText |
375 | -Ubuntu.Components.SwipeArea 1.3: Item |
376 | +Ubuntu.Components.SwipeArea 1.3 UCSwipeArea: Item |
377 | property Direction direction |
378 | readonly property double distance |
379 | readonly property bool dragging |
380 | @@ -1126,6 +1126,8 @@ |
381 | signal distanceChanged(double distance) |
382 | signal touchPositionChanged(QPointF position) |
383 | signal immediateRecognitionChanged(bool immediateRecognition) |
384 | + signal grabGestureChanged(bool grabGesture) |
385 | + property bool grabGesture |
386 | readonly property bool pressed |
387 | readonly property QPointF touchPosition |
388 | Ubuntu.Components.SwipeArea.Direction: Enum |
389 | @@ -1205,6 +1207,7 @@ |
390 | function mouseDrag(Item item, Qt.point from, Qt.point delta, Qt.MouseButton button, Qt.KeyboardModifiers stateKey, int steps) |
391 | function mouseDrag(Item item, Qt.point from, Qt.point delta, Qt.MouseButton button, Qt.KeyboardModifiers stateKey) |
392 | function mouseDrag(Item item, Qt.point from, Qt.point delta, Qt.MouseButton button) |
393 | + function removeTimeConstraintsFromSwipeArea(Item item) |
394 | readonly property bool touchPresent |
395 | Ubuntu.Components.TextArea 1.0 0.1: StyledItem |
396 | property bool autoExpand |
397 | @@ -1447,9 +1450,9 @@ |
398 | readonly property int selectionStart |
399 | property QValidator validator |
400 | property int verticalAlignment |
401 | -Ubuntu.PerformanceMetrics.TextureFromImage 1.0 0.1: Item |
402 | +Ubuntu.PerformanceMetrics.TextureFromImage 1.0 0.1 UPMTextureFromImage: Item |
403 | property QImage image |
404 | -Ubuntu.Components.ThemeSettings 1.3: QtObject |
405 | +Ubuntu.Components.ThemeSettings 1.3 UCTheme: QtObject |
406 | property string name |
407 | property QtObject palette |
408 | readonly property ThemeSettings parentTheme |
409 | @@ -1559,13 +1562,14 @@ |
410 | readonly property color warmGrey |
411 | Ubuntu.Components.UbuntuListView 1.0 0.1: ListView |
412 | property int expandedIndex |
413 | -Ubuntu.Components.UbuntuListView 1.1: UbuntuListView |
414 | +Ubuntu.Components.UbuntuListView 1.1 UbuntuListView11: UbuntuListView |
415 | readonly property PullToRefresh pullToRefresh |
416 | -Ubuntu.Components.UbuntuListView 1.3: UbuntuListView |
417 | +Ubuntu.Components.UbuntuListView 1.3: ListView |
418 | + property int expandedIndex |
419 | readonly property PullToRefresh pullToRefresh |
420 | Ubuntu.Components.UbuntuNumberAnimation 1.0 0.1: PropertyAnimation |
421 | Ubuntu.Components.UbuntuNumberAnimation 1.3: PropertyAnimation |
422 | -Ubuntu.Components.UbuntuShape 1.3 1.2 1.0 0.1 Shape 1.0 0.1: Item |
423 | +Ubuntu.Components.UbuntuShape 1.3 1.2 1.0 0.1 Shape 1.0 0.1 UCUbuntuShape: Item |
424 | property Aspect aspect 1.3 |
425 | property color backgroundColor 1.3 |
426 | property BackgroundMode backgroundMode 1.3 |
427 | @@ -1611,7 +1615,7 @@ |
428 | Ubuntu.Components.UbuntuShape.WrapMode: Enum |
429 | Repeat |
430 | Transparent |
431 | -Ubuntu.Components.UbuntuShapeOverlay 1.2: UbuntuShape |
432 | +Ubuntu.Components.UbuntuShapeOverlay 1.2 UCUbuntuShapeOverlay: UbuntuShape |
433 | property color overlayColor |
434 | property QRectF overlayRect |
435 | Ubuntu.Test.UbuntuTestCase 1.0 0.1: TestCase |
436 | |
437 | === modified file 'debian/control' |
438 | --- debian/control 2015-12-16 09:55:02 +0000 |
439 | +++ debian/control 2016-01-08 17:10:46 +0000 |
440 | @@ -107,6 +107,15 @@ |
441 | This package contains the development files for |
442 | Ubuntu gestures library with SwipeArea |
443 | |
444 | +Package: libubuntugestures5-private-dev |
445 | +Architecture: any |
446 | +Multi-Arch: same |
447 | +Pre-Depends: dpkg (>= 1.15.6~), ${misc:Pre-Depends} |
448 | +Depends: ${misc:Depends}, |
449 | + ${shlibs:Depends}, |
450 | +Description: Ubuntu gestures library private development files |
451 | + This package contains the private development files for |
452 | + Ubuntu gestures library with SwipeArea |
453 | |
454 | |
455 | Package: ubuntu-ui-toolkit-theme |
456 | |
457 | === added file 'debian/libubuntugestures5-private-dev.install' |
458 | --- debian/libubuntugestures5-private-dev.install 1970-01-01 00:00:00 +0000 |
459 | +++ debian/libubuntugestures5-private-dev.install 2016-01-08 17:10:46 +0000 |
460 | @@ -0,0 +1,3 @@ |
461 | +usr/include/*/qt5/UbuntuGestures/*/UbuntuGestures/private/ucswipearea_p.h |
462 | +usr/include/*/qt5/UbuntuGestures/*/UbuntuGestures/private/ucswipearea_p_p.h |
463 | +usr/include/*/qt5/UbuntuGestures/*/UbuntuGestures/private/damper_p.h |
464 | |
465 | === modified file 'documentation/ubuntu-components.qdoc' |
466 | --- documentation/ubuntu-components.qdoc 2015-03-03 13:47:48 +0000 |
467 | +++ documentation/ubuntu-components.qdoc 2016-01-08 17:10:46 +0000 |
468 | @@ -15,7 +15,7 @@ |
469 | */ |
470 | |
471 | /*! |
472 | - \qmlmodule Ubuntu.Components 1.2 |
473 | + \qmlmodule Ubuntu.Components 1.3 |
474 | \title Basic QML Types |
475 | \nextpage {Ubuntu User Interface Toolkit} |
476 | */ |
477 | |
478 | === modified file 'documentation/ubuntu-ui-toolkit-common.qdocconf' |
479 | --- documentation/ubuntu-ui-toolkit-common.qdocconf 2015-09-01 11:59:13 +0000 |
480 | +++ documentation/ubuntu-ui-toolkit-common.qdocconf 2016-01-08 17:10:46 +0000 |
481 | @@ -29,7 +29,7 @@ |
482 | excludefiles += $BLD/../src/Ubuntu/Components/1.3/PageWrapperUtils.js |
483 | outputdir = $BLD/html |
484 | outputformats = HTML |
485 | -version = 1.2 |
486 | +version = 1.3 |
487 | syntaxhighlighting = true |
488 | sourceencoding = UTF-8 |
489 | outputencoding = UTF-8 |
490 | |
491 | === modified file 'examples/ubuntu-ui-toolkit-gallery/Buttons.qml' |
492 | --- examples/ubuntu-ui-toolkit-gallery/Buttons.qml 2015-06-19 05:14:00 +0000 |
493 | +++ examples/ubuntu-ui-toolkit-gallery/Buttons.qml 2016-01-08 17:10:46 +0000 |
494 | @@ -50,8 +50,8 @@ |
495 | objectName: "button_color" |
496 | width: units.gu(20) |
497 | action: Action { |
498 | - text: i18n.tr("Call %1").arg(shortcut) |
499 | - shortcut: 'Ctrl+C' |
500 | + text: i18n.tr("C&all %1").arg(shortcut) |
501 | + shortcut: 'Ctrl+L' |
502 | property bool flipped |
503 | onTriggered: flipped = !flipped |
504 | } |
505 | |
506 | === modified file 'examples/ubuntu-ui-toolkit-gallery/Label.qml' |
507 | --- examples/ubuntu-ui-toolkit-gallery/Label.qml 2015-09-21 14:44:13 +0000 |
508 | +++ examples/ubuntu-ui-toolkit-gallery/Label.qml 2016-01-08 17:10:46 +0000 |
509 | @@ -28,27 +28,27 @@ |
510 | |
511 | Label { |
512 | textSize: Label.XxSmall |
513 | - text: "xx-small" |
514 | + text: "Label.XxSmall" |
515 | } |
516 | Label { |
517 | textSize: Label.XSmall |
518 | - text: "x-small" |
519 | + text: "Label.XSmall" |
520 | } |
521 | Label { |
522 | textSize: Label.Small |
523 | - text: "small" |
524 | + text: "Label.Small" |
525 | } |
526 | Label { |
527 | textSize: Label.Medium |
528 | - text: "medium" |
529 | + text: "Label.Medium" |
530 | } |
531 | Label { |
532 | textSize: Label.Large |
533 | - text: "large" |
534 | + text: "Label.Large" |
535 | } |
536 | Label { |
537 | textSize: Label.XLarge |
538 | - text: "x-large" |
539 | + text: "Label.XLarge" |
540 | } |
541 | } |
542 | } |
543 | |
544 | === modified file 'examples/ubuntu-ui-toolkit-gallery/MainPage.qml' |
545 | --- examples/ubuntu-ui-toolkit-gallery/MainPage.qml 2015-12-15 14:20:33 +0000 |
546 | +++ examples/ubuntu-ui-toolkit-gallery/MainPage.qml 2016-01-08 17:10:46 +0000 |
547 | @@ -66,6 +66,18 @@ |
548 | iconName: "starred" |
549 | visible: !QuickUtils.mouseAttached |
550 | onTriggered: QuickUtils.mouseAttached = true |
551 | + }, |
552 | + Action { |
553 | + text: i18n.tr("Detach keyboard") |
554 | + iconName: "non-starred" |
555 | + visible: QuickUtils.keyboardAttached |
556 | + onTriggered: QuickUtils.keyboardAttached = false |
557 | + }, |
558 | + Action { |
559 | + text: i18n.tr("Attach keyboard") |
560 | + iconName: "starred" |
561 | + visible: !QuickUtils.keyboardAttached |
562 | + onTriggered: QuickUtils.keyboardAttached = true |
563 | } |
564 | ] |
565 | } |
566 | @@ -101,36 +113,14 @@ |
567 | |
568 | delegate: ListItem { |
569 | objectName: model.objectName |
570 | - contentItem { |
571 | - anchors.leftMargin: units.gu(2) |
572 | - anchors.rightMargin: units.gu(2) |
573 | - } |
574 | enabled: source != "" |
575 | // Used by Autopilot |
576 | property string text: label |
577 | onClicked: widgetList.currentIndex = index |
578 | - Label { |
579 | - id: labelItem |
580 | - anchors { |
581 | - fill: parent |
582 | - rightMargin: units.gu(4) |
583 | - } |
584 | - text: label |
585 | - verticalAlignment: Text.AlignVCenter |
586 | - } |
587 | - Icon { |
588 | - name: "next" |
589 | - width: units.gu(2) |
590 | - height: units.gu(2) |
591 | - anchors { |
592 | - verticalCenter: parent.verticalCenter |
593 | - right: parent.right |
594 | - } |
595 | - } |
596 | - } |
597 | - highlight: Rectangle { |
598 | - color: theme.palette.selected.background |
599 | - } |
600 | - highlightMoveDuration: 0 |
601 | + ListItemLayout { |
602 | + title.text: label |
603 | + ProgressionSlot {} |
604 | + } |
605 | + } |
606 | } |
607 | } |
608 | |
609 | === modified file 'examples/ubuntu-ui-toolkit-gallery/UbuntuListViews.qml' |
610 | --- examples/ubuntu-ui-toolkit-gallery/UbuntuListViews.qml 2015-04-29 07:21:29 +0000 |
611 | +++ examples/ubuntu-ui-toolkit-gallery/UbuntuListViews.qml 2016-01-08 17:10:46 +0000 |
612 | @@ -16,7 +16,6 @@ |
613 | |
614 | import QtQuick 2.4 |
615 | import Ubuntu.Components 1.3 |
616 | -import Ubuntu.Components.ListItems 1.3 as ListItem |
617 | |
618 | Template { |
619 | objectName: "ubuntuListViewTemplate" |
620 | @@ -52,9 +51,14 @@ |
621 | height: units.gu(36) |
622 | model: fruitModel |
623 | clip: true |
624 | + currentIndex: -1 |
625 | |
626 | - delegate: ListItem.Standard { |
627 | - text: name |
628 | + delegate: ListItem { |
629 | + ListItemLayout { |
630 | + title.text: name |
631 | + } |
632 | + // to enable highlight |
633 | + onClicked: ListView.view.currentIndex = index |
634 | } |
635 | |
636 | pullToRefresh { |
637 | |
638 | === modified file 'src/Ubuntu/Components/1.2/TextField.qml' |
639 | --- src/Ubuntu/Components/1.2/TextField.qml 2015-12-14 15:47:03 +0000 |
640 | +++ src/Ubuntu/Components/1.2/TextField.qml 2016-01-08 17:10:46 +0000 |
641 | @@ -929,7 +929,7 @@ |
642 | width: units.gu(2.5) |
643 | height: width |
644 | // use icon from icon-theme |
645 | - name: control.hasClearButton && !control.readOnly ? "clear-search" : "" |
646 | + name: control.hasClearButton && !control.readOnly ? "edit-clear" : "" |
647 | } |
648 | |
649 | onClicked: editor.text = "" |
650 | |
651 | === modified file 'src/Ubuntu/Components/1.3/AdaptivePageLayout.qml' |
652 | --- src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-10-29 10:03:14 +0000 |
653 | +++ src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2016-01-08 17:10:46 +0000 |
654 | @@ -777,6 +777,7 @@ |
655 | |
656 | property color dividerColor: layout.__propagated.header.dividerColor |
657 | property color panelColor: layout.__propagated.header.panelColor |
658 | + property color backgroundColor: layout.__propagated.header.backgroundColor |
659 | |
660 | visible: !customHeader && holder.pageWrapper && holder.pageWrapper.active |
661 | |
662 | |
663 | === modified file 'src/Ubuntu/Components/1.3/AppHeader.qml' |
664 | --- src/Ubuntu/Components/1.3/AppHeader.qml 2015-12-14 20:38:59 +0000 |
665 | +++ src/Ubuntu/Components/1.3/AppHeader.qml 2016-01-08 17:10:46 +0000 |
666 | @@ -32,6 +32,11 @@ |
667 | } |
668 | |
669 | /*! |
670 | + The background color of the header. Value set by MainView. |
671 | + */ |
672 | + property color backgroundColor |
673 | + |
674 | + /*! |
675 | The background color of the divider. Value set by MainView. |
676 | */ |
677 | property color dividerColor |
678 | |
679 | === modified file 'src/Ubuntu/Components/1.3/MainView.qml' |
680 | --- src/Ubuntu/Components/1.3/MainView.qml 2015-10-13 13:37:43 +0000 |
681 | +++ src/Ubuntu/Components/1.3/MainView.qml 2016-01-08 17:10:46 +0000 |
682 | @@ -121,28 +121,10 @@ |
683 | UbuntuApplication.inputMethod.keyboardRectangle.height : 0 |
684 | } |
685 | |
686 | - // clip the contents so that it does not overlap the header |
687 | Item { |
688 | - id: contentsClipper |
689 | + id: contents |
690 | anchors { |
691 | - left: parent.left |
692 | - right: parent.right |
693 | - top: headerItem.bottom |
694 | - bottom: parent.bottom |
695 | - } |
696 | - // only clip when necessary |
697 | - // ListView headers may be positioned at the top, independent from |
698 | - // flickable.contentY, so do not clip depending on activePage.flickable.contentY. |
699 | - clip: headerItem.bottomY > 0 && internal.activePage && internal.activePage.flickable |
700 | - |
701 | - Item { |
702 | - id: contents |
703 | - anchors { |
704 | - fill: parent |
705 | - |
706 | - // compensate so that the actual y is always 0 |
707 | - topMargin: -parent.y |
708 | - } |
709 | + fill: parent |
710 | } |
711 | } |
712 | |
713 | @@ -159,6 +141,7 @@ |
714 | property real bottomY: headerItem.y + headerItem.height |
715 | dividerColor: Qt.darker(mainView.headerColor, 1.1) |
716 | panelColor: Qt.lighter(mainView.headerColor, 1.1) |
717 | + backgroundColor: mainView.headerColor |
718 | |
719 | title: internal.activePage ? internal.activePage.title : "" |
720 | pageStack: internal.activePage ? internal.activePage.pageStack : null |
721 | @@ -179,7 +162,8 @@ |
722 | // don't show the application header if the page has its own header. |
723 | visible: !(internal.activePage && |
724 | internal.activePage.hasOwnProperty("header") && |
725 | - internal.activePage.header) |
726 | + internal.activePage.header) && |
727 | + internal.activePage |
728 | |
729 | height: visible ? implicitHeight : 0 |
730 | |
731 | |
732 | === modified file 'src/Ubuntu/Components/1.3/TextField.qml' |
733 | --- src/Ubuntu/Components/1.3/TextField.qml 2015-12-15 19:31:38 +0000 |
734 | +++ src/Ubuntu/Components/1.3/TextField.qml 2016-01-08 17:10:46 +0000 |
735 | @@ -329,6 +329,11 @@ |
736 | inputs. See QLineEdit::inputMask for further details, as the exact same mask strings |
737 | are used by TextField. |
738 | |
739 | + Note that when using an inputMask together with echoMode to hide the input |
740 | + the empty TextField may still show masked characters - consider \l validator instead. |
741 | + |
742 | + \sa acceptableInput, validator |
743 | + |
744 | \qmlproperty string inputMask |
745 | */ |
746 | property alias inputMask: editor.inputMask |
747 | @@ -534,6 +539,19 @@ |
748 | } |
749 | \endqml |
750 | |
751 | + The next example is for a use case of typing a PIN with masked characters. |
752 | + |
753 | + \qml |
754 | + import QtQuick 2.4 |
755 | + import Ubuntu.Components 1.3 |
756 | + |
757 | + TextField { |
758 | + echoMode: TextInput.Password |
759 | + validator: RegExpValidator { regExp: /^\d{4}$/ } |
760 | + inputMethodHints: Qt.ImhDigitsOnly |
761 | + } |
762 | + \endqml |
763 | + |
764 | \sa acceptableInput, inputMask |
765 | |
766 | \qmlproperty Validator validator |
767 | @@ -939,7 +957,7 @@ |
768 | width: units.gu(2.5) |
769 | height: width |
770 | // use icon from icon-theme |
771 | - name: control.hasClearButton && !control.readOnly ? "clear-search" : "" |
772 | + name: control.hasClearButton && !control.readOnly ? "edit-clear" : "" |
773 | } |
774 | |
775 | onClicked: editor.text = "" |
776 | |
777 | === removed file 'src/Ubuntu/Components/1.3/UbuntuListView.qml' |
778 | --- src/Ubuntu/Components/1.3/UbuntuListView.qml 2015-04-29 07:21:29 +0000 |
779 | +++ src/Ubuntu/Components/1.3/UbuntuListView.qml 1970-01-01 00:00:00 +0000 |
780 | @@ -1,143 +0,0 @@ |
781 | -/* |
782 | - * Copyright 2014 Canonical Ltd. |
783 | - * |
784 | - * This program is free software; you can redistribute it and/or modify |
785 | - * it under the terms of the GNU Lesser General Public License as published by |
786 | - * the Free Software Foundation; version 3. |
787 | - * |
788 | - * This program is distributed in the hope that it will be useful, |
789 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
790 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
791 | - * GNU Lesser General Public License for more details. |
792 | - * |
793 | - * You should have received a copy of the GNU Lesser General Public License |
794 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
795 | - */ |
796 | - |
797 | -import QtQuick 2.4 |
798 | -import Ubuntu.Components 1.3 as Toolkit |
799 | - |
800 | -/*! |
801 | - \qmltype UbuntuListView |
802 | - \inqmlmodule Ubuntu.Components 1.1 |
803 | - \ingroup ubuntu |
804 | - \brief A ListView with special features tailored for a look and feel fitting the |
805 | - Ubuntu Touch platform. |
806 | - The UbuntuListView works just like a regular ListView, but it adds special features |
807 | - such as expanding/collapsing items (when used together with the Expandable item). |
808 | - It provides features like automatically positioning the expanding item when it |
809 | - expands and collapsing it again when the user taps outside of it. |
810 | - |
811 | - Examples: |
812 | - \qml |
813 | - import Ubuntu.Components 1.3 |
814 | - import Ubuntu.Components.ListItems 1.3 as ListItem |
815 | - |
816 | - Item { |
817 | - ListModel { |
818 | - id: listModel |
819 | - } |
820 | - |
821 | - UbuntuListView { |
822 | - id: ubuntuListView |
823 | - anchors { left: parent.left; right: parent.right } |
824 | - height: units.gu(24) |
825 | - model: listModel |
826 | - |
827 | - delegate: ListItem.Expandable { |
828 | - id: expandingItem |
829 | - |
830 | - expandedHeight: units.gu(30) |
831 | - |
832 | - onClicked: { |
833 | - ubuntuListView.expandedIndex = index; |
834 | - } |
835 | - } |
836 | - } |
837 | - } |
838 | - \endqml |
839 | -*/ |
840 | - |
841 | -ListView { |
842 | - id: root |
843 | - |
844 | - /*! |
845 | - The index of the currently expanded item. -1 if no item is expanded. |
846 | - */ |
847 | - property int expandedIndex: -1 |
848 | - |
849 | - QtObject { |
850 | - id: priv |
851 | - |
852 | - function positionViewAtIndexAnimated(expandedIndex) { |
853 | - animation.from = root.contentY; |
854 | - root.currentIndex = expandedIndex; |
855 | - if (expandedIndex == root.count - 1) { |
856 | - root.positionViewAtIndex(expandedIndex, ListView.End); |
857 | - } else { |
858 | - root.positionViewAtIndex(expandedIndex + 1, ListView.End); |
859 | - } |
860 | - |
861 | - var effectiveExpandedHeight = Math.min(root.currentItem.expandedHeight, root.height - root.currentItem.collapsedHeight); |
862 | - if (root.contentY - root.originY == 0) { |
863 | - if (((root.currentIndex + 1) * root.currentItem.collapsedHeight) + effectiveExpandedHeight > root.height) { |
864 | - animation.to = ((root.currentIndex + 1) * root.currentItem.collapsedHeight + effectiveExpandedHeight) - root.height + root.originY |
865 | - } else { |
866 | - animation.to = root.originY |
867 | - } |
868 | - } else { |
869 | - animation.to = root.contentY + (effectiveExpandedHeight - root.currentItem.collapsedHeight); |
870 | - } |
871 | - animation.start(); |
872 | - } |
873 | - |
874 | - function requestFocus(reason) { |
875 | - // lookup for the currentItem, and if it is a FocusScope, focus the view |
876 | - // this will also focus the currentItem |
877 | - if (root.currentItem && root.currentItem.hasOwnProperty("activeFocusOnPress")) { |
878 | - root.forceActiveFocus(reason); |
879 | - } |
880 | - } |
881 | - } |
882 | - |
883 | - focus: true |
884 | - |
885 | - /*! |
886 | - \internal |
887 | - Grab focus when moved, flicked or clicked |
888 | - */ |
889 | - onMovementStarted: priv.requestFocus(Qt.MouseFocusReason) |
890 | - onFlickStarted: priv.requestFocus(Qt.MouseFocusReason) |
891 | - Toolkit.Mouse.onClicked: priv.requestFocus(Qt.MouseFocusReason) |
892 | - |
893 | - /*! |
894 | - Expand the item at the given index. |
895 | - */ |
896 | - onExpandedIndexChanged: { |
897 | - if (expandedIndex < 0) { |
898 | - return; |
899 | - } |
900 | - priv.positionViewAtIndexAnimated(expandedIndex, ListView.End) |
901 | - } |
902 | - |
903 | - UbuntuNumberAnimation { |
904 | - id: animation |
905 | - target: root |
906 | - property: "contentY" |
907 | - } |
908 | - |
909 | - MouseArea { |
910 | - parent: contentItem |
911 | - anchors.fill: parent |
912 | - z: 2 |
913 | - enabled: root.expandedIndex != -1 |
914 | - onClicked: root.expandedIndex = -1; |
915 | - } |
916 | - |
917 | - // animate move displaced |
918 | - moveDisplaced: Transition { |
919 | - UbuntuNumberAnimation { |
920 | - properties: "x,y" |
921 | - } |
922 | - } |
923 | -} |
924 | |
925 | === renamed file 'src/Ubuntu/Components/1.3/UbuntuListView11.qml' => 'src/Ubuntu/Components/1.3/UbuntuListView.qml' |
926 | --- src/Ubuntu/Components/1.3/UbuntuListView11.qml 2015-04-25 08:54:58 +0000 |
927 | +++ src/Ubuntu/Components/1.3/UbuntuListView.qml 2016-01-08 17:10:46 +0000 |
928 | @@ -1,5 +1,5 @@ |
929 | /* |
930 | - * Copyright 2014 Canonical Ltd. |
931 | + * Copyright 2015 Canonical Ltd. |
932 | * |
933 | * This program is free software; you can redistribute it and/or modify |
934 | * it under the terms of the GNU Lesser General Public License as published by |
935 | @@ -15,19 +15,188 @@ |
936 | */ |
937 | |
938 | import QtQuick 2.4 |
939 | - |
940 | -// documentation in UbuntuListView11.qdoc |
941 | -UbuntuListView { |
942 | - |
943 | - /*! |
944 | - \internal |
945 | - \qmlproperty PullToRefresh pullToRefresh |
946 | +import Ubuntu.Components 1.3 as Toolkit |
947 | + |
948 | +/*! |
949 | + \qmltype UbuntuListView |
950 | + \inqmlmodule Ubuntu.Components 1.1 |
951 | + \ingroup ubuntu |
952 | + \inherits ListView |
953 | + \brief A ListView with special features tailored for a look and feel fitting the |
954 | + Ubuntu Touch platform. |
955 | + The UbuntuListView works just like a regular ListView, but it adds special features |
956 | + such as expanding/collapsing items (when used together with the Expandable item). |
957 | + It provides features like automatically positioning the expanding item when it |
958 | + expands and collapsing it again when the user taps outside of it. |
959 | + |
960 | + Examples: |
961 | + \qml |
962 | + import Ubuntu.Components 1.3 |
963 | + import Ubuntu.Components.ListItems 1.3 as ListItem |
964 | + |
965 | + Item { |
966 | + ListModel { |
967 | + id: listModel |
968 | + } |
969 | + |
970 | + UbuntuListView { |
971 | + id: ubuntuListView |
972 | + anchors { left: parent.left; right: parent.right } |
973 | + height: units.gu(24) |
974 | + model: listModel |
975 | + |
976 | + delegate: ListItem.Expandable { |
977 | + id: expandingItem |
978 | + |
979 | + expandedHeight: units.gu(30) |
980 | + |
981 | + onClicked: { |
982 | + ubuntuListView.expandedIndex = index; |
983 | + } |
984 | + } |
985 | + } |
986 | + } |
987 | + \endqml |
988 | +*/ |
989 | + |
990 | +ListView { |
991 | + id: root |
992 | + |
993 | + /*! |
994 | + \deprecated |
995 | + The index of the currently expanded item. -1 if no item is expanded. |
996 | + \b {THIS PROPERTY IS DEPRECATED. USE THE NEW ListItem TO HANDLE EXPANSION} |
997 | + */ |
998 | + property int expandedIndex: -1 |
999 | + |
1000 | + /*! |
1001 | + \qmlproperty pullToRefresh UbuntuListView::pullToRefresh |
1002 | + \readonly |
1003 | + \since Ubuntu.Components 1.1 |
1004 | + |
1005 | + Attached PullToRefresh to control manual model refresh. The component is disabled |
1006 | + by default. |
1007 | + |
1008 | + \qml |
1009 | + import QtQuick 2.4 |
1010 | + import Ubuntu.Components 1.3 |
1011 | + |
1012 | + UbuntuListView { |
1013 | + width: units.gu(40) |
1014 | + height: units.gu(71) |
1015 | + model: XmlListModel { |
1016 | + source: "http://feeds.reuters.com/reuters/topNews" |
1017 | + query: "/rss/channel/item" |
1018 | + XmlRole { name: "title"; query: "title/string()" } |
1019 | + } |
1020 | + // let refresh control know when the refresh gets completed |
1021 | + pullToRefresh { |
1022 | + enable: true |
1023 | + refreshing: model.status === XmlListModel.Loading |
1024 | + onRefresh: model.reload() |
1025 | + } |
1026 | + delegate: ListItem { |
1027 | + ListItemLayout { |
1028 | + title.text: modelData |
1029 | + } |
1030 | + onClicked: { |
1031 | + ListView.view.model.reload(); |
1032 | + } |
1033 | + } |
1034 | + } |
1035 | + \endqml |
1036 | */ |
1037 | - property alias pullToRefresh: refreshItem |
1038 | + readonly property alias pullToRefresh: refreshItem |
1039 | |
1040 | PullToRefresh { |
1041 | objectName: "listview_pulltorefresh" |
1042 | id: refreshItem |
1043 | enabled: false |
1044 | } |
1045 | + |
1046 | + QtObject { |
1047 | + id: priv |
1048 | + |
1049 | + function positionViewAtIndexAnimated(expandedIndex) { |
1050 | + animation.from = root.contentY; |
1051 | + root.currentIndex = expandedIndex; |
1052 | + if (expandedIndex == root.count - 1) { |
1053 | + root.positionViewAtIndex(expandedIndex, ListView.End); |
1054 | + } else { |
1055 | + root.positionViewAtIndex(expandedIndex + 1, ListView.End); |
1056 | + } |
1057 | + |
1058 | + var effectiveExpandedHeight = Math.min(root.currentItem.expandedHeight, root.height - root.currentItem.collapsedHeight); |
1059 | + if (root.contentY - root.originY == 0) { |
1060 | + if (((root.currentIndex + 1) * root.currentItem.collapsedHeight) + effectiveExpandedHeight > root.height) { |
1061 | + animation.to = ((root.currentIndex + 1) * root.currentItem.collapsedHeight + effectiveExpandedHeight) - root.height + root.originY |
1062 | + } else { |
1063 | + animation.to = root.originY |
1064 | + } |
1065 | + } else { |
1066 | + animation.to = root.contentY + (effectiveExpandedHeight - root.currentItem.collapsedHeight); |
1067 | + } |
1068 | + animation.start(); |
1069 | + } |
1070 | + |
1071 | + function requestFocus(reason) { |
1072 | + // lookup for the currentItem, and if it is a FocusScope, focus the view |
1073 | + // this will also focus the currentItem |
1074 | + if (root.currentItem && root.currentItem.hasOwnProperty("activeFocusOnPress")) { |
1075 | + // is the currentItem a ListItem? |
1076 | + if (QuickUtils.inherits(root.currentItem, "UCListItem")) { |
1077 | + root.currentItem.requestFocus(reason); |
1078 | + } else { |
1079 | + root.forceActiveFocus(reason); |
1080 | + } |
1081 | + } |
1082 | + } |
1083 | + } |
1084 | + |
1085 | + focus: true |
1086 | + |
1087 | + /*! |
1088 | + \internal |
1089 | + Grab focus when moved, flicked or clicked |
1090 | + */ |
1091 | + onMovementStarted: priv.requestFocus(Qt.MouseFocusReason) |
1092 | + onFlickStarted: priv.requestFocus(Qt.MouseFocusReason) |
1093 | + Toolkit.Mouse.onClicked: priv.requestFocus(Qt.MouseFocusReason) |
1094 | + |
1095 | + /*! |
1096 | + Expand the item at the given index. |
1097 | + */ |
1098 | + onExpandedIndexChanged: { |
1099 | + if (expandedIndex < 0) { |
1100 | + return; |
1101 | + } |
1102 | + priv.positionViewAtIndexAnimated(expandedIndex, ListView.End) |
1103 | + } |
1104 | + |
1105 | + UbuntuNumberAnimation { |
1106 | + id: animation |
1107 | + target: root |
1108 | + property: "contentY" |
1109 | + } |
1110 | + |
1111 | + MouseArea { |
1112 | + parent: contentItem |
1113 | + anchors.fill: parent |
1114 | + z: 2 |
1115 | + enabled: root.expandedIndex != -1 |
1116 | + onClicked: root.expandedIndex = -1; |
1117 | + } |
1118 | + |
1119 | + // animate move displaced |
1120 | + moveDisplaced: Transition { |
1121 | + UbuntuNumberAnimation { |
1122 | + properties: "x,y" |
1123 | + } |
1124 | + } |
1125 | + |
1126 | + // highlight current item |
1127 | + highlight: Rectangle { |
1128 | + color: theme.palette.selected.background |
1129 | + } |
1130 | + highlightMoveDuration: 0 |
1131 | } |
1132 | |
1133 | === removed file 'src/Ubuntu/Components/1.3/UbuntuListView11.qdoc' |
1134 | --- src/Ubuntu/Components/1.3/UbuntuListView11.qdoc 2015-04-25 08:54:58 +0000 |
1135 | +++ src/Ubuntu/Components/1.3/UbuntuListView11.qdoc 1970-01-01 00:00:00 +0000 |
1136 | @@ -1,38 +0,0 @@ |
1137 | -/*! |
1138 | - \qmlproperty pullToRefresh UbuntuListView::pullToRefresh |
1139 | - \readonly |
1140 | - \since Ubuntu.Components 1.1 |
1141 | - |
1142 | - Attached PullToRefresh to control manual model refresh. The component is disabled |
1143 | - by default. |
1144 | - |
1145 | - \qml |
1146 | - import QtQuick 2.4 |
1147 | - import Ubuntu.Components 1.2 |
1148 | - import Ubuntu.Components.ListItems 1.0 |
1149 | - |
1150 | - UbuntuListView { |
1151 | - width: units.gu(40) |
1152 | - height: units.gu(71) |
1153 | - model: XmlListModel { |
1154 | - source: "http://feeds.reuters.com/reuters/topNews" |
1155 | - query: "/rss/channel/item" |
1156 | - XmlRole { name: "title"; query: "title/string()" } |
1157 | - } |
1158 | - // let refresh control know when the refresh gets completed |
1159 | - pullToRefresh { |
1160 | - enable: true |
1161 | - refreshing: model.status === XmlListModel.Loading |
1162 | - onRefresh: model.reload() |
1163 | - } |
1164 | - delegate: ListItem.Standard { |
1165 | - width: ListView.view.width |
1166 | - height: units.gu(5) |
1167 | - text: modelData |
1168 | - onClicked: { |
1169 | - ListView.view.model.reload(); |
1170 | - } |
1171 | - } |
1172 | - } |
1173 | - \endqml |
1174 | - */ |
1175 | |
1176 | === modified file 'src/Ubuntu/Components/ComponentModule.pro' |
1177 | --- src/Ubuntu/Components/ComponentModule.pro 2015-12-17 09:13:29 +0000 |
1178 | +++ src/Ubuntu/Components/ComponentModule.pro 2016-01-08 17:10:46 +0000 |
1179 | @@ -124,7 +124,6 @@ |
1180 | 1.3/ToolbarItems.qml \ |
1181 | 1.3/tree.js \ |
1182 | 1.3/UbuntuColors.qml \ |
1183 | - 1.3/UbuntuListView11.qml \ |
1184 | 1.3/UbuntuListView.qml \ |
1185 | 1.3/UbuntuNumberAnimation.qml \ |
1186 | 1.3/ListItemPopover.qml \ |
1187 | @@ -136,7 +135,6 @@ |
1188 | |
1189 | OTHER_FILES+= qmldir \ |
1190 | 1.3/CrossFadeImage.qdoc \ |
1191 | - 1.3/UbuntuListView11.qdoc \ |
1192 | 1.3/PageHeadConfiguration.qdoc \ |
1193 | 1.3/MainView.qdoc \ |
1194 | 1.3/Icon.qdoc |
1195 | |
1196 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml' |
1197 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml 2015-12-16 07:59:19 +0000 |
1198 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml 2016-01-08 17:10:46 +0000 |
1199 | @@ -24,7 +24,7 @@ |
1200 | |
1201 | anchors.fill: parent |
1202 | anchors.margins: -units.gu(0.4) |
1203 | - backgroundColor: Qt.rgba(focusColor.r, focusColor.g, focusColor.b, 0.8) |
1204 | + backgroundColor: Qt.rgba(focusColor.r, focusColor.g, focusColor.b, 1.0) |
1205 | visible: styledItem.keyNavigationFocus |
1206 | z: styledItem.z - 1 |
1207 | |
1208 | |
1209 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml' |
1210 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml 2015-12-08 22:05:42 +0000 |
1211 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml 2016-01-08 17:10:46 +0000 |
1212 | @@ -44,6 +44,15 @@ |
1213 | */ |
1214 | property color titleColor: headerStyle.config.foregroundColor |
1215 | |
1216 | + /*! |
1217 | + The background color of the header. |
1218 | + */ |
1219 | + property color backgroundColor: styledItem.backgroundColor |
1220 | + Rectangle { |
1221 | + anchors.fill: parent |
1222 | + color: headerStyle.backgroundColor |
1223 | + } |
1224 | + |
1225 | // FIXME: When the three panel color properties below are removed, |
1226 | // update unity8/Dash/PageHeader to use the new theming (currently |
1227 | // in progress) to set these colors. |
1228 | |
1229 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml' |
1230 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml 2015-12-11 08:38:42 +0000 |
1231 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml 2016-01-08 17:10:46 +0000 |
1232 | @@ -92,8 +92,10 @@ |
1233 | } |
1234 | |
1235 | Component.onDestruction: { |
1236 | - rootItem.__propagated.header.visibleChanged.disconnect(fixTopMargin); |
1237 | - rootItem.__propagated.header.heightChanged.disconnect(fixTopMargin); |
1238 | + if (rootItem && rootItem.__propagated && rootItem.__propagated.header) { |
1239 | + rootItem.__propagated.header.visibleChanged.disconnect(fixTopMargin); |
1240 | + rootItem.__propagated.header.heightChanged.disconnect(fixTopMargin); |
1241 | + } |
1242 | } |
1243 | |
1244 | function fixTopMargin() { |
1245 | |
1246 | === modified file 'src/Ubuntu/Components/plugin/plugin.cpp' |
1247 | --- src/Ubuntu/Components/plugin/plugin.cpp 2015-12-08 10:54:31 +0000 |
1248 | +++ src/Ubuntu/Components/plugin/plugin.cpp 2016-01-08 17:10:46 +0000 |
1249 | @@ -71,13 +71,15 @@ |
1250 | #include "uclabel.h" |
1251 | #include "uclistitemlayout.h" |
1252 | #include "ucbottomedgehint.h" |
1253 | -#include "gestures/ucswipearea.h" |
1254 | #include "ucmathutils.h" |
1255 | #include "ucbottomedge.h" |
1256 | #include "ucbottomedgeregion.h" |
1257 | #include "ucbottomedgestyle.h" |
1258 | #include "ucpagetreenode.h" |
1259 | |
1260 | +// From UbuntuGestures |
1261 | +#include "private/ucswipearea_p.h" |
1262 | + |
1263 | #include <sys/types.h> |
1264 | #include <unistd.h> |
1265 | #include <stdexcept> |
1266 | |
1267 | === modified file 'src/Ubuntu/Components/plugin/plugin.pri' |
1268 | --- src/Ubuntu/Components/plugin/plugin.pri 2015-12-15 15:58:54 +0000 |
1269 | +++ src/Ubuntu/Components/plugin/plugin.pri 2016-01-08 17:10:46 +0000 |
1270 | @@ -3,7 +3,7 @@ |
1271 | PKGCONFIG += gio-2.0 dbus-1 libnih-dbus |
1272 | } |
1273 | |
1274 | -QT *= core-private qml qml-private quick quick-private gui-private dbus svg UbuntuGestures |
1275 | +QT *= core-private qml qml-private quick quick-private gui-private dbus svg UbuntuGestures UbuntuGestures_private |
1276 | |
1277 | equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) { |
1278 | QT += v8-private |
1279 | @@ -98,8 +98,6 @@ |
1280 | $$PWD/ucimportversionchecker_p.h \ |
1281 | $$PWD/ucbottomedgehint.h \ |
1282 | $$PWD/ucbottomedgehint_p.h \ |
1283 | - $$PWD/gestures/ucswipearea.h \ |
1284 | - $$PWD/gestures/ucswipearea_p.h \ |
1285 | $$PWD/gestures/damper.h \ |
1286 | $$PWD/gestures/ubuntugesturesqmlglobal.h \ |
1287 | $$PWD/ucmathutils.h \ |
1288 | @@ -174,7 +172,6 @@ |
1289 | $$PWD/privates/threelabelsslot_p.cpp \ |
1290 | $$PWD/ucimportversionchecker_p.cpp \ |
1291 | $$PWD/ucbottomedgehint.cpp \ |
1292 | - $$PWD/gestures/ucswipearea.cpp \ |
1293 | $$PWD/ucmathutils.cpp \ |
1294 | $$PWD/ucbottomedge.cpp \ |
1295 | $$PWD/ucbottomedgestyle.cpp \ |
1296 | |
1297 | === modified file 'src/Ubuntu/Components/plugin/privates/threelabelsslot_p.cpp' |
1298 | --- src/Ubuntu/Components/plugin/privates/threelabelsslot_p.cpp 2015-11-08 21:39:34 +0000 |
1299 | +++ src/Ubuntu/Components/plugin/privates/threelabelsslot_p.cpp 2016-01-08 17:10:46 +0000 |
1300 | @@ -38,7 +38,10 @@ |
1301 | void UCThreeLabelsSlotPrivate::setTitleProperties() |
1302 | { |
1303 | if (m_title != Q_NULLPTR) { |
1304 | - m_title->setWrapMode(UCLabel::WordWrap); |
1305 | + //Using WrapAnywhere because ElideRight elides too early when used |
1306 | + //together with WrapWord, and that produces an unexpected result. |
1307 | + //This will cover most of the usecases. |
1308 | + m_title->setWrapMode(UCLabel::WrapAnywhere); |
1309 | m_title->setElideMode(UCLabel::ElideRight); |
1310 | m_title->setMaximumLineCount(1); |
1311 | m_title->setTextSize(UCLabel::Medium); |
1312 | @@ -48,7 +51,7 @@ |
1313 | void UCThreeLabelsSlotPrivate::setSubtitleProperties() |
1314 | { |
1315 | if (m_subtitle != Q_NULLPTR) { |
1316 | - m_subtitle->setWrapMode(UCLabel::WordWrap); |
1317 | + m_subtitle->setWrapMode(UCLabel::WrapAnywhere); |
1318 | m_subtitle->setElideMode(UCLabel::ElideRight); |
1319 | m_subtitle->setMaximumLineCount(1); |
1320 | m_subtitle->setTextSize(UCLabel::Small); |
1321 | @@ -58,7 +61,7 @@ |
1322 | void UCThreeLabelsSlotPrivate::setSummaryProperties() |
1323 | { |
1324 | if (m_summary != Q_NULLPTR) { |
1325 | - m_summary->setWrapMode(UCLabel::WordWrap); |
1326 | + m_summary->setWrapMode(UCLabel::WrapAnywhere); |
1327 | m_summary->setElideMode(UCLabel::ElideRight); |
1328 | m_summary->setMaximumLineCount(2); |
1329 | m_summary->setTextSize(UCLabel::Small); |
1330 | @@ -99,19 +102,19 @@ |
1331 | QQuickAnchors *subtitleAnchors = QQuickItemPrivate::get(m_subtitle)->anchors(); |
1332 | subtitleAnchors->setTop(skipTitle |
1333 | ? top() |
1334 | - : QQuickItemPrivate::get(m_title)->baseline()); |
1335 | + : QQuickItemPrivate::get(m_title)->bottom()); |
1336 | subtitleAnchors->setTopMargin(skipTitle |
1337 | ? 0 |
1338 | - : UCUnits::instance().dp(LABELSBLOCK_SPACING_DP)); |
1339 | + : UCUnits::instance().dp(TITLE_SPACING_DP)); |
1340 | } |
1341 | |
1342 | if (!skipSummary) { |
1343 | QQuickAnchors *summaryAnchors = QQuickItemPrivate::get(m_summary)->anchors(); |
1344 | summaryAnchors->setTop(skipSubtitle |
1345 | - ? (skipTitle ? top() : QQuickItemPrivate::get(m_title)->baseline()) |
1346 | + ? (skipTitle ? top() : QQuickItemPrivate::get(m_title)->bottom()) |
1347 | : QQuickItemPrivate::get(m_subtitle)->bottom()); |
1348 | summaryAnchors->setTopMargin(skipSubtitle |
1349 | - ? (skipTitle ? 0 : UCUnits::instance().dp(LABELSBLOCK_SPACING_DP)) |
1350 | + ? (skipTitle ? 0 : UCUnits::instance().dp(TITLE_SPACING_DP)) |
1351 | : 0); |
1352 | } |
1353 | //Update height of the labels box |
1354 | |
1355 | === modified file 'src/Ubuntu/Components/plugin/privates/threelabelsslot_p.h' |
1356 | --- src/Ubuntu/Components/plugin/privates/threelabelsslot_p.h 2015-10-01 08:47:31 +0000 |
1357 | +++ src/Ubuntu/Components/plugin/privates/threelabelsslot_p.h 2016-01-08 17:10:46 +0000 |
1358 | @@ -20,7 +20,9 @@ |
1359 | #include <QQuickItem> |
1360 | #include <private/qquickitem_p.h> |
1361 | |
1362 | -#define LABELSBLOCK_SPACING_DP 4 |
1363 | +//The padding between title and the string below it (i.e. subtitle, or |
1364 | +//summary, when subtitle is empty) |
1365 | +#define TITLE_SPACING_DP 2 |
1366 | |
1367 | class UCLabel; |
1368 | class UCThreeLabelsSlotPrivate; |
1369 | |
1370 | === modified file 'src/Ubuntu/Components/plugin/quickutils.cpp' |
1371 | --- src/Ubuntu/Components/plugin/quickutils.cpp 2015-12-07 09:07:00 +0000 |
1372 | +++ src/Ubuntu/Components/plugin/quickutils.cpp 2016-01-08 17:10:46 +0000 |
1373 | @@ -33,7 +33,8 @@ |
1374 | QuickUtils::QuickUtils(QObject *parent) : |
1375 | QObject(parent), |
1376 | m_rootView(0), |
1377 | - m_mouseAttached(false) |
1378 | + m_mouseAttached(false), |
1379 | + m_keyboardAttached(false) |
1380 | { |
1381 | QGuiApplication::instance()->installEventFilter(this); |
1382 | m_omitIM << "ibus" << "none" << "compose"; |
1383 | |
1384 | === modified file 'src/Ubuntu/Components/plugin/quickutils.h' |
1385 | --- src/Ubuntu/Components/plugin/quickutils.h 2015-11-05 13:41:35 +0000 |
1386 | +++ src/Ubuntu/Components/plugin/quickutils.h 2016-01-08 17:10:46 +0000 |
1387 | @@ -32,6 +32,7 @@ |
1388 | Q_PROPERTY(QString inputMethodProvider READ inputMethodProvider) |
1389 | Q_PROPERTY(bool touchScreenAvailable READ touchScreenAvailable NOTIFY touchScreenAvailableChanged) |
1390 | Q_PROPERTY(bool mouseAttached MEMBER m_mouseAttached NOTIFY mouseAttachedChanged) |
1391 | + Q_PROPERTY(bool keyboardAttached MEMBER m_keyboardAttached NOTIFY keyboardAttachedChanged) |
1392 | public: |
1393 | static QuickUtils& instance() |
1394 | { |
1395 | @@ -53,6 +54,10 @@ |
1396 | { |
1397 | return m_mouseAttached; |
1398 | } |
1399 | + bool keyboardAttached() |
1400 | + { |
1401 | + return m_keyboardAttached; |
1402 | + } |
1403 | |
1404 | Q_SIGNALS: |
1405 | void rootObjectChanged(); |
1406 | @@ -60,6 +65,7 @@ |
1407 | void deactivated(); |
1408 | void touchScreenAvailableChanged(); |
1409 | void mouseAttachedChanged(); |
1410 | + void keyboardAttachedChanged(); |
1411 | |
1412 | protected: |
1413 | bool eventFilter(QObject *, QEvent *); |
1414 | @@ -69,6 +75,7 @@ |
1415 | QPointer<QQuickView> m_rootView; |
1416 | QStringList m_omitIM; |
1417 | bool m_mouseAttached; |
1418 | + bool m_keyboardAttached; |
1419 | |
1420 | void lookupQuickView(); |
1421 | }; |
1422 | |
1423 | === modified file 'src/Ubuntu/Components/plugin/ucaction.cpp' |
1424 | --- src/Ubuntu/Components/plugin/ucaction.cpp 2015-12-13 07:48:56 +0000 |
1425 | +++ src/Ubuntu/Components/plugin/ucaction.cpp 2016-01-08 17:10:46 +0000 |
1426 | @@ -15,6 +15,7 @@ |
1427 | */ |
1428 | |
1429 | #include "ucaction.h" |
1430 | +#include "quickutils.h" |
1431 | |
1432 | #include <QtDebug> |
1433 | #include <QtQml/QQmlInfo> |
1434 | @@ -22,6 +23,30 @@ |
1435 | #include <QtQuick/qquickwindow.h> |
1436 | #include <private/qguiapplication_p.h> |
1437 | |
1438 | +bool shortcutContextMatcher(QObject* object, Qt::ShortcutContext context) |
1439 | +{ |
1440 | + UCAction* action = static_cast<UCAction*>(object); |
1441 | + // Can't access member here because it's not public |
1442 | + if (!action->property("enabled").toBool()) |
1443 | + return false; |
1444 | + |
1445 | + switch (context) { |
1446 | + case Qt::ApplicationShortcut: |
1447 | + return true; |
1448 | + case Qt::WindowShortcut: { |
1449 | + QObject* window = object; |
1450 | + while (window && !window->isWindowType()) { |
1451 | + window = window->parent(); |
1452 | + if (QQuickItem* item = qobject_cast<QQuickItem*>(window)) |
1453 | + window = item->window(); |
1454 | + } |
1455 | + return window && window == QGuiApplication::focusWindow(); |
1456 | + } |
1457 | + default: break; |
1458 | + } |
1459 | + return false; |
1460 | +} |
1461 | + |
1462 | /*! |
1463 | * \qmltype Action |
1464 | * \instantiates UCAction |
1465 | @@ -74,6 +99,20 @@ |
1466 | * as well as to define actions for pages, or when defining options in \c ListItemOptions. |
1467 | * |
1468 | * Examples: See \l Page |
1469 | + * |
1470 | + * \section2 Mnemonics |
1471 | + * Since Ubuntu.Components 1.3 Action supports mnemonics. Mnemonics are shortcuts |
1472 | + * defined in the \l text property, prefixed the shortcut letter with \&. For instance |
1473 | + * \c "\&Call" will bint the \c "Alt-C" shortcut to the action. When a mnemonic |
1474 | + * is detected on the Action and a keyboard is attached to the device, the \l text |
1475 | + * property will provide a formatted text having the mnemonic letter underscored. |
1476 | + * \qml |
1477 | + * Action { |
1478 | + * id: call |
1479 | + * iconName: "call" |
1480 | + * text: "&Call" |
1481 | + * } |
1482 | + * \endqml |
1483 | */ |
1484 | |
1485 | /*! |
1486 | @@ -94,7 +133,69 @@ |
1487 | /*! |
1488 | * \qmlproperty string Action::text |
1489 | * The user visible primary label of the action. |
1490 | + * |
1491 | + * Mnemonics are shortcuts prefixed in the text with \&. If the text has multiple |
1492 | + * occurences of the \& character, the first one will be considered for the shortcut. |
1493 | + * The \& character cannot be used as shortcut. |
1494 | */ |
1495 | +QString UCAction::text() |
1496 | +{ |
1497 | + // if we have a mnemonic, underscore it |
1498 | + if (!m_mnemonic.isEmpty()) { |
1499 | + |
1500 | + QString mnemonic = "&" + m_mnemonic.toString().remove("Alt+"); |
1501 | + // patch special cases |
1502 | + mnemonic.replace("Space", " "); |
1503 | + int mnemonicIndex = m_text.indexOf(mnemonic); |
1504 | + if (mnemonicIndex < 0) { |
1505 | + // try lower case |
1506 | + mnemonic = mnemonic.toLower(); |
1507 | + mnemonicIndex = m_text.indexOf(mnemonic); |
1508 | + } |
1509 | + QString displayText(m_text); |
1510 | + // FIXME: we need QInputDeviceInfo to detect the keyboard attechment |
1511 | + // https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1276808 |
1512 | + if (QuickUtils::instance().keyboardAttached()) { |
1513 | + // underscore the character |
1514 | + displayText.replace(mnemonicIndex, mnemonic.length(), "<u>" + mnemonic[1] + "</u>"); |
1515 | + } else { |
1516 | + displayText.remove(mnemonicIndex, 1); |
1517 | + } |
1518 | + return displayText; |
1519 | + } |
1520 | + return m_text; |
1521 | +} |
1522 | +void UCAction::setText(const QString &text) |
1523 | +{ |
1524 | + if (m_text == text) { |
1525 | + return; |
1526 | + } |
1527 | + m_text = text; |
1528 | + setMnemonicFromText(m_text); |
1529 | + Q_EMIT textChanged(); |
1530 | +} |
1531 | +void UCAction::resetText() |
1532 | +{ |
1533 | + setText(QString()); |
1534 | +} |
1535 | + |
1536 | +void UCAction::setMnemonicFromText(const QString &text) |
1537 | +{ |
1538 | + QKeySequence sequence = QKeySequence::mnemonic(text); |
1539 | + if (sequence == m_mnemonic) { |
1540 | + return; |
1541 | + } |
1542 | + if (!m_mnemonic.isEmpty()) { |
1543 | + QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(0, this, m_mnemonic); |
1544 | + } |
1545 | + |
1546 | + m_mnemonic = sequence; |
1547 | + |
1548 | + if (!m_mnemonic.isEmpty()) { |
1549 | + Qt::ShortcutContext context = Qt::WindowShortcut; |
1550 | + QGuiApplicationPrivate::instance()->shortcutMap.addShortcut(this, m_mnemonic, context, shortcutContextMatcher); |
1551 | + } |
1552 | +} |
1553 | |
1554 | /*! |
1555 | * \qmlproperty string Action::keywords |
1556 | @@ -158,11 +259,16 @@ |
1557 | , m_published(false) |
1558 | { |
1559 | generateName(); |
1560 | + // FIXME: we need QInputDeviceInfo to detect the keyboard attechment |
1561 | + // https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1276808 |
1562 | + connect(&QuickUtils::instance(), &QuickUtils::keyboardAttachedChanged, |
1563 | + this, &UCAction::onKeyboardAttached); |
1564 | } |
1565 | |
1566 | UCAction::~UCAction() |
1567 | { |
1568 | resetShortcut(); |
1569 | + resetText(); |
1570 | } |
1571 | |
1572 | bool UCAction::isValidType(QVariant::Type valueType) |
1573 | @@ -249,22 +355,6 @@ |
1574 | qWarning() << "Action.itemHint is a DEPRECATED property. Use ActionItems to specify the representation of an Action."; |
1575 | } |
1576 | |
1577 | -bool shortcutContextMatcher(QObject* object, Qt::ShortcutContext) |
1578 | -{ |
1579 | - UCAction* action = static_cast<UCAction*>(object); |
1580 | - // Can't access member here because it's not public |
1581 | - if (!action->property("enabled").toBool()) |
1582 | - return false; |
1583 | - |
1584 | - QObject* window = object; |
1585 | - while (window && !window->isWindowType()) { |
1586 | - window = window->parent(); |
1587 | - if (QQuickItem* item = qobject_cast<QQuickItem*>(window)) |
1588 | - window = item->window(); |
1589 | - } |
1590 | - return window && window == QGuiApplication::focusWindow(); |
1591 | -} |
1592 | - |
1593 | QKeySequence sequenceFromVariant(const QVariant& variant) { |
1594 | if (variant.type() == QVariant::Int) |
1595 | return static_cast<QKeySequence::StandardKey>(variant.toInt()); |
1596 | @@ -320,6 +410,14 @@ |
1597 | return true; |
1598 | } |
1599 | |
1600 | +// trigger text changes whenever HW keyboad is attached/detached |
1601 | +void UCAction::onKeyboardAttached() |
1602 | +{ |
1603 | + if (!m_mnemonic.isEmpty()) { |
1604 | + Q_EMIT textChanged(); |
1605 | + } |
1606 | +} |
1607 | + |
1608 | /*! |
1609 | * \qmlmethod Action::trigger(var value) |
1610 | * Checks the \c value against the action \l parameterType and triggers the action. |
1611 | |
1612 | === modified file 'src/Ubuntu/Components/plugin/ucaction.h' |
1613 | --- src/Ubuntu/Components/plugin/ucaction.h 2015-12-14 06:15:16 +0000 |
1614 | +++ src/Ubuntu/Components/plugin/ucaction.h 2016-01-08 17:10:46 +0000 |
1615 | @@ -20,6 +20,7 @@ |
1616 | #include <QtCore/QObject> |
1617 | #include <QtCore/QVariant> |
1618 | #include <QtCore/QUrl> |
1619 | +#include <QtGui/QKeySequence> |
1620 | |
1621 | // the function detects whether QML has an overridden trigger() slot available |
1622 | // and invokes the one with the appropriate signature |
1623 | @@ -51,7 +52,7 @@ |
1624 | // transferred from Unity Actions |
1625 | Q_ENUMS(Type) |
1626 | Q_PROPERTY(QString name MEMBER m_name WRITE setName NOTIFY nameChanged) |
1627 | - Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged) |
1628 | + Q_PROPERTY(QString text READ text WRITE setText RESET resetText NOTIFY textChanged) |
1629 | Q_PROPERTY(QString iconName MEMBER m_iconName WRITE setIconName NOTIFY iconNameChanged) |
1630 | Q_PROPERTY(QString description MEMBER m_description NOTIFY descriptionChanged) |
1631 | Q_PROPERTY(QString keywords MEMBER m_keywords NOTIFY keywordsChanged) |
1632 | @@ -84,6 +85,9 @@ |
1633 | } |
1634 | |
1635 | void setName(const QString &name); |
1636 | + QString text(); |
1637 | + void setText(const QString &text); |
1638 | + void resetText(); |
1639 | void setIconName(const QString &name); |
1640 | void setIconSource(const QUrl &url); |
1641 | void setItemHint(QQmlComponent *); |
1642 | @@ -114,6 +118,7 @@ |
1643 | QString m_description; |
1644 | QString m_keywords; |
1645 | QVariant m_shortcut; |
1646 | + QKeySequence m_mnemonic; |
1647 | QQmlComponent *m_itemHint; |
1648 | Type m_parameterType; |
1649 | bool m_factoryIconSource:1; |
1650 | @@ -130,7 +135,9 @@ |
1651 | |
1652 | bool isValidType(QVariant::Type valueType); |
1653 | void generateName(); |
1654 | + void setMnemonicFromText(const QString &text); |
1655 | bool event(QEvent *event); |
1656 | + void onKeyboardAttached(); |
1657 | }; |
1658 | |
1659 | #endif // UCACTION_H |
1660 | |
1661 | === modified file 'src/Ubuntu/Components/plugin/ucbottomedge.cpp' |
1662 | --- src/Ubuntu/Components/plugin/ucbottomedge.cpp 2015-12-14 07:21:44 +0000 |
1663 | +++ src/Ubuntu/Components/plugin/ucbottomedge.cpp 2016-01-08 17:10:46 +0000 |
1664 | @@ -34,7 +34,7 @@ |
1665 | #include "ucheader.h" |
1666 | #include "ucaction.h" |
1667 | #include "quickutils.h" |
1668 | -#include "gestures/ucswipearea.h" |
1669 | +#include "private/ucswipearea_p.h" |
1670 | #include <QtQuick/private/qquickanimation_p.h> |
1671 | |
1672 | Q_LOGGING_CATEGORY(ucBottomEdge, "ubuntu.components.BottomEdge", QtMsgType::QtWarningMsg) |
1673 | |
1674 | === modified file 'src/Ubuntu/Components/plugin/ucbottomedgehint.cpp' |
1675 | --- src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2015-12-14 16:05:03 +0000 |
1676 | +++ src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2016-01-08 17:10:46 +0000 |
1677 | @@ -23,7 +23,7 @@ |
1678 | #include "ucnamespace.h" |
1679 | #include "ucunits.h" |
1680 | #include "ucaction.h" |
1681 | -#include "gestures/ucswipearea.h" |
1682 | +#include "private/ucswipearea_p.h" |
1683 | #include "propertychange_p.h" |
1684 | #include <QtQml/private/qqmlproperty_p.h> |
1685 | #include <QtQuick/private/qquickflickable_p.h> |
1686 | |
1687 | === modified file 'src/Ubuntu/Components/plugin/ucfontutils.h' |
1688 | --- src/Ubuntu/Components/plugin/ucfontutils.h 2015-09-22 14:39:47 +0000 |
1689 | +++ src/Ubuntu/Components/plugin/ucfontutils.h 2016-01-08 17:10:46 +0000 |
1690 | @@ -26,12 +26,12 @@ |
1691 | |
1692 | public: |
1693 | static constexpr float fontUnits = 14.0f; |
1694 | - static constexpr float xxSmallScale = 0.677f; |
1695 | - static constexpr float xSmallScale = 0.804f; |
1696 | - static constexpr float smallScale = 0.931f; |
1697 | - static constexpr float mediumScale = 1.079f; |
1698 | - static constexpr float largeScale = 1.291f; |
1699 | - static constexpr float xLargeScale = 1.714f; |
1700 | + static constexpr float xxSmallScale = 0.606f; |
1701 | + static constexpr float xSmallScale = 0.707f; |
1702 | + static constexpr float smallScale = 0.857f; |
1703 | + static constexpr float mediumScale = 1.0f; |
1704 | + static constexpr float largeScale = 1.414f; |
1705 | + static constexpr float xLargeScale = 1.905f; |
1706 | |
1707 | static UCFontUtils& instance() |
1708 | { |
1709 | |
1710 | === modified file 'src/Ubuntu/Components/plugin/uclistitemlayout.cpp' |
1711 | --- src/Ubuntu/Components/plugin/uclistitemlayout.cpp 2015-11-10 11:39:51 +0000 |
1712 | +++ src/Ubuntu/Components/plugin/uclistitemlayout.cpp 2016-01-08 17:10:46 +0000 |
1713 | @@ -27,6 +27,7 @@ |
1714 | \qmltype ListItemLayout |
1715 | \instantiates UCListItemLayout |
1716 | \inqmlmodule Ubuntu.Components 1.3 |
1717 | + \since Ubuntu.Components 1.3 |
1718 | \inherits SlotsLayout |
1719 | \ingroup ubuntu |
1720 | |
1721 | @@ -74,7 +75,7 @@ |
1722 | \l ListItem and ListItemLayout: |
1723 | \qml |
1724 | ListItem { |
1725 | - height: layout.height + divider.height |
1726 | + height: layout.height + (divider.visible ? divider.height : 0) |
1727 | ListItemLayout { |
1728 | id: layout |
1729 | title.text: "Hello developers!" |
1730 | @@ -103,7 +104,7 @@ |
1731 | \qml |
1732 | ListItem { |
1733 | id: listItem |
1734 | - height: layout.height + divider.height |
1735 | + height: layout.height + (divider.visible ? divider.height : 0) |
1736 | |
1737 | ListItemLayout { |
1738 | id: layout |
1739 | @@ -155,8 +156,8 @@ |
1740 | The \l title is positioned at the top, followed by \l subtitle and \l summary, |
1741 | respectively. |
1742 | |
1743 | - The \l subtitle has its top anchored to \l {title}'s baseline, with a margin of |
1744 | - 4 DPs. |
1745 | + The \l subtitle has its top anchored to \l {title}'s bottom, with a margin of |
1746 | + 2 DPs. |
1747 | |
1748 | The \l summary has its top tightly anchored to \l {subtitle}'s bottom. |
1749 | |
1750 | @@ -208,6 +209,81 @@ |
1751 | } |
1752 | \endqml |
1753 | |
1754 | + \section1 About aliasing labels properties |
1755 | + Due to the way ListItemsLayout's labels are created (see |
1756 | + \l {Optimizing memory consumption}) it is not possible to |
1757 | + directly alias their properties. It is still possible, however, |
1758 | + to expose an API that gives indirect read-write access to those |
1759 | + properties. |
1760 | + The following code: |
1761 | + |
1762 | + \qml |
1763 | + ListItem { |
1764 | + property alias titleText: layout.title.text |
1765 | + ListItemLayout { |
1766 | + id: layout |
1767 | + } |
1768 | + } |
1769 | + \endqml |
1770 | + |
1771 | + will return the error "Invalid alias location", because |
1772 | + the title object does not yet exist at time when the alias |
1773 | + is created. |
1774 | + |
1775 | + If you need to expose an API for your component that allows |
1776 | + changing the properties of the labels, we recommend aliasing |
1777 | + the labels themselves. Let's assume you want to create a |
1778 | + QML component to use as a delegate of many |
1779 | + list views inside your application: you will probably have a qml |
1780 | + file holding the definition of the that delegate, and the content |
1781 | + of that file will be similar to: |
1782 | + \qml |
1783 | + //Content of CustomListItem.qml |
1784 | + import QtQuick 2.4 |
1785 | + import Ubuntu.Components 1.3 |
1786 | + |
1787 | + ListItem { |
1788 | + id: listitem |
1789 | + property alias title: layout.title |
1790 | + property alias iconName: icon.name |
1791 | + |
1792 | + height: layout.height + (divider.visible ? divider.height : 0) |
1793 | + |
1794 | + ListItemLayout { |
1795 | + id: layout |
1796 | + Icon { |
1797 | + id: icon |
1798 | + width: units.gu(2) |
1799 | + } |
1800 | + } |
1801 | + } |
1802 | + \endqml |
1803 | + |
1804 | + As you can see, we alias the label item itself instead of its |
1805 | + properties. This also has the advantage of only exposing one alias |
1806 | + instead of one for each property, thus making your QML app a bit more performant. |
1807 | + Once your delegate is defined, you can use it in your ListViews like usual. |
1808 | + \qml |
1809 | + //other UI code... |
1810 | + |
1811 | + ListView { |
1812 | + anchors.fill: parent |
1813 | + model: ListModel { |
1814 | + id: listViewModel |
1815 | + ListElement { titleText: "Hello1"; icon: "message" } |
1816 | + ListElement { titleText: "Hello2"; icon: "email" } |
1817 | + ListElement { titleText: "Hello3"; icon: "email" } |
1818 | + ListElement { titleText: "Hello4"; icon: "message" } |
1819 | + } |
1820 | + delegate: CustomListItem { |
1821 | + title.text: model.titleText |
1822 | + iconName: model.icon |
1823 | + } |
1824 | + } |
1825 | + \endqml |
1826 | + |
1827 | + Note how title's properties are all accessible via the "title" identifier. |
1828 | + |
1829 | */ |
1830 | UCListItemLayout::UCListItemLayout(QQuickItem *parent) |
1831 | : UCSlotsLayout(parent) |
1832 | |
1833 | === modified file 'src/Ubuntu/Components/plugin/ucqquickimageextension.cpp' |
1834 | --- src/Ubuntu/Components/plugin/ucqquickimageextension.cpp 2015-10-15 08:43:17 +0000 |
1835 | +++ src/Ubuntu/Components/plugin/ucqquickimageextension.cpp 2016-01-08 17:10:46 +0000 |
1836 | @@ -77,16 +77,19 @@ |
1837 | int separatorPosition = resolved.indexOf("/"); |
1838 | QString scaleFactor = resolved.left(separatorPosition); |
1839 | QString selectedFilePath = resolved.mid(separatorPosition+1); |
1840 | + QString fragment(m_source.hasFragment() ? "#" + m_source.fragment() : QString("")); |
1841 | |
1842 | if (scaleFactor == "1") { |
1843 | if (qFuzzyCompare(qGuiApp->devicePixelRatio(), (qreal)1.0) |
1844 | || selectedFilePath.endsWith(".svg") || selectedFilePath.endsWith(".svgz")) { |
1845 | - // No scaling necessary. Just pass the file as is. |
1846 | - m_image->setSource(QUrl::fromLocalFile(selectedFilePath)); |
1847 | + // Take care to pass the original fragment |
1848 | + QUrl selectedFileUrl(QUrl::fromLocalFile(selectedFilePath)); |
1849 | + selectedFileUrl.setFragment(fragment); |
1850 | + m_image->setSource(selectedFileUrl); |
1851 | } else { |
1852 | // Need to scale the pixel-based image to suit the devicePixelRatio setting ourselves. |
1853 | // If we let Qt do it, Qt will not choose the UITK-supported "@gu" scaled images. |
1854 | - m_image->setSource(QUrl("image://scaling/1/" + selectedFilePath)); |
1855 | + m_image->setSource(QUrl("image://scaling/1/" + selectedFilePath + fragment)); |
1856 | // explicitly set the source size in the QQuickImageBase, this persuades it that the |
1857 | // supplied image is suitable for the current devicePixelRatio. |
1858 | m_image->setSourceSize(m_image->sourceSize()); |
1859 | @@ -95,7 +98,7 @@ |
1860 | // Prepend "image://scaling" for the image to be loaded by UCScalingImageProvider. |
1861 | if (!m_source.path().endsWith(".sci")) { |
1862 | // Regular image file |
1863 | - m_image->setSource(QUrl("image://scaling/" + resolved)); |
1864 | + m_image->setSource(QUrl("image://scaling/" + resolved + fragment)); |
1865 | } else { |
1866 | // .sci image file. Rewrite the .sci file into a temporary file. |
1867 | bool rewritten = true; |
1868 | @@ -124,7 +127,10 @@ |
1869 | } |
1870 | |
1871 | if (rewritten) { |
1872 | - m_image->setSource(QUrl::fromLocalFile(rewrittenSciFile->fileName())); |
1873 | + // Take care to pass the original fragment |
1874 | + QUrl rewrittenSciFileUrl(QUrl::fromLocalFile(rewrittenSciFile->fileName())); |
1875 | + rewrittenSciFileUrl.setFragment(fragment); |
1876 | + m_image->setSource(rewrittenSciFileUrl); |
1877 | } else { |
1878 | m_image->setSource(m_source); |
1879 | } |
1880 | |
1881 | === modified file 'src/Ubuntu/Components/plugin/ucscalingimageprovider.cpp' |
1882 | --- src/Ubuntu/Components/plugin/ucscalingimageprovider.cpp 2014-09-30 12:10:46 +0000 |
1883 | +++ src/Ubuntu/Components/plugin/ucscalingimageprovider.cpp 2016-01-08 17:10:46 +0000 |
1884 | @@ -40,7 +40,9 @@ |
1885 | { |
1886 | int separatorPosition = id.indexOf("/"); |
1887 | float scaleFactor = id.left(separatorPosition).toFloat(); |
1888 | - QString path = id.mid(separatorPosition+1); |
1889 | + int fragmentPosition = id.lastIndexOf("#"); |
1890 | + int pathLength = fragmentPosition > -1 ? fragmentPosition - separatorPosition - 1 : -1; |
1891 | + QString path = id.mid(separatorPosition + 1, pathLength); |
1892 | QFile file(path); |
1893 | |
1894 | if (file.open(QIODevice::ReadOnly)) { |
1895 | |
1896 | === modified file 'src/Ubuntu/Components/qmldir' |
1897 | --- src/Ubuntu/Components/qmldir 2015-12-17 09:13:29 +0000 |
1898 | +++ src/Ubuntu/Components/qmldir 2016-01-08 17:10:46 +0000 |
1899 | @@ -130,7 +130,7 @@ |
1900 | OrientationHelper 1.3 1.3/OrientationHelper.qml |
1901 | UbuntuNumberAnimation 1.3 1.3/UbuntuNumberAnimation.qml |
1902 | PullToRefresh 1.3 1.3/PullToRefresh.qml |
1903 | -UbuntuListView 1.3 1.3/UbuntuListView11.qml |
1904 | +UbuntuListView 1.3 1.3/UbuntuListView.qml |
1905 | Captions 1.3 1.3/Captions.qml |
1906 | internal ColorUtils 1.3/colorUtils.js |
1907 | DateUtils 1.3 1.3/dateUtils.js |
1908 | |
1909 | === modified file 'src/Ubuntu/Test/plugin/plugin.pri' |
1910 | --- src/Ubuntu/Test/plugin/plugin.pri 2015-10-21 08:33:21 +0000 |
1911 | +++ src/Ubuntu/Test/plugin/plugin.pri 2016-01-08 17:10:46 +0000 |
1912 | @@ -1,4 +1,4 @@ |
1913 | -QT *= core-private qml qml-private quick quick-private gui-private testlib |
1914 | +QT *= core-private qml qml-private quick quick-private gui-private testlib UbuntuGestures |
1915 | |
1916 | equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) { |
1917 | QT *= v8-private |
1918 | @@ -7,6 +7,7 @@ |
1919 | CONFIG += no_keywords |
1920 | DEFINES += UBUNTU_QML_IMPORT_PATH='\\"$${ROOT_BUILD_DIR}/qml\\"' |
1921 | DEFINES += QT_USE_QSTRINGBUILDER |
1922 | +INCLUDEPATH += ../UbuntuGestures |
1923 | |
1924 | TARGET = $$qtLibraryTarget($$TARGET) |
1925 | uri = Ubuntu.Test |
1926 | |
1927 | === modified file 'src/Ubuntu/Test/plugin/uctestextras.cpp' |
1928 | --- src/Ubuntu/Test/plugin/uctestextras.cpp 2015-11-25 07:44:10 +0000 |
1929 | +++ src/Ubuntu/Test/plugin/uctestextras.cpp 2016-01-08 17:10:46 +0000 |
1930 | @@ -17,7 +17,11 @@ |
1931 | #include "uctestextras.h" |
1932 | #include "uctestcase.h" |
1933 | |
1934 | +#include "ucswipearea_p.h" |
1935 | +#include "ucswipearea_p_p.h" |
1936 | + |
1937 | #include <qpa/qwindowsysteminterface.h> |
1938 | +#include <private/qobject_p.h> |
1939 | #include <QSysInfo> |
1940 | |
1941 | const char *DEVICE_MISSING_MSG = "No touch device registered. Register one using registerTouchDevice() before using %1"; |
1942 | @@ -375,3 +379,17 @@ |
1943 | } |
1944 | QTest::mouseRelease(item->window(), button, stateKey, movePoint, delay); |
1945 | } |
1946 | + |
1947 | + |
1948 | +void UCTestExtras::removeTimeConstraintsFromSwipeArea(QQuickItem *item) |
1949 | +{ |
1950 | + UCSwipeArea *swipeArea = dynamic_cast<UCSwipeArea*>(item); |
1951 | + if (!swipeArea) { |
1952 | + qWarning() << item << "is not a SwipeArea"; |
1953 | + return; |
1954 | + } |
1955 | + |
1956 | + UCSwipeAreaPrivate *priv = static_cast<UCSwipeAreaPrivate *>(QObjectPrivate::get(swipeArea)); |
1957 | + priv->setMaxTime(60 * 60 * 1000); |
1958 | + priv->setCompositionTime(0); |
1959 | +} |
1960 | |
1961 | === modified file 'src/Ubuntu/Test/plugin/uctestextras.h' |
1962 | --- src/Ubuntu/Test/plugin/uctestextras.h 2015-11-24 15:23:02 +0000 |
1963 | +++ src/Ubuntu/Test/plugin/uctestextras.h 2016-01-08 17:10:46 +0000 |
1964 | @@ -46,6 +46,8 @@ |
1965 | |
1966 | static void mouseDrag(QQuickItem *item, const QPoint &from, const QPoint &delta, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, int steps = -1, int delay = -1); |
1967 | |
1968 | + static void removeTimeConstraintsFromSwipeArea(QQuickItem *item); |
1969 | + |
1970 | public: // yet for cpp use |
1971 | static void touchDragWithPoints(int touchId, QQuickItem *item, QList<QPoint> points, int delay = -1); |
1972 | static void mouseDragWithPoints(QQuickItem *item, QList<QPoint> points, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, int delay = -1); |
1973 | |
1974 | === modified file 'src/Ubuntu/UbuntuGestures/UbuntuGestures.pro' |
1975 | --- src/Ubuntu/UbuntuGestures/UbuntuGestures.pro 2015-11-17 13:01:00 +0000 |
1976 | +++ src/Ubuntu/UbuntuGestures/UbuntuGestures.pro 2016-01-08 17:10:46 +0000 |
1977 | @@ -21,6 +21,10 @@ |
1978 | unownedtouchevent.h \ |
1979 | ubuntugesturesglobal.h \ |
1980 | pool.h \ |
1981 | + ucswipearea_p.h \ |
1982 | + ucswipearea_p_p.h \ |
1983 | + damper.h \ |
1984 | + |
1985 | |
1986 | SOURCES += candidateinactivitytimer.cpp \ |
1987 | debughelpers.cpp \ |
1988 | @@ -29,3 +33,5 @@ |
1989 | touchownershipevent.cpp \ |
1990 | touchregistry.cpp \ |
1991 | unownedtouchevent.cpp \ |
1992 | + ucswipearea.cpp \ |
1993 | + damper.cpp \ |
1994 | \ No newline at end of file |
1995 | |
1996 | === renamed file 'src/Ubuntu/Components/plugin/gestures/damper.cpp' => 'src/Ubuntu/UbuntuGestures/damper.cpp' |
1997 | --- src/Ubuntu/Components/plugin/gestures/damper.cpp 2015-10-21 08:33:21 +0000 |
1998 | +++ src/Ubuntu/UbuntuGestures/damper.cpp 2016-01-08 17:10:46 +0000 |
1999 | @@ -14,7 +14,7 @@ |
2000 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2001 | */ |
2002 | |
2003 | -#include "Damper.h" |
2004 | +#include "damper_p.h" |
2005 | #include <QDebug> |
2006 | |
2007 | QDebug operator<<(QDebug dbg, const DampedPointF &p) |
2008 | |
2009 | === renamed file 'src/Ubuntu/Components/plugin/gestures/damper.h' => 'src/Ubuntu/UbuntuGestures/damper_p.h' |
2010 | === renamed file 'src/Ubuntu/Components/plugin/gestures/ucswipearea.cpp' => 'src/Ubuntu/UbuntuGestures/ucswipearea.cpp' |
2011 | --- src/Ubuntu/Components/plugin/gestures/ucswipearea.cpp 2015-12-16 09:52:31 +0000 |
2012 | +++ src/Ubuntu/UbuntuGestures/ucswipearea.cpp 2016-01-08 17:10:46 +0000 |
2013 | @@ -15,7 +15,7 @@ |
2014 | * |
2015 | */ |
2016 | |
2017 | -#include "ucswipearea_p.h" |
2018 | +#include "ucswipearea_p_p.h" |
2019 | |
2020 | #include <QQuickWindow> |
2021 | #include <QtCore/qmath.h> |
2022 | @@ -71,19 +71,19 @@ |
2023 | |
2024 | switch (ev->type()) { |
2025 | case QEvent::TouchBegin: |
2026 | - message.append("TouchBegin "); |
2027 | + message.append(QStringLiteral("TouchBegin ")); |
2028 | break; |
2029 | case QEvent::TouchUpdate: |
2030 | - message.append("TouchUpdate "); |
2031 | + message.append(QStringLiteral("TouchUpdate ")); |
2032 | break; |
2033 | case QEvent::TouchEnd: |
2034 | - message.append("TouchEnd "); |
2035 | + message.append(QStringLiteral("TouchEnd ")); |
2036 | break; |
2037 | case QEvent::TouchCancel: |
2038 | - message.append("TouchCancel "); |
2039 | + message.append(QStringLiteral("TouchCancel ")); |
2040 | break; |
2041 | default: |
2042 | - message.append("INVALID_TOUCH_EVENT_TYPE "); |
2043 | + message.append(QStringLiteral("INVALID_TOUCH_EVENT_TYPE ")); |
2044 | } |
2045 | |
2046 | Q_FOREACH(const QTouchEvent::TouchPoint& touchPoint, ev->touchPoints()) { |
2047 | @@ -352,6 +352,36 @@ |
2048 | Q_EMIT immediateRecognitionChanged(enabled); |
2049 | } |
2050 | } |
2051 | + |
2052 | +/*! |
2053 | + * \qmlproperty bool SwipeArea::grabGesture |
2054 | + * If true, any gestures will be grabbed and owned by the SwipeArea as usual. |
2055 | + * If false, gestures will still be reported, but events may be grabbed by |
2056 | + * another Qml object. |
2057 | + * |
2058 | + * Defaults to true. In most cases this should not be unset. |
2059 | + */ |
2060 | +bool UCSwipeArea::grabGesture() const |
2061 | +{ |
2062 | + Q_D(const UCSwipeArea); |
2063 | + return d->grabGesture; |
2064 | +} |
2065 | + |
2066 | +void UCSwipeArea::setGrabGesture(bool enabled) |
2067 | +{ |
2068 | + Q_D(UCSwipeArea); |
2069 | + if (d->grabGesture != enabled) { |
2070 | + d->grabGesture = enabled; |
2071 | + |
2072 | + if (!d->grabGesture && d->status == UCSwipeAreaPrivate::Undecided) { |
2073 | + TouchRegistry::instance()->removeCandidateOwnerForTouch(d->touchId, this); |
2074 | + // We still wanna know when it ends for keeping the composition time window up-to-date |
2075 | + TouchRegistry::instance()->addTouchWatcher(d->touchId, this); |
2076 | + } |
2077 | + |
2078 | + Q_EMIT grabGestureChanged(enabled); |
2079 | + } |
2080 | +} |
2081 | |
2082 | bool UCSwipeArea::event(QEvent *event) |
2083 | { |
2084 | @@ -401,7 +431,10 @@ |
2085 | unownedTouchEvent_undecided(unownedTouchEvent); |
2086 | break; |
2087 | default: // Recognized: |
2088 | - // do nothing |
2089 | + if (!grabGesture) { |
2090 | + // Treat unowned event as if we owned it, but we are really just watching it |
2091 | + touchEvent_recognized(event); |
2092 | + } |
2093 | break; |
2094 | } |
2095 | |
2096 | @@ -453,7 +486,9 @@ |
2097 | } |
2098 | |
2099 | if (movedFarEnoughAlongGestureAxis()) { |
2100 | - TouchRegistry::instance()->requestTouchOwnership(touchId, q); |
2101 | + if (grabGesture) { |
2102 | + TouchRegistry::instance()->requestTouchOwnership(touchId, q); |
2103 | + } |
2104 | setStatus(Recognized); |
2105 | updatePosition(touchScenePosition); |
2106 | } else if (isPastMaxDistance()) { |
2107 | @@ -552,12 +587,21 @@ |
2108 | if (recognitionIsDisabled()) { |
2109 | // Behave like a dumb TouchArea |
2110 | SA_TRACE("Gesture recognition is disabled. Requesting touch ownership immediately."); |
2111 | - TouchRegistry::instance()->requestTouchOwnership(touchId, q); |
2112 | setStatus(Recognized); |
2113 | - event->accept(); |
2114 | + if (grabGesture) { |
2115 | + TouchRegistry::instance()->requestTouchOwnership(touchId, q); |
2116 | + event->accept(); |
2117 | + } else { |
2118 | + watchPressedTouchPoints(touchPoints); |
2119 | + event->ignore(); |
2120 | + } |
2121 | } else { |
2122 | // just monitor the touch points for now. |
2123 | - TouchRegistry::instance()->addCandidateOwnerForTouch(touchId, q); |
2124 | + if (grabGesture) { |
2125 | + TouchRegistry::instance()->addCandidateOwnerForTouch(touchId, q); |
2126 | + } else { |
2127 | + watchPressedTouchPoints(touchPoints); |
2128 | + } |
2129 | |
2130 | setStatus(Undecided); |
2131 | // Let the item below have it. We will monitor it and grab it later if a gesture |
2132 | @@ -859,7 +903,7 @@ |
2133 | |
2134 | QString ActiveTouchesInfo::toString() |
2135 | { |
2136 | - QString string = "("; |
2137 | + QString string = QStringLiteral("("); |
2138 | |
2139 | { |
2140 | QTextStream stream(&string); |
2141 | @@ -869,7 +913,7 @@ |
2142 | }); |
2143 | } |
2144 | |
2145 | - string.append(")"); |
2146 | + string.append(QStringLiteral(")")); |
2147 | |
2148 | return string; |
2149 | } |
2150 | @@ -981,6 +1025,7 @@ |
2151 | , status(WaitingForTouch) |
2152 | , direction(UCSwipeArea::Rightwards) |
2153 | , immediateRecognition(false) |
2154 | + , grabGesture(true) |
2155 | { |
2156 | } |
2157 | |
2158 | |
2159 | === renamed file 'src/Ubuntu/Components/plugin/gestures/ucswipearea.h' => 'src/Ubuntu/UbuntuGestures/ucswipearea_p.h' |
2160 | --- src/Ubuntu/Components/plugin/gestures/ucswipearea.h 2015-12-10 08:03:24 +0000 |
2161 | +++ src/Ubuntu/UbuntuGestures/ucswipearea_p.h 2016-01-08 17:10:46 +0000 |
2162 | @@ -19,8 +19,7 @@ |
2163 | #define UCSWIPEAREA_H |
2164 | |
2165 | #include <QtQuick/QQuickItem> |
2166 | -#include "ubuntugesturesqmlglobal.h" |
2167 | -#include "damper.h" |
2168 | +#include "ubuntugesturesglobal.h" |
2169 | |
2170 | // lib UbuntuGestures |
2171 | #include <UbuntuGestures/Pool> |
2172 | @@ -34,7 +33,7 @@ |
2173 | class UCSwipeAreaPrivate; |
2174 | |
2175 | class UCSwipeAreaPrivate; |
2176 | -class UBUNTUGESTURESQML_EXPORT UCSwipeArea : public QQuickItem |
2177 | +class UBUNTUGESTURES_EXPORT UCSwipeArea : public QQuickItem |
2178 | { |
2179 | Q_OBJECT |
2180 | |
2181 | @@ -47,6 +46,7 @@ |
2182 | READ immediateRecognition |
2183 | WRITE setImmediateRecognition |
2184 | NOTIFY immediateRecognitionChanged) |
2185 | + Q_PROPERTY(bool grabGesture READ grabGesture WRITE setGrabGesture NOTIFY grabGestureChanged) |
2186 | |
2187 | Q_ENUMS(Direction) |
2188 | public: |
2189 | @@ -75,6 +75,9 @@ |
2190 | bool immediateRecognition() const; |
2191 | void setImmediateRecognition(bool enabled); |
2192 | |
2193 | + bool grabGesture() const; |
2194 | + void setGrabGesture(bool enabled); |
2195 | + |
2196 | Q_SIGNALS: |
2197 | void directionChanged(Direction direction); |
2198 | void draggingChanged(bool dragging); |
2199 | @@ -82,6 +85,7 @@ |
2200 | void distanceChanged(qreal distance); |
2201 | void touchPositionChanged(const QPointF &position); |
2202 | void immediateRecognitionChanged(bool immediateRecognition); |
2203 | + void grabGestureChanged(bool grabGesture); |
2204 | |
2205 | protected: |
2206 | bool event(QEvent *e) override; |
2207 | |
2208 | === renamed file 'src/Ubuntu/Components/plugin/gestures/ucswipearea_p.h' => 'src/Ubuntu/UbuntuGestures/ucswipearea_p_p.h' |
2209 | --- src/Ubuntu/Components/plugin/gestures/ucswipearea_p.h 2015-12-16 09:52:31 +0000 |
2210 | +++ src/Ubuntu/UbuntuGestures/ucswipearea_p_p.h 2016-01-08 17:10:46 +0000 |
2211 | @@ -18,18 +18,20 @@ |
2212 | #ifndef UCSWIPEAREAPRIVATE_H |
2213 | #define UCSWIPEAREAPRIVATE_H |
2214 | |
2215 | -#include "ucswipearea.h" |
2216 | +#include "ucswipearea_p.h" |
2217 | #include <QtQuick/private/qquickitem_p.h> |
2218 | |
2219 | +#include "damper_p.h" |
2220 | + |
2221 | // Information about an active touch point |
2222 | -struct UBUNTUGESTURESQML_EXPORT ActiveTouchInfo { |
2223 | +struct UBUNTUGESTURES_EXPORT ActiveTouchInfo { |
2224 | ActiveTouchInfo() : id(-1), startTime(-1) {} |
2225 | bool isValid() const { return id != -1; } |
2226 | void reset() { id = -1; } |
2227 | int id; |
2228 | qint64 startTime; |
2229 | }; |
2230 | -class UBUNTUGESTURESQML_EXPORT ActiveTouchesInfo { |
2231 | +class UBUNTUGESTURES_EXPORT ActiveTouchesInfo { |
2232 | public: |
2233 | ActiveTouchesInfo(const UbuntuGestures::SharedTimeSource &timeSource); |
2234 | void update(QTouchEvent *event); |
2235 | @@ -46,7 +48,7 @@ |
2236 | }; |
2237 | |
2238 | class UCSwipeAreaStatusListener; |
2239 | -class UBUNTUGESTURESQML_EXPORT UCSwipeAreaPrivate : public QQuickItemPrivate |
2240 | +class UBUNTUGESTURES_EXPORT UCSwipeAreaPrivate : public QQuickItemPrivate |
2241 | { |
2242 | Q_DECLARE_PUBLIC(UCSwipeArea) |
2243 | |
2244 | @@ -71,7 +73,6 @@ |
2245 | // Useful for testing, where a fake time source can be supplied |
2246 | void setTimeSource(const UbuntuGestures::SharedTimeSource &timeSource); |
2247 | |
2248 | -public: |
2249 | // Describes the state of the directional drag gesture. |
2250 | enum Status { |
2251 | // Waiting for a new touch point to land on this area. No gesture is being processed |
2252 | @@ -161,9 +162,10 @@ |
2253 | UCSwipeArea::Direction direction; |
2254 | |
2255 | bool immediateRecognition; |
2256 | + bool grabGesture; |
2257 | }; |
2258 | |
2259 | -class UBUNTUGESTURESQML_EXPORT UCSwipeAreaStatusListener |
2260 | +class UBUNTUGESTURES_EXPORT UCSwipeAreaStatusListener |
2261 | { |
2262 | public: |
2263 | virtual void swipeStatusChanged(UCSwipeAreaPrivate::Status /*old*/, UCSwipeAreaPrivate::Status /*new*/) {} |
2264 | |
2265 | === modified file 'tests/api/Extinct/Animals/AnimalModule.pro' |
2266 | --- tests/api/Extinct/Animals/AnimalModule.pro 2015-11-30 15:39:52 +0000 |
2267 | +++ tests/api/Extinct/Animals/AnimalModule.pro 2016-01-08 17:10:46 +0000 |
2268 | @@ -8,7 +8,7 @@ |
2269 | QML_FILES += \ |
2270 | Andrewsarchus.qml \ |
2271 | Paratriisodon.qml \ |
2272 | - gigantophis.qml \ |
2273 | + Gigantophis.qml \ |
2274 | test.qml \ |
2275 | digger.js \ |
2276 | |
2277 | |
2278 | === renamed file 'tests/api/Extinct/Animals/gigantophis.qml' => 'tests/api/Extinct/Animals/Gigantophis.qml' |
2279 | === modified file 'tests/api/Extinct/Animals/plugin/plugin.cpp' |
2280 | --- tests/api/Extinct/Animals/plugin/plugin.cpp 2015-12-11 10:38:46 +0000 |
2281 | +++ tests/api/Extinct/Animals/plugin/plugin.cpp 2016-01-08 17:10:46 +0000 |
2282 | @@ -17,6 +17,7 @@ |
2283 | */ |
2284 | |
2285 | #include "plugin.h" |
2286 | +#include "tarpan.h" |
2287 | #include "smilodon.h" |
2288 | #include "pangaea.h" |
2289 | #include "rune.h" |
2290 | @@ -50,6 +51,7 @@ |
2291 | { |
2292 | Q_ASSERT(uri == QLatin1String("Extinct.Animals")); |
2293 | |
2294 | + qmlRegisterType<EATarpan>(); |
2295 | qmlRegisterType<EASmilodon>(uri, 1, 0, "Smilodon"); |
2296 | qmlRegisterType<EASmilodon>(uri, 0, 1, "ScimitarCat"); |
2297 | |
2298 | |
2299 | === modified file 'tests/api/Extinct/Animals/plugin/plugin.pri' |
2300 | --- tests/api/Extinct/Animals/plugin/plugin.pri 2015-12-02 09:22:28 +0000 |
2301 | +++ tests/api/Extinct/Animals/plugin/plugin.pri 2016-01-08 17:10:46 +0000 |
2302 | @@ -13,6 +13,7 @@ |
2303 | |
2304 | HEADERS += \ |
2305 | $$PWD/plugin.h \ |
2306 | + $$PWD/tarpan.h \ |
2307 | $$PWD/smilodon.h \ |
2308 | $$PWD/pangaea.h \ |
2309 | $$PWD/rune.h \ |
2310 | @@ -21,6 +22,7 @@ |
2311 | |
2312 | SOURCES += \ |
2313 | $$PWD/plugin.cpp \ |
2314 | + $$PWD/tarpan.cpp \ |
2315 | $$PWD/smilodon.cpp \ |
2316 | $$PWD/pangaea.cpp \ |
2317 | $$PWD/rune.cpp \ |
2318 | |
2319 | === added file 'tests/api/Extinct/Animals/plugin/tarpan.cpp' |
2320 | --- tests/api/Extinct/Animals/plugin/tarpan.cpp 1970-01-01 00:00:00 +0000 |
2321 | +++ tests/api/Extinct/Animals/plugin/tarpan.cpp 2016-01-08 17:10:46 +0000 |
2322 | @@ -0,0 +1,59 @@ |
2323 | +/* |
2324 | + * Copyright 2015 Canonical Ltd. |
2325 | + * |
2326 | + * This program is free software; you can redistribute it and/or modify |
2327 | + * it under the terms of the GNU Lesser General Public License as published by |
2328 | + * the Free Software Foundation; version 3. |
2329 | + * |
2330 | + * This program is distributed in the hope that it will be useful, |
2331 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2332 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2333 | + * GNU Lesser General Public License for more details. |
2334 | + * |
2335 | + * You should have received a copy of the GNU Lesser General Public License |
2336 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2337 | + * |
2338 | + * Author: Christian Dywan <christian.dywan@canonical.com> |
2339 | + */ |
2340 | + |
2341 | +#include "tarpan.h" |
2342 | + |
2343 | +/*! |
2344 | + * \qmltype EATarpan |
2345 | + * \instantiates EATarpan |
2346 | + * \inqmlmodule Extinct.Animals 1.0 |
2347 | + * \ingroup ubuntu-commandline |
2348 | + * \brief The Tarpan class specifies the behavior of a Eurasian wild horse. |
2349 | + */ |
2350 | + |
2351 | +EATarpan::EATarpan(QObject *parent) : |
2352 | + QObject(parent) |
2353 | +{ |
2354 | +} |
2355 | + |
2356 | +/*! |
2357 | + * \qmlproperty string EATarpan::name |
2358 | + * |
2359 | + * Name identifying the wild horse. |
2360 | + * |
2361 | + */ |
2362 | +QString EATarpan::name() const |
2363 | +{ |
2364 | + return m_name; |
2365 | +} |
2366 | + |
2367 | +void EATarpan::setName(const QString &name) |
2368 | +{ |
2369 | + m_name = name; |
2370 | + Q_EMIT(nameChanged()); |
2371 | +} |
2372 | + |
2373 | +/*! |
2374 | + * \qmlmethod string EATarpan::kick() |
2375 | + * |
2376 | + * A generous kick, commonly towards someone's groin area. |
2377 | + * |
2378 | + */ |
2379 | +void EATarpan::kick() const |
2380 | +{ |
2381 | +} |
2382 | |
2383 | === added file 'tests/api/Extinct/Animals/plugin/tarpan.h' |
2384 | --- tests/api/Extinct/Animals/plugin/tarpan.h 1970-01-01 00:00:00 +0000 |
2385 | +++ tests/api/Extinct/Animals/plugin/tarpan.h 2016-01-08 17:10:46 +0000 |
2386 | @@ -0,0 +1,46 @@ |
2387 | +/* |
2388 | + * Copyright 2015 Canonical Ltd. |
2389 | + * |
2390 | + * This program is free software; you can redistribute it and/or modify |
2391 | + * it under the terms of the GNU Lesser General Public License as published by |
2392 | + * the Free Software Foundation; version 3. |
2393 | + * |
2394 | + * This program is distributed in the hope that it will be useful, |
2395 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2396 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2397 | + * GNU Lesser General Public License for more details. |
2398 | + * |
2399 | + * You should have received a copy of the GNU Lesser General Public License |
2400 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2401 | + * |
2402 | + * Author: Christian Dywan <christian.dywan@canonical.com> |
2403 | + */ |
2404 | + |
2405 | +#ifndef UCTARPAN_H |
2406 | +#define UCTARPAN_H |
2407 | + |
2408 | +#include <QtCore/QObject> |
2409 | +#include <QtCore/QString> |
2410 | + |
2411 | +class EATarpan : public QObject |
2412 | +{ |
2413 | + Q_OBJECT |
2414 | + |
2415 | + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) |
2416 | + |
2417 | +public: |
2418 | + explicit EATarpan(QObject *parent = 0); |
2419 | + |
2420 | + QString name() const; |
2421 | + void setName(const QString &name); |
2422 | + |
2423 | + Q_INVOKABLE void kick() const; |
2424 | + |
2425 | +Q_SIGNALS: |
2426 | + void nameChanged(); |
2427 | + |
2428 | +private: |
2429 | + QString m_name; |
2430 | +}; |
2431 | + |
2432 | +#endif // UCTARPAN_H |
2433 | |
2434 | === modified file 'tests/api/Extinct/Animals/qmldir' |
2435 | --- tests/api/Extinct/Animals/qmldir 2015-12-02 09:22:28 +0000 |
2436 | +++ tests/api/Extinct/Animals/qmldir 2016-01-08 17:10:46 +0000 |
2437 | @@ -1,7 +1,7 @@ |
2438 | module Extinct.Animals |
2439 | plugin ExtinctAnimals |
2440 | Titanoboa 4.2 test.qml |
2441 | -Gigantophis 4.3 gigantophis.qml |
2442 | +Gigantophis 4.3 Gigantophis.qml |
2443 | internal WoollyMammoth mammoth.qml |
2444 | MonsterSnake 3.1 test.qml |
2445 | Excavator 1.0 digger.js |
2446 | |
2447 | === modified file 'tests/api/components.api' |
2448 | --- tests/api/components.api 2015-12-11 10:38:46 +0000 |
2449 | +++ tests/api/components.api 2016-01-08 17:10:46 +0000 |
2450 | @@ -1,9 +1,12 @@ |
2451 | -Extinct.Animals.Andrewsarchus 2.0: Item |
2452 | - property double saggitalCrestSize |
2453 | - property double skullSize |
2454 | -Extinct.Animals.AndrewsarchusMongoliensis 2.5: Item |
2455 | - property double saggitalCrestSize |
2456 | - property double skullSize |
2457 | +Extinct.Animals.Andrewsarchus 2.0 Paratriisodon: Item |
2458 | + property double saggitalCrestSize |
2459 | + property double skullSize |
2460 | +Extinct.Animals.AndrewsarchusMongoliensis 2.5 Paratriisodon: Item |
2461 | + property double saggitalCrestSize |
2462 | + property double skullSize |
2463 | +EATarpan: QtObject |
2464 | + function kick() |
2465 | + property string name |
2466 | Extinct.Animals.Europe 4.1: QtObject |
2467 | Extinct.Animals.Europe 4.2: Europe |
2468 | readonly property ushort era 4.2 |
2469 | @@ -23,10 +26,10 @@ |
2470 | Extinct.Animals.Pangaea.ModernContinent: Enum |
2471 | America |
2472 | Europe |
2473 | -Extinct.Animals.Smilodon 1.0 ScimitarCat 0.1: QtObject |
2474 | +Extinct.Animals.Smilodon 1.0 ScimitarCat 0.1 EASmilodon: QtObject |
2475 | function string paw(int i) |
2476 | property string name |
2477 | -Extinct.Animals.Titanoboa 4.2 MonsterSnake 3.1: Item |
2478 | +Extinct.Animals.Titanoboa 4.2 MonsterSnake 3.1 test: Item |
2479 | property string bar |
2480 | property var basket |
2481 | property url bazz |
2482 | |
2483 | === modified file 'tests/autopilot/ubuntuuitoolkit/__init__.py' |
2484 | --- tests/autopilot/ubuntuuitoolkit/__init__.py 2015-05-28 15:23:13 +0000 |
2485 | +++ tests/autopilot/ubuntuuitoolkit/__init__.py 2016-01-08 17:10:46 +0000 |
2486 | @@ -48,6 +48,7 @@ |
2487 | 'ToolkitException', |
2488 | 'ubuntu_scenarios', |
2489 | 'UbuntuListView11', |
2490 | + 'UbuntuListView', |
2491 | 'UbuntuUIToolkitCustomProxyObjectBase', |
2492 | ] |
2493 | |
2494 | @@ -86,4 +87,5 @@ |
2495 | ToolkitException, |
2496 | UbuntuUIToolkitCustomProxyObjectBase, |
2497 | UbuntuListView11, |
2498 | + UbuntuListView, |
2499 | ) |
2500 | |
2501 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py' |
2502 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py 2015-09-30 14:46:48 +0000 |
2503 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py 2016-01-08 17:10:46 +0000 |
2504 | @@ -44,6 +44,7 @@ |
2505 | 'Toolbar', |
2506 | 'ToolkitException', |
2507 | 'UbuntuListView11', |
2508 | + 'UbuntuListView', |
2509 | 'UbuntuUIToolkitCustomProxyObjectBase', |
2510 | ] |
2511 | |
2512 | @@ -90,5 +91,6 @@ |
2513 | from ubuntuuitoolkit._custom_proxy_objects._textfield import TextField |
2514 | from ubuntuuitoolkit._custom_proxy_objects._toolbar import Toolbar |
2515 | from ubuntuuitoolkit._custom_proxy_objects._ubuntulistview import ( |
2516 | - UbuntuListView11 |
2517 | + UbuntuListView11, |
2518 | + UbuntuListView, |
2519 | ) |
2520 | |
2521 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_ubuntulistview.py' |
2522 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_ubuntulistview.py 2015-09-22 15:56:35 +0000 |
2523 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_ubuntulistview.py 2016-01-08 17:10:46 +0000 |
2524 | @@ -45,3 +45,7 @@ |
2525 | refresh.wait_for_refresh() |
2526 | return True |
2527 | return False |
2528 | + |
2529 | + |
2530 | +class UbuntuListView(UbuntuListView11): |
2531 | + """Autopilot helper for the UbuntuListView 1.3.""" |
2532 | |
2533 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py' |
2534 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2015-12-09 14:34:55 +0000 |
2535 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2016-01-08 17:10:46 +0000 |
2536 | @@ -34,7 +34,7 @@ |
2537 | text="Call")), |
2538 | ('button with color', dict( |
2539 | button_name="button_color", is_enabled=True, |
2540 | - color=[0, 161, 50, 255], icon=None, text="Call Ctrl+C")), |
2541 | + color=[0, 161, 50, 255], icon=None, text="C&all Ctrl+L")), |
2542 | ('button with icon', dict( |
2543 | button_name="button_iconsource", is_enabled=True, color=None, |
2544 | icon="call.png", text=None)), |
2545 | |
2546 | === modified file 'tests/uitk_test_plan.sh' |
2547 | --- tests/uitk_test_plan.sh 2015-12-16 09:50:40 +0000 |
2548 | +++ tests/uitk_test_plan.sh 2016-01-08 17:10:46 +0000 |
2549 | @@ -552,3 +552,4 @@ |
2550 | echo "Comparing results with the archive tests" > $MAINFILE |
2551 | compare_results |
2552 | fi |
2553 | + |
2554 | |
2555 | === modified file 'tests/unit/plugin_dependency.pri' |
2556 | --- tests/unit/plugin_dependency.pri 2015-12-16 12:57:21 +0000 |
2557 | +++ tests/unit/plugin_dependency.pri 2016-01-08 17:10:46 +0000 |
2558 | @@ -8,7 +8,7 @@ |
2559 | PRE_TARGETDEPS += $$PLUGIN_BLD/Test/libUbuntuTest.so |
2560 | LIBS += -L$$PLUGIN_BLD/Components -lUbuntuComponents |
2561 | LIBS += -L$$PLUGIN_BLD/Test -lUbuntuTest |
2562 | -LIBS += -L$$PWD/../../lib -lUbuntuGestures |
2563 | +LIBS += -L$${ROOT_BUILD_DIR}/lib -lUbuntuGestures |
2564 | DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$_PRO_FILE_PWD_\\\"\" |
2565 | QMAKE_CXXFLAGS += -Werror |
2566 | |
2567 | |
2568 | === modified file 'tests/unit/runtest.sh' |
2569 | --- tests/unit/runtest.sh 2015-12-16 09:52:31 +0000 |
2570 | +++ tests/unit/runtest.sh 2016-01-08 17:10:46 +0000 |
2571 | @@ -70,7 +70,7 @@ |
2572 | $_CMD $_ARGS 2>&1 | grep -v 'QFontDatabase: Cannot find font directory' |
2573 | if [ "x$UITK_TEST_KEEP_RUNNING" != "x1" ]; then |
2574 | ${BUILD_DIR}/tests/checkresults.sh $_XML |
2575 | - RESULT=$* |
2576 | + RESULT=$? |
2577 | fi |
2578 | else |
2579 | echo "Skipped because no DISPLAY available" |
2580 | |
2581 | === modified file 'tests/unit/tst_components/tst_fontutils.qml' |
2582 | --- tests/unit/tst_components/tst_fontutils.qml 2015-03-03 13:20:06 +0000 |
2583 | +++ tests/unit/tst_components/tst_fontutils.qml 2016-01-08 17:10:46 +0000 |
2584 | @@ -1,5 +1,5 @@ |
2585 | /* |
2586 | - * Copyright 2012 Canonical Ltd. |
2587 | + * Copyright 2012-2015 Canonical Ltd. |
2588 | * |
2589 | * This program is free software; you can redistribute it and/or modify |
2590 | * it under the terms of the GNU Lesser General Public License as published by |
2591 | @@ -22,12 +22,12 @@ |
2592 | name: "FontUtilsAPI" |
2593 | |
2594 | function test_modularScale() { |
2595 | - compare(FontUtils.modularScale("xx-small"), 0.677, "xx-small scale"); |
2596 | - compare(FontUtils.modularScale("x-small"), 0.804, "x-small scale"); |
2597 | - compare(FontUtils.modularScale("small"), 0.931, "small scale"); |
2598 | - compare(FontUtils.modularScale("medium"), 1.079, "medium scale"); |
2599 | - compare(FontUtils.modularScale("large"), 1.291, "large scale"); |
2600 | - compare(FontUtils.modularScale("x-large"), 1.714, "x-large scale"); |
2601 | + compare(FontUtils.modularScale("xx-small"), 0.606, "xx-small scale"); |
2602 | + compare(FontUtils.modularScale("x-small"), 0.707, "x-small scale"); |
2603 | + compare(FontUtils.modularScale("small"), 0.857, "small scale"); |
2604 | + compare(FontUtils.modularScale("medium"), 1.0, "medium scale"); |
2605 | + compare(FontUtils.modularScale("large"), 1.414, "large scale"); |
2606 | + compare(FontUtils.modularScale("x-large"), 1.905, "x-large scale"); |
2607 | } |
2608 | |
2609 | function test_modularScale_failures() { |
2610 | @@ -36,17 +36,16 @@ |
2611 | } |
2612 | |
2613 | function test_sizeToPixels() { |
2614 | - compare(FontUtils.sizeToPixels("xx-small"), 0.677 * units.dp(14), "xx-small scale"); |
2615 | - compare(FontUtils.sizeToPixels("x-small"), 0.804 * units.dp(14), "x-small scale"); |
2616 | - compare(FontUtils.sizeToPixels("small"), 0.931 * units.dp(14), "small scale"); |
2617 | - compare(FontUtils.sizeToPixels("medium"), 1.079 * units.dp(14), "medium scale"); |
2618 | - compare(FontUtils.sizeToPixels("large"), 1.291 * units.dp(14), "large scale"); |
2619 | - compare(FontUtils.sizeToPixels("x-large"), 1.714 * units.dp(14), "x-large scale"); |
2620 | + compare(FontUtils.sizeToPixels("xx-small"), 0.606 * units.dp(14), "xx-small scale"); |
2621 | + compare(FontUtils.sizeToPixels("x-small"), 0.707 * units.dp(14), "x-small scale"); |
2622 | + compare(FontUtils.sizeToPixels("small"), 0.857 * units.dp(14), "small scale"); |
2623 | + compare(FontUtils.sizeToPixels("medium"), 1.0 * units.dp(14), "medium scale"); |
2624 | + compare(FontUtils.sizeToPixels("large"), 1.414 * units.dp(14), "large scale"); |
2625 | + compare(FontUtils.sizeToPixels("x-large"), 1.905 * units.dp(14), "x-large scale"); |
2626 | } |
2627 | |
2628 | function test_sizeToPixels_failures() { |
2629 | compare(FontUtils.sizeToPixels("xxsmall"), 0.0, "xxsmall not defined"); |
2630 | compare(FontUtils.sizeToPixels("undefined"), 0.0, "undefined scale"); |
2631 | } |
2632 | - |
2633 | } |
2634 | |
2635 | === modified file 'tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp' |
2636 | --- tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp 2015-12-12 08:25:22 +0000 |
2637 | +++ tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp 2016-01-08 17:10:46 +0000 |
2638 | @@ -20,7 +20,7 @@ |
2639 | #include "ucbottomedgeregion.h" |
2640 | #include "ucbottomedge_p.h" |
2641 | #include "ucbottomedgehint.h" |
2642 | -#include "gestures/ucswipearea.h" |
2643 | +#include "private/ucswipearea_p.h" |
2644 | #include "ucunits.h" |
2645 | #include "ucheader.h" |
2646 | #include "ucaction.h" |
2647 | |
2648 | === modified file 'tests/unit_x11/tst_bottomedge/tst_bottomedge.pro' |
2649 | --- tests/unit_x11/tst_bottomedge/tst_bottomedge.pro 2015-12-12 08:25:22 +0000 |
2650 | +++ tests/unit_x11/tst_bottomedge/tst_bottomedge.pro 2016-01-08 17:10:46 +0000 |
2651 | @@ -1,5 +1,5 @@ |
2652 | include(../test-include.pri) |
2653 | -QT += core-private qml-private quick-private gui-private UbuntuGestures |
2654 | +QT += core-private qml-private quick-private gui-private UbuntuGestures UbuntuGestures_private |
2655 | |
2656 | SOURCES += \ |
2657 | tst_bottomedge.cpp |
2658 | |
2659 | === added file 'tests/unit_x11/tst_components/PageHeaderBaseDividerBottom@18.png' |
2660 | Binary files tests/unit_x11/tst_components/PageHeaderBaseDividerBottom@18.png 1970-01-01 00:00:00 +0000 and tests/unit_x11/tst_components/PageHeaderBaseDividerBottom@18.png 2016-01-08 17:10:46 +0000 differ |
2661 | === added file 'tests/unit_x11/tst_components/battery-100-charging.svg' |
2662 | --- tests/unit_x11/tst_components/battery-100-charging.svg 1970-01-01 00:00:00 +0000 |
2663 | +++ tests/unit_x11/tst_components/battery-100-charging.svg 2016-01-08 17:10:46 +0000 |
2664 | @@ -0,0 +1,25 @@ |
2665 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
2666 | +<!-- Created with Inkscape (http://www.inkscape.org/) --> |
2667 | +<svg id="svg4966" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="90" viewBox="0 0 139.00489 90.000001" width="139" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"> |
2668 | + <metadata id="metadata4971"> |
2669 | + <rdf:RDF> |
2670 | + <cc:Work rdf:about=""> |
2671 | + <dc:format>image/svg+xml</dc:format> |
2672 | + <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> |
2673 | + <dc:title/> |
2674 | + </cc:Work> |
2675 | + </rdf:RDF> |
2676 | + </metadata> |
2677 | + <g id="layer1" transform="translate(-149.78 -484.51)"> |
2678 | + <g id="g5120" transform="translate(-433.79 125.71)"> |
2679 | + <g id="g5124" transform="translate(409.57 223.43)"> |
2680 | + <g id="g5126" style="fill:none" transform="matrix(2.1875 0 0 1.875 -456 -1657.8)"> |
2681 | + <rect id="rect5128" style="opacity:.21171;fill:none" transform="translate(0 804.36)" height="48" width="48" y="152" x="288"/> |
2682 | + </g> |
2683 | + <path id="path5130" style="fill:#808080" transform="translate(174 135.36)" d="m86 15-75.156 0.012c-7.844-0.012-10.844 1.988-10.844 11.988v18 18c0 10 3 12 10.844 11.988l75.156 0.012c7.8438 0.01172 11-2.3633 11-12v-4.0117h8v-13.988-13.988h-8v-4.012c0-9.637-3.156-12.012-11-12zm-75 6c21.619 0.0096 48.956 0.0081 75 0 4 0 5 1 5 6v18 18c0 5-1 6-5 6-26.044-0.008-53.381-0.01-75 0-4 0-5-1-5-6v-18-18c0-5 1-6 5-6z"/> |
2684 | + <path id="path5132" style="fill:#38b44a" d="m1051 697c-3 0-4 0-4 5v26c0 5 1 5 4 5h65c3 0 4 0 4-5v-26c0-5-1-5-4-5z" transform="translate(-861 -534.64)"/> |
2685 | + <path id="path3847-0" style="fill:#808080" d="m299 150.36-13.996 35h14v25l14.005-35h-14z"/> |
2686 | + </g> |
2687 | + </g> |
2688 | + </g> |
2689 | +</svg> |
2690 | |
2691 | === added file 'tests/unit_x11/tst_components/shape.svg' |
2692 | --- tests/unit_x11/tst_components/shape.svg 1970-01-01 00:00:00 +0000 |
2693 | +++ tests/unit_x11/tst_components/shape.svg 2016-01-08 17:10:46 +0000 |
2694 | @@ -0,0 +1,77 @@ |
2695 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
2696 | +<!-- Created with Inkscape (http://www.inkscape.org/) --> |
2697 | + |
2698 | +<svg |
2699 | + xmlns:dc="http://purl.org/dc/elements/1.1/" |
2700 | + xmlns:cc="http://creativecommons.org/ns#" |
2701 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
2702 | + xmlns:svg="http://www.w3.org/2000/svg" |
2703 | + xmlns="http://www.w3.org/2000/svg" |
2704 | + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
2705 | + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
2706 | + width="64" |
2707 | + height="64" |
2708 | + id="svg3336" |
2709 | + version="1.1" |
2710 | + inkscape:version="0.48.5 r10040" |
2711 | + sodipodi:docname="ushape.svg"> |
2712 | + <defs |
2713 | + id="defs3338" /> |
2714 | + <sodipodi:namedview |
2715 | + id="base" |
2716 | + pagecolor="#ffffff" |
2717 | + bordercolor="#666666" |
2718 | + borderopacity="1.0" |
2719 | + inkscape:pageopacity="0.0" |
2720 | + inkscape:pageshadow="2" |
2721 | + inkscape:zoom="4" |
2722 | + inkscape:cx="113.3337" |
2723 | + inkscape:cy="-31.239507" |
2724 | + inkscape:document-units="px" |
2725 | + inkscape:current-layer="layer1" |
2726 | + showgrid="false" |
2727 | + inkscape:window-width="1871" |
2728 | + inkscape:window-height="1056" |
2729 | + inkscape:window-x="49" |
2730 | + inkscape:window-y="24" |
2731 | + inkscape:window-maximized="1" |
2732 | + inkscape:showpageshadow="false" |
2733 | + borderlayer="false" |
2734 | + showborder="true" /> |
2735 | + <metadata |
2736 | + id="metadata3341"> |
2737 | + <rdf:RDF> |
2738 | + <cc:Work |
2739 | + rdf:about=""> |
2740 | + <dc:format>image/svg+xml</dc:format> |
2741 | + <dc:type |
2742 | + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> |
2743 | + <dc:title /> |
2744 | + </cc:Work> |
2745 | + </rdf:RDF> |
2746 | + </metadata> |
2747 | + <g |
2748 | + inkscape:label="Layer 1" |
2749 | + inkscape:groupmode="layer" |
2750 | + id="layer1" |
2751 | + transform="translate(0,-988.36218)"> |
2752 | + <g |
2753 | + transform="matrix(0.92774742,0,0,0.92677598,0,190.60819)" |
2754 | + id="layer1-3" |
2755 | + inkscape:label="Layer 1" |
2756 | + style="fill:#000000;display:inline"> |
2757 | + <g |
2758 | + style="fill:#000000" |
2759 | + inkscape:label="Layer 1" |
2760 | + id="layer1-2" |
2761 | + transform="translate(0,9.99998)"> |
2762 | + <path |
2763 | + sodipodi:nodetypes="sssssssss" |
2764 | + inkscape:connector-curvature="0" |
2765 | + id="path3774" |
2766 | + d="m 66.770269,850.78408 72.334451,0 c 58.42399,0 66.77028,8.34623 66.77028,66.77022 l 0,58.03793 c 0,58.42377 -8.34629,66.76997 -66.77028,66.76997 l -72.334451,0 C 8.3462835,1042.3622 0,1034.016 0,975.59223 L 0,917.5543 c 0,-58.42399 8.3462835,-66.77022 66.770269,-66.77022 z" |
2767 | + style="fill:#000000;fill-opacity:1;stroke:none;display:inline" /> |
2768 | + </g> |
2769 | + </g> |
2770 | + </g> |
2771 | +</svg> |
2772 | |
2773 | === modified file 'tests/unit_x11/tst_components/tst_imageprovider.qml' |
2774 | --- tests/unit_x11/tst_components/tst_imageprovider.qml 2015-03-03 13:20:06 +0000 |
2775 | +++ tests/unit_x11/tst_components/tst_imageprovider.qml 2016-01-08 17:10:46 +0000 |
2776 | @@ -53,16 +53,41 @@ |
2777 | signalName: "visibleChanged" |
2778 | } |
2779 | |
2780 | - function test_sourceChanged() { |
2781 | + function cleanup() { |
2782 | + sourceChangeSpy.clear(); |
2783 | + visibleChangedSpy.clear(); |
2784 | + } |
2785 | + |
2786 | + // tests adjusted to reproduce bug #1401920 |
2787 | + function test_sourceChanged_bug1401920_data() { |
2788 | + return [ |
2789 | + {tag: "Bitmap file", file: 'tst_icon-select.png'}, |
2790 | + {tag: "Bitmap file(18gu)", gu: 18, file: 'tst_icon-select.png'}, |
2791 | + {tag: "Bitmap with fragment", file: 'tst_icon-select.png#' + Date.now()}, |
2792 | + {tag: "Bitmap with fragment(18gu)", gu: 18, file: 'PageHeaderBaseDividerBottom@18.png#' + Date.now()}, |
2793 | + {tag: "Bitmap file with gu", file: 'tst_icon-select@18.png'}, |
2794 | + {tag: "Bitmap file with gu(18gu)", gu: 18, file: 'PageHeaderBaseDividerBottom@18.png'}, |
2795 | + {tag: "Bitmap with gu/ fragment", file: 'tst_icon-select@18.png#' + Date.now()}, |
2796 | + {tag: "Bitmap with gu/ fragment(18gu)", gu: 18, file: 'PageHeaderBaseDividerBottom@18.png#' + Date.now()}, |
2797 | + {tag: "Scalable file", file: 'battery-100-charging.svg'}, |
2798 | + {tag: "Scalable file(18gu)", gu: 18, file: 'shape.svg'}, |
2799 | + {tag: "Scalable with fragment", file: 'shape.svg#' + Date.now()}, |
2800 | + {tag: "Scalable with fragment(18gu)", gu: 18, file: 'battery-100-charging.svg#' + Date.now()}, |
2801 | + ]; |
2802 | + } |
2803 | + |
2804 | + function test_sourceChanged_bug1401920(data) { |
2805 | + units.gridUnit = data.gu ? data.gu : 8; |
2806 | sourceChangeSpy.target = test; |
2807 | - test.source = "/usr/share/icons/ubuntu-mobile/actions/scalable/delete.svg"; |
2808 | - sourceChangeSpy.wait(); |
2809 | + test.source = Qt.resolvedUrl(data.file); |
2810 | + sourceChangeSpy.wait(400); |
2811 | + compare(test.source, Qt.resolvedUrl(data.file)); |
2812 | } |
2813 | |
2814 | function test_sourceNOTIFYable() { |
2815 | /* Test source through visible to cover NOTIFYable errors */ |
2816 | visibleChangedSpy.target = bindingTest; |
2817 | - bindingTest.source = "/usr/share/icons/ubuntu-mobile/actions/scalable/help.svg"; |
2818 | + bindingTest.source = Qt.resolvedUrl('battery-100-charging.svg'); |
2819 | visibleChangedSpy.wait(); |
2820 | } |
2821 | } |
2822 | |
2823 | === modified file 'tests/unit_x11/tst_components/tst_pagestack.qml' |
2824 | --- tests/unit_x11/tst_components/tst_pagestack.qml 2015-10-21 19:33:28 +0000 |
2825 | +++ tests/unit_x11/tst_components/tst_pagestack.qml 2016-01-08 17:10:46 +0000 |
2826 | @@ -54,9 +54,15 @@ |
2827 | id: tabs |
2828 | Tab { |
2829 | id: tab1 |
2830 | + page: Page { |
2831 | + title: "Tab 1" |
2832 | + } |
2833 | } |
2834 | Tab { |
2835 | id: tab2 |
2836 | + page: Page { |
2837 | + title: "Tab 2" |
2838 | + } |
2839 | } |
2840 | } |
2841 | Page { |
2842 | |
2843 | === modified file 'tests/unit_x11/tst_components/tst_scrollbar.qml' |
2844 | --- tests/unit_x11/tst_components/tst_scrollbar.qml 2015-12-16 16:33:22 +0000 |
2845 | +++ tests/unit_x11/tst_components/tst_scrollbar.qml 2016-01-08 17:10:46 +0000 |
2846 | @@ -46,7 +46,9 @@ |
2847 | Rectangle { |
2848 | id: content |
2849 | width: units.gu(40) |
2850 | - height: units.gu(50) |
2851 | + //make this much taller than the flickable to avoid timing issues when |
2852 | + //detecting if the flickable is flicking in the tests |
2853 | + height: units.gu(200) |
2854 | color: "blue" |
2855 | } |
2856 | } |
2857 | @@ -60,6 +62,9 @@ |
2858 | SignalSpy { |
2859 | id: signalSpy |
2860 | } |
2861 | + SignalSpy { |
2862 | + id: anotherSignalSpy |
2863 | + } |
2864 | |
2865 | Flickable { |
2866 | anchors.fill: parent |
2867 | @@ -126,6 +131,8 @@ |
2868 | } |
2869 | function setupSignalSpy(spy, target, signalName) { |
2870 | spy.clear() |
2871 | + //reset signalName otherwise it will look for the old signalName in the new target |
2872 | + spy.signalName = "" |
2873 | spy.target = target |
2874 | spy.signalName = signalName |
2875 | } |
2876 | @@ -176,46 +183,81 @@ |
2877 | scrollbar_trailingAlign_anchors.flickableItem.top, "top anchor") |
2878 | } |
2879 | |
2880 | - function test_indicatorWhileFlicking() { |
2881 | + function test_indicatorStyleWhileFlicking_shortContent() { |
2882 | var freshTestItem = getFreshFlickable() |
2883 | if (!freshTestItem) return |
2884 | |
2885 | var flickable = freshTestItem.flickable |
2886 | var scrollbar = freshTestItem.scrollbar |
2887 | |
2888 | - setupSignalSpy(signalSpy, flickable, "movementEnded") |
2889 | - |
2890 | - flick(flickable, 1, 2, units.gu(2), units.gu(3)) |
2891 | - compare(flickable.moving, true, "not moving") |
2892 | - compare(scrollbar.__styleInstance.state, "indicator", "wrong style while flicking") |
2893 | - |
2894 | - signalSpy.wait() |
2895 | - compare(signalSpy.count, 1, "flick not completed") |
2896 | - |
2897 | - compare(scrollbar.__styleInstance.state, "hidden", "wrong style while flicking short item") |
2898 | + compare(scrollbar.__styleInstance.veryLongContentItem, false, "Scrollable item should be short.") |
2899 | + |
2900 | + setupSignalSpy(signalSpy, flickable, "movingChanged") |
2901 | + |
2902 | + flick(flickable, 1, 2, units.gu(2), -units.gu(10)) |
2903 | + |
2904 | + signalSpy.wait() |
2905 | + compare(signalSpy.count, 1, "No movingChanged signal after simulating a flick.") |
2906 | + compare(flickable.moving, true, "Flickable not moving after simulating a flick.") |
2907 | + compare(scrollbar.__styleInstance.state, "indicator", "Wrong style while flicking.") |
2908 | + |
2909 | + //we don't set it up before because the hinting feature already changes the style to thumb |
2910 | + //at the beginning |
2911 | + setupSignalSpy(anotherSignalSpy, scrollbar.__styleInstance, "stateChanged") |
2912 | + |
2913 | + //make sure the flickable stops |
2914 | + mousePress(flickable, 0, 0) |
2915 | + mouseMove(flickable, 0, 0) |
2916 | + mouseRelease(flickable, 0, 0) |
2917 | + |
2918 | + signalSpy.wait() |
2919 | + compare(flickable.moving, false, "Flickable still moving after simulating mouse click.") |
2920 | + compare(signalSpy.count, 2, "No movingChanged signal after Flickable stopped moving.") |
2921 | + |
2922 | + anotherSignalSpy.wait() |
2923 | + compare(anotherSignalSpy.count, 1, "State unchanged after Flickable stopped moving.") |
2924 | + compare(scrollbar.__styleInstance.state, "hidden", "Wrong style after the item stopped moving.") |
2925 | + |
2926 | freshTestItem.destroy() |
2927 | } |
2928 | |
2929 | - function test_thumbStyleVeryLongContent() { |
2930 | + function test_thumbStyleWhileFlicking_veryLongContent() { |
2931 | var freshTestItem = getFreshFlickable() |
2932 | if (!freshTestItem) return |
2933 | |
2934 | var flickable = freshTestItem.flickable |
2935 | var scrollbar = freshTestItem.scrollbar |
2936 | |
2937 | + setupSignalSpy(signalSpy, scrollbar.__styleInstance, "veryLongContentItemChanged") |
2938 | setVeryLongContentItem(flickable) |
2939 | - compare(scrollbar.__styleInstance.veryLongContentItem, true, "very long content item not detected") |
2940 | - |
2941 | - setupSignalSpy(signalSpy, flickable, "movementEnded") |
2942 | - |
2943 | - flick(flickable, 1, 2, units.gu(2), units.gu(3)) |
2944 | - compare(flickable.moving, true, "not moving") |
2945 | - compare(scrollbar.__styleInstance.state, "thumb", "wrong style while flicking a very long item") |
2946 | - |
2947 | - signalSpy.wait() |
2948 | - compare(signalSpy.count, 1, "flick not completed") |
2949 | - |
2950 | - compare(scrollbar.__styleInstance.state, "hidden", "wrong style while flicking a very long item") |
2951 | + signalSpy.wait() |
2952 | + |
2953 | + compare(scrollbar.__styleInstance.veryLongContentItem, true, "Very long content item not detected") |
2954 | + |
2955 | + setupSignalSpy(signalSpy, flickable, "movingChanged") |
2956 | + flick(flickable, 1, 2, units.gu(2), -units.gu(10)) |
2957 | + |
2958 | + signalSpy.wait() |
2959 | + compare(signalSpy.count, 1, "No movingChanged signal after simulating a flick.") |
2960 | + compare(flickable.moving, true, "Flickable not moving after simulating a flick.") |
2961 | + compare(scrollbar.__styleInstance.state, "thumb", "Wrong style while flicking a very long item") |
2962 | + |
2963 | + //we don't set it up before because the hinting feature already changes the style to thumb |
2964 | + //at the beginning |
2965 | + setupSignalSpy(anotherSignalSpy, scrollbar.__styleInstance, "stateChanged") |
2966 | + |
2967 | + //make sure the flickable stops |
2968 | + mousePress(flickable, 0, 0) |
2969 | + mouseMove(flickable, 0, 0) |
2970 | + mouseRelease(flickable, 0, 0) |
2971 | + |
2972 | + signalSpy.wait() |
2973 | + compare(flickable.moving, false, "Flickable still moving after simulating mouse click.") |
2974 | + compare(signalSpy.count, 2, "No movingChanged signal after Flickable stopped moving.") |
2975 | + |
2976 | + anotherSignalSpy.wait() |
2977 | + compare(anotherSignalSpy.count, 1, "State unchanged after Flickable stopped moving.") |
2978 | + compare(scrollbar.__styleInstance.state, "hidden", "Wrong style after a the item stopped moving.") |
2979 | freshTestItem.destroy() |
2980 | } |
2981 | } |
2982 | |
2983 | === modified file 'tests/unit_x11/tst_components/tst_shortcuts.qml' |
2984 | --- tests/unit_x11/tst_components/tst_shortcuts.qml 2015-12-06 11:48:53 +0000 |
2985 | +++ tests/unit_x11/tst_components/tst_shortcuts.qml 2016-01-08 17:10:46 +0000 |
2986 | @@ -46,6 +46,10 @@ |
2987 | |
2988 | function init() { |
2989 | } |
2990 | + function cleanup() { |
2991 | + spy.clear(); |
2992 | + shortcutSpy.clear(); |
2993 | + } |
2994 | |
2995 | SignalSpy { |
2996 | id: spy |
2997 | @@ -102,6 +106,60 @@ |
2998 | shortcutSpy.clear(); |
2999 | action.shortcut = undefined; |
3000 | shortcutSpy.wait(200); |
3001 | + shortcutSpy.target = null; |
3002 | + } |
3003 | + |
3004 | + function test_mnemonic_data() { |
3005 | + return [ |
3006 | + {tag: "HW keyboard, valid 'C&all'", kbd: true, text: "C&all", displayText: "C<u>a</u>ll", key: Qt.Key_A, xfail: false}, |
3007 | + {tag: "HW keyboard, valid '&Save & Exit", kbd: true, text: "&Save & Exit", displayText: "<u>S</u>ave & Exit", key: Qt.Key_S, xfail: false}, |
3008 | + {tag: "HW keyboard, valid 'Hide &Seek'", kbd: true, text: "Hide&Seek", displayText: "Hide<u>S</u>eek", key: Qt.Key_S, xfail: false}, |
3009 | + {tag: "HW keyboard, valid 'Save & Exit'", kbd: true, text: "Save & Exit", displayText: "Save <u> </u>Exit", key: Qt.Key_Space, xfail: false}, |
3010 | + {tag: "HW keyboard, valid 'Paste &&&Proceed'", kbd: true, text: "Paste &&&Proceed", displayText: "Paste &&<u>P</u>roceed", key: Qt.Key_P, xfail: false}, |
3011 | + {tag: "HW keyboard, valid 'Cut &$'", kbd: true, text: "Cut &$", displayText: "Cut <u>$</u>", key: Qt.Key_Dollar, xfail: false}, |
3012 | + {tag: "HW keyboard, valid 'At &@'", kbd: true, text: "At &@", displayText: "At <u>@</u>", key: Qt.Key_At, xfail: false}, |
3013 | + {tag: "HW keyboard, valid '&_'", kbd: true, text: "&_", displayText: "<u>_</u>", key: Qt.Key_Underscore, xfail: false}, |
3014 | + |
3015 | + {tag: "HW keyboard, invalid '&&Call'", kbd: true, text: "&&Call", displayText: "&&Call", key: Qt.Key_Asterisk, xfail: true}, |
3016 | + {tag: "HW keyboard, invalid 'Jump &'", kbd: true, text: "Jump &", displayText: "Jump &", key: Qt.Key_Asterisk, xfail: true}, |
3017 | + {tag: "HW keyboard, invalid '&&'", kbd: true, text: "&&", displayText: "&&", key: Qt.Key_Asterisk, xfail: true}, |
3018 | + |
3019 | + {tag: "no HW keyboard", kbd: false, text: "&Call", displayText: "Call", key: Qt.Key_C, xfail: false}, |
3020 | + ]; |
3021 | + } |
3022 | + function test_mnemonic(data) { |
3023 | + QuickUtils.keyboardAttached = data.kbd; |
3024 | + action.text = data.text; |
3025 | + if (!data.kbd && QuickUtils.keyboardAttached) { |
3026 | + skip("Cannot test this case: " + data.tag); |
3027 | + } |
3028 | + compare(action.text, data.displayText); |
3029 | + // shortcut |
3030 | + keyClick(data.key, Qt.AltModifier); |
3031 | + if (data.xfail) { |
3032 | + expectFail(data.tag, "invalid mnemonic"); |
3033 | + } |
3034 | + spy.wait(200); |
3035 | + } |
3036 | + |
3037 | + SignalSpy { |
3038 | + id: textSpy |
3039 | + target: action |
3040 | + signalName: "textChanged" |
3041 | + } |
3042 | + |
3043 | + function test_mnemonic_displaytext() { |
3044 | + QuickUtils.keyboardAttached = false; |
3045 | + if (QuickUtils.keyboardAttached) { |
3046 | + skip("the test needs to be able to detach the keyboard"); |
3047 | + } |
3048 | + action.text = "&Call"; |
3049 | + textSpy.clear(); |
3050 | + QuickUtils.keyboardAttached = true; |
3051 | + if (!QuickUtils.keyboardAttached) { |
3052 | + skip("the test needs to be able to attach the keyboard"); |
3053 | + } |
3054 | + textSpy.wait(200); |
3055 | } |
3056 | } |
3057 | } |
3058 | |
3059 | === modified file 'tests/unit_x11/tst_components/tst_slotslayout.qml' |
3060 | --- tests/unit_x11/tst_components/tst_slotslayout.qml 2015-11-09 16:20:34 +0000 |
3061 | +++ tests/unit_x11/tst_components/tst_slotslayout.qml 2016-01-08 17:10:46 +0000 |
3062 | @@ -66,6 +66,17 @@ |
3063 | readonly property var trailingSlots: [] |
3064 | } |
3065 | ListItemLayout { |
3066 | + id: layoutMultilineLabels |
3067 | + title.text: "test \n test" |
3068 | + title.maximumLineCount: 2 |
3069 | + subtitle.text: "test2 \n test2 \n test2" |
3070 | + subtitle.maximumLineCount: 3 |
3071 | + summary.text: "test3 \n test3" |
3072 | + summary.maximumLineCount: 2 |
3073 | + readonly property var leadingSlots: [] |
3074 | + readonly property var trailingSlots: [] |
3075 | + } |
3076 | + ListItemLayout { |
3077 | id: layoutOneLeading |
3078 | readonly property var leadingSlots: [layoutOneLeading_leading1] |
3079 | readonly property var trailingSlots: [] |
3080 | @@ -375,6 +386,17 @@ |
3081 | compare(item.padding.trailing, units.gu(1), "Default trailing padding") |
3082 | } |
3083 | |
3084 | + function checkDefaultWrapping(item) { |
3085 | + //we have to use WrapAnywhere because otherwise it will have unexpected behaviour |
3086 | + //when used together with ElideRight when the string wraps (it will elide too early). |
3087 | + compare(item.title.wrapMode, Label.WrapAnywhere, "Wrong default title wrapMode") |
3088 | + compare(item.subtitle.wrapMode, Label.WrapAnywhere, "Wrong default subtitle wrapMode") |
3089 | + compare(item.summary.wrapMode, Label.WrapAnywhere, "Wrong default summary wrapMode") |
3090 | + compare(item.title.elide, Label.ElideRight, "Wrong default title elide") |
3091 | + compare(item.subtitle.elide, Label.ElideRight, "Wrong default subtitle elide") |
3092 | + compare(item.summary.elide, Label.ElideRight, "Wrong default summary elide") |
3093 | + } |
3094 | + |
3095 | function checkImplicitSize(item) { |
3096 | compare(item.implicitHeight, expectedImplicitHeight(item), "Implicit height check") |
3097 | compare(item.implicitWidth, column.width, "Fill parent's width") |
3098 | @@ -718,7 +740,7 @@ |
3099 | "Default labels positioning, subtitle's y") |
3100 | } else { |
3101 | compare(listitemlayout.subtitle.y, |
3102 | - listitemlayout.title.baselineOffset + units.dp(4), |
3103 | + listitemlayout.title.y + listitemlayout.title.height + units.dp(2), |
3104 | "Default labels positioning, subtitle's y") |
3105 | } |
3106 | } |
3107 | @@ -734,7 +756,7 @@ |
3108 | compare(listitemlayout.summary.y, 0, |
3109 | "Default labels positioning, summary's y") |
3110 | } else { |
3111 | - compare(listitemlayout.summary.y, listitemlayout.title.baselineOffset + units.dp(4), |
3112 | + compare(listitemlayout.summary.y, listitemlayout.title.y + listitemlayout.title.height + units.dp(2), |
3113 | "Default labels positioning, summary's y") |
3114 | } |
3115 | } else { |
3116 | @@ -744,6 +766,10 @@ |
3117 | } |
3118 | } |
3119 | |
3120 | + function test_defaultLabelsWrappingAndElide() { |
3121 | + checkDefaultWrapping(layoutLabels) |
3122 | + } |
3123 | + |
3124 | function test_defaultMainSlotHeight() { |
3125 | var titleText = layoutLabels.title.text |
3126 | var subtitleText = layoutLabels.subtitle.text |
3127 | @@ -873,5 +899,24 @@ |
3128 | compare(obj !== null, true, "QML ListItemLayout: testing labels' QML context.") |
3129 | obj.destroy() |
3130 | } |
3131 | + |
3132 | + //first version of ListItemLayout anchored subtitle to title's baseline, but that breaks |
3133 | + //when title is multiline |
3134 | + function test_multilineLabelsPositioning() { |
3135 | + compare(layoutMultilineLabels.title.maximumLineCount, 2, |
3136 | + "Multiline labels positioning: wrong title maximumLineCount") |
3137 | + compare(layoutMultilineLabels.subtitle.maximumLineCount, 3, |
3138 | + "Multiline labels positioning: wrong subtitle maximumLineCount") |
3139 | + compare(layoutMultilineLabels.summary.maximumLineCount, 2, |
3140 | + "Multiline labels positioning: wrong summary maximumLineCount") |
3141 | + |
3142 | + compare(layoutMultilineLabels.title.lineCount, 2, |
3143 | + "Multiline labels positioning: wrong title lineCount") |
3144 | + compare(layoutMultilineLabels.subtitle.lineCount, 3, |
3145 | + "Multiline labels positioning: wrong subtitle lineCount") |
3146 | + compare(layoutMultilineLabels.summary.lineCount, 2, |
3147 | + "Multiline labels positioning: wrong summary lineCount") |
3148 | + checkLabelsY(layoutMultilineLabels) |
3149 | + } |
3150 | } |
3151 | } |
3152 | |
3153 | === added file 'tests/unit_x11/tst_components/tst_ubuntulistview13.qml' |
3154 | --- tests/unit_x11/tst_components/tst_ubuntulistview13.qml 1970-01-01 00:00:00 +0000 |
3155 | +++ tests/unit_x11/tst_components/tst_ubuntulistview13.qml 2016-01-08 17:10:46 +0000 |
3156 | @@ -0,0 +1,105 @@ |
3157 | +/* |
3158 | + * Copyright 2014 Canonical Ltd. |
3159 | + * |
3160 | + * This program is free software; you can redistribute it and/or modify |
3161 | + * it under the terms of the GNU Lesser General Public License as published by |
3162 | + * the Free Software Foundation; version 3. |
3163 | + * |
3164 | + * This program is distributed in the hope that it will be useful, |
3165 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3166 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3167 | + * GNU Lesser General Public License for more details. |
3168 | + * |
3169 | + * You should have received a copy of the GNU Lesser General Public License |
3170 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3171 | + */ |
3172 | + |
3173 | +import QtQuick 2.4 |
3174 | +import QtTest 1.0 |
3175 | +import Ubuntu.Test 1.0 |
3176 | +import Ubuntu.Components 1.3 |
3177 | + |
3178 | +Item { |
3179 | + width: units.gu(40) |
3180 | + height: units.gu(60) |
3181 | + |
3182 | + ListModel { |
3183 | + id: dummyModel |
3184 | + Component.onCompleted: { |
3185 | + reload(); |
3186 | + } |
3187 | + function reload() { |
3188 | + clear(); |
3189 | + for (var i = 0; i < 20; ++i) { |
3190 | + dummyModel.append({idx: i}); |
3191 | + } |
3192 | + } |
3193 | + } |
3194 | + |
3195 | + // timer used to simulate the model refresh |
3196 | + Timer { |
3197 | + id: refreshTimer |
3198 | + interval: 500 |
3199 | + onTriggered: { |
3200 | + dummyModel.reload(); |
3201 | + } |
3202 | + } |
3203 | + |
3204 | + UbuntuListView { |
3205 | + id: ubuntuListView |
3206 | + anchors.fill: parent |
3207 | + clip: true |
3208 | + model: dummyModel |
3209 | + |
3210 | + pullToRefresh { |
3211 | + refreshing: refreshTimer.running |
3212 | + onRefresh: refreshTimer.restart() |
3213 | + } |
3214 | + |
3215 | + delegate: ListItem { |
3216 | + id: expandable |
3217 | + Label { text: "item " + index } |
3218 | + } |
3219 | + } |
3220 | + |
3221 | + UbuntuTestCase { |
3222 | + name: "UbuntuListView" |
3223 | + when: windowShown |
3224 | + |
3225 | + SignalSpy { |
3226 | + id: refreshSpy |
3227 | + signalName: "onRefresh" |
3228 | + } |
3229 | + |
3230 | + function initTestCase() { |
3231 | + tryCompare(dummyModel, "count", 20); |
3232 | + } |
3233 | + |
3234 | + function init() { |
3235 | + waitForRendering(ubuntuListView, 1000); |
3236 | + } |
3237 | + |
3238 | + function cleanup() { |
3239 | + // scroll the ListView back to top |
3240 | + ubuntuListView.positionViewAtIndex(0, ListView.Beginning); |
3241 | + refreshSpy.clear(); |
3242 | + refreshSpy.target = null; |
3243 | + ubuntuListView.pullToRefresh.enabled = false; |
3244 | + } |
3245 | + |
3246 | + function test_0_defaults() { |
3247 | + verify(ubuntuListView.hasOwnProperty("pullToRefresh"), "PullToRefresh is missing"); |
3248 | + compare(ubuntuListView.pullToRefresh.enabled, false, "PullToRefresh functionality is disabled by default"); |
3249 | + } |
3250 | + |
3251 | + function test_pullToRefresh_manual_refresh() { |
3252 | + ubuntuListView.pullToRefresh.enabled = true; |
3253 | + refreshSpy.target = ubuntuListView.pullToRefresh |
3254 | + var x = ubuntuListView.width / 2; |
3255 | + mouseDrag(ubuntuListView, x, units.gu(1), 0, ubuntuListView.height); |
3256 | + refreshSpy.wait(); |
3257 | + tryCompareFunction(function() { return ubuntuListView.pullToRefresh.refreshing; }, false, 1000); |
3258 | + waitForRendering(ubuntuListView, 1000); |
3259 | + } |
3260 | + } |
3261 | +} |
3262 | |
3263 | === modified file 'tests/unit_x11/tst_swipearea/tst_swipearea.cpp' |
3264 | --- tests/unit_x11/tst_swipearea/tst_swipearea.cpp 2015-12-16 09:52:31 +0000 |
3265 | +++ tests/unit_x11/tst_swipearea/tst_swipearea.cpp 2016-01-08 17:10:46 +0000 |
3266 | @@ -23,8 +23,8 @@ |
3267 | #include <private/qquickmousearea_p.h> |
3268 | #include <private/qquickwindow_p.h> |
3269 | |
3270 | -#include "gestures/ucswipearea.h" |
3271 | -#include "gestures/ucswipearea_p.h" |
3272 | +#include "private/ucswipearea_p.h" |
3273 | +#include "private/ucswipearea_p_p.h" |
3274 | #define protected public |
3275 | #define private public |
3276 | #include <UbuntuGestures/TouchRegistry> |
3277 | |
3278 | === modified file 'tests/unit_x11/tst_swipearea/tst_swipearea.pro' |
3279 | --- tests/unit_x11/tst_swipearea/tst_swipearea.pro 2015-11-06 14:05:07 +0000 |
3280 | +++ tests/unit_x11/tst_swipearea/tst_swipearea.pro 2016-01-08 17:10:46 +0000 |
3281 | @@ -1,5 +1,5 @@ |
3282 | include(../test-include.pri) |
3283 | -QT += core-private qml-private quick-private gui-private UbuntuGestures |
3284 | +QT += core-private qml-private quick-private gui-private UbuntuGestures UbuntuGestures_private |
3285 | SOURCES += \ |
3286 | GestureTest.cpp \ |
3287 | tst_swipearea.cpp |
FAILED: Continuous integration, rev:1272 jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- ci/2246/ jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- vivid-amd64- ci/70/console jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- vivid-armhf- ci/70/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- ui-toolkit- ci/2246/ rebuild
http://