Merge lp:~unity-team/unity8/scopes-v4 into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michał Sawicz
Approved revision: 1105
Merged at revision: 1128
Proposed branch: lp:~unity-team/unity8/scopes-v4
Merge into: lp:unity8
Prerequisite: lp:~aacid/unity8/unstable_departments_test
Diff against target: 1551 lines (+431/-353)
18 files modified
debian/control (+2/-2)
qml/Dash/Dash.qml (+9/-11)
qml/Dash/DashContent.qml (+3/-5)
qml/Dash/DashNavigation.qml (+44/-44)
qml/Dash/DashNavigationList.qml (+14/-14)
qml/Dash/GenericScopeView.qml (+4/-14)
qml/ScopeTool.qml (+1/-11)
tests/mocks/Unity/CMakeLists.txt (+3/-3)
tests/mocks/Unity/Unity.qmltypes (+87/-35)
tests/mocks/Unity/fake_navigation.cpp (+36/-44)
tests/mocks/Unity/fake_navigation.h (+13/-13)
tests/mocks/Unity/fake_scope.cpp (+73/-25)
tests/mocks/Unity/fake_scope.h (+16/-8)
tests/mocks/Unity/fake_scopes.cpp (+10/-2)
tests/mocks/Unity/fake_scopes.h (+1/-0)
tests/mocks/Unity/fake_unity_plugin.cpp (+2/-2)
tests/qmltests/Dash/tst_Dash.qml (+5/-9)
tests/qmltests/Dash/tst_DashContent.qml (+108/-111)
To merge this branch: bzr merge lp:~unity-team/unity8/scopes-v4
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Michal Hruby (community) Approve
Michał Sawicz Approve
Albert Astals Cid Pending
Review via email: mp+229758@code.launchpad.net

This proposal supersedes a proposal from 2014-08-01.

Commit message

Work with the scopes-v4 branch + departments->navigation renaming

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
https://code.launchpad.net/~unity-team/unity-api/scopes-v4/+merge/228346

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

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

 * 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?
N/A

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) : Posted in a previous version of this proposal
review: Abstain
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 : 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 : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

testDash is failing

review: Needs Fixing
lp:~unity-team/unity8/scopes-v4 updated
1102. By Albert Astals Cid

Fix merge/tests

Revision history for this message
Michal Hruby (mhr3) wrote :

Missing bump to dep on scopes-impl-4

review: Needs Fixing
lp:~unity-team/unity8/scopes-v4 updated
1103. By Albert Astals Cid

more renaming

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

> Missing bump to dep on scopes-impl-4

Disagree, that is just for https://code.launchpad.net/~aacid/unity8/alt_nav_support not for this one.

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

> testDash is failing

Should be fixed now

lp:~unity-team/unity8/scopes-v4 updated
1104. By Albert Astals Cid

New need implementation

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

> > Missing bump to dep on scopes-impl-4
>
> Disagree, that is just for
> https://code.launchpad.net/~aacid/unity8/alt_nav_support not for this one.

Ok, you're right, since there are renames we need this. Added.

lp:~unity-team/unity8/scopes-v4 updated
1105. By Albert Astals Cid

More updates

Revision history for this message
Michał Sawicz (saviq) 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.
Won't, need v4, but passes locally.

review: Approve
Revision history for this message
Michal Hruby (mhr3) wrote :

Looks good to me now.

review: Approve
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)

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 2014-07-31 16:48:11 +0000
3+++ debian/control 2014-08-06 11:31:11 +0000
4@@ -24,7 +24,7 @@
5 libpulse-dev,
6 libqmenumodel-dev (>= 0.2.8),
7 libqt5xmlpatterns5-dev,
8- libunity-api-dev (>= 7.87),
9+ libunity-api-dev (>= 7.88),
10 libusermetricsoutput1-dev,
11 libxcb1-dev,
12 pkg-config,
13@@ -112,7 +112,7 @@
14 unity-application-impl-2,
15 unity-notifications-impl-3,
16 unity-plugin-scopes | unity-scopes-impl,
17- unity-scopes-impl-2,
18+ unity-scopes-impl-4,
19 unity8-fake-env | unity-application-impl,
20 ${misc:Depends},
21 Breaks: unity8 (<< 7.86),
22
23=== modified file 'qml/Dash/Dash.qml'
24--- qml/Dash/Dash.qml 2014-07-29 11:35:10 +0000
25+++ qml/Dash/Dash.qml 2014-08-06 11:31:11 +0000
26@@ -38,7 +38,13 @@
27 }
28
29 function setCurrentScope(scopeId, animate, reset) {
30- var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId)
31+ var scopeIndex = -1;
32+ for (var i = 0; i < scopes.count; ++i) {
33+ if (scopes.getScope(i).id == scopeId) {
34+ scopeIndex = i;
35+ break;
36+ }
37+ }
38
39 if (scopeIndex == -1) {
40 console.warn("No match for scope with id: %1".arg(scopeId))
41@@ -63,15 +69,8 @@
42 }
43 }
44
45- SortFilterProxyModel {
46- id: filteredScopes
47- model: Scopes {
48- id: scopes
49- }
50- dynamicSortFilter: true
51-
52- filterRole: Scopes.RoleVisible
53- filterRegExp: RegExp("^true$")
54+ Scopes {
55+ id: scopes
56 }
57
58 DashContent {
59@@ -79,7 +78,6 @@
60 objectName: "dashContent"
61 width: parent.width
62 height: parent.height
63- model: filteredScopes
64 scopes: scopes
65 visible: x != -width
66 onGotoScope: {
67
68=== modified file 'qml/Dash/DashContent.qml'
69--- qml/Dash/DashContent.qml 2014-08-06 11:31:10 +0000
70+++ qml/Dash/DashContent.qml 2014-08-06 11:31:11 +0000
71@@ -23,8 +23,7 @@
72 Item {
73 id: dashContent
74
75- property var model: null
76- property var scopes: null
77+ property alias scopes: dashContentList.model
78 readonly property alias currentIndex: dashContentList.currentIndex
79
80 signal scopeLoaded(string scopeId)
81@@ -89,10 +88,9 @@
82 id: dashContentList
83 objectName: "dashContentList"
84
85- interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving && !currentItem.departmentsShown
86+ interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving && !currentItem.navigationShown
87
88 anchors.fill: parent
89- model: dashContent.model
90 orientation: ListView.Horizontal
91 boundsBehavior: Flickable.DragAndOvershootBounds
92 flickDeceleration: units.gu(625)
93@@ -130,7 +128,7 @@
94 objectName: scope.id + " loader"
95
96 readonly property bool moving: item ? item.moving : false
97- readonly property bool departmentsShown: item ? item.departmentsShown : false
98+ readonly property bool navigationShown: item ? item.navigationShown : false
99 readonly property var categoryView: item ? item.categoryView : null
100 readonly property var theScope: scope
101
102
103=== renamed file 'qml/Dash/DashDepartments.qml' => 'qml/Dash/DashNavigation.qml'
104--- qml/Dash/DashDepartments.qml 2014-08-06 11:31:10 +0000
105+++ qml/Dash/DashNavigation.qml 2014-08-06 11:31:11 +0000
106@@ -15,17 +15,17 @@
107 */
108
109 import QtQuick 2.2
110-import Ubuntu.Components 0.1
111+import Ubuntu.Components 1.1
112
113 AbstractButton {
114 id: root
115- objectName: "dashDepartments"
116+ objectName: "dashNavigation"
117
118 property var scope: null
119
120 property bool showList: false
121
122- readonly property var currentDepartment: scope && scope.hasDepartments ? scope.getDepartment(scope.currentDepartmentId) : null
123+ readonly property var currentNavigation: scope && scope.hasNavigation ? scope.getNavigation(scope.currentNavigationId) : null
124
125 property alias windowWidth: blackRect.width
126 property alias windowHeight: blackRect.height
127@@ -34,21 +34,21 @@
128 // Are we drilling down the tree or up?
129 property bool isGoingBack: false
130
131- visible: root.currentDepartment != null
132+ visible: root.currentNavigation != null
133
134 height: visible ? units.gu(5) : 0
135
136 onClicked: {
137- departmentListView.updateMaxHeight();
138+ navigationListView.updateMaxHeight();
139 root.showList = !root.showList;
140 }
141
142 Rectangle {
143 id: blackRect
144 color: "black"
145- opacity: departmentListView.currentItem && departmentListView.currentItem.visible ? 0.3 : 0
146+ opacity: navigationListView.currentItem && navigationListView.currentItem.visible ? 0.3 : 0
147 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
148- anchors.top: departmentListView.top
149+ anchors.top: navigationListView.top
150 anchors.right: parent.right
151 visible: opacity != 0
152 }
153@@ -79,7 +79,7 @@
154 anchors.fill: parent
155 anchors.margins: units.gu(2)
156 verticalAlignment: Text.AlignVCenter
157- text: root.currentDepartment ? root.currentDepartment.label : ""
158+ text: root.currentNavigation ? root.currentNavigation.label : ""
159 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
160 }
161
162@@ -93,18 +93,18 @@
163 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
164 }
165
166- // departmentListView is outside root
167+ // navigationListView is outside root
168 ListView {
169- id: departmentListView
170- objectName: "departmentListView"
171+ id: navigationListView
172+ objectName: "navigationListView"
173 orientation: ListView.Horizontal
174 interactive: false
175 clip: root.width != windowWidth
176 model: ListModel {
177- id: departmentModel
178+ id: navigationModel
179 // We have two roles
180- // departmentId: the department id of the department the list represents
181- // nullifyDepartment: overrides departmentId to be null
182+ // navigationId: the navigation id of the navigation the list represents
183+ // nullifyNavigation: overrides navigationId to be null
184 // This is used to "clear" the delegate when going "right" on the tree
185 }
186 anchors {
187@@ -126,84 +126,84 @@
188 }
189 }
190 highlightMoveDuration: UbuntuAnimation.FastDuration
191- delegate: DashDepartmentsList {
192- objectName: "department" + index
193+ delegate: DashNavigationList {
194+ objectName: "navigation" + index
195 visible: height != 0
196- width: departmentListView.width
197+ width: navigationListView.width
198 scopeStyle: root.scopeStyle
199 property real desiredHeight: {
200 if (root.showList) {
201- if (department && department.loaded && x == departmentListView.contentX)
202+ if (navigation && navigation.loaded && x == navigationListView.contentX)
203 {
204- departmentListView.updateMaxHeight();
205- return Math.min(implicitHeight, departmentListView.maxHeight);
206+ navigationListView.updateMaxHeight();
207+ return Math.min(implicitHeight, navigationListView.maxHeight);
208 } else {
209- return departmentListView.prevHeight;
210+ return navigationListView.prevHeight;
211 }
212 } else {
213 return 0;
214 }
215 }
216 height: desiredHeight
217- department: (nullifyDepartment || !scope) ? null : scope.getDepartment(departmentId)
218- currentDepartment: root.currentDepartment
219- onEnterDepartment: {
220- scope.loadDepartment(newDepartmentId);
221+ navigation: (nullifyNavigation || !scope) ? null : scope.getNavigation(navigationId)
222+ currentNavigation: root.currentNavigation
223+ onEnterNavigation: {
224+ scope.setNavigationState(newNavigationId, false);
225 // We only need to add a new item to the model
226 // if we have children, otherwise just load it
227 if (hasChildren) {
228 isGoingBack = false;
229- departmentModel.append({"departmentId": newDepartmentId, "nullifyDepartment": false});
230- departmentListView.currentIndex++;
231+ navigationModel.append({"navigationId": newNavigationId, "nullifyNavigation": false});
232+ navigationListView.currentIndex++;
233 } else {
234 showList = false;
235 }
236 }
237 onGoBackToParentClicked: {
238- scope.loadDepartment(department.parentDepartmentId);
239+ scope.setNavigationState(navigation.parentNavigationId, false);
240 isGoingBack = true;
241- departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", false);
242- departmentListView.currentIndex--;
243+ navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
244+ navigationListView.currentIndex--;
245 }
246- onAllDepartmentClicked: {
247+ onAllNavigationClicked: {
248 showList = false;
249- if (root.currentDepartment.parentDepartmentId == department.departmentId) {
250+ if (root.currentNavigation.parentNavigationId == navigation.navigationId) {
251 // For leaves we have to go to the parent too
252- scope.loadDepartment(root.currentDepartment.parentDepartmentId);
253+ scope.setNavigationState(root.currentNavigation.parentNavigationId, false);
254 }
255 }
256 }
257 onContentXChanged: {
258- if (contentX == width * departmentListView.currentIndex) {
259+ if (contentX == width * navigationListView.currentIndex) {
260 if (isGoingBack) {
261- departmentModel.remove(departmentListView.currentIndex + 1);
262+ navigationModel.remove(navigationListView.currentIndex + 1);
263 } else {
264- departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", true);
265+ navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", true);
266 }
267 }
268 }
269 }
270
271 InverseMouseArea {
272- anchors.fill: departmentListView
273+ anchors.fill: navigationListView
274 enabled: root.showList
275 onClicked: root.showList = false
276 }
277
278 onScopeChanged: {
279- departmentModel.clear();
280- if (scope && scope.hasDepartments) {
281- departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
282+ navigationModel.clear();
283+ if (scope && scope.hasNavigation) {
284+ navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
285 }
286 }
287
288 Connections {
289 target: scope
290- onHasDepartmentsChanged: {
291- if (scope.hasDepartments) {
292- departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
293+ onHasNavigationChanged: {
294+ if (scope.hasNavigation) {
295+ navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
296 } else {
297- departmentModel.clear();
298+ navigationModel.clear();
299 }
300 }
301 }
302
303=== renamed file 'qml/Dash/DashDepartmentsList.qml' => 'qml/Dash/DashNavigationList.qml'
304--- qml/Dash/DashDepartmentsList.qml 2014-08-06 11:31:10 +0000
305+++ qml/Dash/DashNavigationList.qml 2014-08-06 11:31:11 +0000
306@@ -15,16 +15,16 @@
307 */
308
309 import QtQuick 2.2
310-import Ubuntu.Components 0.1
311+import Ubuntu.Components 1.1
312
313 Item {
314 id: root
315- property var department: null
316- property var currentDepartment: null
317+ property var navigation: null
318+ property var currentNavigation: null
319 property var scopeStyle: null
320- signal enterDepartment(var newDepartmentId, bool hasChildren)
321+ signal enterNavigation(var newNavigationId, bool hasChildren)
322 signal goBackToParentClicked()
323- signal allDepartmentClicked()
324+ signal allNavigationClicked()
325
326 readonly property int itemHeight: units.gu(5)
327 readonly property color foregroundColor: root.scopeStyle ? root.scopeStyle.foreground : "grey"
328@@ -38,7 +38,7 @@
329 ActivityIndicator {
330 id: loadingIndicator
331 anchors.centerIn: parent
332- running: !(department && department.loaded)
333+ running: !(navigation && navigation.loaded)
334 }
335 clip: true
336
337@@ -69,7 +69,7 @@
338 id: backButton
339 objectName: "backButton"
340 width: parent.width
341- visible: department && !department.isRoot || false
342+ visible: navigation && !navigation.isRoot || false
343 height: itemHeight
344
345 onClicked: root.goBackToParentClicked();
346@@ -93,7 +93,7 @@
347 left: backImage.right
348 leftMargin: units.gu(0.5)
349 }
350- text: department ? department.parentLabel : ""
351+ text: navigation ? navigation.parentLabel : ""
352 color: root.foregroundColor
353 }
354
355@@ -115,7 +115,7 @@
356 id: allButton
357 objectName: "allButton"
358 width: parent.width
359- visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) || false
360+ visible: navigation && (!navigation.isRoot || (root.currentNavigation && !root.currentNavigation.isRoot && root.currentNavigation.parentNavigationId == navigation.navigationId)) || false
361 height: itemHeight
362
363 Label {
364@@ -124,7 +124,7 @@
365 left: parent.left
366 leftMargin: units.gu(2)
367 }
368- text: department ? (department.allLabel != "" ? department.allLabel : department.label) : ""
369+ text: navigation ? (navigation.allLabel != "" ? navigation.allLabel : navigation.label) : ""
370 font.bold: true
371 color: root.foregroundColor
372 }
373@@ -142,18 +142,18 @@
374 height: units.dp(1)
375 }
376
377- onClicked: root.allDepartmentClicked();
378+ onClicked: root.allNavigationClicked();
379 }
380
381 Repeater {
382- model: department && department.loaded ? department : null
383+ model: navigation && navigation.loaded ? navigation : null
384 clip: true
385 delegate: AbstractButton {
386 objectName: root.objectName + "child" + index
387 height: root.itemHeight
388 width: root.width
389
390- onClicked: root.enterDepartment(departmentId, hasChildren)
391+ onClicked: root.enterNavigation(navigationId, hasChildren)
392
393 Label {
394 anchors {
395@@ -189,7 +189,7 @@
396 color: root.foregroundColor
397 opacity: 0.1
398 height: units.dp(1)
399- visible: index != department.count - 1
400+ visible: index != navigation.count - 1
401 }
402 }
403 }
404
405=== modified file 'qml/Dash/GenericScopeView.qml'
406--- qml/Dash/GenericScopeView.qml 2014-08-06 11:31:10 +0000
407+++ qml/Dash/GenericScopeView.qml 2014-08-06 11:31:11 +0000
408@@ -25,7 +25,7 @@
409 FocusScope {
410 id: scopeView
411
412- readonly property alias departmentsShown: dashDepartments.showList
413+ readonly property alias navigationShown: dashNavigation.showList
414 property var scope: null
415 property SortFilterProxyModel categories: categoryFilter
416 property bool isCurrent: false
417@@ -40,16 +40,6 @@
418
419 signal backClicked()
420
421- onScopeChanged: {
422- if (scope) {
423- scope.activateApplication.connect(activateApp);
424- }
425- }
426-
427- function activateApp(appId) {
428- Qt.openUrlExternally(appId);
429- }
430-
431 function positionAtBeginning() {
432 categoryView.positionAtBeginning()
433 }
434@@ -120,7 +110,7 @@
435 model: scopeView.categories
436 forceNoClip: previewListView.open
437 pixelAligned: true
438- interactive: !dashDepartments.showList
439+ interactive: !dashNavigation.showList
440
441 property string expandedCategoryId: ""
442
443@@ -392,8 +382,8 @@
444 searchInProgress: scopeView.scope ? scopeView.scope.searchInProgress : false
445 scopeStyle: scopeView.scopeStyle
446
447- bottomItem: DashDepartments {
448- id: dashDepartments
449+ bottomItem: DashNavigation {
450+ id: dashNavigation
451 scope: scopeView.scope
452 width: parent.width <= units.gu(60) ? parent.width : units.gu(40)
453 anchors.right: parent.right
454
455=== modified file 'qml/ScopeTool.qml'
456--- qml/ScopeTool.qml 2014-07-03 09:08:22 +0000
457+++ qml/ScopeTool.qml 2014-08-06 11:31:11 +0000
458@@ -45,16 +45,6 @@
459 signal searchClicked
460 }
461
462- SortFilterProxyModel {
463- id: filteredScopes
464- model: Scopes {
465- id: scopes
466- }
467- dynamicSortFilter: true
468-
469- filterRole: Scopes.RoleVisible
470- filterRegExp: RegExp("^true$")
471- }
472
473 Rectangle {
474 anchors.fill: dashContent
475@@ -72,8 +62,8 @@
476 DashContent {
477 id: dashContent
478
479- model: filteredScopes
480 property var scope: scopes.getScope(currentIndex)
481+ scopes: Scopes { }
482
483 anchors {
484 top: parent.top
485
486=== modified file 'tests/mocks/Unity/CMakeLists.txt'
487--- tests/mocks/Unity/CMakeLists.txt 2014-08-05 12:06:16 +0000
488+++ tests/mocks/Unity/CMakeLists.txt 2014-08-06 11:31:11 +0000
489@@ -7,7 +7,7 @@
490 pkg_search_module(DEE dee-1.0 REQUIRED)
491 pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
492 pkg_search_module(DEEQT libdee-qt5 REQUIRED)
493-pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=3)
494+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=4)
495
496 include_directories(
497 ${CMAKE_CURRENT_BINARY_DIR}
498@@ -23,14 +23,14 @@
499 fake_scope.cpp
500 fake_scopes.cpp
501 fake_categories.cpp
502- fake_department.cpp
503+ fake_navigation.cpp
504 fake_resultsmodel.cpp
505 fake_previewmodel.cpp
506 fake_previewstack.cpp
507 fake_previewwidgetmodel.cpp
508 fake_unity_plugin.cpp
509 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/CategoriesInterface.h
510- ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/DepartmentInterface.h
511+ ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/NavigationInterface.h
512 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewModelInterface.h
513 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewStackInterface.h
514 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewWidgetModelInterface.h
515
516=== modified file 'tests/mocks/Unity/Unity.qmltypes'
517--- tests/mocks/Unity/Unity.qmltypes 2014-07-10 10:59:08 +0000
518+++ tests/mocks/Unity/Unity.qmltypes 2014-08-06 11:31:11 +0000
519@@ -24,6 +24,12 @@
520 Parameter { name: "categoryId"; type: "string" }
521 Parameter { name: "json"; type: "string" }
522 }
523+ Method {
524+ name: "data"
525+ type: "QVariant"
526+ Parameter { name: "row"; type: "int" }
527+ Parameter { name: "role"; type: "int" }
528+ }
529 }
530 Component {
531 name: "PreviewModel"
532@@ -62,6 +68,10 @@
533 prototype: "unity::shell::scopes::ScopeInterface"
534 exports: ["Unity/MockScope 0.2"]
535 exportMetaObjectRevisions: [0]
536+ Signal {
537+ name: "performQuery"
538+ Parameter { name: "query"; type: "string" }
539+ }
540 Method {
541 name: "setSearchInProgress"
542 Parameter { name: "inProg"; type: "bool" }
543@@ -81,18 +91,21 @@
544 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
545 }
546 Method {
547- name: "getDepartment"
548- type: "unity::shell::scopes::DepartmentInterface*"
549- Parameter { name: "id"; type: "string" }
550- }
551- Method {
552- name: "loadDepartment"
553- Parameter { name: "id"; type: "string" }
554- }
555- Method {
556- name: "performQuery"
557- Parameter { name: "query"; type: "string" }
558- }
559+ name: "getNavigation"
560+ type: "unity::shell::scopes::NavigationInterface*"
561+ Parameter { name: "navigationId"; type: "string" }
562+ }
563+ Method {
564+ name: "getAltNavigation"
565+ type: "unity::shell::scopes::NavigationInterface*"
566+ Parameter { name: "altNavigationId"; type: "string" }
567+ }
568+ Method {
569+ name: "setNavigationState"
570+ Parameter { name: "navigationId"; type: "string" }
571+ Parameter { name: "isAltNavigation"; type: "bool" }
572+ }
573+ Method { name: "refresh" }
574 }
575 Component {
576 name: "Scopes"
577@@ -137,6 +150,7 @@
578 "RoleRawRendererTemplate": 3,
579 "RoleRenderer": 4,
580 "RoleComponents": 5,
581+ "RoleHeaderLink": 6,
582 "RoleResults": 7,
583 "RoleCount": 8
584 }
585@@ -157,27 +171,28 @@
586 }
587 }
588 Component {
589- name: "unity::shell::scopes::DepartmentInterface"
590+ name: "unity::shell::scopes::NavigationInterface"
591 prototype: "QAbstractListModel"
592- exports: ["Unity/Department 0.2"]
593+ exports: ["Unity/Navigation 0.2"]
594 isCreatable: false
595 exportMetaObjectRevisions: [0]
596 Enum {
597 name: "Roles"
598 values: {
599- "RoleDepartmentId": 0,
600+ "RoleNavigationId": 0,
601 "RoleLabel": 1,
602 "RoleHasChildren": 2,
603 "RoleIsActive": 3
604 }
605 }
606- Property { name: "departmentId"; type: "string"; isReadonly: true }
607+ Property { name: "navigationId"; type: "string"; isReadonly: true }
608 Property { name: "label"; type: "string"; isReadonly: true }
609 Property { name: "allLabel"; type: "string"; isReadonly: true }
610- Property { name: "parentDepartmentId"; type: "string"; isReadonly: true }
611+ Property { name: "parentNavigationId"; type: "string"; isReadonly: true }
612 Property { name: "parentLabel"; type: "string"; isReadonly: true }
613 Property { name: "loaded"; type: "bool"; isReadonly: true }
614 Property { name: "isRoot"; type: "bool"; isReadonly: true }
615+ Property { name: "hidden"; type: "bool"; isReadonly: true }
616 Property { name: "count"; type: "int"; isReadonly: true }
617 }
618 Component {
619@@ -247,7 +262,8 @@
620 "RoleEmblem": 8,
621 "RoleSummary": 9,
622 "RoleAttributes": 10,
623- "RoleBackground": 11
624+ "RoleBackground": 11,
625+ "RoleOverlayColor": 12
626 }
627 }
628 Property { name: "categoryId"; type: "string" }
629@@ -259,13 +275,22 @@
630 exports: ["Unity/Scope 0.2"]
631 isCreatable: false
632 exportMetaObjectRevisions: [0]
633+ Enum {
634+ name: "Status"
635+ values: {
636+ "Okay": 0,
637+ "NoInternet": 1,
638+ "NoLocationData": 2,
639+ "Unknown": 3
640+ }
641+ }
642 Property { name: "id"; type: "string"; isReadonly: true }
643 Property { name: "name"; type: "string"; isReadonly: true }
644 Property { name: "iconHint"; type: "string"; isReadonly: true }
645 Property { name: "description"; type: "string"; isReadonly: true }
646 Property { name: "searchHint"; type: "string"; isReadonly: true }
647 Property { name: "searchInProgress"; type: "bool"; isReadonly: true }
648- Property { name: "visible"; type: "bool"; isReadonly: true }
649+ Property { name: "favorite"; type: "bool" }
650 Property { name: "shortcut"; type: "string"; isReadonly: true }
651 Property {
652 name: "categories"
653@@ -273,13 +298,27 @@
654 isReadonly: true
655 isPointer: true
656 }
657+ Property {
658+ name: "settings"
659+ type: "unity::shell::scopes::SettingsModelInterface"
660+ isReadonly: true
661+ isPointer: true
662+ }
663 Property { name: "searchQuery"; type: "string" }
664 Property { name: "noResultsHint"; type: "string" }
665 Property { name: "formFactor"; type: "string" }
666 Property { name: "isActive"; type: "bool" }
667- Property { name: "currentDepartmentId"; type: "string"; isReadonly: true }
668- Property { name: "hasDepartments"; type: "bool"; isReadonly: true }
669+ Property { name: "currentNavigationId"; type: "string"; isReadonly: true }
670+ Property { name: "hasNavigation"; type: "bool"; isReadonly: true }
671+ Property { name: "currentAltNavigationId"; type: "string"; isReadonly: true }
672+ Property { name: "hasAltNavigation"; type: "bool"; isReadonly: true }
673 Property { name: "customizations"; type: "QVariantMap"; isReadonly: true }
674+ Property {
675+ name: "status"
676+ type: "unity::shell::scopes::ScopeInterface::Status"
677+ isReadonly: true
678+ }
679+ Signal { name: "detailsChanged" }
680 Signal { name: "showDash" }
681 Signal { name: "hideDash" }
682 Signal {
683@@ -298,10 +337,6 @@
684 name: "openScope"
685 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
686 }
687- Signal {
688- name: "activateApplication"
689- Parameter { name: "desktop"; type: "string" }
690- }
691 Method {
692 name: "activate"
693 Parameter { name: "result"; type: "QVariant" }
694@@ -317,14 +352,25 @@
695 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
696 }
697 Method {
698- name: "getDepartment"
699- type: "unity::shell::scopes::DepartmentInterface*"
700- Parameter { name: "departmentId"; type: "string" }
701- }
702- Method {
703- name: "loadDepartment"
704- Parameter { name: "departmentId"; type: "string" }
705- }
706+ name: "getNavigation"
707+ type: "unity::shell::scopes::NavigationInterface*"
708+ Parameter { name: "navigationId"; type: "string" }
709+ }
710+ Method {
711+ name: "getAltNavigation"
712+ type: "unity::shell::scopes::NavigationInterface*"
713+ Parameter { name: "altNavigationId"; type: "string" }
714+ }
715+ Method {
716+ name: "setNavigationState"
717+ Parameter { name: "navId"; type: "string" }
718+ Parameter { name: "altNavigation"; type: "bool" }
719+ }
720+ Method {
721+ name: "performQuery"
722+ Parameter { name: "cannedQuery"; type: "string" }
723+ }
724+ Method { name: "refresh" }
725 }
726 Component {
727 name: "unity::shell::scopes::ScopesInterface"
728@@ -334,11 +380,17 @@
729 values: {
730 "RoleScope": 0,
731 "RoleId": 1,
732- "RoleVisible": 2,
733- "RoleTitle": 3
734+ "RoleTitle": 2
735 }
736 }
737 Property { name: "loaded"; type: "bool"; isReadonly: true }
738+ Property { name: "count"; type: "int"; isReadonly: true }
739+ Property {
740+ name: "overviewScope"
741+ type: "unity::shell::scopes::ScopeInterface"
742+ isReadonly: true
743+ isPointer: true
744+ }
745 Method {
746 name: "getScope"
747 type: "unity::shell::scopes::ScopeInterface*"
748
749=== renamed file 'tests/mocks/Unity/fake_department.cpp' => 'tests/mocks/Unity/fake_navigation.cpp'
750--- tests/mocks/Unity/fake_department.cpp 2014-06-18 13:48:32 +0000
751+++ tests/mocks/Unity/fake_navigation.cpp 2014-08-06 11:31:11 +0000
752@@ -14,14 +14,15 @@
753 * along with this program. If not, see <http://www.gnu.org/licenses/>.
754 */
755
756-#include "fake_department.h"
757+#include "fake_navigation.h"
758
759 #include "fake_scope.h"
760
761+#include <QDebug>
762 #include <QTimer>
763
764-Department::Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)
765- : m_departmentId(departmentId)
766+Navigation::Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)
767+ : m_navigationId(navigationId)
768 , m_label(label)
769 , m_allLabel(allLabel)
770 , m_parentId(parentId)
771@@ -30,96 +31,87 @@
772 , m_scope(scope)
773 {
774 QTimer::singleShot(1500, this, SLOT(slotLoaded()));
775- connect(scope, SIGNAL(currentDepartmentIdChanged()), this, SLOT(slotCurrentDepartmentChanged()));
776+ connect(scope, SIGNAL(currentNavigationIdChanged()), this, SLOT(slotCurrentNavigationChanged()));
777 }
778
779-QString Department::departmentId() const
780+QString Navigation::navigationId() const
781 {
782- return m_departmentId;
783+ return m_navigationId;
784 }
785
786-QString Department::label() const
787+QString Navigation::label() const
788 {
789 return m_label;
790 }
791
792-QString Department::allLabel() const
793+QString Navigation::allLabel() const
794 {
795 return m_allLabel;
796 }
797
798-QString Department::parentDepartmentId() const
799+QString Navigation::parentNavigationId() const
800 {
801 return m_parentId;
802 }
803
804-QString Department::parentLabel() const
805+QString Navigation::parentLabel() const
806 {
807 return m_parentLabel;
808 }
809
810-void Department::slotLoaded()
811+void Navigation::slotLoaded()
812 {
813 m_loaded = true;
814 Q_EMIT loadedChanged();
815 }
816
817-bool Department::loaded() const
818+bool Navigation::loaded() const
819 {
820 return m_loaded;
821 }
822
823-int Department::count() const
824+int Navigation::count() const
825 {
826 return rowCount();
827 }
828
829-bool Department::isRoot() const
830-{
831- return m_departmentId == "root";
832-}
833-
834-int Department::rowCount(const QModelIndex & /*parent*/) const
835-{
836- if (!m_loaded || m_departmentId.startsWith("child") || m_departmentId == "middle3")
837+bool Navigation::isRoot() const
838+{
839+ return m_navigationId == "root" || m_navigationId == "altroot";
840+}
841+
842+bool Navigation::hidden() const
843+{
844+ return m_navigationId == "altroot";
845+}
846+
847+int Navigation::rowCount(const QModelIndex & /*parent*/) const
848+{
849+ if (!m_loaded || m_navigationId.startsWith("child") || m_navigationId == "middle3")
850 return 0;
851 else
852 return 8;
853 }
854
855-QHash<int, QByteArray> Department::roleNames() const
856-{
857- QHash<int, QByteArray> res;
858- res[RoleDepartmentId] = "departmentId";
859- res[RoleLabel] = "label";
860- res[RoleHasChildren] = "hasChildren";
861- res[RoleIsActive] = "isActive";
862- return res;
863-}
864-
865-QVariant Department::data(const QModelIndex &index, int role) const
866+QVariant Navigation::data(const QModelIndex &index, int role) const
867 {
868 switch (role) {
869- case RoleDepartmentId:
870- if (m_departmentId == "root")
871+ case RoleNavigationId:
872+ if (m_navigationId == "root")
873 return QString("middle%1").arg(index.row());
874- else if (m_departmentId.startsWith("middle"))
875- return QString("child%1%2").arg(m_departmentId).arg(index.row());
876- break;
877+ else if (m_navigationId.startsWith("middle"))
878+ return QString("child%1%2").arg(m_navigationId).arg(index.row());
879 case RoleLabel:
880- return QString("%1Child%2").arg(m_departmentId).arg(index.row());
881- break;
882+ return QString("%1Child%2").arg(m_navigationId).arg(index.row());
883 case RoleHasChildren:
884- return m_departmentId == "root" && index.row() != 3;
885- break;
886+ return m_navigationId == "root" && index.row() != 3;
887 case RoleIsActive:
888- return m_scope->currentDepartmentId() == data(index, RoleDepartmentId);
889- break;
890+ return m_scope->currentNavigationId() == data(index, RoleNavigationId);
891 }
892 return QVariant();
893 }
894
895-void Department::slotCurrentDepartmentChanged()
896+void Navigation::slotCurrentNavigationChanged()
897 {
898 // This is wasteful, should only emit it if really something changed in this
899 // deparment, but this is a mock, so no need to optimize
900
901=== renamed file 'tests/mocks/Unity/fake_department.h' => 'tests/mocks/Unity/fake_navigation.h'
902--- tests/mocks/Unity/fake_department.h 2014-05-29 10:25:21 +0000
903+++ tests/mocks/Unity/fake_navigation.h 2014-08-06 11:31:11 +0000
904@@ -14,48 +14,48 @@
905 * along with this program. If not, see <http://www.gnu.org/licenses/>.
906 */
907
908-#ifndef FAKE_DEPARTMENT_H
909-#define FAKE_DEPARTMENT_H
910+#ifndef FAKE_NAVIGATION_H
911+#define FAKE_NAVIGATION_H
912
913-#include <unity/shell/scopes/DepartmentInterface.h>
914+#include <unity/shell/scopes/NavigationInterface.h>
915
916 class Scope;
917
918-class Department : public unity::shell::scopes::DepartmentInterface
919+class Navigation : public unity::shell::scopes::NavigationInterface
920 {
921 Q_OBJECT
922
923 public:
924- Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);
925+ Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);
926
927- QString departmentId() const override;
928+ QString navigationId() const override;
929 QString label() const override;
930 QString allLabel() const override;
931- QString parentDepartmentId() const override;
932+ QString parentNavigationId() const override;
933 QString parentLabel() const override;
934 bool loaded() const override;
935+ bool isRoot() const override;
936+ bool hidden() const override;
937 int count() const override;
938- bool isRoot() const override;
939
940 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
941- QHash<int, QByteArray> roleNames() const;
942 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
943
944 public Q_SLOTS:
945- void slotCurrentDepartmentChanged();
946+ void slotCurrentNavigationChanged();
947
948 private Q_SLOTS:
949 void slotLoaded();
950
951 private:
952- QString m_departmentId;
953+ QString m_navigationId;
954 QString m_label;
955 QString m_allLabel;
956 QString m_parentId;
957 QString m_parentLabel;
958 bool m_loaded;
959- QString m_currentDepartment;
960+ QString m_currentNavigation;
961 Scope *m_scope;
962 };
963
964-#endif // FAKE_DEPARTMENT_H
965+#endif // FAKE_NAVIGATION_H
966
967=== modified file 'tests/mocks/Unity/fake_scope.cpp'
968--- tests/mocks/Unity/fake_scope.cpp 2014-07-24 20:40:57 +0000
969+++ tests/mocks/Unity/fake_scope.cpp 2014-08-06 11:31:11 +0000
970@@ -14,24 +14,26 @@
971 * along with this program. If not, see <http://www.gnu.org/licenses/>.
972 */
973
974+#include <QDebug>
975 #include <QUrl>
976
977 #include "fake_scope.h"
978-#include "fake_department.h"
979+#include "fake_navigation.h"
980 #include "fake_resultsmodel.h"
981
982 Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
983 {
984 }
985
986-Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent, int categories)
987+Scope::Scope(QString const& id, QString const& name, bool favorite, QObject* parent, int categories)
988 : unity::shell::scopes::ScopeInterface(parent)
989 , m_id(id)
990 , m_name(name)
991- , m_visible(visible)
992 , m_searching(false)
993+ , m_favorite(favorite)
994 , m_isActive(false)
995- , m_currentDeparment("root")
996+ , m_currentNavigationId("root")
997+ , m_currentAltNavigationId("altroot")
998 , m_previewRendererName("preview-generic")
999 , m_categories(new Categories(categories, this))
1000 {
1001@@ -77,6 +79,11 @@
1002 return m_searching;
1003 }
1004
1005+bool Scope::favorite() const
1006+{
1007+ return m_favorite;
1008+}
1009+
1010 unity::shell::scopes::CategoriesInterface* Scope::categories() const
1011 {
1012 return m_categories;
1013@@ -97,11 +104,6 @@
1014 return m_formFactor;
1015 }
1016
1017-bool Scope::visible() const
1018-{
1019- return m_visible;
1020-}
1021-
1022 bool Scope::isActive() const
1023 {
1024 return m_isActive;
1025@@ -131,6 +133,13 @@
1026 }
1027 }
1028
1029+void Scope::setFavorite(const bool favorite)
1030+{
1031+ if (favorite != m_favorite) {
1032+ m_favorite = favorite;
1033+ Q_EMIT favoriteChanged();
1034+ }
1035+}
1036 void Scope::setSearchInProgress(const bool inProg)
1037 {
1038 if (inProg != m_searching) {
1039@@ -170,14 +179,29 @@
1040 qFatal("Scope::closeScope is not implemented");
1041 }
1042
1043-QString Scope::currentDepartmentId() const
1044-{
1045- return m_currentDeparment;
1046-}
1047-
1048-bool Scope::hasDepartments() const
1049-{
1050- return true;
1051+QString Scope::currentNavigationId() const
1052+{
1053+ return m_currentNavigationId;
1054+}
1055+
1056+bool Scope::hasNavigation() const
1057+{
1058+ return true;
1059+}
1060+
1061+QString Scope::currentAltNavigationId() const
1062+{
1063+ return m_currentAltNavigationId;
1064+}
1065+
1066+bool Scope::hasAltNavigation() const
1067+{
1068+ return true;
1069+}
1070+
1071+Scope::Status Scope::status() const
1072+{
1073+ return Status::Okay;
1074 }
1075
1076 QVariantMap Scope::customizations() const
1077@@ -196,7 +220,12 @@
1078 return m;
1079 }
1080
1081-unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
1082+void Scope::refresh()
1083+{
1084+ qDebug() << "Scope::refresh is currently not implmented in the fake scopes plugin";
1085+}
1086+
1087+unity::shell::scopes::NavigationInterface* Scope::getNavigation(const QString& id)
1088 {
1089 if (id.isEmpty())
1090 return nullptr;
1091@@ -210,11 +239,30 @@
1092 parentId = id.mid(5, 7);
1093 parentLabel = parentId;
1094 }
1095- return new Department(id, id, "all"+id, parentId, parentLabel, this);
1096-}
1097-
1098-void Scope::loadDepartment(const QString& id)
1099-{
1100- m_currentDeparment = id;
1101- Q_EMIT currentDepartmentIdChanged();
1102+ return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
1103+}
1104+
1105+unity::shell::scopes::NavigationInterface* Scope::getAltNavigation(QString const& id)
1106+{
1107+ if (id.isEmpty())
1108+ return nullptr;
1109+
1110+ QString parentId;
1111+ QString parentLabel;
1112+ if (id.startsWith("altmiddle")) {
1113+ parentId = "altroot";
1114+ parentLabel = "altroot";
1115+ }
1116+ return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
1117+}
1118+
1119+void Scope::setNavigationState(const QString &navigationId, bool isAltNavigation)
1120+{
1121+ if (isAltNavigation) {
1122+ m_currentAltNavigationId = navigationId;
1123+ Q_EMIT currentAltNavigationIdChanged();
1124+ } else {
1125+ m_currentNavigationId = navigationId;
1126+ Q_EMIT currentNavigationIdChanged();
1127+ }
1128 }
1129
1130=== modified file 'tests/mocks/Unity/fake_scope.h'
1131--- tests/mocks/Unity/fake_scope.h 2014-07-11 16:39:33 +0000
1132+++ tests/mocks/Unity/fake_scope.h 2014-08-06 11:31:11 +0000
1133@@ -30,7 +30,7 @@
1134
1135 public:
1136 Scope(QObject* parent = 0);
1137- Scope(QString const& id, QString const& name, bool visible, QObject* parent = 0, int categories = 20);
1138+ Scope(QString const& id, QString const& name, bool favorite, QObject* parent = 0, int categories = 20);
1139
1140 /* getters */
1141 QString id() const override;
1142@@ -38,9 +38,9 @@
1143 QString iconHint() const override;
1144 QString description() const override;
1145 QString searchHint() const override;
1146- bool visible() const override;
1147 QString shortcut() const override;
1148 bool searchInProgress() const override;
1149+ bool favorite() const override;
1150 unity::shell::scopes::CategoriesInterface* categories() const override;
1151 QString searchQuery() const override;
1152 QString noResultsHint() const override;
1153@@ -53,6 +53,7 @@
1154 void setNoResultsHint(const QString& hint) override;
1155 void setFormFactor(const QString& form_factor) override;
1156 void setActive(const bool) override;
1157+ void setFavorite(const bool) override;
1158 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
1159
1160 Q_INVOKABLE void activate(QVariant const& result) override;
1161@@ -60,14 +61,20 @@
1162 Q_INVOKABLE void cancelActivation() override;
1163 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
1164
1165- QString currentDepartmentId() const override;
1166- bool hasDepartments() const override;
1167- Q_INVOKABLE unity::shell::scopes::DepartmentInterface* getDepartment(const QString& id) override;
1168- Q_INVOKABLE void loadDepartment(const QString& id) override;
1169+ QString currentNavigationId() const override;
1170+ bool hasNavigation() const override;
1171+ QString currentAltNavigationId() const override;
1172+ bool hasAltNavigation() const override;
1173+ Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) override;
1174+ Q_INVOKABLE unity::shell::scopes::NavigationInterface* getAltNavigation(QString const& altNavigationId) override;
1175+ Q_INVOKABLE void setNavigationState(const QString &navigationId, bool isAltNavigation) override;
1176 Q_SIGNAL void performQuery(const QString& query) override;
1177
1178+ Status status() const override;
1179 QVariantMap customizations() const override;
1180
1181+ Q_INVOKABLE void refresh() override;
1182+
1183 protected:
1184
1185 QString m_id;
1186@@ -77,10 +84,11 @@
1187 QString m_searchQuery;
1188 QString m_noResultsHint;
1189 QString m_formFactor;
1190- bool m_visible;
1191 bool m_searching;
1192+ bool m_favorite;
1193 bool m_isActive;
1194- QString m_currentDeparment;
1195+ QString m_currentNavigationId;
1196+ QString m_currentAltNavigationId;
1197
1198 QString m_previewRendererName;
1199
1200
1201=== modified file 'tests/mocks/Unity/fake_scopes.cpp'
1202--- tests/mocks/Unity/fake_scopes.cpp 2014-07-25 13:25:45 +0000
1203+++ tests/mocks/Unity/fake_scopes.cpp 2014-08-06 11:31:11 +0000
1204@@ -32,6 +32,11 @@
1205 timer.setSingleShot(true);
1206 timer.setInterval(100);
1207 QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));
1208+
1209+ QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
1210+ QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
1211+ QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
1212+
1213 load();
1214 }
1215
1216@@ -92,8 +97,6 @@
1217 return QVariant::fromValue(scope);
1218 } else if (role == Scopes::RoleId) {
1219 return QVariant::fromValue(scope->id());
1220- } else if (role == Scopes::RoleVisible) {
1221- return QVariant::fromValue(scope->visible());
1222 } else if (role == Scopes::RoleTitle) {
1223 return QVariant::fromValue(scope->name());
1224 } else {
1225@@ -125,6 +128,11 @@
1226 return m_loaded;
1227 }
1228
1229+int Scopes::count() const
1230+{
1231+ return rowCount();
1232+}
1233+
1234 unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
1235 {
1236 return nullptr;
1237
1238=== modified file 'tests/mocks/Unity/fake_scopes.h'
1239--- tests/mocks/Unity/fake_scopes.h 2014-07-25 13:25:45 +0000
1240+++ tests/mocks/Unity/fake_scopes.h 2014-08-06 11:31:11 +0000
1241@@ -50,6 +50,7 @@
1242 QModelIndex parent ( const QModelIndex & index ) const;
1243
1244 bool loaded() const override;
1245+ int count() const override;
1246 unity::shell::scopes::ScopeInterface* overviewScope() const override;
1247
1248 private Q_SLOTS:
1249
1250=== modified file 'tests/mocks/Unity/fake_unity_plugin.cpp'
1251--- tests/mocks/Unity/fake_unity_plugin.cpp 2014-07-08 11:26:44 +0000
1252+++ tests/mocks/Unity/fake_unity_plugin.cpp 2014-08-06 11:31:11 +0000
1253@@ -22,7 +22,7 @@
1254 // local
1255 #include "fake_scopes.h"
1256 #include "fake_categories.h"
1257-#include "fake_department.h"
1258+#include "fake_navigation.h"
1259 #include "fake_previewmodel.h"
1260 #include "fake_previewwidgetmodel.h"
1261 #include "fake_resultsmodel.h"
1262@@ -43,7 +43,7 @@
1263 qmlRegisterType<Scopes>(uri, 0, 2, "Scopes");
1264 qmlRegisterType<Scope>(uri, 0, 2, "MockScope");
1265 qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML.");
1266- qmlRegisterUncreatableType<unity::shell::scopes::DepartmentInterface>(uri, 0, 2, "Department", "Can't create Department object in QML.");
1267+ qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML.");
1268 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML.");
1269 qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance.");
1270 qmlRegisterUncreatableType<ResultsModel>(uri, 0, 2, "ResultsModel", "Can't create ResultsModel object in QML.");
1271
1272=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
1273--- tests/qmltests/Dash/tst_Dash.qml 2014-07-29 11:35:10 +0000
1274+++ tests/qmltests/Dash/tst_Dash.qml 2014-08-06 11:31:11 +0000
1275@@ -64,10 +64,10 @@
1276
1277 function get_scope_data() {
1278 return [
1279- { tag: "MockScope1", visualIndex: 0, shouldBeVisible: true },
1280- { tag: "MockScope2", visualIndex: -1, shouldBeVisible: false },
1281- { tag: "clickscope", visualIndex: 1, shouldBeVisible: true },
1282- { tag: "MockScope5", visualIndex: 2, shouldBeVisible: true },
1283+ { tag: "MockScope1", visualIndex: 0 },
1284+ { tag: "MockScope2", visualIndex: 1 },
1285+ { tag: "clickscope", visualIndex: 2 },
1286+ { tag: "MockScope5", visualIndex: 3 },
1287 ]
1288 }
1289
1290@@ -76,10 +76,6 @@
1291 }
1292
1293 function test_show_scope_on_load(data) {
1294- if (data.shouldBeVisible == false) {
1295- console.log("Not testing " + data.tag + ": not visible");
1296- return;
1297- }
1298 var dashContentList = findChild(dash, "dashContentList");
1299
1300 dash.showScopeOnLoaded = data.tag
1301@@ -87,7 +83,7 @@
1302 tryCompare(dashContentList, "count", 0);
1303 scopes.load();
1304 tryCompare(scopes, "loaded", true);
1305- tryCompare(dashContentList, "count", 4);
1306+ tryCompare(dashContentList, "count", 5);
1307
1308 verify(dashContentList != undefined);
1309 tryCompare(dashContentList, "currentIndex", data.visualIndex);
1310
1311=== modified file 'tests/qmltests/Dash/tst_DashContent.qml'
1312--- tests/qmltests/Dash/tst_DashContent.qml 2014-08-06 11:31:10 +0000
1313+++ tests/qmltests/Dash/tst_DashContent.qml 2014-08-06 11:31:11 +0000
1314@@ -43,9 +43,6 @@
1315 id: dashContent
1316 anchors.fill: parent
1317
1318- model: SortFilterProxyModel {
1319- model: scopesModel
1320- }
1321 scopes : scopesModel
1322 }
1323
1324@@ -268,119 +265,119 @@
1325 verify(carouselLV.tileWidth / carouselLV.tileHeight == cardTool.components["art"]["aspect-ratio"]);
1326 }
1327
1328- function test_departments() {
1329+ function test_navigations() {
1330 var dashContentList = findChild(dashContent, "dashContentList");
1331- tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashDepartments") != null; }, true);
1332- var dashDepartments = findChild(dashContentList.currentItem, "dashDepartments");
1333- tryCompare(dashDepartments, "visible", true);
1334- compare(dashDepartments.showList, false);
1335- waitForRendering(dashDepartments);
1336- mouseClick(dashDepartments, 0, 0);
1337- compare(dashDepartments.showList, true);
1338-
1339- var departmentListView = findChild(dashDepartments, "departmentListView");
1340- compare(departmentListView.count, 1);
1341- tryCompare(departmentListView.currentItem.department, "loaded", true);
1342-
1343- waitForRendering(departmentListView);
1344- waitForRendering(departmentListView.currentItem);
1345-
1346- var allButton = findChild(dashDepartments, "allButton");
1347- compare(allButton.visible, false);
1348-
1349- var department = findChild(dashDepartments, "department0child3");
1350- mouseClick(department, 0, 0);
1351- compare(dashDepartments.showList, false);
1352- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle3");
1353- tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1354-
1355- mouseClick(dashDepartments, 0, 0);
1356- compare(dashDepartments.showList, true);
1357- waitForRendering(departmentListView);
1358- waitForRendering(departmentListView.currentItem);
1359- compare(allButton.visible, true);
1360-
1361- mouseClick(allButton, 0, 0);
1362- compare(dashDepartments.showList, false);
1363- tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
1364- tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1365-
1366- mouseClick(dashDepartments, 0, 0);
1367- compare(dashDepartments.showList, true);
1368- waitForRendering(departmentListView);
1369- waitForRendering(departmentListView.currentItem);
1370- compare(allButton.visible, false);
1371-
1372- department = findChild(dashDepartments, "department0child2");
1373- mouseClick(department, 0, 0);
1374- compare(dashDepartments.showList, true);
1375- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1376- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1377-
1378- var departmentList1 = findChild(dashDepartments, "department1");
1379- allButton = findChild(departmentList1, "allButton");
1380- var backButton = findChild(findChild(departmentList1, "department1"), "backButton");
1381- compare(allButton.visible, true);
1382- compare(backButton.visible, true);
1383-
1384- tryCompare(departmentListView, "contentX", departmentList1.x);
1385- waitForRendering(departmentListView);
1386- mouseClick(allButton, 0, 0);
1387- compare(dashDepartments.showList, false);
1388- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1389- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1390-
1391- mouseClick(dashDepartments, 0, 0);
1392- compare(dashDepartments.showList, true);
1393- waitForRendering(departmentListView);
1394- waitForRendering(departmentListView.currentItem);
1395- compare(allButton.visible, true);
1396- compare(backButton.visible, true);
1397-
1398- tryCompare(departmentList1.department, "loaded", true);
1399- department = findChild(dashDepartments, "department1child2");
1400- mouseClick(department, 0, 0);
1401- compare(dashDepartments.showList, false);
1402- tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle22");
1403- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1404-
1405- mouseClick(dashDepartments, 0, 0);
1406- compare(dashDepartments.showList, true);
1407- waitForRendering(departmentListView);
1408- waitForRendering(departmentListView.currentItem);
1409-
1410- tryCompare(departmentList1.department, "loaded", true);
1411- department = findChild(dashDepartments, "department1child3");
1412- mouseClick(department, 0, 0);
1413- compare(dashDepartments.showList, false);
1414- tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle23");
1415- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1416-
1417- mouseClick(dashDepartments, 0, 0);
1418- compare(dashDepartments.showList, true);
1419- waitForRendering(departmentListView);
1420- waitForRendering(departmentListView.currentItem);
1421+ tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
1422+ var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
1423+ tryCompare(dashNavigation, "visible", true);
1424+ compare(dashNavigation.showList, false);
1425+ waitForRendering(dashNavigation);
1426+ mouseClick(dashNavigation, 0, 0);
1427+ compare(dashNavigation.showList, true);
1428+
1429+ var navigationListView = findChild(dashNavigation, "navigationListView");
1430+ compare(navigationListView.count, 1);
1431+ tryCompare(navigationListView.currentItem.navigation, "loaded", true);
1432+
1433+ waitForRendering(navigationListView);
1434+ waitForRendering(navigationListView.currentItem);
1435+
1436+ var allButton = findChild(dashNavigation, "allButton");
1437+ compare(allButton.visible, false);
1438+
1439+ var navigation = findChild(dashNavigation, "navigation0child3");
1440+ mouseClick(navigation, 0, 0);
1441+ compare(dashNavigation.showList, false);
1442+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle3");
1443+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1444+
1445+ mouseClick(dashNavigation, 0, 0);
1446+ compare(dashNavigation.showList, true);
1447+ waitForRendering(navigationListView);
1448+ waitForRendering(navigationListView.currentItem);
1449+ compare(allButton.visible, true);
1450+
1451+ mouseClick(allButton, 0, 0);
1452+ compare(dashNavigation.showList, false);
1453+ tryCompare(dashNavigation.currentNavigation, "navigationId", "root");
1454+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1455+
1456+ mouseClick(dashNavigation, 0, 0);
1457+ compare(dashNavigation.showList, true);
1458+ waitForRendering(navigationListView);
1459+ waitForRendering(navigationListView.currentItem);
1460+ compare(allButton.visible, false);
1461+
1462+ navigation = findChild(dashNavigation, "navigation0child2");
1463+ mouseClick(navigation, 0, 0);
1464+ compare(dashNavigation.showList, true);
1465+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1466+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1467+
1468+ var navigationList1 = findChild(dashNavigation, "navigation1");
1469+ allButton = findChild(navigationList1, "allButton");
1470+ var backButton = findChild(findChild(navigationList1, "navigation1"), "backButton");
1471+ compare(allButton.visible, true);
1472+ compare(backButton.visible, true);
1473+
1474+ tryCompare(navigationListView, "contentX", navigationList1.x);
1475+ waitForRendering(navigationListView);
1476+ mouseClick(allButton, 0, 0);
1477+ compare(dashNavigation.showList, false);
1478+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1479+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1480+
1481+ mouseClick(dashNavigation, 0, 0);
1482+ compare(dashNavigation.showList, true);
1483+ waitForRendering(navigationListView);
1484+ waitForRendering(navigationListView.currentItem);
1485+ compare(allButton.visible, true);
1486+ compare(backButton.visible, true);
1487+
1488+ tryCompare(navigationList1.navigation, "loaded", true);
1489+ navigation = findChild(dashNavigation, "navigation1child2");
1490+ mouseClick(navigation, 0, 0);
1491+ compare(dashNavigation.showList, false);
1492+ tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle22");
1493+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1494+
1495+ mouseClick(dashNavigation, 0, 0);
1496+ compare(dashNavigation.showList, true);
1497+ waitForRendering(navigationListView);
1498+ waitForRendering(navigationListView.currentItem);
1499+
1500+ tryCompare(navigationList1.navigation, "loaded", true);
1501+ navigation = findChild(dashNavigation, "navigation1child3");
1502+ mouseClick(navigation, 0, 0);
1503+ compare(dashNavigation.showList, false);
1504+ tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle23");
1505+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1506+
1507+ mouseClick(dashNavigation, 0, 0);
1508+ compare(dashNavigation.showList, true);
1509+ waitForRendering(navigationListView);
1510+ waitForRendering(navigationListView.currentItem);
1511 mouseClick(backButton, 0, 0);
1512
1513- tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
1514- tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1515- compare(dashDepartments.showList, true);
1516- mouseClick(dashDepartments, 0, 0);
1517- compare(dashDepartments.showList, false);
1518+ tryCompare(dashNavigation.currentNavigation, "navigationId", "root");
1519+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1520+ compare(dashNavigation.showList, true);
1521+ mouseClick(dashNavigation, 0, 0);
1522+ compare(dashNavigation.showList, false);
1523
1524- mouseClick(dashDepartments, 0, 0);
1525- compare(dashDepartments.showList, true);
1526- tryCompare(departmentListView.currentItem.department, "loaded", true);
1527- department = findChild(dashDepartments, "department0child2");
1528- mouseClick(department, 0, 0);
1529- compare(dashDepartments.showList, true);
1530- departmentList1 = findChild(dashDepartments, "department1");
1531- compare(departmentList1.department.loaded, false);
1532- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1533- allButton = findChild(departmentList1, "allButton");
1534- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1535+ mouseClick(dashNavigation, 0, 0);
1536+ compare(dashNavigation.showList, true);
1537+ tryCompare(navigationListView.currentItem.navigation, "loaded", true);
1538+ navigation = findChild(dashNavigation, "navigation0child2");
1539+ mouseClick(navigation, 0, 0);
1540+ compare(dashNavigation.showList, true);
1541+ navigationList1 = findChild(dashNavigation, "navigation1");
1542+ compare(navigationList1.navigation.loaded, false);
1543+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1544+ allButton = findChild(navigationList1, "allButton");
1545+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1546 mouseClick(allButton, 0, 0);
1547- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1548+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1549 }
1550 }
1551 }

Subscribers

People subscribed via source and target branches