Merge lp:~cimi/unity8/bug-1541967 into lp:unity8

Proposed by Andrea Cimitan
Status: Rejected
Rejected by: Andrea Cimitan
Proposed branch: lp:~cimi/unity8/bug-1541967
Merge into: lp:unity8
Prerequisite: lp:~aacid/unity8/activtion-progress
Diff against target: 874 lines (+108/-323)
17 files modified
debian/control (+2/-2)
qml/Dash/GenericScopeView.qml (+13/-41)
qml/Dash/PreviewView.qml (+26/-69)
qml/Dash/Previews/Preview.qml (+0/-4)
qml/Dash/Previews/PreviewExpandable.qml (+0/-1)
qml/Dash/Previews/PreviewRatingEdit.qml (+0/-1)
qml/Dash/Previews/PreviewWidget.qml (+0/-3)
qml/Dash/Previews/PreviewWidgetFactory.qml (+0/-4)
tests/mocks/Unity/CMakeLists.txt (+1/-3)
tests/mocks/Unity/Unity.qmltypes (+33/-50)
tests/mocks/Unity/fake_previewstack.cpp (+0/-68)
tests/mocks/Unity/fake_previewstack.h (+0/-52)
tests/mocks/Unity/fake_scope.cpp (+2/-2)
tests/mocks/Unity/fake_scope.h (+2/-2)
tests/mocks/Unity/fake_unity_plugin.cpp (+1/-2)
tests/qmltests/CMakeLists.txt (+1/-1)
tests/qmltests/Dash/tst_PreviewView.qml (+27/-18)
To merge this branch: bzr merge lp:~cimi/unity8/bug-1541967
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Andrea Cimitan (community) Disapprove
Unity8 CI Bot continuous-integration Needs Fixing
Albert Astals Cid Pending
Review via email: mp+286623@code.launchpad.net

This proposal supersedes a proposal from 2016-02-08.

Commit message

Make the PreviewListView not interactive so it doesn't scroll

Description of the change

Make the previews not scrollable

 * Are there any related MPs required for this MP to build/function as expected? Please list.
n
 * Did you perform an exploratory manual test run of your code change and any related functionality?
y
 * Did you make sure that your branch does not contain spurious tags?
y
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
n/a
 * If you changed the UI, has there been a design review?
y

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2173
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/289/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/409/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/432
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/450
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/450
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/446
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/446/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/446/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/446
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/446/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/446/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/446
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/446/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/446/console

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-1-ci/289/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal

Any reason that we don't fix this properly?

review: Needs Information
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Paweł Stołowski (stolowski) wrote : Posted in a previous version of this proposal

> Any reason that we don't fix this properly?

Proper fix will be possible once I refactor shell plugin and scope interfaces to only expose one preview. WIP.

Revision history for this message
Andrea Cimitan (cimi) wrote : Posted in a previous version of this proposal

still have to fix the tests and test it with the silo before is ready for review. comments still welcome

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote : Posted in a previous version of this proposal

> still have to fix the tests and test it with the silo before is ready for
> review. comments still welcome
test fixed, I need to bump debian stuff and test with the silo yet

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/bug-1541967 updated
2204. By Andrea Cimitan

merged

2205. By Andrea Cimitan

Merged the other way around

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :
review: Disapprove
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

2205. By Andrea Cimitan

Merged the other way around

2204. By Andrea Cimitan

merged

2203. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

2202. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

2201. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

2200. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2016-02-19 11:24:40 +0000
3+++ debian/control 2016-02-19 11:24:41 +0000
4@@ -29,7 +29,7 @@
5 libqt5xmlpatterns5-dev,
6 libsystemsettings-dev,
7 libudev-dev,
8- libunity-api-dev (>= 7.106),
9+ libunity-api-dev (>= 7.107),
10 libusermetricsoutput1-dev,
11 # Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
12 libx11-dev[!armhf],
13@@ -134,7 +134,7 @@
14 unity-application-impl-13,
15 unity-notifications-impl-3,
16 unity-plugin-scopes | unity-scopes-impl,
17- unity-scopes-impl-10,
18+ unity-scopes-impl-11,
19 unity8-fake-env | unity-application-impl,
20 ${misc:Depends},
21 Breaks: unity8 (<< 7.86),
22
23=== modified file 'qml/Dash/GenericScopeView.qml'
24--- qml/Dash/GenericScopeView.qml 2016-02-19 11:24:40 +0000
25+++ qml/Dash/GenericScopeView.qml 2016-02-19 11:24:41 +0000
26@@ -73,49 +73,30 @@
27 }
28
29 property var maybePreviewResult;
30- property int maybePreviewIndex;
31- property var maybePreviewResultsModel;
32- property int maybePreviewLimitedCategoryItemCount;
33 property string maybePreviewCategoryId;
34
35 function clearMaybePreviewData() {
36 scopeView.maybePreviewResult = undefined;
37- scopeView.maybePreviewIndex = -1;
38- scopeView.maybePreviewResultsModel = undefined;
39- scopeView.maybePreviewLimitedCategoryItemCount = -1;
40 scopeView.maybePreviewCategoryId = "";
41 }
42
43- function itemClicked(index, result, itemModel, resultsModel, limitedCategoryItemCount, categoryId) {
44+ function itemClicked(result, categoryId) {
45 scopeView.maybePreviewResult = result;
46- scopeView.maybePreviewIndex = index;
47- scopeView.maybePreviewResultsModel = resultsModel;
48- scopeView.maybePreviewLimitedCategoryItemCount = limitedCategoryItemCount;
49 scopeView.maybePreviewCategoryId = categoryId;
50
51 scope.activate(result, categoryId);
52 }
53
54- function itemPressedAndHeld(index, result, resultsModel, limitedCategoryItemCount, categoryId) {
55+ function itemPressedAndHeld(result, categoryId) {
56 clearMaybePreviewData();
57
58- openPreview(result, index, resultsModel, limitedCategoryItemCount, categoryId);
59+ openPreview(result, categoryId);
60 }
61
62- function openPreview(result, index, resultsModel, limitedCategoryItemCount, categoryId) {
63- var previewStack = scope.preview(result, categoryId);
64- if (previewStack) {
65- if (limitedCategoryItemCount > 0) {
66- previewLimitModel.model = resultsModel;
67- previewLimitModel.limit = limitedCategoryItemCount;
68- subPageLoader.model = previewLimitModel;
69- } else {
70- subPageLoader.model = resultsModel;
71- }
72- subPageLoader.initialIndex = -1;
73- subPageLoader.initialIndex = index;
74- subPageLoader.categoryId = categoryId;
75- subPageLoader.previewStack = previewStack;
76+ function openPreview(result, categoryId) {
77+ var previewModel = scope.preview(result, categoryId);
78+ if (previewModel) {
79+ subPageLoader.previewModel = previewModel;
80 subPageLoader.openSubPage("preview");
81 }
82 }
83@@ -166,9 +147,6 @@
84 onPreviewRequested: { // (QVariant const& result)
85 if (result === scopeView.maybePreviewResult) {
86 openPreview(result,
87- scopeView.maybePreviewIndex,
88- scopeView.maybePreviewResultsModel,
89- scopeView.maybePreviewLimitedCategoryItemCount,
90 scopeView.maybePreviewCategoryId);
91
92 clearMaybePreviewData();
93@@ -400,11 +378,11 @@
94 Connections {
95 target: rendererLoader.item
96 onClicked: { // (int index, var result, var item, var itemModel)
97- scopeView.itemClicked(index, result, itemModel, target.model, categoryItemCount(), baseItem.category);
98+ scopeView.itemClicked(result, baseItem.category);
99 }
100
101 onPressAndHold: { // (int index, var result, var itemModel)
102- scopeView.itemPressedAndHeld(index, result, target.model, categoryItemCount(), baseItem.category);
103+ scopeView.itemPressedAndHeld(result, baseItem.category);
104 }
105
106 function categoryItemCount() {
107@@ -779,13 +757,10 @@
108 property var scope: scopeView.scope
109 property var scopeStyle: scopeView.scopeStyle
110 property int initialIndex: -1
111- property var previewStack;
112- property string categoryId
113- property var model: null
114+ property var previewModel;
115
116 readonly property bool processing: item && item.processing || false
117 readonly property int count: item && item.count || 0
118- readonly property int currentIndex: item && item.currentIndex || 0
119 readonly property var currentItem: item && item.currentItem || null
120
121 property string subPage: ""
122@@ -800,7 +775,7 @@
123 }
124
125 source: switch(subPage) {
126- case "preview": return "PreviewListView.qml";
127+ case "preview": return "PreviewView.qml";
128 case "settings": return "ScopeSettingsPage.qml";
129 default: return "";
130 }
131@@ -810,11 +785,8 @@
132 item.scopeStyle = Qt.binding(function() { return subPageLoader.scopeStyle; } )
133 if (subPage == "preview") {
134 item.open = Qt.binding(function() { return subPageLoader.open; } )
135- item.initialIndex = Qt.binding(function() { return subPageLoader.initialIndex; } )
136- item.model = Qt.binding(function() { return subPageLoader.model; } )
137- item.categoryId = Qt.binding(function() { return subPageLoader.categoryId; } )
138- item.initialIndexPreviewStack = subPageLoader.previewStack;
139- subPageLoader.previewStack = null;
140+ item.previewModel = subPageLoader.previewModel;
141+ subPageLoader.previewModel = null;
142 }
143 open = true;
144 }
145
146=== renamed file 'qml/Dash/PreviewListView.qml' => 'qml/Dash/PreviewView.qml'
147--- qml/Dash/PreviewListView.qml 2015-10-26 08:53:52 +0000
148+++ qml/Dash/PreviewView.qml 2016-02-19 11:24:41 +0000
149@@ -23,20 +23,14 @@
150 Item {
151 id: root
152
153- property int initialIndex: -1
154- property var initialIndexPreviewStack: null
155+ property bool open: false
156 property var scope: null
157 property var scopeStyle: null
158- property string categoryId
159- property bool usedInitialIndex: false
160
161 property alias showSignatureLine: header.showSignatureLine
162
163- property alias open: previewListView.open
164- property alias model: previewListView.model
165- property alias currentIndex: previewListView.currentIndex
166- property alias currentItem: previewListView.currentItem
167- property alias count: previewListView.count
168+ property alias currentItem: previewLoader.item
169+ property var previewModel
170
171 readonly property bool processing: currentItem && (!currentItem.previewModel.loaded
172 || currentItem.previewModel.processingAction)
173@@ -55,73 +49,36 @@
174 onBackClicked: root.backClicked()
175 }
176
177- ListView {
178- id: previewListView
179- objectName: "listView"
180+ onOpenChanged: {
181+ if (!open) {
182+ // Cancel any pending preview requests or actions
183+ if (currentItem && currentItem.previewData !== undefined) {
184+ currentItem.previewData.cancelAction();
185+ }
186+ root.scope.cancelActivation();
187+ }
188+ }
189+
190+ Loader {
191+ id: previewLoader
192+ objectName: "loader"
193 anchors {
194 top: header.bottom
195 bottom: parent.bottom
196 left: parent.left
197 right: parent.right
198 }
199- orientation: ListView.Horizontal
200- highlightRangeMode: ListView.StrictlyEnforceRange
201- snapMode: ListView.SnapOneItem
202- boundsBehavior: Flickable.DragAndOvershootBounds
203- highlightMoveDuration: 250
204- flickDeceleration: units.gu(625)
205- maximumFlickVelocity: width * 5
206- cacheBuffer: 0
207-
208- property bool open: false
209-
210- onOpenChanged: {
211- if (!open) {
212- // Cancel any pending preview requests or actions
213- if (previewListView.currentItem && previewListView.currentItem.previewData !== undefined) {
214- previewListView.currentItem.previewData.cancelAction();
215- }
216- root.scope.cancelActivation();
217- model = undefined;
218- }
219- }
220-
221- onModelChanged: {
222- if (count > 0 && initialIndex >= 0 && !usedInitialIndex) {
223- usedInitialIndex = true;
224- previewListView.positionViewAtIndex(initialIndex, ListView.SnapPosition);
225- }
226- }
227-
228- delegate: Previews.Preview {
229+
230+ sourceComponent: Previews.Preview {
231 id: preview
232- objectName: "preview" + index
233- height: previewListView.height
234- width: previewListView.width
235-
236- isCurrent: ListView.isCurrentItem
237-
238- readonly property var previewStack: {
239- if (root.open) {
240- if (index === root.initialIndex) {
241- return root.initialIndexPreviewStack;
242- } else {
243- return root.scope.preview(result, root.categoryId);
244- }
245- } else {
246- return null;
247- }
248- }
249-
250- previewModel: {
251- if (previewStack) {
252- return previewStack.getPreviewModel(0);
253- } else {
254- return null;
255- }
256- }
257-
258- scopeStyle: root.scopeStyle
259+ objectName: "preview"
260+ height: previewLoader.height
261+ width: previewLoader.width
262+ }
263+
264+ onLoaded: {
265+ item.scopeStyle = Qt.binding(function() { return root.scopeStyle; });
266+ item.previewModel = Qt.binding(function() { return root.previewModel; });
267 }
268 }
269
270
271=== modified file 'qml/Dash/Previews/Preview.qml'
272--- qml/Dash/Previews/Preview.qml 2015-11-26 16:36:41 +0000
273+++ qml/Dash/Previews/Preview.qml 2016-02-19 11:24:41 +0000
274@@ -34,9 +34,6 @@
275 */
276 property var previewModel
277
278- //! \brief Should be set to true if this preview is currently displayed.
279- property bool isCurrent: false
280-
281 //! \brief The ScopeStyle component.
282 property var scopeStyle: null
283
284@@ -88,7 +85,6 @@
285 widgetId: model.widgetId
286 widgetType: model.type
287 widgetData: model.properties
288- isCurrentPreview: root.isCurrent
289 scopeStyle: root.scopeStyle
290 parentFlickable: column
291
292
293=== modified file 'qml/Dash/Previews/PreviewExpandable.qml'
294--- qml/Dash/Previews/PreviewExpandable.qml 2015-09-18 07:43:38 +0000
295+++ qml/Dash/Previews/PreviewExpandable.qml 2016-02-19 11:24:41 +0000
296@@ -84,7 +84,6 @@
297 widgetId: model.widgetId
298 widgetType: model.type
299 widgetData: model.properties
300- isCurrentPreview: root.isCurrentPreview
301 scopeStyle: root.scopeStyle
302 anchors {
303 left: parent.left
304
305=== modified file 'qml/Dash/Previews/PreviewRatingEdit.qml'
306--- qml/Dash/Previews/PreviewRatingEdit.qml 2016-01-20 17:59:53 +0000
307+++ qml/Dash/Previews/PreviewRatingEdit.qml 2016-02-19 11:24:41 +0000
308@@ -68,7 +68,6 @@
309
310 widgetId: root.widgetId
311 widgetData: root.widgetData
312- isCurrentPreview: root.isCurrentPreview
313 scopeStyle: root.scopeStyle
314
315 ratingValue: widgetData["rating"]
316
317=== modified file 'qml/Dash/Previews/PreviewWidget.qml'
318--- qml/Dash/Previews/PreviewWidget.qml 2015-11-26 16:36:41 +0000
319+++ qml/Dash/Previews/PreviewWidget.qml 2016-02-19 11:24:41 +0000
320@@ -19,9 +19,6 @@
321 /*! Interface for preview widgets. */
322
323 Item {
324- //! Specifies the preview widget being currently used or not
325- property bool isCurrentPreview: true
326-
327 //! The widget identifier
328 property string widgetId
329
330
331=== modified file 'qml/Dash/Previews/PreviewWidgetFactory.qml'
332--- qml/Dash/Previews/PreviewWidgetFactory.qml 2015-11-26 16:36:41 +0000
333+++ qml/Dash/Previews/PreviewWidgetFactory.qml 2016-02-19 11:24:41 +0000
334@@ -37,9 +37,6 @@
335 //! Should the widget show in expanded mode (For those that support it)
336 property bool expanded: widgetType !== "expandable" || widgetData["expanded"] === true
337
338- //! Set to true if the parent preview is displayed.
339- property bool isCurrentPreview: false
340-
341 //! Set margins width.
342 property real widgetMargins: status === Loader.Ready ? item.widgetMargins : units.gu(1)
343
344@@ -82,7 +79,6 @@
345 onLoaded: {
346 item.widgetId = Qt.binding(function() { return root.widgetId } )
347 item.widgetData = Qt.binding(function() { return root.widgetData } )
348- item.isCurrentPreview = Qt.binding(function() { return root.isCurrentPreview } )
349 item.expanded = Qt.binding(function() { return root.expanded } )
350 item.scopeStyle = Qt.binding(function() { return root.scopeStyle } )
351 item.parentFlickable = Qt.binding(function() { return root.parentFlickable } )
352
353=== modified file 'tests/mocks/Unity/CMakeLists.txt'
354--- tests/mocks/Unity/CMakeLists.txt 2016-02-19 11:24:40 +0000
355+++ tests/mocks/Unity/CMakeLists.txt 2016-02-19 11:24:41 +0000
356@@ -8,7 +8,7 @@
357 add_subdirectory(Screens)
358
359 pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
360-pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=10)
361+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=11)
362
363 include_directories(
364 ${CMAKE_CURRENT_BINARY_DIR}
365@@ -28,13 +28,11 @@
366 fake_navigation.cpp
367 fake_resultsmodel.cpp
368 fake_previewmodel.cpp
369- fake_previewstack.cpp
370 fake_previewwidgetmodel.cpp
371 fake_unity_plugin.cpp
372 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/CategoriesInterface.h
373 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/NavigationInterface.h
374 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewModelInterface.h
375- ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewStackInterface.h
376 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewWidgetModelInterface.h
377 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ResultsModelInterface.h
378 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/ScopeInterface.h
379
380=== modified file 'tests/mocks/Unity/Unity.qmltypes'
381--- tests/mocks/Unity/Unity.qmltypes 2015-02-13 09:01:16 +0000
382+++ tests/mocks/Unity/Unity.qmltypes 2016-02-19 11:24:41 +0000
383@@ -1,4 +1,4 @@
384-import QtQuick.tooling 1.1
385+import QtQuick.tooling 1.2
386
387 // This file describes the plugin-supplied types contained in the library.
388 // It is used for QML tooling purposes only.
389@@ -7,18 +7,11 @@
390 // 'qmlplugindump -notrelocatable Unity 0.2 tests/mocks'
391
392 Module {
393+ dependencies: ["QtQuick 2.4", "Unity.Indicators 0.1"]
394 Component {
395 name: "Categories"
396 prototype: "unity::shell::scopes::CategoriesInterface"
397 Method {
398- name: "addSpecialCategory"
399- Parameter { name: "categoryId"; type: "string" }
400- Parameter { name: "name"; type: "string" }
401- Parameter { name: "icon"; type: "string" }
402- Parameter { name: "rawTemplate"; type: "string" }
403- Parameter { name: "countObject"; type: "QObject"; isPointer: true }
404- }
405- Method {
406 name: "overrideCategoryJson"
407 type: "bool"
408 Parameter { name: "categoryId"; type: "string" }
409@@ -61,18 +54,6 @@
410 }
411 }
412 Component {
413- name: "PreviewStack"
414- prototype: "unity::shell::scopes::PreviewStackInterface"
415- exports: ["Unity/PreviewStack 0.2"]
416- isCreatable: false
417- exportMetaObjectRevisions: [0]
418- Method {
419- name: "getPreviewModel"
420- type: "unity::shell::scopes::PreviewModelInterface*"
421- Parameter { name: "index"; type: "int" }
422- }
423- }
424- Component {
425 name: "PreviewWidgetModel"
426 prototype: "unity::shell::scopes::PreviewWidgetModelInterface"
427 exports: ["Unity/PreviewWidgetModel 0.2"]
428@@ -95,11 +76,11 @@
429 prototype: "unity::shell::scopes::ScopeInterface"
430 exports: ["Unity/MockScope 0.2"]
431 exportMetaObjectRevisions: [0]
432+ Signal { name: "refreshed" }
433 Signal {
434- name: "performQuery"
435+ name: "queryPerformed"
436 Parameter { name: "query"; type: "string" }
437 }
438- Signal { name: "refreshed" }
439 Method {
440 name: "setId"
441 Parameter { name: "id"; type: "string" }
442@@ -115,11 +96,13 @@
443 Method {
444 name: "activate"
445 Parameter { name: "result"; type: "QVariant" }
446+ Parameter { name: "categoryId"; type: "string" }
447 }
448 Method {
449 name: "preview"
450- type: "PreviewStack*"
451+ type: "PreviewModel*"
452 Parameter { name: "result"; type: "QVariant" }
453+ Parameter { name: "categoryId"; type: "string" }
454 }
455 Method { name: "cancelActivation" }
456 Method {
457@@ -142,6 +125,12 @@
458 Parameter { name: "isAltNavigation"; type: "bool" }
459 }
460 Method { name: "refresh" }
461+ Method {
462+ name: "activateAction"
463+ Parameter { name: "result"; type: "QVariant" }
464+ Parameter { name: "categoryId"; type: "string" }
465+ Parameter { name: "actionId"; type: "string" }
466+ }
467 }
468 Component {
469 name: "Scopes"
470@@ -182,6 +171,10 @@
471 Parameter { name: "index"; type: "int" }
472 }
473 Method {
474+ name: "closeScope"
475+ Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
476+ }
477+ Method {
478 name: "getScopeFromAll"
479 type: "Scope*"
480 Parameter { name: "scope_id"; type: "string" }
481@@ -214,14 +207,6 @@
482 Parameter { name: "categoryId"; type: "string" }
483 Parameter { name: "json"; type: "string" }
484 }
485- Method {
486- name: "addSpecialCategory"
487- Parameter { name: "categoryId"; type: "string" }
488- Parameter { name: "name"; type: "string" }
489- Parameter { name: "icon"; type: "string" }
490- Parameter { name: "rawTemplate"; type: "string" }
491- Parameter { name: "countObject"; type: "QObject"; isPointer: true }
492- }
493 }
494 Component {
495 name: "unity::shell::scopes::NavigationInterface"
496@@ -271,22 +256,6 @@
497 }
498 }
499 Component {
500- name: "unity::shell::scopes::PreviewStackInterface"
501- prototype: "QAbstractListModel"
502- Enum {
503- name: "Roles"
504- values: {
505- "RolePreviewModel": 0
506- }
507- }
508- Property { name: "widgetColumnCount"; type: "int" }
509- Method {
510- name: "getPreviewModel"
511- type: "unity::shell::scopes::PreviewModelInterface*"
512- Parameter { name: "index"; type: "int" }
513- }
514- }
515- Component {
516 name: "unity::shell::scopes::PreviewWidgetModelInterface"
517 prototype: "QAbstractListModel"
518 Enum {
519@@ -316,7 +285,8 @@
520 "RoleSummary": 9,
521 "RoleAttributes": 10,
522 "RoleBackground": 11,
523- "RoleOverlayColor": 12
524+ "RoleOverlayColor": 12,
525+ "RoleQuickPreviewData": 13
526 }
527 }
528 Property { name: "categoryId"; type: "string" }
529@@ -343,6 +313,7 @@
530 Property { name: "description"; type: "string"; isReadonly: true }
531 Property { name: "searchHint"; type: "string"; isReadonly: true }
532 Property { name: "searchInProgress"; type: "bool"; isReadonly: true }
533+ Property { name: "activationInProgress"; type: "bool"; isReadonly: true }
534 Property { name: "favorite"; type: "bool" }
535 Property { name: "shortcut"; type: "string"; isReadonly: true }
536 Property {
537@@ -393,11 +364,13 @@
538 Method {
539 name: "activate"
540 Parameter { name: "result"; type: "QVariant" }
541+ Parameter { name: "categoryId"; type: "string" }
542 }
543 Method {
544 name: "preview"
545- type: "unity::shell::scopes::PreviewStackInterface*"
546+ type: "unity::shell::scopes::PreviewModelInterface*"
547 Parameter { name: "result"; type: "QVariant" }
548+ Parameter { name: "categoryId"; type: "string" }
549 }
550 Method { name: "cancelActivation" }
551 Method {
552@@ -424,6 +397,12 @@
553 Parameter { name: "cannedQuery"; type: "string" }
554 }
555 Method { name: "refresh" }
556+ Method {
557+ name: "activateAction"
558+ Parameter { name: "result"; type: "QVariant" }
559+ Parameter { name: "categoryId"; type: "string" }
560+ Parameter { name: "actionId"; type: "string" }
561+ }
562 }
563 Component {
564 name: "unity::shell::scopes::ScopesInterface"
565@@ -464,6 +443,10 @@
566 Parameter { name: "scopeId"; type: "string" }
567 Parameter { name: "index"; type: "int" }
568 }
569+ Method {
570+ name: "closeScope"
571+ Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
572+ }
573 }
574 Component {
575 name: "unity::shell::scopes::SettingsModelInterface"
576
577=== removed file 'tests/mocks/Unity/fake_previewstack.cpp'
578--- tests/mocks/Unity/fake_previewstack.cpp 2015-09-14 11:07:25 +0000
579+++ tests/mocks/Unity/fake_previewstack.cpp 1970-01-01 00:00:00 +0000
580@@ -1,68 +0,0 @@
581-/*
582- * Copyright (C) 2014 Canonical, Ltd.
583- *
584- * This program is free software; you can redistribute it and/or modify
585- * it under the terms of the GNU General Public License as published by
586- * the Free Software Foundation; version 3.
587- *
588- * This program is distributed in the hope that it will be useful,
589- * but WITHOUT ANY WARRANTY; without even the implied warranty of
590- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
591- * GNU General Public License for more details.
592- *
593- * You should have received a copy of the GNU General Public License
594- * along with this program. If not, see <http://www.gnu.org/licenses/>.
595- */
596-
597-// self
598-#include "fake_previewstack.h"
599-
600-// local
601-#include "fake_previewmodel.h"
602-#include "fake_scope.h"
603-
604-PreviewStack::PreviewStack(Scope *scope)
605- : unity::shell::scopes::PreviewStackInterface(nullptr)
606-{
607- m_previews << new PreviewModel(this, scope);
608-}
609-
610-PreviewStack::~PreviewStack()
611-{
612-}
613-
614-void PreviewStack::setWidgetColumnCount(int columnCount)
615-{
616- if (columnCount != 1) {
617- qFatal("PreviewStack::setWidgetColumnCount != 1 not implemented");
618- }
619-}
620-
621-int PreviewStack::widgetColumnCount() const
622-{
623- return 1;
624-}
625-
626-int PreviewStack::rowCount(const QModelIndex&) const
627-{
628- return m_previews.size();
629-}
630-
631-unity::shell::scopes::PreviewModelInterface* PreviewStack::getPreviewModel(int index) const
632-{
633- if (index >= m_previews.size()) {
634- return nullptr;
635- }
636-
637- return m_previews.at(index);
638-}
639-
640-QVariant PreviewStack::data(const QModelIndex& index, int role) const
641-{
642- switch (role) {
643- case RolePreviewModel:
644- return QVariant::fromValue(m_previews.at(index.row()));
645- default:
646- return QVariant();
647- }
648-}
649
650=== removed file 'tests/mocks/Unity/fake_previewstack.h'
651--- tests/mocks/Unity/fake_previewstack.h 2015-09-14 11:07:25 +0000
652+++ tests/mocks/Unity/fake_previewstack.h 1970-01-01 00:00:00 +0000
653@@ -1,52 +0,0 @@
654-/*
655- * Copyright (C) 2014 Canonical, Ltd.
656- *
657- * This program is free software; you can redistribute it and/or modify
658- * it under the terms of the GNU General Public License as published by
659- * the Free Software Foundation; version 3.
660- *
661- * This program is distributed in the hope that it will be useful,
662- * but WITHOUT ANY WARRANTY; without even the implied warranty of
663- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
664- * GNU General Public License for more details.
665- *
666- * You should have received a copy of the GNU General Public License
667- * along with this program. If not, see <http://www.gnu.org/licenses/>.
668- */
669-
670-
671-#ifndef FAKE_PREVIEWSTACK_H
672-#define FAKE_PREVIEWSTACK_H
673-
674-#include <unity/shell/scopes/PreviewStackInterface.h>
675-
676-#include <QSharedPointer>
677-#include <QVariantMap>
678-
679-class PreviewModel;
680-
681-class Scope;
682-
683-class PreviewStack : public unity::shell::scopes::PreviewStackInterface
684-{
685- Q_OBJECT
686-
687-public:
688- explicit PreviewStack(Scope* scope = 0);
689- virtual ~PreviewStack();
690-
691- QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
692- int rowCount(const QModelIndex& parent = QModelIndex()) const override;
693-
694- Q_INVOKABLE unity::shell::scopes::PreviewModelInterface* getPreviewModel(int index) const override;
695-
696- void setWidgetColumnCount(int columnCount) override;
697- int widgetColumnCount() const override;
698-
699-private:
700- QList<PreviewModel*> m_previews;
701-};
702-
703-Q_DECLARE_METATYPE(PreviewStack*)
704-
705-#endif // FAKE_PREVIEWSTACK_H
706
707=== modified file 'tests/mocks/Unity/fake_scope.cpp'
708--- tests/mocks/Unity/fake_scope.cpp 2016-02-19 11:24:40 +0000
709+++ tests/mocks/Unity/fake_scope.cpp 2016-02-19 11:24:41 +0000
710@@ -199,14 +199,14 @@
711 }
712 }
713
714-PreviewStack* Scope::preview(QVariant const& result, QString const& /*categoryId*/)
715+PreviewModel* Scope::preview(QVariant const& result, QString const& /*categoryId*/)
716 {
717 Q_UNUSED(result);
718
719 if (m_returnNullPreview) {
720 return nullptr;
721 } else {
722- return new PreviewStack(this);
723+ return new PreviewModel(this);
724 }
725 }
726
727
728=== modified file 'tests/mocks/Unity/fake_scope.h'
729--- tests/mocks/Unity/fake_scope.h 2016-02-19 11:24:40 +0000
730+++ tests/mocks/Unity/fake_scope.h 2016-02-19 11:24:41 +0000
731@@ -20,7 +20,7 @@
732 #include <unity/shell/scopes/ScopeInterface.h>
733
734 #include "fake_categories.h"
735-#include "fake_previewstack.h"
736+#include "fake_previewmodel.h"
737
738 #include <QTimer>
739
740@@ -62,7 +62,7 @@
741 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
742
743 Q_INVOKABLE void activate(QVariant const& result, QString const& categoryId) override;
744- Q_INVOKABLE PreviewStack* preview(QVariant const& result, QString const& categoryId) override;
745+ Q_INVOKABLE PreviewModel* preview(QVariant const& result, QString const& categoryId) override;
746 Q_INVOKABLE void cancelActivation() override;
747 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
748
749
750=== modified file 'tests/mocks/Unity/fake_unity_plugin.cpp'
751--- tests/mocks/Unity/fake_unity_plugin.cpp 2014-08-26 12:27:36 +0000
752+++ tests/mocks/Unity/fake_unity_plugin.cpp 2016-02-19 11:24:41 +0000
753@@ -47,10 +47,9 @@
754 qmlRegisterUncreatableType<unity::shell::scopes::SettingsModelInterface>(uri, 0, 2, "SettingsModel", "Can't create SettingsModel object in QML.");
755 qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML.");
756 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML.");
757- qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance.");
758+ qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from Scope instance.");
759 qmlRegisterUncreatableType<ResultsModel>(uri, 0, 2, "ResultsModel", "Can't create ResultsModel object in QML.");
760 qmlRegisterType<ResultsModel>(uri, 0, 2, "FakeResultsModel");
761 qmlRegisterType<PreviewModel>(uri, 0, 2, "FakePreviewModel");
762 qmlRegisterUncreatableType<PreviewWidgetModel>(uri, 0, 2, "PreviewWidgetModel", "Can't create new PreviewWidgetModel in QML. Get them from PreviewModel instance.");
763- qmlRegisterUncreatableType<PreviewStack>(uri, 0, 2, "PreviewStack", "Can't create new PreviewStack in QML. Get them from Scope instance.");
764 }
765
766=== modified file 'tests/qmltests/CMakeLists.txt'
767--- tests/qmltests/CMakeLists.txt 2016-01-29 11:52:14 +0000
768+++ tests/qmltests/CMakeLists.txt 2016-02-19 11:24:41 +0000
769@@ -29,7 +29,7 @@
770 add_unity8_qmltest(Dash CardTool)
771 add_unity8_qmltest(Dash GenericScopeView)
772 add_unity8_qmltest(Dash DashPageHeader)
773-add_unity8_qmltest(Dash PreviewListView)
774+add_unity8_qmltest(Dash PreviewView)
775 add_unity8_qmltest(Dash/Previews Preview)
776 add_unity8_qmltest(Dash/Previews PreviewActions)
777 add_unity8_qmltest(Dash/Previews PreviewAudioPlayback)
778
779=== renamed file 'tests/qmltests/Dash/tst_PreviewListView.qml' => 'tests/qmltests/Dash/tst_PreviewView.qml'
780--- tests/qmltests/Dash/tst_PreviewListView.qml 2015-08-24 07:45:32 +0000
781+++ tests/qmltests/Dash/tst_PreviewView.qml 2016-02-19 11:24:41 +0000
782@@ -36,8 +36,8 @@
783 id: mockResultsModel
784 }
785
786- PreviewListView {
787- id: listView
788+ PreviewView {
789+ id: view
790 anchors.fill: parent
791 scope: mockScope
792 scopeStyle: ScopeStyle {
793@@ -45,12 +45,23 @@
794 }
795 }
796
797+ Item {
798+ Repeater {
799+ id: repeater
800+ model: mockResultsModel
801+ Item {
802+ property var previewModel: mockScope.preview(model.result, model.categoryId);
803+ }
804+ }
805+ }
806+
807+
808 UT.UnityTestCase {
809 id: testCase
810- name: "PreviewListView"
811+ name: "PreviewView"
812 when: windowShown
813
814- property MouseArea mouseArea: findChild(listView, "processingMouseArea")
815+ property MouseArea mouseArea: findChild(view, "processingMouseArea")
816
817 SignalSpy {
818 id: clickedSpy
819@@ -59,43 +70,41 @@
820 }
821
822 function init() {
823- listView.model = mockResultsModel;
824- listView.currentIndex = 1;
825- listView.open = true;
826+ view.open = true;
827+ view.previewModel = repeater.itemAt(0).previewModel
828 verify(testCase.mouseArea, "Can't find the processingMouseArea object.");
829 }
830
831 function cleanup() {
832- listView.open = false;
833- listView.model = null;
834+ view.open = false;
835 clickedSpy.clear();
836 }
837
838 function test_notProcessing() {
839 expectFail("", "processingMouseArea should not receive the click.");
840- mouseClick(listView);
841+ mouseClick(view);
842 clickedSpy.wait();
843 }
844
845 function test_processing() {
846- verify(listView.currentItem, "currentItem is not ready yet");
847- listView.currentItem.previewModel.setLoaded(false);
848-
849- tryCompare(listView, "processing", true);
850-
851- mouseClick(listView);
852+ verify(view.currentItem, "currentItem is not ready yet");
853+ view.currentItem.previewModel.setLoaded(false);
854+
855+ tryCompare(view, "processing", true);
856+
857+ mouseClick(view);
858 clickedSpy.wait();
859 }
860
861 function test_title() {
862- var header = findChild(listView, "innerPageHeader");
863+ var header = findChild(view, "innerPageHeader");
864 verify(header, "Could not find the preview header");
865
866 compare(header.config.title, "Mock Scope");
867 }
868
869 function test_header_style() {
870- var header = findChild(listView, "pageHeader");
871+ var header = findChild(view, "pageHeader");
872 verify(header, "Could not find the header");
873
874 var innerHeader = findChild(header, "innerPageHeader");

Subscribers

People subscribed via source and target branches