Merge lp:~saviq/unity8/dash-activity-indicator into lp:unity8

Proposed by Michał Sawicz
Status: Superseded
Proposed branch: lp:~saviq/unity8/dash-activity-indicator
Merge into: lp:unity8
Diff against target: 1995 lines (+588/-444)
25 files modified
debian/control (+2/-2)
plugins/Dash/ScopeStyle.qml (+11/-8)
qml/Components/PageHeader.qml (+1/-14)
qml/Dash/Dash.qml (+77/-12)
qml/Dash/DashContent.qml (+5/-4)
qml/Dash/DashNavigation.qml (+50/-43)
qml/Dash/DashNavigationList.qml (+14/-18)
qml/Dash/GenericScopeView.qml (+6/-12)
qml/Dash/PreviewListView.qml (+27/-31)
qml/ScopeTool.qml (+1/-11)
tests/autopilot/unity8/shell/emulators/dash.py (+1/-1)
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/plugins/Dash/tst_ScopeStyle.qml (+14/-7)
tests/qmltests/Components/tst_PageHeader.qml (+0/-23)
tests/qmltests/Dash/tst_Dash.qml (+28/-15)
tests/qmltests/Dash/tst_DashContent.qml (+109/-110)
tests/qmltests/Dash/tst_GenericScopeView.qml (+1/-1)
To merge this branch: bzr merge lp:~saviq/unity8/dash-activity-indicator
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Needs Fixing
Andrea Cimitan (community) Needs Fixing
Review via email: mp+228718@code.launchpad.net

This proposal has been superseded by a proposal from 2014-08-06.

Commit message

Refactor dash activity indicator.

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
No.

 * 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?
Yes, there was. And will be again.

To post a comment you must log in.
1078. By Michał Sawicz

Add one more step to verify that indicator goes away.

1079. By Michał Sawicz

Drop departments id, unused.

1080. By Michał Sawicz

Re-add newline.

1081. By Michał Sawicz

Newline--

1082. By Michał Sawicz

Undo divider changes.

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)
1083. By Michał Sawicz

Merge trunk.

Revision history for this message
Andrea Cimitan (cimi) wrote :

See inline

review: Needs Fixing
1084. By Michał Sawicz

Fix review comments.

Revision history for this message
Michał Sawicz (saviq) :
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)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in tests/qmltests/Dash/tst_Dash.qml
1 conflicts encountered.

review: Needs Fixing
1085. By Michał Sawicz

Merge.

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 :

There are autopilot failures related to autopilot, can you have a look?

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

err, autopilot failures related to indicators i mean :D

review: Needs Fixing
1086. By Michał Sawicz

Fix search emulator.

1087. By Michał Sawicz

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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

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 14:50:38 +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 'plugins/Dash/ScopeStyle.qml'
24--- plugins/Dash/ScopeStyle.qml 2014-07-18 18:09:13 +0000
25+++ plugins/Dash/ScopeStyle.qml 2014-08-06 14:50:38 +0000
26@@ -38,14 +38,20 @@
27 /// Color used for text and symbolic icons
28 readonly property color foreground: "foreground-color" in style ? style["foreground-color"] : d.defaultDark
29
30+ /// Luminance of the foreground color
31+ readonly property real foregroundLuminance: foreground ? luminance(foreground) : d.defaultForegroundLuminance
32+
33 /// Color used for the overall background
34 readonly property color background: "background-color" in style ? style["background-color"] : "transparent"
35
36+ /// Luminance of the foreground color
37+ readonly property real backgroundLuminance: background ? luminance(background) : d.defaultBackgroundLuminance
38+
39 /*! \brief Luminance threshold for switching between fore and background color
40
41 \note If background colour is not fully opaque, it's not taken into account.
42 */
43- readonly property real threshold: background.a !== 1.0 ? d.foregroundLuminance : (d.foregroundLuminance + d.backgroundLuminance) / 2
44+ readonly property real threshold: background.a !== 1.0 ? foregroundLuminance : (foregroundLuminance + backgroundLuminance) / 2
45
46 /*! \brief The lighter of foreground and background colors
47
48@@ -53,8 +59,8 @@
49 and defaults to the theme-provided light color.
50 */
51 readonly property color light: {
52- if (background.a !== 1.0) return d.foregroundLuminance > d.defaultLightLuminance ? foreground : d.defaultLight;
53- return d.foregroundLuminance > d.backgroundLuminance ? foreground : background;
54+ if (background.a !== 1.0) return foregroundLuminance > d.defaultLightLuminance ? foreground : d.defaultLight;
55+ return foregroundLuminance > backgroundLuminance ? foreground : background;
56 }
57
58 /*! \brief The darker of foreground and background colors
59@@ -63,8 +69,8 @@
60 and defaults to the theme-provided dark color.
61 */
62 readonly property color dark: {
63- if (background.a !== 1.0) return d.foregroundLuminance < d.defaultDarkLuminance ? foreground : d.defaultDark;
64- return d.foregroundLuminance < d.backgroundLuminance ? foreground : background;
65+ if (background.a !== 1.0) return foregroundLuminance < d.defaultDarkLuminance ? foreground : d.defaultDark;
66+ return foregroundLuminance < backgroundLuminance ? foreground : background;
67 }
68
69 /// Source of the logo image for the header
70@@ -78,9 +84,6 @@
71
72 //! @cond
73 property var d: QtObject {
74- readonly property real foregroundLuminance: luminance(foreground)
75- readonly property real backgroundLuminance: luminance(background)
76-
77 // FIXME: should be taken from the theme
78 readonly property color defaultLight: "white"
79 readonly property color defaultDark: "grey"
80
81=== modified file 'qml/Components/PageHeader.qml'
82--- qml/Components/PageHeader.qml 2014-07-31 16:49:50 +0000
83+++ qml/Components/PageHeader.qml 2014-08-06 14:50:38 +0000
84@@ -32,7 +32,6 @@
85 property bool searchEntryEnabled: false
86 property ListModel searchHistory: SearchHistoryModel
87 property alias searchQuery: searchTextField.text
88- property bool searchInProgress: false
89
90 property alias bottomItem: bottomContainer.children
91
92@@ -200,25 +199,13 @@
93 anchors.fill: parent
94 anchors.margins: units.gu(.75)
95 source: "image://theme/clear"
96- opacity: searchTextField.text.length > 0 && !searchActivityIndicator.running
97+ opacity: searchTextField.text.length > 0
98 visible: opacity > 0
99 Behavior on opacity {
100 UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
101 }
102 }
103
104- ActivityIndicator {
105- id: searchActivityIndicator
106- objectName: "searchIndicator"
107- anchors.fill: parent
108- anchors.margins: units.gu(.75)
109- running: root.searchInProgress
110- opacity: running ? 1 : 0
111- Behavior on opacity {
112- UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
113- }
114- }
115-
116 onClicked: {
117 root.resetSearch(true);
118 root.openSearchHistory();
119
120=== modified file 'qml/Dash/Dash.qml'
121--- qml/Dash/Dash.qml 2014-07-29 11:35:10 +0000
122+++ qml/Dash/Dash.qml 2014-08-06 14:50:38 +0000
123@@ -14,7 +14,7 @@
124 * along with this program. If not, see <http://www.gnu.org/licenses/>.
125 */
126
127-import QtQuick 2.0
128+import QtQuick 2.2
129 import Ubuntu.Components 0.1
130 import Unity 0.2
131 import Utils 0.1
132@@ -38,7 +38,13 @@
133 }
134
135 function setCurrentScope(scopeId, animate, reset) {
136- var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId)
137+ var scopeIndex = -1;
138+ for (var i = 0; i < scopes.count; ++i) {
139+ if (scopes.getScope(i).id == scopeId) {
140+ scopeIndex = i;
141+ break;
142+ }
143+ }
144
145 if (scopeIndex == -1) {
146 console.warn("No match for scope with id: %1".arg(scopeId))
147@@ -63,15 +69,8 @@
148 }
149 }
150
151- SortFilterProxyModel {
152- id: filteredScopes
153- model: Scopes {
154- id: scopes
155- }
156- dynamicSortFilter: true
157-
158- filterRole: Scopes.RoleVisible
159- filterRegExp: RegExp("^true$")
160+ Scopes {
161+ id: scopes
162 }
163
164 DashContent {
165@@ -79,7 +78,6 @@
166 objectName: "dashContent"
167 width: parent.width
168 height: parent.height
169- model: filteredScopes
170 scopes: scopes
171 visible: x != -width
172 onGotoScope: {
173@@ -134,4 +132,71 @@
174 }
175 }
176 }
177+
178+ Rectangle {
179+ id: indicator
180+ objectName: "processingIndicator"
181+ anchors {
182+ left: parent.left
183+ right: parent.right
184+ bottom: parent.bottom
185+ }
186+ height: units.dp(3)
187+ color: scopeStyle.backgroundLuminance > 0.7 ? "#50000000" : "#50ffffff"
188+ opacity: 0
189+ visible: opacity > 0
190+
191+ readonly property bool processing: dashContent.processing || scopeItem.processing
192+
193+ Behavior on opacity {
194+ UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
195+ }
196+
197+ onProcessingChanged: {
198+ if (processing) delay.start();
199+ else if (!persist.running) indicator.opacity = 0;
200+ }
201+
202+ Timer {
203+ id: delay
204+ interval: 200
205+ onTriggered: if (indicator.processing) {
206+ persist.restart();
207+ indicator.opacity = 1;
208+ }
209+ }
210+
211+ Timer {
212+ id: persist
213+ interval: 2 * UbuntuAnimation.SleepyDuration - UbuntuAnimation.FastDuration
214+ onTriggered: if (!indicator.processing) indicator.opacity = 0
215+ }
216+
217+ Rectangle {
218+ id: orange
219+ anchors { top: parent.top; bottom: parent.bottom }
220+ width: parent.width / 4
221+ color: Theme.palette.selected.foreground
222+
223+ SequentialAnimation {
224+ running: indicator.visible
225+ loops: Animation.Infinite
226+ XAnimator {
227+ from: -orange.width / 2
228+ to: indicator.width - orange.width / 2
229+ duration: UbuntuAnimation.SleepyDuration
230+ easing.type: Easing.InOutSine
231+ target: orange
232+ }
233+ XAnimator {
234+ from: indicator.width - orange.width / 2
235+ to: -orange.width / 2
236+ duration: UbuntuAnimation.SleepyDuration
237+ easing.type: Easing.InOutSine
238+ target: orange
239+ }
240+ }
241+ }
242+ }
243+
244 }
245
246=== modified file 'qml/Dash/DashContent.qml'
247--- qml/Dash/DashContent.qml 2014-07-24 23:31:44 +0000
248+++ qml/Dash/DashContent.qml 2014-08-06 14:50:38 +0000
249@@ -23,9 +23,10 @@
250 Item {
251 id: dashContent
252
253- property var model: null
254- property var scopes: null
255+ property alias scopes: dashContentList.model
256 readonly property alias currentIndex: dashContentList.currentIndex
257+ readonly property bool processing: dashContentList.currentItem && dashContentList.currentItem.item
258+ && dashContentList.currentItem.item.processing || false
259
260 signal scopeLoaded(string scopeId)
261 signal gotoScope(string scopeId)
262@@ -89,10 +90,9 @@
263 id: dashContentList
264 objectName: "dashContentList"
265
266- interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving
267+ interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving && !currentItem.navigationShown
268
269 anchors.fill: parent
270- model: dashContent.model
271 orientation: ListView.Horizontal
272 boundsBehavior: Flickable.DragAndOvershootBounds
273 flickDeceleration: units.gu(625)
274@@ -130,6 +130,7 @@
275 objectName: scope.id + " loader"
276
277 readonly property bool moving: item ? item.moving : false
278+ readonly property bool navigationShown: item ? item.navigationShown : false
279 readonly property var categoryView: item ? item.categoryView : null
280 readonly property var theScope: scope
281
282
283=== renamed file 'qml/Dash/DashDepartments.qml' => 'qml/Dash/DashNavigation.qml'
284--- qml/Dash/DashDepartments.qml 2014-07-08 11:08:19 +0000
285+++ qml/Dash/DashNavigation.qml 2014-08-06 14:50:38 +0000
286@@ -15,17 +15,17 @@
287 */
288
289 import QtQuick 2.2
290-import Ubuntu.Components 0.1
291+import Ubuntu.Components 1.1
292
293 AbstractButton {
294 id: root
295- objectName: "dashDepartments"
296+ objectName: "dashNavigation"
297
298 property var scope: null
299
300 property bool showList: false
301
302- readonly property var currentDepartment: scope && scope.hasDepartments ? scope.getDepartment(scope.currentDepartmentId) : null
303+ readonly property var currentNavigation: scope && scope.hasNavigation ? scope.getNavigation(scope.currentNavigationId) : null
304
305 property alias windowWidth: blackRect.width
306 property alias windowHeight: blackRect.height
307@@ -34,20 +34,21 @@
308 // Are we drilling down the tree or up?
309 property bool isGoingBack: false
310
311- visible: root.currentDepartment != null
312+ visible: root.currentNavigation != null
313
314 height: visible ? units.gu(5) : 0
315
316 onClicked: {
317+ navigationListView.updateMaxHeight();
318 root.showList = !root.showList;
319 }
320
321 Rectangle {
322 id: blackRect
323 color: "black"
324- opacity: departmentListView.currentItem && departmentListView.currentItem.visible ? 0.3 : 0
325+ opacity: navigationListView.currentItem && navigationListView.currentItem.visible ? 0.3 : 0
326 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
327- anchors.top: departmentListView.top
328+ anchors.top: navigationListView.top
329 anchors.right: parent.right
330 visible: opacity != 0
331 }
332@@ -78,7 +79,7 @@
333 anchors.fill: parent
334 anchors.margins: units.gu(2)
335 verticalAlignment: Text.AlignVCenter
336- text: root.currentDepartment ? root.currentDepartment.label : ""
337+ text: root.currentNavigation ? root.currentNavigation.label : ""
338 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
339 }
340
341@@ -92,18 +93,18 @@
342 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
343 }
344
345- // departmentListView is outside root
346+ // navigationListView is outside root
347 ListView {
348- id: departmentListView
349- objectName: "departmentListView"
350+ id: navigationListView
351+ objectName: "navigationListView"
352 orientation: ListView.Horizontal
353 interactive: false
354 clip: root.width != windowWidth
355 model: ListModel {
356- id: departmentModel
357+ id: navigationModel
358 // We have two roles
359- // departmentId: the department id of the department the list represents
360- // nullifyDepartment: overrides departmentId to be null
361+ // navigationId: the navigation id of the navigation the list represents
362+ // nullifyNavigation: overrides navigationId to be null
363 // This is used to "clear" the delegate when going "right" on the tree
364 }
365 anchors {
366@@ -111,7 +112,12 @@
367 right: parent.right
368 top: root.bottom
369 }
370- readonly property int maxHeight: (windowHeight - mapToItem(null, root.x, root.y).y) - units.gu(8)
371+ property int maxHeight: -1
372+ Component.onCompleted: updateMaxHeight();
373+ function updateMaxHeight()
374+ {
375+ maxHeight = (windowHeight - mapToItem(null, 0, 0).y) - units.gu(8);
376+ }
377 property int prevHeight: maxHeight
378 height: currentItem ? currentItem.height : maxHeight
379 onHeightChanged: {
380@@ -120,83 +126,84 @@
381 }
382 }
383 highlightMoveDuration: UbuntuAnimation.FastDuration
384- delegate: DashDepartmentsList {
385- objectName: "department" + index
386+ delegate: DashNavigationList {
387+ objectName: "navigation" + index
388 visible: height != 0
389- width: departmentListView.width
390+ width: navigationListView.width
391 scopeStyle: root.scopeStyle
392 property real desiredHeight: {
393 if (root.showList) {
394- if (department && department.loaded && x == departmentListView.contentX)
395+ if (navigation && navigation.loaded && x == navigationListView.contentX)
396 {
397- return Math.min(implicitHeight, departmentListView.maxHeight);
398+ navigationListView.updateMaxHeight();
399+ return Math.min(implicitHeight, navigationListView.maxHeight);
400 } else {
401- return departmentListView.prevHeight;
402+ return navigationListView.prevHeight;
403 }
404 } else {
405 return 0;
406 }
407 }
408 height: desiredHeight
409- department: (nullifyDepartment || !scope) ? null : scope.getDepartment(departmentId)
410- currentDepartment: root.currentDepartment
411- onEnterDepartment: {
412- scope.loadDepartment(newDepartmentId);
413+ navigation: (nullifyNavigation || !scope) ? null : scope.getNavigation(navigationId)
414+ currentNavigation: root.currentNavigation
415+ onEnterNavigation: {
416+ scope.setNavigationState(newNavigationId, false);
417 // We only need to add a new item to the model
418 // if we have children, otherwise just load it
419 if (hasChildren) {
420 isGoingBack = false;
421- departmentModel.append({"departmentId": newDepartmentId, "nullifyDepartment": false});
422- departmentListView.currentIndex++;
423+ navigationModel.append({"navigationId": newNavigationId, "nullifyNavigation": false});
424+ navigationListView.currentIndex++;
425 } else {
426 showList = false;
427 }
428 }
429 onGoBackToParentClicked: {
430- scope.loadDepartment(department.parentDepartmentId);
431+ scope.setNavigationState(navigation.parentNavigationId, false);
432 isGoingBack = true;
433- departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", false);
434- departmentListView.currentIndex--;
435+ navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
436+ navigationListView.currentIndex--;
437 }
438- onAllDepartmentClicked: {
439+ onAllNavigationClicked: {
440 showList = false;
441- if (root.currentDepartment.parentDepartmentId == department.departmentId) {
442+ if (root.currentNavigation.parentNavigationId == navigation.navigationId) {
443 // For leaves we have to go to the parent too
444- scope.loadDepartment(root.currentDepartment.parentDepartmentId);
445+ scope.setNavigationState(root.currentNavigation.parentNavigationId, false);
446 }
447 }
448 }
449 onContentXChanged: {
450- if (contentX == width * departmentListView.currentIndex) {
451+ if (contentX == width * navigationListView.currentIndex) {
452 if (isGoingBack) {
453- departmentModel.remove(departmentListView.currentIndex + 1);
454+ navigationModel.remove(navigationListView.currentIndex + 1);
455 } else {
456- departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", true);
457+ navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", true);
458 }
459 }
460 }
461 }
462
463 InverseMouseArea {
464- anchors.fill: departmentListView
465+ anchors.fill: navigationListView
466 enabled: root.showList
467 onClicked: root.showList = false
468 }
469
470 onScopeChanged: {
471- departmentModel.clear();
472- if (scope && scope.hasDepartments) {
473- departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
474+ navigationModel.clear();
475+ if (scope && scope.hasNavigation) {
476+ navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
477 }
478 }
479
480 Connections {
481 target: scope
482- onHasDepartmentsChanged: {
483- if (scope.hasDepartments) {
484- departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
485+ onHasNavigationChanged: {
486+ if (scope.hasNavigation) {
487+ navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
488 } else {
489- departmentModel.clear();
490+ navigationModel.clear();
491 }
492 }
493 }
494
495=== renamed file 'qml/Dash/DashDepartmentsList.qml' => 'qml/Dash/DashNavigationList.qml'
496--- qml/Dash/DashDepartmentsList.qml 2014-07-08 11:08:19 +0000
497+++ qml/Dash/DashNavigationList.qml 2014-08-06 14:50:38 +0000
498@@ -15,16 +15,16 @@
499 */
500
501 import QtQuick 2.2
502-import Ubuntu.Components 0.1
503+import Ubuntu.Components 1.1
504
505 Item {
506 id: root
507- property var department: null
508- property var currentDepartment: null
509+ property var navigation: null
510+ property var currentNavigation: null
511 property var scopeStyle: null
512- signal enterDepartment(var newDepartmentId, bool hasChildren)
513+ signal enterNavigation(var newNavigationId, bool hasChildren)
514 signal goBackToParentClicked()
515- signal allDepartmentClicked()
516+ signal allNavigationClicked()
517
518 readonly property int itemHeight: units.gu(5)
519 readonly property color foregroundColor: root.scopeStyle ? root.scopeStyle.foreground : "grey"
520@@ -35,11 +35,6 @@
521 anchors.fill: parent
522 }
523
524- ActivityIndicator {
525- id: loadingIndicator
526- anchors.centerIn: parent
527- running: !(department && department.loaded)
528- }
529 clip: true
530
531 Behavior on height {
532@@ -54,6 +49,7 @@
533
534 anchors.fill: parent
535
536+ flickableDirection: Flickable.VerticalFlick
537 contentHeight: column.height
538 contentWidth: width
539
540@@ -68,7 +64,7 @@
541 id: backButton
542 objectName: "backButton"
543 width: parent.width
544- visible: department && !department.isRoot || false
545+ visible: navigation && !navigation.isRoot || false
546 height: itemHeight
547
548 onClicked: root.goBackToParentClicked();
549@@ -92,7 +88,7 @@
550 left: backImage.right
551 leftMargin: units.gu(0.5)
552 }
553- text: department ? department.parentLabel : ""
554+ text: navigation ? navigation.parentLabel : ""
555 color: root.foregroundColor
556 }
557
558@@ -114,7 +110,7 @@
559 id: allButton
560 objectName: "allButton"
561 width: parent.width
562- visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) || false
563+ visible: navigation && (!navigation.isRoot || (root.currentNavigation && !root.currentNavigation.isRoot && root.currentNavigation.parentNavigationId == navigation.navigationId)) || false
564 height: itemHeight
565
566 Label {
567@@ -123,7 +119,7 @@
568 left: parent.left
569 leftMargin: units.gu(2)
570 }
571- text: department ? (department.allLabel != "" ? department.allLabel : department.label) : ""
572+ text: navigation ? (navigation.allLabel != "" ? navigation.allLabel : navigation.label) : ""
573 font.bold: true
574 color: root.foregroundColor
575 }
576@@ -141,18 +137,18 @@
577 height: units.dp(1)
578 }
579
580- onClicked: root.allDepartmentClicked();
581+ onClicked: root.allNavigationClicked();
582 }
583
584 Repeater {
585- model: department && department.loaded ? department : null
586+ model: navigation && navigation.loaded ? navigation : null
587 clip: true
588 delegate: AbstractButton {
589 objectName: root.objectName + "child" + index
590 height: root.itemHeight
591 width: root.width
592
593- onClicked: root.enterDepartment(departmentId, hasChildren)
594+ onClicked: root.enterNavigation(navigationId, hasChildren)
595
596 Label {
597 anchors {
598@@ -188,7 +184,7 @@
599 color: root.foregroundColor
600 opacity: 0.1
601 height: units.dp(1)
602- visible: index != department.count - 1
603+ visible: index != navigation.count - 1
604 }
605 }
606 }
607
608=== modified file 'qml/Dash/GenericScopeView.qml'
609--- qml/Dash/GenericScopeView.qml 2014-07-29 11:35:10 +0000
610+++ qml/Dash/GenericScopeView.qml 2014-08-06 14:50:38 +0000
611@@ -25,6 +25,7 @@
612 FocusScope {
613 id: scopeView
614
615+ readonly property alias navigationShown: dashNavigation.showList
616 property var scope: null
617 property SortFilterProxyModel categories: categoryFilter
618 property bool isCurrent: false
619@@ -37,18 +38,10 @@
620 style: scope ? scope.customizations : {}
621 }
622
623+ readonly property bool processing: scope ? scope.searchInProgress || previewListView.processing : false
624+
625 signal backClicked()
626
627- onScopeChanged: {
628- if (scope) {
629- scope.activateApplication.connect(activateApp);
630- }
631- }
632-
633- function activateApp(appId) {
634- Qt.openUrlExternally(appId);
635- }
636-
637 function positionAtBeginning() {
638 categoryView.positionAtBeginning()
639 }
640@@ -119,6 +112,7 @@
641 model: scopeView.categories
642 forceNoClip: previewListView.open
643 pixelAligned: true
644+ interactive: !dashNavigation.showList
645
646 property string expandedCategoryId: ""
647
648@@ -387,10 +381,10 @@
649 title: scopeView.scope ? scopeView.scope.name : ""
650 showBackButton: scopeView.hasBackAction
651 searchEntryEnabled: true
652- searchInProgress: scopeView.scope ? scopeView.scope.searchInProgress : false
653 scopeStyle: scopeView.scopeStyle
654
655- bottomItem: DashDepartments {
656+ bottomItem: DashNavigation {
657+ id: dashNavigation
658 scope: scopeView.scope
659 width: parent.width <= units.gu(60) ? parent.width : units.gu(40)
660 anchors.right: parent.right
661
662=== modified file 'qml/Dash/PreviewListView.qml'
663--- qml/Dash/PreviewListView.qml 2014-07-17 13:10:45 +0000
664+++ qml/Dash/PreviewListView.qml 2014-08-06 14:50:38 +0000
665@@ -32,6 +32,9 @@
666 property alias currentItem: previewListView.currentItem
667 property alias count: previewListView.count
668
669+ readonly property bool processing: currentItem && (!currentItem.previewModel.loaded
670+ || currentItem.previewModel.processingAction)
671+
672 PageHeader {
673 id: header
674 objectName: "pageHeader"
675@@ -83,39 +86,32 @@
676 }
677 }
678
679- delegate: Item {
680- objectName: "previewItem" + index
681+ delegate: Previews.Preview {
682+ id: preview
683+ objectName: "preview" + index
684 height: previewListView.height
685 width: previewListView.width
686
687- readonly property bool ready: preview.previewModel.loaded
688-
689- Previews.Preview {
690- id: preview
691- objectName: "preview" + index
692- anchors.fill: parent
693-
694- isCurrent: parent.ListView.isCurrentItem
695-
696- previewModel: {
697- var previewStack = root.scope.preview(result);
698- return previewStack.getPreviewModel(0);
699- }
700- scopeStyle: root.scopeStyle
701- }
702-
703- MouseArea {
704- id: processingMouseArea
705- objectName: "processingMouseArea"
706- anchors.fill: parent
707- enabled: !preview.previewModel.loaded || preview.previewModel.processingAction
708-
709- ActivityIndicator {
710- anchors.centerIn: parent
711- visible: root.open && parent.enabled
712- running: visible
713- }
714- }
715- }
716+ isCurrent: ListView.isCurrentItem
717+
718+ previewModel: {
719+ var previewStack = root.scope.preview(result);
720+ return previewStack.getPreviewModel(0);
721+ }
722+ scopeStyle: root.scopeStyle
723+ }
724+ }
725+
726+ MouseArea {
727+ id: processingMouseArea
728+ objectName: "processingMouseArea"
729+ anchors {
730+ left: parent.left
731+ right: parent.right
732+ top: pageHeader.bottom
733+ bottom: parent.bottom
734+ }
735+
736+ enabled: root.processing
737 }
738 }
739
740=== modified file 'qml/ScopeTool.qml'
741--- qml/ScopeTool.qml 2014-07-03 09:08:22 +0000
742+++ qml/ScopeTool.qml 2014-08-06 14:50:38 +0000
743@@ -45,16 +45,6 @@
744 signal searchClicked
745 }
746
747- SortFilterProxyModel {
748- id: filteredScopes
749- model: Scopes {
750- id: scopes
751- }
752- dynamicSortFilter: true
753-
754- filterRole: Scopes.RoleVisible
755- filterRegExp: RegExp("^true$")
756- }
757
758 Rectangle {
759 anchors.fill: dashContent
760@@ -72,8 +62,8 @@
761 DashContent {
762 id: dashContent
763
764- model: filteredScopes
765 property var scope: scopes.getScope(currentIndex)
766+ scopes: Scopes { }
767
768 anchors {
769 top: parent.top
770
771=== modified file 'tests/autopilot/unity8/shell/emulators/dash.py'
772--- tests/autopilot/unity8/shell/emulators/dash.py 2014-07-29 19:49:36 +0000
773+++ tests/autopilot/unity8/shell/emulators/dash.py 2014-08-06 14:50:38 +0000
774@@ -150,7 +150,7 @@
775 headerContainer.contentY.wait_for(0)
776 search_text_field = self._get_search_text_field()
777 search_text_field.write(query)
778- current_header.select_single(objectName="searchIndicator").running.wait_for(False)
779+ self.select_single(objectName="processingIndicator").visible.wait_for(False)
780
781 def _get_search_text_field(self):
782 page_header = self._get_current_page_header()
783
784=== modified file 'tests/mocks/Unity/CMakeLists.txt'
785--- tests/mocks/Unity/CMakeLists.txt 2014-08-05 12:06:16 +0000
786+++ tests/mocks/Unity/CMakeLists.txt 2014-08-06 14:50:38 +0000
787@@ -7,7 +7,7 @@
788 pkg_search_module(DEE dee-1.0 REQUIRED)
789 pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
790 pkg_search_module(DEEQT libdee-qt5 REQUIRED)
791-pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=3)
792+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=4)
793
794 include_directories(
795 ${CMAKE_CURRENT_BINARY_DIR}
796@@ -23,14 +23,14 @@
797 fake_scope.cpp
798 fake_scopes.cpp
799 fake_categories.cpp
800- fake_department.cpp
801+ fake_navigation.cpp
802 fake_resultsmodel.cpp
803 fake_previewmodel.cpp
804 fake_previewstack.cpp
805 fake_previewwidgetmodel.cpp
806 fake_unity_plugin.cpp
807 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/CategoriesInterface.h
808- ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/DepartmentInterface.h
809+ ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/NavigationInterface.h
810 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewModelInterface.h
811 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewStackInterface.h
812 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewWidgetModelInterface.h
813
814=== modified file 'tests/mocks/Unity/Unity.qmltypes'
815--- tests/mocks/Unity/Unity.qmltypes 2014-07-10 10:59:08 +0000
816+++ tests/mocks/Unity/Unity.qmltypes 2014-08-06 14:50:38 +0000
817@@ -24,6 +24,12 @@
818 Parameter { name: "categoryId"; type: "string" }
819 Parameter { name: "json"; type: "string" }
820 }
821+ Method {
822+ name: "data"
823+ type: "QVariant"
824+ Parameter { name: "row"; type: "int" }
825+ Parameter { name: "role"; type: "int" }
826+ }
827 }
828 Component {
829 name: "PreviewModel"
830@@ -62,6 +68,10 @@
831 prototype: "unity::shell::scopes::ScopeInterface"
832 exports: ["Unity/MockScope 0.2"]
833 exportMetaObjectRevisions: [0]
834+ Signal {
835+ name: "performQuery"
836+ Parameter { name: "query"; type: "string" }
837+ }
838 Method {
839 name: "setSearchInProgress"
840 Parameter { name: "inProg"; type: "bool" }
841@@ -81,18 +91,21 @@
842 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
843 }
844 Method {
845- name: "getDepartment"
846- type: "unity::shell::scopes::DepartmentInterface*"
847- Parameter { name: "id"; type: "string" }
848- }
849- Method {
850- name: "loadDepartment"
851- Parameter { name: "id"; type: "string" }
852- }
853- Method {
854- name: "performQuery"
855- Parameter { name: "query"; type: "string" }
856- }
857+ name: "getNavigation"
858+ type: "unity::shell::scopes::NavigationInterface*"
859+ Parameter { name: "navigationId"; type: "string" }
860+ }
861+ Method {
862+ name: "getAltNavigation"
863+ type: "unity::shell::scopes::NavigationInterface*"
864+ Parameter { name: "altNavigationId"; type: "string" }
865+ }
866+ Method {
867+ name: "setNavigationState"
868+ Parameter { name: "navigationId"; type: "string" }
869+ Parameter { name: "isAltNavigation"; type: "bool" }
870+ }
871+ Method { name: "refresh" }
872 }
873 Component {
874 name: "Scopes"
875@@ -137,6 +150,7 @@
876 "RoleRawRendererTemplate": 3,
877 "RoleRenderer": 4,
878 "RoleComponents": 5,
879+ "RoleHeaderLink": 6,
880 "RoleResults": 7,
881 "RoleCount": 8
882 }
883@@ -157,27 +171,28 @@
884 }
885 }
886 Component {
887- name: "unity::shell::scopes::DepartmentInterface"
888+ name: "unity::shell::scopes::NavigationInterface"
889 prototype: "QAbstractListModel"
890- exports: ["Unity/Department 0.2"]
891+ exports: ["Unity/Navigation 0.2"]
892 isCreatable: false
893 exportMetaObjectRevisions: [0]
894 Enum {
895 name: "Roles"
896 values: {
897- "RoleDepartmentId": 0,
898+ "RoleNavigationId": 0,
899 "RoleLabel": 1,
900 "RoleHasChildren": 2,
901 "RoleIsActive": 3
902 }
903 }
904- Property { name: "departmentId"; type: "string"; isReadonly: true }
905+ Property { name: "navigationId"; type: "string"; isReadonly: true }
906 Property { name: "label"; type: "string"; isReadonly: true }
907 Property { name: "allLabel"; type: "string"; isReadonly: true }
908- Property { name: "parentDepartmentId"; type: "string"; isReadonly: true }
909+ Property { name: "parentNavigationId"; type: "string"; isReadonly: true }
910 Property { name: "parentLabel"; type: "string"; isReadonly: true }
911 Property { name: "loaded"; type: "bool"; isReadonly: true }
912 Property { name: "isRoot"; type: "bool"; isReadonly: true }
913+ Property { name: "hidden"; type: "bool"; isReadonly: true }
914 Property { name: "count"; type: "int"; isReadonly: true }
915 }
916 Component {
917@@ -247,7 +262,8 @@
918 "RoleEmblem": 8,
919 "RoleSummary": 9,
920 "RoleAttributes": 10,
921- "RoleBackground": 11
922+ "RoleBackground": 11,
923+ "RoleOverlayColor": 12
924 }
925 }
926 Property { name: "categoryId"; type: "string" }
927@@ -259,13 +275,22 @@
928 exports: ["Unity/Scope 0.2"]
929 isCreatable: false
930 exportMetaObjectRevisions: [0]
931+ Enum {
932+ name: "Status"
933+ values: {
934+ "Okay": 0,
935+ "NoInternet": 1,
936+ "NoLocationData": 2,
937+ "Unknown": 3
938+ }
939+ }
940 Property { name: "id"; type: "string"; isReadonly: true }
941 Property { name: "name"; type: "string"; isReadonly: true }
942 Property { name: "iconHint"; type: "string"; isReadonly: true }
943 Property { name: "description"; type: "string"; isReadonly: true }
944 Property { name: "searchHint"; type: "string"; isReadonly: true }
945 Property { name: "searchInProgress"; type: "bool"; isReadonly: true }
946- Property { name: "visible"; type: "bool"; isReadonly: true }
947+ Property { name: "favorite"; type: "bool" }
948 Property { name: "shortcut"; type: "string"; isReadonly: true }
949 Property {
950 name: "categories"
951@@ -273,13 +298,27 @@
952 isReadonly: true
953 isPointer: true
954 }
955+ Property {
956+ name: "settings"
957+ type: "unity::shell::scopes::SettingsModelInterface"
958+ isReadonly: true
959+ isPointer: true
960+ }
961 Property { name: "searchQuery"; type: "string" }
962 Property { name: "noResultsHint"; type: "string" }
963 Property { name: "formFactor"; type: "string" }
964 Property { name: "isActive"; type: "bool" }
965- Property { name: "currentDepartmentId"; type: "string"; isReadonly: true }
966- Property { name: "hasDepartments"; type: "bool"; isReadonly: true }
967+ Property { name: "currentNavigationId"; type: "string"; isReadonly: true }
968+ Property { name: "hasNavigation"; type: "bool"; isReadonly: true }
969+ Property { name: "currentAltNavigationId"; type: "string"; isReadonly: true }
970+ Property { name: "hasAltNavigation"; type: "bool"; isReadonly: true }
971 Property { name: "customizations"; type: "QVariantMap"; isReadonly: true }
972+ Property {
973+ name: "status"
974+ type: "unity::shell::scopes::ScopeInterface::Status"
975+ isReadonly: true
976+ }
977+ Signal { name: "detailsChanged" }
978 Signal { name: "showDash" }
979 Signal { name: "hideDash" }
980 Signal {
981@@ -298,10 +337,6 @@
982 name: "openScope"
983 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
984 }
985- Signal {
986- name: "activateApplication"
987- Parameter { name: "desktop"; type: "string" }
988- }
989 Method {
990 name: "activate"
991 Parameter { name: "result"; type: "QVariant" }
992@@ -317,14 +352,25 @@
993 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
994 }
995 Method {
996- name: "getDepartment"
997- type: "unity::shell::scopes::DepartmentInterface*"
998- Parameter { name: "departmentId"; type: "string" }
999- }
1000- Method {
1001- name: "loadDepartment"
1002- Parameter { name: "departmentId"; type: "string" }
1003- }
1004+ name: "getNavigation"
1005+ type: "unity::shell::scopes::NavigationInterface*"
1006+ Parameter { name: "navigationId"; type: "string" }
1007+ }
1008+ Method {
1009+ name: "getAltNavigation"
1010+ type: "unity::shell::scopes::NavigationInterface*"
1011+ Parameter { name: "altNavigationId"; type: "string" }
1012+ }
1013+ Method {
1014+ name: "setNavigationState"
1015+ Parameter { name: "navId"; type: "string" }
1016+ Parameter { name: "altNavigation"; type: "bool" }
1017+ }
1018+ Method {
1019+ name: "performQuery"
1020+ Parameter { name: "cannedQuery"; type: "string" }
1021+ }
1022+ Method { name: "refresh" }
1023 }
1024 Component {
1025 name: "unity::shell::scopes::ScopesInterface"
1026@@ -334,11 +380,17 @@
1027 values: {
1028 "RoleScope": 0,
1029 "RoleId": 1,
1030- "RoleVisible": 2,
1031- "RoleTitle": 3
1032+ "RoleTitle": 2
1033 }
1034 }
1035 Property { name: "loaded"; type: "bool"; isReadonly: true }
1036+ Property { name: "count"; type: "int"; isReadonly: true }
1037+ Property {
1038+ name: "overviewScope"
1039+ type: "unity::shell::scopes::ScopeInterface"
1040+ isReadonly: true
1041+ isPointer: true
1042+ }
1043 Method {
1044 name: "getScope"
1045 type: "unity::shell::scopes::ScopeInterface*"
1046
1047=== renamed file 'tests/mocks/Unity/fake_department.cpp' => 'tests/mocks/Unity/fake_navigation.cpp'
1048--- tests/mocks/Unity/fake_department.cpp 2014-06-18 13:48:32 +0000
1049+++ tests/mocks/Unity/fake_navigation.cpp 2014-08-06 14:50:38 +0000
1050@@ -14,14 +14,15 @@
1051 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1052 */
1053
1054-#include "fake_department.h"
1055+#include "fake_navigation.h"
1056
1057 #include "fake_scope.h"
1058
1059+#include <QDebug>
1060 #include <QTimer>
1061
1062-Department::Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)
1063- : m_departmentId(departmentId)
1064+Navigation::Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)
1065+ : m_navigationId(navigationId)
1066 , m_label(label)
1067 , m_allLabel(allLabel)
1068 , m_parentId(parentId)
1069@@ -30,96 +31,87 @@
1070 , m_scope(scope)
1071 {
1072 QTimer::singleShot(1500, this, SLOT(slotLoaded()));
1073- connect(scope, SIGNAL(currentDepartmentIdChanged()), this, SLOT(slotCurrentDepartmentChanged()));
1074+ connect(scope, SIGNAL(currentNavigationIdChanged()), this, SLOT(slotCurrentNavigationChanged()));
1075 }
1076
1077-QString Department::departmentId() const
1078+QString Navigation::navigationId() const
1079 {
1080- return m_departmentId;
1081+ return m_navigationId;
1082 }
1083
1084-QString Department::label() const
1085+QString Navigation::label() const
1086 {
1087 return m_label;
1088 }
1089
1090-QString Department::allLabel() const
1091+QString Navigation::allLabel() const
1092 {
1093 return m_allLabel;
1094 }
1095
1096-QString Department::parentDepartmentId() const
1097+QString Navigation::parentNavigationId() const
1098 {
1099 return m_parentId;
1100 }
1101
1102-QString Department::parentLabel() const
1103+QString Navigation::parentLabel() const
1104 {
1105 return m_parentLabel;
1106 }
1107
1108-void Department::slotLoaded()
1109+void Navigation::slotLoaded()
1110 {
1111 m_loaded = true;
1112 Q_EMIT loadedChanged();
1113 }
1114
1115-bool Department::loaded() const
1116+bool Navigation::loaded() const
1117 {
1118 return m_loaded;
1119 }
1120
1121-int Department::count() const
1122+int Navigation::count() const
1123 {
1124 return rowCount();
1125 }
1126
1127-bool Department::isRoot() const
1128-{
1129- return m_departmentId == "root";
1130-}
1131-
1132-int Department::rowCount(const QModelIndex & /*parent*/) const
1133-{
1134- if (!m_loaded || m_departmentId.startsWith("child") || m_departmentId == "middle3")
1135+bool Navigation::isRoot() const
1136+{
1137+ return m_navigationId == "root" || m_navigationId == "altroot";
1138+}
1139+
1140+bool Navigation::hidden() const
1141+{
1142+ return m_navigationId == "altroot";
1143+}
1144+
1145+int Navigation::rowCount(const QModelIndex & /*parent*/) const
1146+{
1147+ if (!m_loaded || m_navigationId.startsWith("child") || m_navigationId == "middle3")
1148 return 0;
1149 else
1150 return 8;
1151 }
1152
1153-QHash<int, QByteArray> Department::roleNames() const
1154-{
1155- QHash<int, QByteArray> res;
1156- res[RoleDepartmentId] = "departmentId";
1157- res[RoleLabel] = "label";
1158- res[RoleHasChildren] = "hasChildren";
1159- res[RoleIsActive] = "isActive";
1160- return res;
1161-}
1162-
1163-QVariant Department::data(const QModelIndex &index, int role) const
1164+QVariant Navigation::data(const QModelIndex &index, int role) const
1165 {
1166 switch (role) {
1167- case RoleDepartmentId:
1168- if (m_departmentId == "root")
1169+ case RoleNavigationId:
1170+ if (m_navigationId == "root")
1171 return QString("middle%1").arg(index.row());
1172- else if (m_departmentId.startsWith("middle"))
1173- return QString("child%1%2").arg(m_departmentId).arg(index.row());
1174- break;
1175+ else if (m_navigationId.startsWith("middle"))
1176+ return QString("child%1%2").arg(m_navigationId).arg(index.row());
1177 case RoleLabel:
1178- return QString("%1Child%2").arg(m_departmentId).arg(index.row());
1179- break;
1180+ return QString("%1Child%2").arg(m_navigationId).arg(index.row());
1181 case RoleHasChildren:
1182- return m_departmentId == "root" && index.row() != 3;
1183- break;
1184+ return m_navigationId == "root" && index.row() != 3;
1185 case RoleIsActive:
1186- return m_scope->currentDepartmentId() == data(index, RoleDepartmentId);
1187- break;
1188+ return m_scope->currentNavigationId() == data(index, RoleNavigationId);
1189 }
1190 return QVariant();
1191 }
1192
1193-void Department::slotCurrentDepartmentChanged()
1194+void Navigation::slotCurrentNavigationChanged()
1195 {
1196 // This is wasteful, should only emit it if really something changed in this
1197 // deparment, but this is a mock, so no need to optimize
1198
1199=== renamed file 'tests/mocks/Unity/fake_department.h' => 'tests/mocks/Unity/fake_navigation.h'
1200--- tests/mocks/Unity/fake_department.h 2014-05-29 10:25:21 +0000
1201+++ tests/mocks/Unity/fake_navigation.h 2014-08-06 14:50:38 +0000
1202@@ -14,48 +14,48 @@
1203 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1204 */
1205
1206-#ifndef FAKE_DEPARTMENT_H
1207-#define FAKE_DEPARTMENT_H
1208+#ifndef FAKE_NAVIGATION_H
1209+#define FAKE_NAVIGATION_H
1210
1211-#include <unity/shell/scopes/DepartmentInterface.h>
1212+#include <unity/shell/scopes/NavigationInterface.h>
1213
1214 class Scope;
1215
1216-class Department : public unity::shell::scopes::DepartmentInterface
1217+class Navigation : public unity::shell::scopes::NavigationInterface
1218 {
1219 Q_OBJECT
1220
1221 public:
1222- Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);
1223+ Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);
1224
1225- QString departmentId() const override;
1226+ QString navigationId() const override;
1227 QString label() const override;
1228 QString allLabel() const override;
1229- QString parentDepartmentId() const override;
1230+ QString parentNavigationId() const override;
1231 QString parentLabel() const override;
1232 bool loaded() const override;
1233+ bool isRoot() const override;
1234+ bool hidden() const override;
1235 int count() const override;
1236- bool isRoot() const override;
1237
1238 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
1239- QHash<int, QByteArray> roleNames() const;
1240 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
1241
1242 public Q_SLOTS:
1243- void slotCurrentDepartmentChanged();
1244+ void slotCurrentNavigationChanged();
1245
1246 private Q_SLOTS:
1247 void slotLoaded();
1248
1249 private:
1250- QString m_departmentId;
1251+ QString m_navigationId;
1252 QString m_label;
1253 QString m_allLabel;
1254 QString m_parentId;
1255 QString m_parentLabel;
1256 bool m_loaded;
1257- QString m_currentDepartment;
1258+ QString m_currentNavigation;
1259 Scope *m_scope;
1260 };
1261
1262-#endif // FAKE_DEPARTMENT_H
1263+#endif // FAKE_NAVIGATION_H
1264
1265=== modified file 'tests/mocks/Unity/fake_scope.cpp'
1266--- tests/mocks/Unity/fake_scope.cpp 2014-07-24 20:40:57 +0000
1267+++ tests/mocks/Unity/fake_scope.cpp 2014-08-06 14:50:38 +0000
1268@@ -14,24 +14,26 @@
1269 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1270 */
1271
1272+#include <QDebug>
1273 #include <QUrl>
1274
1275 #include "fake_scope.h"
1276-#include "fake_department.h"
1277+#include "fake_navigation.h"
1278 #include "fake_resultsmodel.h"
1279
1280 Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
1281 {
1282 }
1283
1284-Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent, int categories)
1285+Scope::Scope(QString const& id, QString const& name, bool favorite, QObject* parent, int categories)
1286 : unity::shell::scopes::ScopeInterface(parent)
1287 , m_id(id)
1288 , m_name(name)
1289- , m_visible(visible)
1290 , m_searching(false)
1291+ , m_favorite(favorite)
1292 , m_isActive(false)
1293- , m_currentDeparment("root")
1294+ , m_currentNavigationId("root")
1295+ , m_currentAltNavigationId("altroot")
1296 , m_previewRendererName("preview-generic")
1297 , m_categories(new Categories(categories, this))
1298 {
1299@@ -77,6 +79,11 @@
1300 return m_searching;
1301 }
1302
1303+bool Scope::favorite() const
1304+{
1305+ return m_favorite;
1306+}
1307+
1308 unity::shell::scopes::CategoriesInterface* Scope::categories() const
1309 {
1310 return m_categories;
1311@@ -97,11 +104,6 @@
1312 return m_formFactor;
1313 }
1314
1315-bool Scope::visible() const
1316-{
1317- return m_visible;
1318-}
1319-
1320 bool Scope::isActive() const
1321 {
1322 return m_isActive;
1323@@ -131,6 +133,13 @@
1324 }
1325 }
1326
1327+void Scope::setFavorite(const bool favorite)
1328+{
1329+ if (favorite != m_favorite) {
1330+ m_favorite = favorite;
1331+ Q_EMIT favoriteChanged();
1332+ }
1333+}
1334 void Scope::setSearchInProgress(const bool inProg)
1335 {
1336 if (inProg != m_searching) {
1337@@ -170,14 +179,29 @@
1338 qFatal("Scope::closeScope is not implemented");
1339 }
1340
1341-QString Scope::currentDepartmentId() const
1342-{
1343- return m_currentDeparment;
1344-}
1345-
1346-bool Scope::hasDepartments() const
1347-{
1348- return true;
1349+QString Scope::currentNavigationId() const
1350+{
1351+ return m_currentNavigationId;
1352+}
1353+
1354+bool Scope::hasNavigation() const
1355+{
1356+ return true;
1357+}
1358+
1359+QString Scope::currentAltNavigationId() const
1360+{
1361+ return m_currentAltNavigationId;
1362+}
1363+
1364+bool Scope::hasAltNavigation() const
1365+{
1366+ return true;
1367+}
1368+
1369+Scope::Status Scope::status() const
1370+{
1371+ return Status::Okay;
1372 }
1373
1374 QVariantMap Scope::customizations() const
1375@@ -196,7 +220,12 @@
1376 return m;
1377 }
1378
1379-unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
1380+void Scope::refresh()
1381+{
1382+ qDebug() << "Scope::refresh is currently not implmented in the fake scopes plugin";
1383+}
1384+
1385+unity::shell::scopes::NavigationInterface* Scope::getNavigation(const QString& id)
1386 {
1387 if (id.isEmpty())
1388 return nullptr;
1389@@ -210,11 +239,30 @@
1390 parentId = id.mid(5, 7);
1391 parentLabel = parentId;
1392 }
1393- return new Department(id, id, "all"+id, parentId, parentLabel, this);
1394-}
1395-
1396-void Scope::loadDepartment(const QString& id)
1397-{
1398- m_currentDeparment = id;
1399- Q_EMIT currentDepartmentIdChanged();
1400+ return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
1401+}
1402+
1403+unity::shell::scopes::NavigationInterface* Scope::getAltNavigation(QString const& id)
1404+{
1405+ if (id.isEmpty())
1406+ return nullptr;
1407+
1408+ QString parentId;
1409+ QString parentLabel;
1410+ if (id.startsWith("altmiddle")) {
1411+ parentId = "altroot";
1412+ parentLabel = "altroot";
1413+ }
1414+ return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
1415+}
1416+
1417+void Scope::setNavigationState(const QString &navigationId, bool isAltNavigation)
1418+{
1419+ if (isAltNavigation) {
1420+ m_currentAltNavigationId = navigationId;
1421+ Q_EMIT currentAltNavigationIdChanged();
1422+ } else {
1423+ m_currentNavigationId = navigationId;
1424+ Q_EMIT currentNavigationIdChanged();
1425+ }
1426 }
1427
1428=== modified file 'tests/mocks/Unity/fake_scope.h'
1429--- tests/mocks/Unity/fake_scope.h 2014-07-11 16:39:33 +0000
1430+++ tests/mocks/Unity/fake_scope.h 2014-08-06 14:50:38 +0000
1431@@ -30,7 +30,7 @@
1432
1433 public:
1434 Scope(QObject* parent = 0);
1435- Scope(QString const& id, QString const& name, bool visible, QObject* parent = 0, int categories = 20);
1436+ Scope(QString const& id, QString const& name, bool favorite, QObject* parent = 0, int categories = 20);
1437
1438 /* getters */
1439 QString id() const override;
1440@@ -38,9 +38,9 @@
1441 QString iconHint() const override;
1442 QString description() const override;
1443 QString searchHint() const override;
1444- bool visible() const override;
1445 QString shortcut() const override;
1446 bool searchInProgress() const override;
1447+ bool favorite() const override;
1448 unity::shell::scopes::CategoriesInterface* categories() const override;
1449 QString searchQuery() const override;
1450 QString noResultsHint() const override;
1451@@ -53,6 +53,7 @@
1452 void setNoResultsHint(const QString& hint) override;
1453 void setFormFactor(const QString& form_factor) override;
1454 void setActive(const bool) override;
1455+ void setFavorite(const bool) override;
1456 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
1457
1458 Q_INVOKABLE void activate(QVariant const& result) override;
1459@@ -60,14 +61,20 @@
1460 Q_INVOKABLE void cancelActivation() override;
1461 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
1462
1463- QString currentDepartmentId() const override;
1464- bool hasDepartments() const override;
1465- Q_INVOKABLE unity::shell::scopes::DepartmentInterface* getDepartment(const QString& id) override;
1466- Q_INVOKABLE void loadDepartment(const QString& id) override;
1467+ QString currentNavigationId() const override;
1468+ bool hasNavigation() const override;
1469+ QString currentAltNavigationId() const override;
1470+ bool hasAltNavigation() const override;
1471+ Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) override;
1472+ Q_INVOKABLE unity::shell::scopes::NavigationInterface* getAltNavigation(QString const& altNavigationId) override;
1473+ Q_INVOKABLE void setNavigationState(const QString &navigationId, bool isAltNavigation) override;
1474 Q_SIGNAL void performQuery(const QString& query) override;
1475
1476+ Status status() const override;
1477 QVariantMap customizations() const override;
1478
1479+ Q_INVOKABLE void refresh() override;
1480+
1481 protected:
1482
1483 QString m_id;
1484@@ -77,10 +84,11 @@
1485 QString m_searchQuery;
1486 QString m_noResultsHint;
1487 QString m_formFactor;
1488- bool m_visible;
1489 bool m_searching;
1490+ bool m_favorite;
1491 bool m_isActive;
1492- QString m_currentDeparment;
1493+ QString m_currentNavigationId;
1494+ QString m_currentAltNavigationId;
1495
1496 QString m_previewRendererName;
1497
1498
1499=== modified file 'tests/mocks/Unity/fake_scopes.cpp'
1500--- tests/mocks/Unity/fake_scopes.cpp 2014-07-25 13:25:45 +0000
1501+++ tests/mocks/Unity/fake_scopes.cpp 2014-08-06 14:50:38 +0000
1502@@ -32,6 +32,11 @@
1503 timer.setSingleShot(true);
1504 timer.setInterval(100);
1505 QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));
1506+
1507+ QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
1508+ QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
1509+ QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
1510+
1511 load();
1512 }
1513
1514@@ -92,8 +97,6 @@
1515 return QVariant::fromValue(scope);
1516 } else if (role == Scopes::RoleId) {
1517 return QVariant::fromValue(scope->id());
1518- } else if (role == Scopes::RoleVisible) {
1519- return QVariant::fromValue(scope->visible());
1520 } else if (role == Scopes::RoleTitle) {
1521 return QVariant::fromValue(scope->name());
1522 } else {
1523@@ -125,6 +128,11 @@
1524 return m_loaded;
1525 }
1526
1527+int Scopes::count() const
1528+{
1529+ return rowCount();
1530+}
1531+
1532 unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
1533 {
1534 return nullptr;
1535
1536=== modified file 'tests/mocks/Unity/fake_scopes.h'
1537--- tests/mocks/Unity/fake_scopes.h 2014-07-25 13:25:45 +0000
1538+++ tests/mocks/Unity/fake_scopes.h 2014-08-06 14:50:38 +0000
1539@@ -50,6 +50,7 @@
1540 QModelIndex parent ( const QModelIndex & index ) const;
1541
1542 bool loaded() const override;
1543+ int count() const override;
1544 unity::shell::scopes::ScopeInterface* overviewScope() const override;
1545
1546 private Q_SLOTS:
1547
1548=== modified file 'tests/mocks/Unity/fake_unity_plugin.cpp'
1549--- tests/mocks/Unity/fake_unity_plugin.cpp 2014-07-08 11:26:44 +0000
1550+++ tests/mocks/Unity/fake_unity_plugin.cpp 2014-08-06 14:50:38 +0000
1551@@ -22,7 +22,7 @@
1552 // local
1553 #include "fake_scopes.h"
1554 #include "fake_categories.h"
1555-#include "fake_department.h"
1556+#include "fake_navigation.h"
1557 #include "fake_previewmodel.h"
1558 #include "fake_previewwidgetmodel.h"
1559 #include "fake_resultsmodel.h"
1560@@ -43,7 +43,7 @@
1561 qmlRegisterType<Scopes>(uri, 0, 2, "Scopes");
1562 qmlRegisterType<Scope>(uri, 0, 2, "MockScope");
1563 qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML.");
1564- qmlRegisterUncreatableType<unity::shell::scopes::DepartmentInterface>(uri, 0, 2, "Department", "Can't create Department object in QML.");
1565+ qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML.");
1566 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML.");
1567 qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance.");
1568 qmlRegisterUncreatableType<ResultsModel>(uri, 0, 2, "ResultsModel", "Can't create ResultsModel object in QML.");
1569
1570=== modified file 'tests/plugins/Dash/tst_ScopeStyle.qml'
1571--- tests/plugins/Dash/tst_ScopeStyle.qml 2014-07-19 07:56:55 +0000
1572+++ tests/plugins/Dash/tst_ScopeStyle.qml 2014-08-06 14:50:38 +0000
1573@@ -54,6 +54,9 @@
1574 { tag: "lightgrey", luminance: 0.8275 },
1575 { tag: "grey", luminance: 0.5020 },
1576 { tag: "darkgrey", luminance: 0.6627 },
1577+ { tag: "red", luminance: 0.2126 },
1578+ { tag: "green", luminance: 0.3590 },
1579+ { tag: "blue", luminance: 0.0722 },
1580 ];
1581 }
1582
1583@@ -64,10 +67,10 @@
1584
1585 function test_foreground_data() {
1586 return [
1587- { tag: "default", index: 0, foreground: "grey" },
1588- { tag: "red on black", index: 1, foreground: "red" },
1589- { tag: "green on white", index: 2, foreground: "green" },
1590- { tag: "blue on darkgrey", index: 3, foreground: "blue" },
1591+ { tag: "default", index: 0, foreground: "grey", luminance: 0.5020 },
1592+ { tag: "red on black", index: 1, foreground: "red", luminance: 0.2126 },
1593+ { tag: "green on white", index: 2, foreground: "green", luminance: 0.3590 },
1594+ { tag: "blue on darkgrey", index: 3, foreground: "blue", luminance: 0.0722 },
1595 ];
1596 }
1597
1598@@ -75,14 +78,15 @@
1599 tool.style = testCase.styles[data.index];
1600 verify(Qt.colorEqual(tool.foreground, data.foreground),
1601 "Foreground color not equal: %1 != %2".arg(tool.foreground).arg(data.foreground));
1602+ compare(tool.foregroundLuminance.toFixed(4), data.luminance.toFixed(4));
1603 }
1604
1605 function test_background_data() {
1606 return [
1607 { tag: "default", index: 0, background: "transparent" },
1608- { tag: "red on black", index: 1, background: "black" },
1609- { tag: "green on white", index: 2, background: "white" },
1610- { tag: "blue on darkgrey", index: 3, background: "darkgrey" },
1611+ { tag: "red on black", index: 1, background: "black", luminance: 0 },
1612+ { tag: "green on white", index: 2, background: "white", luminance: 1 },
1613+ { tag: "blue on darkgrey", index: 3, background: "darkgrey", luminance: 0.6627 },
1614 ];
1615 }
1616
1617@@ -90,6 +94,9 @@
1618 tool.style = testCase.styles[data.index];
1619 verify(Qt.colorEqual(tool.background, data.background),
1620 "Background color not equal: %1 != %2".arg(tool.background).arg(data.background));
1621+ if (data.hasOwnProperty("luminance")) {
1622+ compare(tool.backgroundLuminance.toFixed(4), data.luminance.toFixed(4));
1623+ }
1624 }
1625
1626 function test_threshold_data() {
1627
1628=== modified file 'tests/qmltests/Components/tst_PageHeader.qml'
1629--- tests/qmltests/Components/tst_PageHeader.qml 2014-07-28 09:14:23 +0000
1630+++ tests/qmltests/Components/tst_PageHeader.qml 2014-08-06 14:50:38 +0000
1631@@ -119,29 +119,6 @@
1632 compare(pageHeader.searchHistory.get(0).query, "humppa4")
1633 }
1634
1635- function test_search_indicator() {
1636- var searchIndicator = findChild(pageHeader, "searchIndicator")
1637- var clearIcon = findChild(pageHeader, "clearIcon")
1638-
1639- pageHeader.triggerSearch()
1640-
1641- tryCompare(clearIcon, "visible", false)
1642- pageHeader.searchQuery = "ubuntu"
1643- tryCompare(clearIcon, "visible", true)
1644-
1645- pageHeader.searchInProgress = false
1646- compare(searchIndicator.running, false, "Search indicator is running.")
1647- tryCompare(clearIcon, "visible", true)
1648-
1649- pageHeader.searchInProgress = true
1650- compare(searchIndicator.running, true, "Search indicator isn't running.")
1651- tryCompare(clearIcon, "visible", false)
1652-
1653- pageHeader.searchInProgress = false;
1654- compare(searchIndicator.running, false, "Search indicator is running.")
1655- tryCompare(clearIcon, "visible", true)
1656- }
1657-
1658 function test_titleImage() {
1659
1660 var titleImage = findChild(pageHeader, "titleImage");
1661
1662=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
1663--- tests/qmltests/Dash/tst_Dash.qml 2014-07-29 11:35:10 +0000
1664+++ tests/qmltests/Dash/tst_Dash.qml 2014-08-06 14:50:38 +0000
1665@@ -45,12 +45,8 @@
1666 name: "Dash"
1667 when: windowShown
1668
1669- property var scopes
1670-
1671- Component.onCompleted: {
1672- var dashContent = findChild(dash, "dashContent");
1673- scopes = dashContent.scopes;
1674- }
1675+ readonly property Item dashContent: findChild(dash, "dashContent");
1676+ readonly property var scopes: dashContent.scopes
1677
1678 function init() {
1679 // clear and reload the scopes.
1680@@ -64,10 +60,10 @@
1681
1682 function get_scope_data() {
1683 return [
1684- { tag: "MockScope1", visualIndex: 0, shouldBeVisible: true },
1685- { tag: "MockScope2", visualIndex: -1, shouldBeVisible: false },
1686- { tag: "clickscope", visualIndex: 1, shouldBeVisible: true },
1687- { tag: "MockScope5", visualIndex: 2, shouldBeVisible: true },
1688+ { tag: "MockScope1", visualIndex: 0 },
1689+ { tag: "MockScope2", visualIndex: 1 },
1690+ { tag: "clickscope", visualIndex: 2 },
1691+ { tag: "MockScope5", visualIndex: 3 },
1692 ]
1693 }
1694
1695@@ -76,10 +72,6 @@
1696 }
1697
1698 function test_show_scope_on_load(data) {
1699- if (data.shouldBeVisible == false) {
1700- console.log("Not testing " + data.tag + ": not visible");
1701- return;
1702- }
1703 var dashContentList = findChild(dash, "dashContentList");
1704
1705 dash.showScopeOnLoaded = data.tag
1706@@ -87,7 +79,7 @@
1707 tryCompare(dashContentList, "count", 0);
1708 scopes.load();
1709 tryCompare(scopes, "loaded", true);
1710- tryCompare(dashContentList, "count", 4);
1711+ tryCompare(dashContentList, "count", 5);
1712
1713 verify(dashContentList != undefined);
1714 tryCompare(dashContentList, "currentIndex", data.visualIndex);
1715@@ -110,5 +102,26 @@
1716 dashCommunicatorService.mockSetCurrentScope("clickscope", true, true);
1717 tryCompare(dashContentList, "currentIndex", 1)
1718 }
1719+
1720+ function test_processing_indicator() {
1721+ tryCompare(scopes, "loaded", true);
1722+
1723+ var processingIndicator = findChild(dash, "processingIndicator");
1724+ verify(processingIndicator, "Can't find the processing indicator.");
1725+
1726+ verify(!processingIndicator.visible, "Processing indicator should be visible.");
1727+
1728+ tryCompareFunction(function() {
1729+ return scopes.getScope(dashContent.currentIndex) != null;
1730+ }, true);
1731+ var currentScope = scopes.getScope(dashContent.currentIndex);
1732+ verify(currentScope, "Can't find the current scope.");
1733+
1734+ currentScope.setSearchInProgress(true);
1735+ tryCompare(processingIndicator, "visible", true);
1736+
1737+ currentScope.setSearchInProgress(false);
1738+ tryCompare(processingIndicator, "visible", false);
1739+ }
1740 }
1741 }
1742
1743=== modified file 'tests/qmltests/Dash/tst_DashContent.qml'
1744--- tests/qmltests/Dash/tst_DashContent.qml 2014-07-21 13:28:35 +0000
1745+++ tests/qmltests/Dash/tst_DashContent.qml 2014-08-06 14:50:38 +0000
1746@@ -43,9 +43,6 @@
1747 id: dashContent
1748 anchors.fill: parent
1749
1750- model: SortFilterProxyModel {
1751- model: scopesModel
1752- }
1753 scopes : scopesModel
1754 }
1755
1756@@ -268,117 +265,119 @@
1757 verify(carouselLV.tileWidth / carouselLV.tileHeight == cardTool.components["art"]["aspect-ratio"]);
1758 }
1759
1760- function test_departments() {
1761- var dashDepartments = findChild(dashContent, "dashDepartments");
1762- compare(dashDepartments.visible, true);
1763- compare(dashDepartments.showList, false);
1764- waitForRendering(dashDepartments);
1765- mouseClick(dashDepartments, 0, 0);
1766- compare(dashDepartments.showList, true);
1767-
1768- var departmentListView = findChild(dashDepartments, "departmentListView");
1769- compare(departmentListView.count, 1);
1770- tryCompare(departmentListView.currentItem.department, "loaded", true);
1771-
1772- waitForRendering(departmentListView);
1773- waitForRendering(departmentListView.currentItem);
1774-
1775- var allButton = findChild(dashDepartments, "allButton");
1776- compare(allButton.visible, false);
1777-
1778- var department = findChild(dashDepartments, "department0child3");
1779- mouseClick(department, 0, 0);
1780- compare(dashDepartments.showList, false);
1781- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle3");
1782- tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1783-
1784- mouseClick(dashDepartments, 0, 0);
1785- compare(dashDepartments.showList, true);
1786- waitForRendering(departmentListView);
1787- waitForRendering(departmentListView.currentItem);
1788- compare(allButton.visible, true);
1789-
1790- mouseClick(allButton, 0, 0);
1791- compare(dashDepartments.showList, false);
1792- tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
1793- tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1794-
1795- mouseClick(dashDepartments, 0, 0);
1796- compare(dashDepartments.showList, true);
1797- waitForRendering(departmentListView);
1798- waitForRendering(departmentListView.currentItem);
1799- compare(allButton.visible, false);
1800-
1801- department = findChild(dashDepartments, "department0child2");
1802- mouseClick(department, 0, 0);
1803- compare(dashDepartments.showList, true);
1804- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1805- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1806-
1807- var departmentList1 = findChild(dashDepartments, "department1");
1808- allButton = findChild(departmentList1, "allButton");
1809- var backButton = findChild(findChild(departmentList1, "department1"), "backButton");
1810- compare(allButton.visible, true);
1811- compare(backButton.visible, true);
1812-
1813- tryCompare(departmentListView, "contentX", departmentList1.x);
1814- waitForRendering(departmentListView);
1815- mouseClick(allButton, 0, 0);
1816- compare(dashDepartments.showList, false);
1817- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1818- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1819-
1820- mouseClick(dashDepartments, 0, 0);
1821- compare(dashDepartments.showList, true);
1822- waitForRendering(departmentListView);
1823- waitForRendering(departmentListView.currentItem);
1824- compare(allButton.visible, true);
1825- compare(backButton.visible, true);
1826-
1827- tryCompare(departmentList1.department, "loaded", true);
1828- department = findChild(dashDepartments, "department1child2");
1829- mouseClick(department, 0, 0);
1830- compare(dashDepartments.showList, false);
1831- tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle22");
1832- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1833-
1834- mouseClick(dashDepartments, 0, 0);
1835- compare(dashDepartments.showList, true);
1836- waitForRendering(departmentListView);
1837- waitForRendering(departmentListView.currentItem);
1838-
1839- tryCompare(departmentList1.department, "loaded", true);
1840- department = findChild(dashDepartments, "department1child3");
1841- mouseClick(department, 0, 0);
1842- compare(dashDepartments.showList, false);
1843- tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle23");
1844- tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1845-
1846- mouseClick(dashDepartments, 0, 0);
1847- compare(dashDepartments.showList, true);
1848- waitForRendering(departmentListView);
1849- waitForRendering(departmentListView.currentItem);
1850+ function test_navigations() {
1851+ var dashContentList = findChild(dashContent, "dashContentList");
1852+ tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
1853+ var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
1854+ tryCompare(dashNavigation, "visible", true);
1855+ compare(dashNavigation.showList, false);
1856+ waitForRendering(dashNavigation);
1857+ mouseClick(dashNavigation, 0, 0);
1858+ compare(dashNavigation.showList, true);
1859+
1860+ var navigationListView = findChild(dashNavigation, "navigationListView");
1861+ compare(navigationListView.count, 1);
1862+ tryCompare(navigationListView.currentItem.navigation, "loaded", true);
1863+
1864+ waitForRendering(navigationListView);
1865+ waitForRendering(navigationListView.currentItem);
1866+
1867+ var allButton = findChild(dashNavigation, "allButton");
1868+ compare(allButton.visible, false);
1869+
1870+ var navigation = findChild(dashNavigation, "navigation0child3");
1871+ mouseClick(navigation, 0, 0);
1872+ compare(dashNavigation.showList, false);
1873+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle3");
1874+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1875+
1876+ mouseClick(dashNavigation, 0, 0);
1877+ compare(dashNavigation.showList, true);
1878+ waitForRendering(navigationListView);
1879+ waitForRendering(navigationListView.currentItem);
1880+ compare(allButton.visible, true);
1881+
1882+ mouseClick(allButton, 0, 0);
1883+ compare(dashNavigation.showList, false);
1884+ tryCompare(dashNavigation.currentNavigation, "navigationId", "root");
1885+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1886+
1887+ mouseClick(dashNavigation, 0, 0);
1888+ compare(dashNavigation.showList, true);
1889+ waitForRendering(navigationListView);
1890+ waitForRendering(navigationListView.currentItem);
1891+ compare(allButton.visible, false);
1892+
1893+ navigation = findChild(dashNavigation, "navigation0child2");
1894+ mouseClick(navigation, 0, 0);
1895+ compare(dashNavigation.showList, true);
1896+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1897+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1898+
1899+ var navigationList1 = findChild(dashNavigation, "navigation1");
1900+ allButton = findChild(navigationList1, "allButton");
1901+ var backButton = findChild(findChild(navigationList1, "navigation1"), "backButton");
1902+ compare(allButton.visible, true);
1903+ compare(backButton.visible, true);
1904+
1905+ tryCompare(navigationListView, "contentX", navigationList1.x);
1906+ waitForRendering(navigationListView);
1907+ mouseClick(allButton, 0, 0);
1908+ compare(dashNavigation.showList, false);
1909+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1910+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1911+
1912+ mouseClick(dashNavigation, 0, 0);
1913+ compare(dashNavigation.showList, true);
1914+ waitForRendering(navigationListView);
1915+ waitForRendering(navigationListView.currentItem);
1916+ compare(allButton.visible, true);
1917+ compare(backButton.visible, true);
1918+
1919+ tryCompare(navigationList1.navigation, "loaded", true);
1920+ navigation = findChild(dashNavigation, "navigation1child2");
1921+ mouseClick(navigation, 0, 0);
1922+ compare(dashNavigation.showList, false);
1923+ tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle22");
1924+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1925+
1926+ mouseClick(dashNavigation, 0, 0);
1927+ compare(dashNavigation.showList, true);
1928+ waitForRendering(navigationListView);
1929+ waitForRendering(navigationListView.currentItem);
1930+
1931+ tryCompare(navigationList1.navigation, "loaded", true);
1932+ navigation = findChild(dashNavigation, "navigation1child3");
1933+ mouseClick(navigation, 0, 0);
1934+ compare(dashNavigation.showList, false);
1935+ tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle23");
1936+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1937+
1938+ mouseClick(dashNavigation, 0, 0);
1939+ compare(dashNavigation.showList, true);
1940+ waitForRendering(navigationListView);
1941+ waitForRendering(navigationListView.currentItem);
1942 mouseClick(backButton, 0, 0);
1943
1944- tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
1945- tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1946- compare(dashDepartments.showList, true);
1947- mouseClick(dashDepartments, 0, 0);
1948- compare(dashDepartments.showList, false);
1949+ tryCompare(dashNavigation.currentNavigation, "navigationId", "root");
1950+ tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1951+ compare(dashNavigation.showList, true);
1952+ mouseClick(dashNavigation, 0, 0);
1953+ compare(dashNavigation.showList, false);
1954
1955- mouseClick(dashDepartments, 0, 0);
1956- compare(dashDepartments.showList, true);
1957- tryCompare(departmentListView.currentItem.department, "loaded", true);
1958- department = findChild(dashDepartments, "department0child2");
1959- mouseClick(department, 0, 0);
1960- compare(dashDepartments.showList, true);
1961- departmentList1 = findChild(dashDepartments, "department1");
1962- compare(departmentList1.department.loaded, false);
1963- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1964- allButton = findChild(departmentList1, "allButton");
1965- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1966+ mouseClick(dashNavigation, 0, 0);
1967+ compare(dashNavigation.showList, true);
1968+ tryCompare(navigationListView.currentItem.navigation, "loaded", true);
1969+ navigation = findChild(dashNavigation, "navigation0child2");
1970+ mouseClick(navigation, 0, 0);
1971+ compare(dashNavigation.showList, true);
1972+ navigationList1 = findChild(dashNavigation, "navigation1");
1973+ compare(navigationList1.navigation.loaded, false);
1974+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1975+ allButton = findChild(navigationList1, "allButton");
1976+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1977 mouseClick(allButton, 0, 0);
1978- tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1979+ tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1980 }
1981 }
1982 }
1983
1984=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
1985--- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-07-24 20:40:57 +0000
1986+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-06 14:50:38 +0000
1987@@ -319,7 +319,7 @@
1988 units.gu(2),
1989 testCase.previewListView.height / 2);
1990 tryCompare(previewListViewList, "moving", false);
1991- tryCompare(testCase.previewListView.currentItem, "objectName", "previewItem" + i);
1992+ tryCompare(testCase.previewListView.currentItem, "objectName", "preview" + i);
1993
1994 }
1995 closePreview();

Subscribers

People subscribed via source and target branches