Merge lp:~cimi/unity8/single-preview into lp:unity8

Proposed by Andrea Cimitan
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 2153
Merged at revision: 2210
Proposed branch: lp:~cimi/unity8/single-preview
Merge into: lp:unity8
Prerequisite: lp:~aacid/unity8/activtion-progress
Diff against target: 917 lines (+93/-360)
19 files modified
debian/control (+1/-1)
qml/Dash/GenericScopeView.qml (+13/-41)
qml/Dash/PreviewView.qml (+15/-79)
qml/Dash/Previews/Preview.qml (+0/-4)
qml/Dash/Previews/PreviewExpandable.qml (+0/-1)
qml/Dash/Previews/PreviewRatingDisplay.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 (+0/-2)
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_GenericScopeView.qml (+0/-28)
tests/qmltests/Dash/tst_PreviewView.qml (+25/-18)
To merge this branch: bzr merge lp:~cimi/unity8/single-preview
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity8 CI Bot continuous-integration Needs Fixing
Review via email: mp+286646@code.launchpad.net

Commit message

Updated the Preview view to use a single PreviewModel instead old PreviewStack, using a Loader instead ListView

Description of the change

Make the previews not scrollable, use new model from scopes

 * Are there any related MPs required for this MP to build/function as expected? Please list.
yes,
lp:~stolowski/unity-api/single-preview
lp:~stolowski/unity-scopes-shell/single-preview
 * 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 :
review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/single-preview updated
2147. By Andrea Cimitan

merged

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/single-preview updated
2148. By Andrea Cimitan

Bumping down

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
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
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/single-preview updated
2149. By Andrea Cimitan

Some updates to files

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 :
review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/single-preview updated
2150. By Andrea Cimitan

Fix Review widget

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
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
Albert Astals Cid (aacid) wrote :

Needs a new/fixed commit message.

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote :

You need to update the branches you depend on.

review: Needs Fixing
lp:~cimi/unity8/single-preview updated
2151. By Andrea Cimitan

Fixed mock

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~cimi/unity8/single-preview updated
2152. By Andrea Cimitan

Fix GenericScopeView test

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
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
Albert Astals Cid (aacid) wrote :

Looks good.

I'd prefer if you could remove previewLoader since it doesn't seem it adds anything of value (correct me if i'm wrong)

review: Needs Fixing
lp:~cimi/unity8/single-preview updated
2153. By Andrea Cimitan

removed loader

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
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
Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass? If not, please explain why.
No because needs other branches, passed locally.

 * Did you make sure that the branch does not contain spurious tags?
Yes

review: Approve

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

Subscribers

People subscribed via source and target branches