Merge lp:~mzanetti/unity8/switching-previews into lp:unity8

Proposed by Michael Zanetti
Status: Superseded
Proposed branch: lp:~mzanetti/unity8/switching-previews
Merge into: lp:unity8
Diff against target: 437 lines (+176/-62)
8 files modified
Components/Carousel.qml (+6/-6)
Dash/Apps/AppPreview.qml (+9/-0)
Dash/DashPreview.qml (+2/-2)
Dash/DashPreviewPlaceholder.qml (+25/-0)
Dash/Generic/GenericFilterGrid.qml (+4/-6)
Dash/GenericScopeView.qml (+124/-46)
Dash/SearchableResultModel.qml (+4/-0)
tests/qmltests/Dash/tst_GenericScopeView.qml (+2/-2)
To merge this branch: bzr merge lp:~mzanetti/unity8/switching-previews
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Oren Horev design Pending
Unity Team Pending
Review via email: mp+186991@code.launchpad.net

Commit message

transform previews to be a list that can be swiped left/right

To post a comment you must log in.
340. By Paweł Stołowski

Check results model ptr returned by GetResultsFromCategory method from UnityCore. Fixes: https://bugs.launchpad.net/bugs/1211595, https://bugs.launchpad.net/bugs/1228097.

Approved by PS Jenkins bot, Michal Hruby.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:341
http://jenkins.qa.ubuntu.com/job/unity8-ci/1093/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-saucy/3917
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-touch/1492
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-saucy/1833/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-amd64-ci/117
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1094
        deb: http://jenkins.qa.ubuntu.com/job/unity8-saucy-armhf-ci/1094/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-saucy-i386-ci/1093
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-saucy/248
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-i386/3976
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-i386/3976/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/1494
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-saucy-armhf/1494/artifact/work/output/*zip*/output.zip
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-maguro/1260
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/1271

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity8-ci/1093/rebuild

review: Needs Fixing (continuous-integration)
341. By PS Jenkins bot

Releasing 7.81.3+13.10.20130924.2-0ubuntu1 (revision 340 from lp:unity8).

Approved by PS Jenkins bot.

342. By Paweł Stołowski

Support canned search queries returned by Home Scope.

Approved by Michał Sawicz, PS Jenkins bot.

343. By Michael Zanetti

drop our CrossFadeImage in favor of the SDK one. Fixes: https://bugs.launchpad.net/bugs/1227783.

Approved by Michał Sawicz, PS Jenkins bot.

344. By Michael Terry

Only enable the Bottombar when the HUD is available. Fixes: https://bugs.launchpad.net/bugs/1220306.

Approved by Michał Sawicz, PS Jenkins bot.

345. By Michael Terry

Increase the "Skip intro" clickable area, making dismissing the edge demo intro feel more natural. Fixes: https://bugs.launchpad.net/bugs/1220632.

Approved by PS Jenkins bot, Michał Sawicz.

346. By Albert Astals Cid

Make sure we always have least have one column in the gridview. Fixes: https://bugs.launchpad.net/bugs/1225391.

Approved by PS Jenkins bot, Michał Sawicz.

347. By Albert Astals Cid

LVWPH: Make sure we always overshoot vertically. Fixes: https://bugs.launchpad.net/bugs/1229851.

Approved by PS Jenkins bot, Michał Sawicz.

348. By Michal Hruby

Correctly handle image URI scheme in results.

Approved by PS Jenkins bot, Michał Sawicz.

349. By Albert Astals Cid

Remember the expanded categoryId and not the expanded index

The index can change on search, and we still want to maintain it expanded in that case. Fixes: https://bugs.launchpad.net/bugs/1230216.

Approved by PS Jenkins bot, Michael Zanetti.

350. By Michał Sawicz

Make SHOW_DASH and HIDE_DASH close the current preview. Fixes: https://bugs.launchpad.net/bugs/1231404.

Approved by PS Jenkins bot, Michał Sawicz, Diego Sarmentero.

351. By Diego Sarmentero

- Handling error signal from the DownloadTracker plugin (BUG: #1229744). Fixes: https://bugs.launchpad.net/bugs/1229744.

Approved by PS Jenkins bot, Michał Sawicz, Roberto Alsina.

352. By Diego Sarmentero

- Remove "Reviews and Comments" section from Application Preview until the feature is ready (BUG: #1226632)
- Detect when the keyboard is being shown to allow the user to scroll the Preview even more if necessary to interact with the components at the bottom of that preview, and don't leave those components obscured behind the keyboard (BUG: #1226638). Fixes: https://bugs.launchpad.net/bugs/1224717, https://bugs.launchpad.net/bugs/1226632, https://bugs.launchpad.net/bugs/1226638.

Approved by PS Jenkins bot, Michał Sawicz, Alejandro J. Cura.

353. By Nick Dedekind

Brought messaging indicator inline with UnityMenuModel & UnityMenuAction. Fixes: https://bugs.launchpad.net/bugs/1217676, https://bugs.launchpad.net/bugs/1217678.

Approved by PS Jenkins bot, Michael Zanetti.

354. By Albert Astals Cid

Fix showHeader in an edge case of notShownByItsOwn

Not all the tests i've added fail without the code fix, but i've added them just to be more covered
. Fixes: https://bugs.launchpad.net/bugs/1230187.

Approved by PS Jenkins bot, Michał Sawicz.

355. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

356. By Michał Sawicz

Add a LazyImage component that shows an activity spinner for long-loading images and handles aspect ratio properly.

Approved by PS Jenkins bot, Michael Zanetti.

357. By Michał Sawicz

Fix Qt 5.1 FTBFS and suppress some build warnings.

Approved by PS Jenkins bot, Michael Zanetti.

358. By Paweł Stołowski

Cancel previous actions and previews on new activation / preview. Expose previewed data row in Preview object.

Approved by PS Jenkins bot, Michal Hruby, Michał Sawicz.

359. By PS Jenkins bot

Releasing 7.81.3+13.10.20130927.3-0ubuntu1 (revision 358 from lp:unity8).

Approved by PS Jenkins bot.

360. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

361. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

362. By Michael Zanetti

reset after completely messing up merging

363. By Michael Zanetti

merge trunk

364. By Michael Zanetti

cancel any pending preview activations when closing the preview

365. By Michael Zanetti

also cancel any pending actions

366. By Michael Zanetti

move the openeffect position around instead of overscroll the listview
don't try to cancel any previewActions if the preview hasn't been loaded yet

367. By Michael Zanetti

properly fixed the carousel

368. By Michael Zanetti

that shouldn't have gone in

369. By Michael Zanetti

merge trunk

370. By Michael Zanetti

merge with prerequisite branch

371. By Michael Zanetti

cleanup

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Components/Carousel.qml'
2--- Components/Carousel.qml 2013-07-17 16:27:23 +0000
3+++ Components/Carousel.qml 2013-09-24 11:40:47 +0000
4@@ -48,15 +48,15 @@
5
6 /// Emitted when the user clicked on an item
7 /// @param index is the index of the clicked item
8- /// @param delegateItem is the clicked component/delegate itself
9+ /// @param model is the model of all the items in the carousel
10 /// @param itemY is y of the clicked delegate
11- signal clicked(int index, var delegateItem, real itemY)
12+ signal clicked(int index, var model, real itemY)
13
14 /// Emitted when the user pressed and held on an item
15 /// @param index is the index of the held item
16- /// @param delegateItem is the held component/delegate itself
17+ /// @param model is the model of all the items in the carousel
18 /// @param itemY is y of the held delegate
19- signal pressAndHold(int index, var delegateItem, real itemY)
20+ signal pressAndHold(int index, var model, real itemY)
21
22 implicitHeight: listView.tileHeight * selectedItemScaleFactor
23
24@@ -154,7 +154,7 @@
25 /* We're clicking the selected item and
26 we're in the neighbourhood of radius 1 pixel from it.
27 Let's emit the clicked signal. */
28- carousel.clicked(index, delegateItem, delegateItem.y)
29+ carousel.clicked(index, listView.model, delegateItem.y)
30 return
31 }
32
33@@ -178,7 +178,7 @@
34 /* We're pressAndHold the selected item and
35 we're in the neighbourhood of radius 1 pixel from it.
36 Let's emit the pressAndHold signal. */
37- carousel.pressAndHold(index, delegateItem, delegateItem.y);
38+ carousel.pressAndHold(index, listView.model, delegateItem.y);
39 return;
40 }
41
42
43=== modified file 'Dash/Apps/AppPreview.qml'
44--- Dash/Apps/AppPreview.qml 2013-09-05 10:02:00 +0000
45+++ Dash/Apps/AppPreview.qml 2013-09-24 11:40:47 +0000
46@@ -39,6 +39,15 @@
47 }
48 model: previewData.infoMap["more-screenshots"] != null ? previewData.infoMap["more-screenshots"].value : [previewData.image]
49
50+ // FIXME: Because of ListViews inside ListViews inside Flickables inside ListViews (and some more)
51+ // we finally reached the point where this ListView doesn't correctly get swipe input any more but
52+ // instead the parent ListView is the one that is swiped. This MouseArea sort of creates a blocking
53+ // layer to make sure this ListView can be swiped, regardless of what's behind it.
54+ MouseArea {
55+ anchors.fill: parent
56+ enabled: parent.contentWidth > parent.width
57+ }
58+
59 delegate: UbuntuShape {
60 id: shape
61 anchors {
62
63=== modified file 'Dash/DashPreview.qml'
64--- Dash/DashPreview.qml 2013-08-09 09:48:56 +0000
65+++ Dash/DashPreview.qml 2013-09-24 11:40:47 +0000
66@@ -17,7 +17,7 @@
67 import QtQuick 2.0
68 import Ubuntu.Components 0.1
69
70-Rectangle {
71+Item {
72 id: root
73
74 property var previewData
75@@ -35,7 +35,6 @@
76 signal close()
77 signal previewImageClicked()
78
79- color: Qt.rgba(0, 0, 0, .3)
80 clip: true
81
82 Connections {
83@@ -110,6 +109,7 @@
84 left: parent.left
85 leftMargin: title.paintedWidth + labelItem.spacing
86 }
87+ visible: title.text !== ""
88 }
89 }
90 }
91
92=== added file 'Dash/DashPreviewPlaceholder.qml'
93--- Dash/DashPreviewPlaceholder.qml 1970-01-01 00:00:00 +0000
94+++ Dash/DashPreviewPlaceholder.qml 2013-09-24 11:40:47 +0000
95@@ -0,0 +1,25 @@
96+/*
97+ * Copyright (C) 2013 Canonical, Ltd.
98+ *
99+ * This program is free software; you can redistribute it and/or modify
100+ * it under the terms of the GNU General Public License as published by
101+ * the Free Software Foundation; version 3.
102+ *
103+ * This program is distributed in the hope that it will be useful,
104+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
105+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
106+ * GNU General Public License for more details.
107+ *
108+ * You should have received a copy of the GNU General Public License
109+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
110+ */
111+
112+import QtQuick 2.0
113+import Ubuntu.Components 0.1
114+
115+DashPreview {
116+ ActivityIndicator {
117+ anchors.centerIn: parent
118+ running: true
119+ }
120+}
121
122=== modified file 'Dash/Generic/GenericFilterGrid.qml'
123--- Dash/Generic/GenericFilterGrid.qml 2013-09-05 10:02:00 +0000
124+++ Dash/Generic/GenericFilterGrid.qml 2013-09-24 11:40:47 +0000
125@@ -28,8 +28,8 @@
126 property int iconWidth: units.gu(8)
127 property int iconHeight: units.gu(7.5)
128
129- signal clicked(int index, var delegateItem, real itemY)
130- signal pressAndHold(int index, var delegateItem, real itemY)
131+ signal clicked(int index, var model, real itemY)
132+ signal pressAndHold(int index, var model, real itemY)
133
134 delegate: Tile {
135 id: tile
136@@ -45,13 +45,11 @@
137 fillMode: Image.PreserveAspectCrop
138
139 onClicked: {
140- var data = { model: model }
141- filtergrid.clicked(index, data, tile.y)
142+ filtergrid.clicked(index, filtergrid.model, tile.y)
143 }
144
145 onPressAndHold: {
146- var data = { model: model }
147- filtergrid.pressAndHold(index, data, tile.y)
148+ filtergrid.pressAndHold(index, filtergrid.model, tile.y)
149 }
150 }
151 }
152
153=== modified file 'Dash/GenericScopeView.qml'
154--- Dash/GenericScopeView.qml 2013-09-18 14:41:34 +0000
155+++ Dash/GenericScopeView.qml 2013-09-24 11:40:47 +0000
156@@ -21,11 +21,11 @@
157
158 ScopeView {
159 id: scopeView
160- readonly property alias previewShown: previewLoader.onScreen
161+ readonly property alias previewShown: previewListView.onScreen
162
163 onIsCurrentChanged: {
164 pageHeader.resetSearch();
165- previewLoader.open = false;
166+ previewListView.open = false;
167 }
168
169 onMovementStarted: categoryView.showHeader()
170@@ -48,7 +48,7 @@
171 id: categoryView
172 anchors.fill: parent
173 model: scopeView.categories
174- forceNoClip: previewLoader.onScreen
175+ forceNoClip: previewListView.onScreen
176
177 onAtYEndChanged: if (atYEnd) endReached()
178 onMovingChanged: if (moving && atYEnd) endReached()
179@@ -91,28 +91,56 @@
180 Connections {
181 target: rendererLoader.item
182 onClicked: {
183+ // Prepare the preview in case activate() triggers a preview only
184 effect.positionPx = mapToItem(categoryView, 0, itemY).y
185- scopeView.scope.activate(delegateItem.model.uri,
186- delegateItem.model.icon,
187- delegateItem.model.category,
188- 0,
189- delegateItem.model.mimetype,
190- delegateItem.model.title,
191- delegateItem.model.comment,
192- delegateItem.model.dndUri,
193- delegateItem.model.metadata)
194+ previewListView.model = model;
195+ previewListView.init = true;
196+ previewListView.currentIndex = index;
197+
198+ var item = model.get(index);
199+
200+ if ((scopeView.scope.id == "applications.scope" && categoryId == "installed")
201+ || (scopeView.scope.id == "home.scope" && categoryId == "applications.scope")) {
202+ scopeView.scope.activate(item.uri,
203+ item.icon,
204+ item.category,
205+ 0,
206+ item.mimetype,
207+ item.title,
208+ item.comment,
209+ item.dndUri,
210+ item.metadata)
211+ } else {
212+ previewListView.open = true
213+
214+ scopeView.scope.preview( item.uri,
215+ item.icon,
216+ item.category,
217+ 0,
218+ item.mimetype,
219+ item.title,
220+ item.comment,
221+ item.dndUri,
222+ item.metadata)
223+ }
224 }
225 onPressAndHold: {
226 effect.positionPx = mapToItem(categoryView, 0, itemY).y
227- scopeView.scope.preview( delegateItem.model.uri,
228- delegateItem.model.icon,
229- delegateItem.model.category,
230+ previewListView.model = model;
231+ previewListView.open = true
232+ previewListView.init = true;
233+ previewListView.currentIndex = index;
234+
235+ var item = model.get(index)
236+ scopeView.scope.preview( item.uri,
237+ item.icon,
238+ item.category,
239 0,
240- delegateItem.model.mimetype,
241- delegateItem.model.title,
242- delegateItem.model.comment,
243- delegateItem.model.dndUri,
244- delegateItem.model.metadata)
245+ item.mimetype,
246+ item.title,
247+ item.comment,
248+ item.dndUri,
249+ item.metadata)
250 }
251 }
252 Connections {
253@@ -212,15 +240,15 @@
254 bottomOpacity: 1 - (gap * 0.8)
255
256 property int targetBottomGapPx: height - units.gu(8) - bottomOverflow
257- property real gap: previewLoader.open ? 1.0 : 0.0
258+ property real gap: previewListView.open ? 1.0 : 0.0
259
260 Behavior on gap {
261 NumberAnimation {
262 duration: 200
263 easing.type: Easing.InOutQuad
264 onRunningChanged: {
265- if (!previewLoader.open && !running) {
266- previewLoader.onScreen = false
267+ if (!previewListView.open && !running) {
268+ previewListView.onScreen = false
269 }
270 }
271 }
272@@ -230,8 +258,18 @@
273 Connections {
274 target: scopeView.scope
275 onPreviewReady: {
276- previewLoader.previewData = preview
277- previewLoader.open = true
278+ if (previewListView.init) {
279+ // Preview was triggered because of a click on the item. Need to expand now.
280+ if (!previewListView.open) {
281+ previewListView.open = true
282+ }
283+
284+ var index = previewListView.currentIndex
285+ previewListView.currentIndex = -1
286+ previewListView.currentIndex = index
287+ previewListView.init = false
288+ }
289+ previewListView.currentItem.previewData = preview
290 }
291 }
292
293@@ -239,18 +277,9 @@
294 id: previewDelegateMapper
295 }
296
297- Connections {
298- ignoreUnknownSignals: true
299- target: previewLoader.valid ? previewLoader.item : null
300- onClose: {
301- previewLoader.open = false
302- }
303- }
304-
305- Loader {
306- objectName: "previewLoader"
307- id: previewLoader
308- property var previewData
309+ ListView {
310+ id: previewListView
311+ objectName: "previewListView"
312 height: effect.bottomGapPx - effect.topGapPx
313 anchors {
314 top: parent.top
315@@ -258,32 +287,81 @@
316 left: parent.left
317 right: parent.right
318 }
319- source: onScreen ? previewDelegateMapper.map(previewLoader.previewData.rendererName) : ""
320+ orientation: ListView.Horizontal
321+ highlightRangeMode: ListView.StrictlyEnforceRange
322+ snapMode: ListView.SnapOneItem
323+
324+ // because the ListView is built asynchronous, setting the
325+ // currentIndex directly won't work. We need to refresh it
326+ // when the first preview is ready to be displayed.
327+ property bool init: true
328+
329+ onCurrentIndexChanged: {
330+ if (!init && model !== undefined) {
331+ var item = model.get(currentIndex)
332+ scopeView.scope.preview( item.uri,
333+ item.icon,
334+ item.category,
335+ 0,
336+ item.mimetype,
337+ item.title,
338+ item.comment,
339+ item.dndUri,
340+ item.metadata)
341+ }
342+ }
343
344 property bool open: false
345 property bool onScreen: false
346- property bool valid: item !== null
347
348 onOpenChanged: {
349 if (open) {
350 onScreen = true
351- }
352- }
353-
354- onLoaded: {
355- item.previewData = Qt.binding(function() { return previewLoader.previewData })
356+ } else {
357+ model = undefined
358+ }
359+ }
360+
361+ Rectangle {
362+ anchors.fill: parent
363+ color: Qt.rgba(0, 0, 0, .3)
364+ }
365+
366+ delegate: Loader {
367+ objectName: "previewLoader"
368+ height: previewListView.height
369+ width: previewListView.width
370+ source: previewListView.onScreen ?
371+ (previewData !== undefined ? previewDelegateMapper.map(previewData.rendererName) : "DashPreviewPlaceholder.qml") : ""
372+
373+ property var previewData
374+ property bool valid: item !== null
375+
376+ onLoaded: {
377+ if (previewListView.onScreen && previewData !== undefined) {
378+ item.previewData = Qt.binding(function() { return previewData })
379+ }
380+ }
381+
382+ Connections {
383+ ignoreUnknownSignals: true
384+ target: item
385+ onClose: {
386+ previewListView.open = false
387+ }
388+ }
389 }
390 }
391
392 // TODO: Move as InverseMouseArea to DashPreview
393 MouseArea {
394- enabled: previewLoader.onScreen
395+ enabled: previewListView.onScreen
396 anchors {
397 fill: parent
398 topMargin: effect.bottomGapPx
399 }
400 onClicked: {
401- previewLoader.open = false;
402+ previewListView.open = false;
403 }
404 }
405 }
406
407=== modified file 'Dash/SearchableResultModel.qml'
408--- Dash/SearchableResultModel.qml 2013-08-14 12:19:25 +0000
409+++ Dash/SearchableResultModel.qml 2013-09-24 11:40:47 +0000
410@@ -25,6 +25,10 @@
411
412 filterRole: CategoryResults.RoleTitle
413
414+ function get(index) {
415+ return model.get(mapToSource(index))
416+ }
417+
418 onSearchQueryChanged: {
419 if (searchQuery.length == 0) {
420 filterRegExp = RegExp("");
421
422=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
423--- tests/qmltests/Dash/tst_GenericScopeView.qml 2013-09-17 16:40:27 +0000
424+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2013-09-24 11:40:47 +0000
425@@ -44,10 +44,10 @@
426
427 function test_isCurrent() {
428 var pageHeader = findChild(genericScopeView, "pageHeader");
429- var previewLoader = findChild(genericScopeView, "previewLoader");
430+ var previewListView = findChild(genericScopeView, "previewListView");
431 genericScopeView.isCurrent = true
432 pageHeader.searchQuery = "test"
433- previewLoader.open = true
434+ previewListView.open = true
435 genericScopeView.isCurrent = false
436 tryCompare(pageHeader, "searchQuery", "")
437 tryCompare(genericScopeView, "previewShown", false);

Subscribers

People subscribed via source and target branches