Merge lp:~nick-dedekind/unity8/lp1352977 into lp:unity8

Proposed by Nick Dedekind
Status: Superseded
Proposed branch: lp:~nick-dedekind/unity8/lp1352977
Merge into: lp:unity8
Prerequisite: lp:~unity-team/unity8/scopes-v4
Diff against target: 1922 lines (+481/-470)
29 files modified
debian/control (+3/-3)
qml/Dash/Dash.qml (+11/-9)
qml/Dash/DashContent.qml (+4/-3)
qml/Dash/DashDepartments.qml (+43/-50)
qml/Dash/DashDepartmentsList.qml (+14/-15)
qml/Dash/GenericScopeView.qml (+11/-4)
qml/ScopeTool.qml (+11/-1)
qml/Stages/AppSurfaceContainer.qml (+44/-0)
qml/Stages/SpreadDelegate.qml (+3/-1)
qml/Stages/SurfaceContainer.qml (+5/-22)
tests/mocks/Unity/Application/ApplicationDBusAdaptor.cpp (+11/-4)
tests/mocks/Unity/Application/ApplicationDBusAdaptor.h (+1/-1)
tests/mocks/Unity/Application/ApplicationInfo.cpp (+49/-0)
tests/mocks/Unity/Application/ApplicationInfo.h (+13/-0)
tests/mocks/Unity/Application/ApplicationManager.cpp (+3/-0)
tests/mocks/Unity/Application/ApplicationManager.h (+1/-0)
tests/mocks/Unity/Application/MirSurfaceItem.cpp (+2/-2)
tests/mocks/Unity/Application/MirSurfaceItem.h (+1/-0)
tests/mocks/Unity/CMakeLists.txt (+3/-3)
tests/mocks/Unity/Unity.qmltypes (+35/-87)
tests/mocks/Unity/fake_department.cpp (+44/-36)
tests/mocks/Unity/fake_department.h (+13/-13)
tests/mocks/Unity/fake_scope.cpp (+25/-73)
tests/mocks/Unity/fake_scope.h (+8/-16)
tests/mocks/Unity/fake_scopes.cpp (+2/-10)
tests/mocks/Unity/fake_scopes.h (+0/-1)
tests/mocks/Unity/fake_unity_plugin.cpp (+2/-2)
tests/qmltests/Dash/tst_Dash.qml (+9/-5)
tests/qmltests/Dash/tst_DashContent.qml (+110/-109)
To merge this branch: bzr merge lp:~nick-dedekind/unity8/lp1352977
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Pending
Unity Team Pending
Review via email: mp+229943@code.launchpad.net

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

Commit message

Added application prompt surfaces to allow prompting application which have not yet created a surface.

Description of the change

Added application prompt surfaces to allow prompting application which have not yet created a surface.

To post a comment you must log in.
lp:~nick-dedekind/unity8/lp1352977 updated
1134. By PS Jenkins bot

Resync trunk

1135. By Nick Dedekind

added prompt surfaces

1136. By Nick Dedekind

Fixed promptSurface over app splash

1137. By Nick Dedekind

better mock logging

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2014-08-07 14:25:38 +0000
+++ debian/control 2014-08-07 14:25:38 +0000
@@ -24,7 +24,7 @@
24 libpulse-dev,24 libpulse-dev,
25 libqmenumodel-dev (>= 0.2.8),25 libqmenumodel-dev (>= 0.2.8),
26 libqt5xmlpatterns5-dev,26 libqt5xmlpatterns5-dev,
27 libunity-api-dev (>= 7.88),27 libunity-api-dev (>= 7.87),
28 libusermetricsoutput1-dev,28 libusermetricsoutput1-dev,
29 libxcb1-dev,29 libxcb1-dev,
30 pkg-config,30 pkg-config,
@@ -83,7 +83,7 @@
83 qmenumodel-qml (>= 0.2.8),83 qmenumodel-qml (>= 0.2.8),
84 qml-module-qtquick-xmllistmodel,84 qml-module-qtquick-xmllistmodel,
85 qtdeclarative5-gsettings1.0,85 qtdeclarative5-gsettings1.0,
86 qtdeclarative5-qtmir-plugin (>= 0.4),86 qtdeclarative5-qtmir-plugin (>= 0.4.1),
87 qtdeclarative5-ubuntu-settings-components (>= 0.3),87 qtdeclarative5-ubuntu-settings-components (>= 0.3),
88 qtdeclarative5-ubuntu-telephony0.1,88 qtdeclarative5-ubuntu-telephony0.1,
89 unity-launcher-impl-3,89 unity-launcher-impl-3,
@@ -112,7 +112,7 @@
112 unity-application-impl-2,112 unity-application-impl-2,
113 unity-notifications-impl-3,113 unity-notifications-impl-3,
114 unity-plugin-scopes | unity-scopes-impl,114 unity-plugin-scopes | unity-scopes-impl,
115 unity-scopes-impl-4,115 unity-scopes-impl-2,
116 unity8-fake-env | unity-application-impl,116 unity8-fake-env | unity-application-impl,
117 ${misc:Depends},117 ${misc:Depends},
118Breaks: unity8 (<< 7.86),118Breaks: unity8 (<< 7.86),
119119
=== modified file 'qml/Dash/Dash.qml'
--- qml/Dash/Dash.qml 2014-08-07 14:25:38 +0000
+++ qml/Dash/Dash.qml 2014-07-29 11:35:10 +0000
@@ -38,13 +38,7 @@
38 }38 }
3939
40 function setCurrentScope(scopeId, animate, reset) {40 function setCurrentScope(scopeId, animate, reset) {
41 var scopeIndex = -1;41 var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId)
42 for (var i = 0; i < scopes.count; ++i) {
43 if (scopes.getScope(i).id == scopeId) {
44 scopeIndex = i;
45 break;
46 }
47 }
4842
49 if (scopeIndex == -1) {43 if (scopeIndex == -1) {
50 console.warn("No match for scope with id: %1".arg(scopeId))44 console.warn("No match for scope with id: %1".arg(scopeId))
@@ -69,8 +63,15 @@
69 }63 }
70 }64 }
7165
72 Scopes {66 SortFilterProxyModel {
73 id: scopes67 id: filteredScopes
68 model: Scopes {
69 id: scopes
70 }
71 dynamicSortFilter: true
72
73 filterRole: Scopes.RoleVisible
74 filterRegExp: RegExp("^true$")
74 }75 }
7576
76 DashContent {77 DashContent {
@@ -78,6 +79,7 @@
78 objectName: "dashContent"79 objectName: "dashContent"
79 width: parent.width80 width: parent.width
80 height: parent.height81 height: parent.height
82 model: filteredScopes
81 scopes: scopes83 scopes: scopes
82 visible: x != -width84 visible: x != -width
83 onGotoScope: {85 onGotoScope: {
8486
=== modified file 'qml/Dash/DashContent.qml'
--- qml/Dash/DashContent.qml 2014-08-07 14:25:38 +0000
+++ qml/Dash/DashContent.qml 2014-07-24 23:31:44 +0000
@@ -23,7 +23,8 @@
23Item {23Item {
24 id: dashContent24 id: dashContent
2525
26 property alias scopes: dashContentList.model26 property var model: null
27 property var scopes: null
27 readonly property alias currentIndex: dashContentList.currentIndex28 readonly property alias currentIndex: dashContentList.currentIndex
2829
29 signal scopeLoaded(string scopeId)30 signal scopeLoaded(string scopeId)
@@ -88,9 +89,10 @@
88 id: dashContentList89 id: dashContentList
89 objectName: "dashContentList"90 objectName: "dashContentList"
9091
91 interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving && !currentItem.navigationShown92 interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving
9293
93 anchors.fill: parent94 anchors.fill: parent
95 model: dashContent.model
94 orientation: ListView.Horizontal96 orientation: ListView.Horizontal
95 boundsBehavior: Flickable.DragAndOvershootBounds97 boundsBehavior: Flickable.DragAndOvershootBounds
96 flickDeceleration: units.gu(625)98 flickDeceleration: units.gu(625)
@@ -128,7 +130,6 @@
128 objectName: scope.id + " loader"130 objectName: scope.id + " loader"
129131
130 readonly property bool moving: item ? item.moving : false132 readonly property bool moving: item ? item.moving : false
131 readonly property bool navigationShown: item ? item.navigationShown : false
132 readonly property var categoryView: item ? item.categoryView : null133 readonly property var categoryView: item ? item.categoryView : null
133 readonly property var theScope: scope134 readonly property var theScope: scope
134135
135136
=== renamed file 'qml/Dash/DashNavigation.qml' => 'qml/Dash/DashDepartments.qml'
--- qml/Dash/DashNavigation.qml 2014-08-07 14:25:38 +0000
+++ qml/Dash/DashDepartments.qml 2014-07-08 11:08:19 +0000
@@ -15,17 +15,17 @@
15 */15 */
1616
17import QtQuick 2.217import QtQuick 2.2
18import Ubuntu.Components 1.118import Ubuntu.Components 0.1
1919
20AbstractButton {20AbstractButton {
21 id: root21 id: root
22 objectName: "dashNavigation"22 objectName: "dashDepartments"
2323
24 property var scope: null24 property var scope: null
2525
26 property bool showList: false26 property bool showList: false
2727
28 readonly property var currentNavigation: scope && scope.hasNavigation ? scope.getNavigation(scope.currentNavigationId) : null28 readonly property var currentDepartment: scope && scope.hasDepartments ? scope.getDepartment(scope.currentDepartmentId) : null
2929
30 property alias windowWidth: blackRect.width30 property alias windowWidth: blackRect.width
31 property alias windowHeight: blackRect.height31 property alias windowHeight: blackRect.height
@@ -34,21 +34,20 @@
34 // Are we drilling down the tree or up?34 // Are we drilling down the tree or up?
35 property bool isGoingBack: false35 property bool isGoingBack: false
3636
37 visible: root.currentNavigation != null37 visible: root.currentDepartment != null
3838
39 height: visible ? units.gu(5) : 039 height: visible ? units.gu(5) : 0
4040
41 onClicked: {41 onClicked: {
42 navigationListView.updateMaxHeight();
43 root.showList = !root.showList;42 root.showList = !root.showList;
44 }43 }
4544
46 Rectangle {45 Rectangle {
47 id: blackRect46 id: blackRect
48 color: "black"47 color: "black"
49 opacity: navigationListView.currentItem && navigationListView.currentItem.visible ? 0.3 : 048 opacity: departmentListView.currentItem && departmentListView.currentItem.visible ? 0.3 : 0
50 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }49 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
51 anchors.top: navigationListView.top50 anchors.top: departmentListView.top
52 anchors.right: parent.right51 anchors.right: parent.right
53 visible: opacity != 052 visible: opacity != 0
54 }53 }
@@ -79,7 +78,7 @@
79 anchors.fill: parent78 anchors.fill: parent
80 anchors.margins: units.gu(2)79 anchors.margins: units.gu(2)
81 verticalAlignment: Text.AlignVCenter80 verticalAlignment: Text.AlignVCenter
82 text: root.currentNavigation ? root.currentNavigation.label : ""81 text: root.currentDepartment ? root.currentDepartment.label : ""
83 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"82 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
84 }83 }
8584
@@ -93,18 +92,18 @@
93 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"92 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
94 }93 }
9594
96 // navigationListView is outside root95 // departmentListView is outside root
97 ListView {96 ListView {
98 id: navigationListView97 id: departmentListView
99 objectName: "navigationListView"98 objectName: "departmentListView"
100 orientation: ListView.Horizontal99 orientation: ListView.Horizontal
101 interactive: false100 interactive: false
102 clip: root.width != windowWidth101 clip: root.width != windowWidth
103 model: ListModel {102 model: ListModel {
104 id: navigationModel103 id: departmentModel
105 // We have two roles104 // We have two roles
106 // navigationId: the navigation id of the navigation the list represents105 // departmentId: the department id of the department the list represents
107 // nullifyNavigation: overrides navigationId to be null106 // nullifyDepartment: overrides departmentId to be null
108 // This is used to "clear" the delegate when going "right" on the tree107 // This is used to "clear" the delegate when going "right" on the tree
109 }108 }
110 anchors {109 anchors {
@@ -112,12 +111,7 @@
112 right: parent.right111 right: parent.right
113 top: root.bottom112 top: root.bottom
114 }113 }
115 property int maxHeight: -1114 readonly property int maxHeight: (windowHeight - mapToItem(null, root.x, root.y).y) - units.gu(8)
116 Component.onCompleted: updateMaxHeight();
117 function updateMaxHeight()
118 {
119 maxHeight = (windowHeight - mapToItem(null, 0, 0).y) - units.gu(8);
120 }
121 property int prevHeight: maxHeight115 property int prevHeight: maxHeight
122 height: currentItem ? currentItem.height : maxHeight116 height: currentItem ? currentItem.height : maxHeight
123 onHeightChanged: {117 onHeightChanged: {
@@ -126,84 +120,83 @@
126 }120 }
127 }121 }
128 highlightMoveDuration: UbuntuAnimation.FastDuration122 highlightMoveDuration: UbuntuAnimation.FastDuration
129 delegate: DashNavigationList {123 delegate: DashDepartmentsList {
130 objectName: "navigation" + index124 objectName: "department" + index
131 visible: height != 0125 visible: height != 0
132 width: navigationListView.width126 width: departmentListView.width
133 scopeStyle: root.scopeStyle127 scopeStyle: root.scopeStyle
134 property real desiredHeight: {128 property real desiredHeight: {
135 if (root.showList) {129 if (root.showList) {
136 if (navigation && navigation.loaded && x == navigationListView.contentX)130 if (department && department.loaded && x == departmentListView.contentX)
137 {131 {
138 navigationListView.updateMaxHeight();132 return Math.min(implicitHeight, departmentListView.maxHeight);
139 return Math.min(implicitHeight, navigationListView.maxHeight);
140 } else {133 } else {
141 return navigationListView.prevHeight;134 return departmentListView.prevHeight;
142 }135 }
143 } else {136 } else {
144 return 0;137 return 0;
145 }138 }
146 }139 }
147 height: desiredHeight140 height: desiredHeight
148 navigation: (nullifyNavigation || !scope) ? null : scope.getNavigation(navigationId)141 department: (nullifyDepartment || !scope) ? null : scope.getDepartment(departmentId)
149 currentNavigation: root.currentNavigation142 currentDepartment: root.currentDepartment
150 onEnterNavigation: {143 onEnterDepartment: {
151 scope.setNavigationState(newNavigationId, false);144 scope.loadDepartment(newDepartmentId);
152 // We only need to add a new item to the model145 // We only need to add a new item to the model
153 // if we have children, otherwise just load it146 // if we have children, otherwise just load it
154 if (hasChildren) {147 if (hasChildren) {
155 isGoingBack = false;148 isGoingBack = false;
156 navigationModel.append({"navigationId": newNavigationId, "nullifyNavigation": false});149 departmentModel.append({"departmentId": newDepartmentId, "nullifyDepartment": false});
157 navigationListView.currentIndex++;150 departmentListView.currentIndex++;
158 } else {151 } else {
159 showList = false;152 showList = false;
160 }153 }
161 }154 }
162 onGoBackToParentClicked: {155 onGoBackToParentClicked: {
163 scope.setNavigationState(navigation.parentNavigationId, false);156 scope.loadDepartment(department.parentDepartmentId);
164 isGoingBack = true;157 isGoingBack = true;
165 navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);158 departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", false);
166 navigationListView.currentIndex--;159 departmentListView.currentIndex--;
167 }160 }
168 onAllNavigationClicked: {161 onAllDepartmentClicked: {
169 showList = false;162 showList = false;
170 if (root.currentNavigation.parentNavigationId == navigation.navigationId) {163 if (root.currentDepartment.parentDepartmentId == department.departmentId) {
171 // For leaves we have to go to the parent too164 // For leaves we have to go to the parent too
172 scope.setNavigationState(root.currentNavigation.parentNavigationId, false);165 scope.loadDepartment(root.currentDepartment.parentDepartmentId);
173 }166 }
174 }167 }
175 }168 }
176 onContentXChanged: {169 onContentXChanged: {
177 if (contentX == width * navigationListView.currentIndex) {170 if (contentX == width * departmentListView.currentIndex) {
178 if (isGoingBack) {171 if (isGoingBack) {
179 navigationModel.remove(navigationListView.currentIndex + 1);172 departmentModel.remove(departmentListView.currentIndex + 1);
180 } else {173 } else {
181 navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", true);174 departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", true);
182 }175 }
183 }176 }
184 }177 }
185 }178 }
186179
187 InverseMouseArea {180 InverseMouseArea {
188 anchors.fill: navigationListView181 anchors.fill: departmentListView
189 enabled: root.showList182 enabled: root.showList
190 onClicked: root.showList = false183 onClicked: root.showList = false
191 }184 }
192185
193 onScopeChanged: {186 onScopeChanged: {
194 navigationModel.clear();187 departmentModel.clear();
195 if (scope && scope.hasNavigation) {188 if (scope && scope.hasDepartments) {
196 navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});189 departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
197 }190 }
198 }191 }
199192
200 Connections {193 Connections {
201 target: scope194 target: scope
202 onHasNavigationChanged: {195 onHasDepartmentsChanged: {
203 if (scope.hasNavigation) {196 if (scope.hasDepartments) {
204 navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});197 departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
205 } else {198 } else {
206 navigationModel.clear();199 departmentModel.clear();
207 }200 }
208 }201 }
209 }202 }
210203
=== renamed file 'qml/Dash/DashNavigationList.qml' => 'qml/Dash/DashDepartmentsList.qml'
--- qml/Dash/DashNavigationList.qml 2014-08-07 14:25:38 +0000
+++ qml/Dash/DashDepartmentsList.qml 2014-07-08 11:08:19 +0000
@@ -15,16 +15,16 @@
15 */15 */
1616
17import QtQuick 2.217import QtQuick 2.2
18import Ubuntu.Components 1.118import Ubuntu.Components 0.1
1919
20Item {20Item {
21 id: root21 id: root
22 property var navigation: null22 property var department: null
23 property var currentNavigation: null23 property var currentDepartment: null
24 property var scopeStyle: null24 property var scopeStyle: null
25 signal enterNavigation(var newNavigationId, bool hasChildren)25 signal enterDepartment(var newDepartmentId, bool hasChildren)
26 signal goBackToParentClicked()26 signal goBackToParentClicked()
27 signal allNavigationClicked()27 signal allDepartmentClicked()
2828
29 readonly property int itemHeight: units.gu(5)29 readonly property int itemHeight: units.gu(5)
30 readonly property color foregroundColor: root.scopeStyle ? root.scopeStyle.foreground : "grey"30 readonly property color foregroundColor: root.scopeStyle ? root.scopeStyle.foreground : "grey"
@@ -38,7 +38,7 @@
38 ActivityIndicator {38 ActivityIndicator {
39 id: loadingIndicator39 id: loadingIndicator
40 anchors.centerIn: parent40 anchors.centerIn: parent
41 running: !(navigation && navigation.loaded)41 running: !(department && department.loaded)
42 }42 }
43 clip: true43 clip: true
4444
@@ -54,7 +54,6 @@
5454
55 anchors.fill: parent55 anchors.fill: parent
5656
57 flickableDirection: Flickable.VerticalFlick
58 contentHeight: column.height57 contentHeight: column.height
59 contentWidth: width58 contentWidth: width
6059
@@ -69,7 +68,7 @@
69 id: backButton68 id: backButton
70 objectName: "backButton"69 objectName: "backButton"
71 width: parent.width70 width: parent.width
72 visible: navigation && !navigation.isRoot || false71 visible: department && !department.isRoot || false
73 height: itemHeight72 height: itemHeight
7473
75 onClicked: root.goBackToParentClicked();74 onClicked: root.goBackToParentClicked();
@@ -93,7 +92,7 @@
93 left: backImage.right92 left: backImage.right
94 leftMargin: units.gu(0.5)93 leftMargin: units.gu(0.5)
95 }94 }
96 text: navigation ? navigation.parentLabel : ""95 text: department ? department.parentLabel : ""
97 color: root.foregroundColor96 color: root.foregroundColor
98 }97 }
9998
@@ -115,7 +114,7 @@
115 id: allButton114 id: allButton
116 objectName: "allButton"115 objectName: "allButton"
117 width: parent.width116 width: parent.width
118 visible: navigation && (!navigation.isRoot || (root.currentNavigation && !root.currentNavigation.isRoot && root.currentNavigation.parentNavigationId == navigation.navigationId)) || false117 visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) || false
119 height: itemHeight118 height: itemHeight
120119
121 Label {120 Label {
@@ -124,7 +123,7 @@
124 left: parent.left123 left: parent.left
125 leftMargin: units.gu(2)124 leftMargin: units.gu(2)
126 }125 }
127 text: navigation ? (navigation.allLabel != "" ? navigation.allLabel : navigation.label) : ""126 text: department ? (department.allLabel != "" ? department.allLabel : department.label) : ""
128 font.bold: true127 font.bold: true
129 color: root.foregroundColor128 color: root.foregroundColor
130 }129 }
@@ -142,18 +141,18 @@
142 height: units.dp(1)141 height: units.dp(1)
143 }142 }
144143
145 onClicked: root.allNavigationClicked();144 onClicked: root.allDepartmentClicked();
146 }145 }
147146
148 Repeater {147 Repeater {
149 model: navigation && navigation.loaded ? navigation : null148 model: department && department.loaded ? department : null
150 clip: true149 clip: true
151 delegate: AbstractButton {150 delegate: AbstractButton {
152 objectName: root.objectName + "child" + index151 objectName: root.objectName + "child" + index
153 height: root.itemHeight152 height: root.itemHeight
154 width: root.width153 width: root.width
155154
156 onClicked: root.enterNavigation(navigationId, hasChildren)155 onClicked: root.enterDepartment(departmentId, hasChildren)
157156
158 Label {157 Label {
159 anchors {158 anchors {
@@ -189,7 +188,7 @@
189 color: root.foregroundColor188 color: root.foregroundColor
190 opacity: 0.1189 opacity: 0.1
191 height: units.dp(1)190 height: units.dp(1)
192 visible: index != navigation.count - 1191 visible: index != department.count - 1
193 }192 }
194 }193 }
195 }194 }
196195
=== modified file 'qml/Dash/GenericScopeView.qml'
--- qml/Dash/GenericScopeView.qml 2014-08-07 14:25:38 +0000
+++ qml/Dash/GenericScopeView.qml 2014-07-29 11:35:10 +0000
@@ -25,7 +25,6 @@
25FocusScope {25FocusScope {
26 id: scopeView26 id: scopeView
2727
28 readonly property alias navigationShown: dashNavigation.showList
29 property var scope: null28 property var scope: null
30 property SortFilterProxyModel categories: categoryFilter29 property SortFilterProxyModel categories: categoryFilter
31 property bool isCurrent: false30 property bool isCurrent: false
@@ -40,6 +39,16 @@
4039
41 signal backClicked()40 signal backClicked()
4241
42 onScopeChanged: {
43 if (scope) {
44 scope.activateApplication.connect(activateApp);
45 }
46 }
47
48 function activateApp(appId) {
49 Qt.openUrlExternally(appId);
50 }
51
43 function positionAtBeginning() {52 function positionAtBeginning() {
44 categoryView.positionAtBeginning()53 categoryView.positionAtBeginning()
45 }54 }
@@ -110,7 +119,6 @@
110 model: scopeView.categories119 model: scopeView.categories
111 forceNoClip: previewListView.open120 forceNoClip: previewListView.open
112 pixelAligned: true121 pixelAligned: true
113 interactive: !dashNavigation.showList
114122
115 property string expandedCategoryId: ""123 property string expandedCategoryId: ""
116124
@@ -382,8 +390,7 @@
382 searchInProgress: scopeView.scope ? scopeView.scope.searchInProgress : false390 searchInProgress: scopeView.scope ? scopeView.scope.searchInProgress : false
383 scopeStyle: scopeView.scopeStyle391 scopeStyle: scopeView.scopeStyle
384392
385 bottomItem: DashNavigation {393 bottomItem: DashDepartments {
386 id: dashNavigation
387 scope: scopeView.scope394 scope: scopeView.scope
388 width: parent.width <= units.gu(60) ? parent.width : units.gu(40)395 width: parent.width <= units.gu(60) ? parent.width : units.gu(40)
389 anchors.right: parent.right396 anchors.right: parent.right
390397
=== modified file 'qml/ScopeTool.qml'
--- qml/ScopeTool.qml 2014-08-07 14:25:38 +0000
+++ qml/ScopeTool.qml 2014-07-03 09:08:22 +0000
@@ -45,6 +45,16 @@
45 signal searchClicked45 signal searchClicked
46 }46 }
4747
48 SortFilterProxyModel {
49 id: filteredScopes
50 model: Scopes {
51 id: scopes
52 }
53 dynamicSortFilter: true
54
55 filterRole: Scopes.RoleVisible
56 filterRegExp: RegExp("^true$")
57 }
4858
49 Rectangle {59 Rectangle {
50 anchors.fill: dashContent60 anchors.fill: dashContent
@@ -62,8 +72,8 @@
62 DashContent {72 DashContent {
63 id: dashContent73 id: dashContent
6474
75 model: filteredScopes
65 property var scope: scopes.getScope(currentIndex)76 property var scope: scopes.getScope(currentIndex)
66 scopes: Scopes { }
6777
68 anchors {78 anchors {
69 top: parent.top79 top: parent.top
7080
=== added file 'qml/Stages/AppSurfaceContainer.qml'
--- qml/Stages/AppSurfaceContainer.qml 1970-01-01 00:00:00 +0000
+++ qml/Stages/AppSurfaceContainer.qml 2014-08-07 14:25:38 +0000
@@ -0,0 +1,44 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15*/
16
17import QtQuick 2.0
18import "Animations"
19
20SurfaceContainer {
21 id: container
22 property var promptSurfaces
23
24 Repeater {
25 model: container.promptSurfaces
26
27 delegate: SurfaceContainer {
28 anchors {
29 fill: container
30 topMargin: container.surface.anchors.topMargin
31 rightMargin: container.surface.anchors.rightMargin
32 bottomMargin: container.surface.anchors.bottomMargin
33 leftMargin: container.surface.anchors.leftMargin
34 }
35
36 z: 3 + index
37 surface: modelData
38
39 Component.onCompleted: {
40 animateIn();
41 }
42 }
43 }
44}
045
=== modified file 'qml/Stages/SpreadDelegate.qml'
--- qml/Stages/SpreadDelegate.qml 2014-07-29 11:35:10 +0000
+++ qml/Stages/SpreadDelegate.qml 2014-08-07 14:25:38 +0000
@@ -35,11 +35,13 @@
35 signal clicked()35 signal clicked()
36 signal closed()36 signal closed()
3737
38 SurfaceContainer {38 AppSurfaceContainer {
39 id: surfaceContainer39 id: surfaceContainer
40 objectName: "surfaceContainer"40 objectName: "surfaceContainer"
41 anchors.fill: parent41 anchors.fill: parent
42 surface: model.surface42 surface: model.surface
43 promptSurfaces: model.application.promptSurfaces
44
43 property bool appHasCreatedASurface: false45 property bool appHasCreatedASurface: false
4446
45 onSurfaceChanged: {47 onSurfaceChanged: {
4648
=== modified file 'qml/Stages/SurfaceContainer.qml'
--- qml/Stages/SurfaceContainer.qml 2014-07-23 12:23:10 +0000
+++ qml/Stages/SurfaceContainer.qml 2014-08-07 14:25:38 +0000
@@ -40,19 +40,12 @@
40 childSurfaces[i].removed();40 childSurfaces[i].removed();
41 }41 }
4242
43 //if we don't have children, nothing will tell us to animate out, so do it.43 animateOut();
44 if (childSurfaces.length === 0) {
45 animateOut();
46 }
47 // tell our parent to animate out.
48 if (surface.parentSurface) {
49 surface.parentSurface.parent.animateOut();
50 }
51 }44 }
52 }45 }
5346
54 Repeater {47 Repeater {
55 model: container.surface ? container.surface.childSurfaces : 048 model: surface.childSurfaces
5649
57 delegate: Loader {50 delegate: Loader {
58 z: 251 z: 2
@@ -68,14 +61,13 @@
68 source: Qt.resolvedUrl("SurfaceContainer.qml")61 source: Qt.resolvedUrl("SurfaceContainer.qml")
69 onLoaded: {62 onLoaded: {
70 item.surface = modelData;63 item.surface = modelData;
71 item.animateIn(swipeFromBottom);64 item.animateIn();
72 container.animateIn(swipeUp);
73 }65 }
74 }66 }
75 }67 }
7668
77 function animateIn(component) {69 function animateIn() {
78 var animation = component.createObject(container, { "surface": container.surface });70 var animation = swipeFromBottom.createObject(container, { "surface": container.surface });
79 animation.start();71 animation.start();
8072
81 var tmp = d.animations;73 var tmp = d.animations;
@@ -104,20 +96,11 @@
104 id: swipeFromBottom96 id: swipeFromBottom
105 SwipeFromBottomAnimation {}97 SwipeFromBottomAnimation {}
106 }98 }
107 Component {
108 id: swipeUp
109 SwipeUpAnimation {}
110 }
111 Component {
112 id: darkenFade
113 DarkenAndFadeInAnimation {}
114 }
11599
116 states: [100 states: [
117 State {101 State {
118 name: "initial"102 name: "initial"
119 PropertyChanges { target: surface; anchors.fill: container }103 PropertyChanges { target: surface; anchors.fill: container }
120 }104 }
121 // TODO: more animations!
122 ]105 ]
123}106}
124107
=== modified file 'tests/mocks/Unity/Application/ApplicationDBusAdaptor.cpp'
--- tests/mocks/Unity/Application/ApplicationDBusAdaptor.cpp 2014-07-25 05:39:21 +0000
+++ tests/mocks/Unity/Application/ApplicationDBusAdaptor.cpp 2014-08-07 14:25:38 +0000
@@ -43,10 +43,8 @@
43 return child ? child : surface;43 return child ? child : surface;
44}44}
4545
46quint32 ApplicationDBusAdaptor::addChildSurface(const QString &appId, const QString &surfaceImage)46quint32 ApplicationDBusAdaptor::addPromptSurface(const QString &appId, const QString &surfaceImage)
47{47{
48 qDebug() << "ApplicationDBusAdaptor::addChildSurface - " << appId;
49
50 ApplicationInfo* application = m_applicationManager->findApplication(appId);48 ApplicationInfo* application = m_applicationManager->findApplication(appId);
51 if (!application) {49 if (!application) {
52 qDebug() << "ApplicationDBusAdaptor::addChildSurface - No application found for " << appId;50 qDebug() << "ApplicationDBusAdaptor::addChildSurface - No application found for " << appId;
@@ -58,7 +56,16 @@
58 MirSurfaceItem::Maximized,56 MirSurfaceItem::Maximized,
59 QUrl(surfaceImage));57 QUrl(surfaceImage));
60 m_childItems[surfaceId] = surface;58 m_childItems[surfaceId] = surface;
61 surface->setParentSurface(topSurface(application->surface()));59
60 if (application->promptSurfaceList().count() > 0) {
61 surface->setParentSurface(topSurface(application->promptSurfaceList()[0]));
62 qDebug() << "ApplicationDBusAdaptor::addChildSurface - " << appId;
63 } else {
64 application->addPromptSurface(surface);
65 qDebug() << "ApplicationDBusAdaptor::addPromptSurface - " << appId;
66 }
67
68
62 return surfaceId;69 return surfaceId;
63}70}
6471
6572
=== modified file 'tests/mocks/Unity/Application/ApplicationDBusAdaptor.h'
--- tests/mocks/Unity/Application/ApplicationDBusAdaptor.h 2014-07-19 12:06:55 +0000
+++ tests/mocks/Unity/Application/ApplicationDBusAdaptor.h 2014-08-07 14:25:38 +0000
@@ -31,7 +31,7 @@
31 ApplicationDBusAdaptor(ApplicationManager* applicationManager);31 ApplicationDBusAdaptor(ApplicationManager* applicationManager);
3232
33public Q_SLOTS:33public Q_SLOTS:
34 quint32 addChildSurface(const QString& appId, const QString& surfaceImage);34 quint32 addPromptSurface(const QString& appId, const QString& surfaceImage);
35 void removeChildSurface(int surfaceId);35 void removeChildSurface(int surfaceId);
3636
37private:37private:
3838
=== modified file 'tests/mocks/Unity/Application/ApplicationInfo.cpp'
--- tests/mocks/Unity/Application/ApplicationInfo.cpp 2014-07-25 00:10:11 +0000
+++ tests/mocks/Unity/Application/ApplicationInfo.cpp 2014-08-07 14:25:38 +0000
@@ -98,3 +98,52 @@
98 Q_EMIT surfaceChanged(m_surface);98 Q_EMIT surfaceChanged(m_surface);
99 SurfaceManager::singleton()->registerSurface(m_surface);99 SurfaceManager::singleton()->registerSurface(m_surface);
100}100}
101
102void ApplicationInfo::removeSurface(MirSurfaceItem* surface)
103{
104 if (m_surface == surface) {
105 setSurface(nullptr);
106 } else if (m_promptSurfaces.contains(surface)) {
107 m_promptSurfaces.removeAll(surface);
108 surface->setApplication(nullptr);
109
110 Q_EMIT promptSurfacesChanged();
111 }
112}
113
114void ApplicationInfo::addPromptSurface(MirSurfaceItem* surface)
115{
116 if (surface == m_surface || m_promptSurfaces.contains(surface)) return;
117
118 surface->setApplication(this);
119 m_promptSurfaces.append(surface);
120 Q_EMIT promptSurfacesChanged();
121}
122
123QList<MirSurfaceItem*> ApplicationInfo::promptSurfaceList() const
124{
125 return m_promptSurfaces;
126}
127
128QQmlListProperty<MirSurfaceItem> ApplicationInfo::promptSurfaces()
129{
130 return QQmlListProperty<MirSurfaceItem>(this,
131 0,
132 ApplicationInfo::promptSurfaceCount,
133 ApplicationInfo::promptSurfaceAt);
134}
135
136int ApplicationInfo::promptSurfaceCount(QQmlListProperty<MirSurfaceItem> *prop)
137{
138 ApplicationInfo *p = qobject_cast<ApplicationInfo*>(prop->object);
139 return p->m_promptSurfaces.count();
140}
141
142MirSurfaceItem* ApplicationInfo::promptSurfaceAt(QQmlListProperty<MirSurfaceItem> *prop, int index)
143{
144 ApplicationInfo *p = qobject_cast<ApplicationInfo*>(prop->object);
145
146 if (index < 0 || index >= p->m_promptSurfaces.count())
147 return nullptr;
148 return p->m_promptSurfaces[index];
149}
101150
=== modified file 'tests/mocks/Unity/Application/ApplicationInfo.h'
--- tests/mocks/Unity/Application/ApplicationInfo.h 2014-07-25 00:10:11 +0000
+++ tests/mocks/Unity/Application/ApplicationInfo.h 2014-08-07 14:25:38 +0000
@@ -38,6 +38,7 @@
38 Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged)38 Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged)
39 Q_PROPERTY(Stage stage READ stage WRITE setStage NOTIFY stageChanged)39 Q_PROPERTY(Stage stage READ stage WRITE setStage NOTIFY stageChanged)
40 Q_PROPERTY(MirSurfaceItem* surface READ surface NOTIFY surfaceChanged)40 Q_PROPERTY(MirSurfaceItem* surface READ surface NOTIFY surfaceChanged)
41 Q_PROPERTY(QQmlListProperty<MirSurfaceItem> promptSurfaces READ promptSurfaces NOTIFY promptSurfacesChanged DESIGNABLE false)
4142
42 // Only exists in this fake implementation43 // Only exists in this fake implementation
4344
@@ -85,8 +86,15 @@
85 void setSurface(MirSurfaceItem* surface);86 void setSurface(MirSurfaceItem* surface);
86 MirSurfaceItem* surface() const { return m_surface; }87 MirSurfaceItem* surface() const { return m_surface; }
8788
89 void removeSurface(MirSurfaceItem* surface);
90
91 void addPromptSurface(MirSurfaceItem* surface);
92 QList<MirSurfaceItem*> promptSurfaceList() const;
93 QQmlListProperty<MirSurfaceItem> promptSurfaces();
94
88Q_SIGNALS:95Q_SIGNALS:
89 void surfaceChanged(MirSurfaceItem*);96 void surfaceChanged(MirSurfaceItem*);
97 void promptSurfacesChanged();
9098
91private Q_SLOTS:99private Q_SLOTS:
92 void onStateChanged(State state);100 void onStateChanged(State state);
@@ -94,10 +102,15 @@
94 void createSurface();102 void createSurface();
95103
96private:104private:
105 static int promptSurfaceCount(QQmlListProperty<MirSurfaceItem> *prop);
106 static MirSurfaceItem* promptSurfaceAt(QQmlListProperty<MirSurfaceItem> *prop, int index);
107
97 QQuickItem *m_parentItem;108 QQuickItem *m_parentItem;
98 MirSurfaceItem* m_surface;109 MirSurfaceItem* m_surface;
110 QList<MirSurfaceItem*> m_promptSurfaces;
99};111};
100112
101Q_DECLARE_METATYPE(ApplicationInfo*)113Q_DECLARE_METATYPE(ApplicationInfo*)
114Q_DECLARE_METATYPE(QQmlListProperty<MirSurfaceItem>)
102115
103#endif // APPLICATION_H116#endif // APPLICATION_H
104117
=== modified file 'tests/mocks/Unity/Application/ApplicationManager.cpp'
--- tests/mocks/Unity/Application/ApplicationManager.cpp 2014-07-29 11:41:39 +0000
+++ tests/mocks/Unity/Application/ApplicationManager.cpp 2014-08-07 14:25:38 +0000
@@ -51,6 +51,7 @@
51{51{
52 m_roleNames.insert(RoleSurface, "surface");52 m_roleNames.insert(RoleSurface, "surface");
53 m_roleNames.insert(RoleFullscreen, "fullscreen");53 m_roleNames.insert(RoleFullscreen, "fullscreen");
54 m_roleNames.insert(RoleApplication, "application");
5455
55 buildListOfAvailableApplications();56 buildListOfAvailableApplications();
5657
@@ -92,6 +93,8 @@
92 return QVariant::fromValue(app->surface());93 return QVariant::fromValue(app->surface());
93 case RoleFullscreen:94 case RoleFullscreen:
94 return app->fullscreen();95 return app->fullscreen();
96 case RoleApplication:
97 return QVariant::fromValue(app);
95 default:98 default:
96 return QVariant();99 return QVariant();
97 }100 }
98101
=== modified file 'tests/mocks/Unity/Application/ApplicationManager.h'
--- tests/mocks/Unity/Application/ApplicationManager.h 2014-07-25 00:10:11 +0000
+++ tests/mocks/Unity/Application/ApplicationManager.h 2014-08-07 14:25:38 +0000
@@ -53,6 +53,7 @@
53 enum MoreRoles {53 enum MoreRoles {
54 RoleSurface = RoleScreenshot+1,54 RoleSurface = RoleScreenshot+1,
55 RoleFullscreen,55 RoleFullscreen,
56 RoleApplication,
56 };57 };
57 enum Role {58 enum Role {
58 Dash, Default, Indicators, Notifications, Greeter, Launcher, OnScreenKeyboard,59 Dash, Default, Indicators, Notifications, Greeter, Launcher, OnScreenKeyboard,
5960
=== modified file 'tests/mocks/Unity/Application/MirSurfaceItem.cpp'
--- tests/mocks/Unity/Application/MirSurfaceItem.cpp 2014-07-25 05:39:21 +0000
+++ tests/mocks/Unity/Application/MirSurfaceItem.cpp 2014-08-07 14:25:38 +0000
@@ -54,7 +54,7 @@
54 m_parentSurface->removeChildSurface(this);54 m_parentSurface->removeChildSurface(this);
5555
56 if (m_application)56 if (m_application)
57 m_application->setSurface(nullptr);57 m_application->removeSurface(this);
58}58}
5959
60void MirSurfaceItem::paint(QPainter * painter)60void MirSurfaceItem::paint(QPainter * painter)
@@ -75,7 +75,7 @@
75 }75 }
7676
77 if (m_application) {77 if (m_application) {
78 m_application->setSurface(nullptr);78 m_application->removeSurface(this);
79 }79 }
80 if (!parent()) {80 if (!parent()) {
81 deleteLater();81 deleteLater();
8282
=== modified file 'tests/mocks/Unity/Application/MirSurfaceItem.h'
--- tests/mocks/Unity/Application/MirSurfaceItem.h 2014-07-25 06:50:09 +0000
+++ tests/mocks/Unity/Application/MirSurfaceItem.h 2014-08-07 14:25:38 +0000
@@ -117,5 +117,6 @@
117};117};
118118
119Q_DECLARE_METATYPE(MirSurfaceItem*)119Q_DECLARE_METATYPE(MirSurfaceItem*)
120Q_DECLARE_METATYPE(QList<MirSurfaceItem*>)
120121
121#endif // MIRSURFACEITEM_H122#endif // MIRSURFACEITEM_H
122123
=== modified file 'tests/mocks/Unity/CMakeLists.txt'
--- tests/mocks/Unity/CMakeLists.txt 2014-08-07 14:25:38 +0000
+++ tests/mocks/Unity/CMakeLists.txt 2014-08-05 12:06:16 +0000
@@ -7,7 +7,7 @@
7pkg_search_module(DEE dee-1.0 REQUIRED)7pkg_search_module(DEE dee-1.0 REQUIRED)
8pkg_search_module(GOBJECT gobject-2.0 REQUIRED)8pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
9pkg_search_module(DEEQT libdee-qt5 REQUIRED)9pkg_search_module(DEEQT libdee-qt5 REQUIRED)
10pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=4)10pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=3)
1111
12include_directories(12include_directories(
13 ${CMAKE_CURRENT_BINARY_DIR}13 ${CMAKE_CURRENT_BINARY_DIR}
@@ -23,14 +23,14 @@
23 fake_scope.cpp23 fake_scope.cpp
24 fake_scopes.cpp24 fake_scopes.cpp
25 fake_categories.cpp25 fake_categories.cpp
26 fake_navigation.cpp26 fake_department.cpp
27 fake_resultsmodel.cpp27 fake_resultsmodel.cpp
28 fake_previewmodel.cpp28 fake_previewmodel.cpp
29 fake_previewstack.cpp29 fake_previewstack.cpp
30 fake_previewwidgetmodel.cpp30 fake_previewwidgetmodel.cpp
31 fake_unity_plugin.cpp31 fake_unity_plugin.cpp
32 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/CategoriesInterface.h32 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/CategoriesInterface.h
33 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/NavigationInterface.h33 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/DepartmentInterface.h
34 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewModelInterface.h34 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewModelInterface.h
35 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewStackInterface.h35 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewStackInterface.h
36 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewWidgetModelInterface.h36 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewWidgetModelInterface.h
3737
=== modified file 'tests/mocks/Unity/Unity.qmltypes'
--- tests/mocks/Unity/Unity.qmltypes 2014-08-07 14:25:38 +0000
+++ tests/mocks/Unity/Unity.qmltypes 2014-07-10 10:59:08 +0000
@@ -24,12 +24,6 @@
24 Parameter { name: "categoryId"; type: "string" }24 Parameter { name: "categoryId"; type: "string" }
25 Parameter { name: "json"; type: "string" }25 Parameter { name: "json"; type: "string" }
26 }26 }
27 Method {
28 name: "data"
29 type: "QVariant"
30 Parameter { name: "row"; type: "int" }
31 Parameter { name: "role"; type: "int" }
32 }
33 }27 }
34 Component {28 Component {
35 name: "PreviewModel"29 name: "PreviewModel"
@@ -68,10 +62,6 @@
68 prototype: "unity::shell::scopes::ScopeInterface"62 prototype: "unity::shell::scopes::ScopeInterface"
69 exports: ["Unity/MockScope 0.2"]63 exports: ["Unity/MockScope 0.2"]
70 exportMetaObjectRevisions: [0]64 exportMetaObjectRevisions: [0]
71 Signal {
72 name: "performQuery"
73 Parameter { name: "query"; type: "string" }
74 }
75 Method {65 Method {
76 name: "setSearchInProgress"66 name: "setSearchInProgress"
77 Parameter { name: "inProg"; type: "bool" }67 Parameter { name: "inProg"; type: "bool" }
@@ -91,21 +81,18 @@
91 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }81 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
92 }82 }
93 Method {83 Method {
94 name: "getNavigation"84 name: "getDepartment"
95 type: "unity::shell::scopes::NavigationInterface*"85 type: "unity::shell::scopes::DepartmentInterface*"
96 Parameter { name: "navigationId"; type: "string" }86 Parameter { name: "id"; type: "string" }
97 }87 }
98 Method {88 Method {
99 name: "getAltNavigation"89 name: "loadDepartment"
100 type: "unity::shell::scopes::NavigationInterface*"90 Parameter { name: "id"; type: "string" }
101 Parameter { name: "altNavigationId"; type: "string" }91 }
102 }92 Method {
103 Method {93 name: "performQuery"
104 name: "setNavigationState"94 Parameter { name: "query"; type: "string" }
105 Parameter { name: "navigationId"; type: "string" }95 }
106 Parameter { name: "isAltNavigation"; type: "bool" }
107 }
108 Method { name: "refresh" }
109 }96 }
110 Component {97 Component {
111 name: "Scopes"98 name: "Scopes"
@@ -150,7 +137,6 @@
150 "RoleRawRendererTemplate": 3,137 "RoleRawRendererTemplate": 3,
151 "RoleRenderer": 4,138 "RoleRenderer": 4,
152 "RoleComponents": 5,139 "RoleComponents": 5,
153 "RoleHeaderLink": 6,
154 "RoleResults": 7,140 "RoleResults": 7,
155 "RoleCount": 8141 "RoleCount": 8
156 }142 }
@@ -171,28 +157,27 @@
171 }157 }
172 }158 }
173 Component {159 Component {
174 name: "unity::shell::scopes::NavigationInterface"160 name: "unity::shell::scopes::DepartmentInterface"
175 prototype: "QAbstractListModel"161 prototype: "QAbstractListModel"
176 exports: ["Unity/Navigation 0.2"]162 exports: ["Unity/Department 0.2"]
177 isCreatable: false163 isCreatable: false
178 exportMetaObjectRevisions: [0]164 exportMetaObjectRevisions: [0]
179 Enum {165 Enum {
180 name: "Roles"166 name: "Roles"
181 values: {167 values: {
182 "RoleNavigationId": 0,168 "RoleDepartmentId": 0,
183 "RoleLabel": 1,169 "RoleLabel": 1,
184 "RoleHasChildren": 2,170 "RoleHasChildren": 2,
185 "RoleIsActive": 3171 "RoleIsActive": 3
186 }172 }
187 }173 }
188 Property { name: "navigationId"; type: "string"; isReadonly: true }174 Property { name: "departmentId"; type: "string"; isReadonly: true }
189 Property { name: "label"; type: "string"; isReadonly: true }175 Property { name: "label"; type: "string"; isReadonly: true }
190 Property { name: "allLabel"; type: "string"; isReadonly: true }176 Property { name: "allLabel"; type: "string"; isReadonly: true }
191 Property { name: "parentNavigationId"; type: "string"; isReadonly: true }177 Property { name: "parentDepartmentId"; type: "string"; isReadonly: true }
192 Property { name: "parentLabel"; type: "string"; isReadonly: true }178 Property { name: "parentLabel"; type: "string"; isReadonly: true }
193 Property { name: "loaded"; type: "bool"; isReadonly: true }179 Property { name: "loaded"; type: "bool"; isReadonly: true }
194 Property { name: "isRoot"; type: "bool"; isReadonly: true }180 Property { name: "isRoot"; type: "bool"; isReadonly: true }
195 Property { name: "hidden"; type: "bool"; isReadonly: true }
196 Property { name: "count"; type: "int"; isReadonly: true }181 Property { name: "count"; type: "int"; isReadonly: true }
197 }182 }
198 Component {183 Component {
@@ -262,8 +247,7 @@
262 "RoleEmblem": 8,247 "RoleEmblem": 8,
263 "RoleSummary": 9,248 "RoleSummary": 9,
264 "RoleAttributes": 10,249 "RoleAttributes": 10,
265 "RoleBackground": 11,250 "RoleBackground": 11
266 "RoleOverlayColor": 12
267 }251 }
268 }252 }
269 Property { name: "categoryId"; type: "string" }253 Property { name: "categoryId"; type: "string" }
@@ -275,22 +259,13 @@
275 exports: ["Unity/Scope 0.2"]259 exports: ["Unity/Scope 0.2"]
276 isCreatable: false260 isCreatable: false
277 exportMetaObjectRevisions: [0]261 exportMetaObjectRevisions: [0]
278 Enum {
279 name: "Status"
280 values: {
281 "Okay": 0,
282 "NoInternet": 1,
283 "NoLocationData": 2,
284 "Unknown": 3
285 }
286 }
287 Property { name: "id"; type: "string"; isReadonly: true }262 Property { name: "id"; type: "string"; isReadonly: true }
288 Property { name: "name"; type: "string"; isReadonly: true }263 Property { name: "name"; type: "string"; isReadonly: true }
289 Property { name: "iconHint"; type: "string"; isReadonly: true }264 Property { name: "iconHint"; type: "string"; isReadonly: true }
290 Property { name: "description"; type: "string"; isReadonly: true }265 Property { name: "description"; type: "string"; isReadonly: true }
291 Property { name: "searchHint"; type: "string"; isReadonly: true }266 Property { name: "searchHint"; type: "string"; isReadonly: true }
292 Property { name: "searchInProgress"; type: "bool"; isReadonly: true }267 Property { name: "searchInProgress"; type: "bool"; isReadonly: true }
293 Property { name: "favorite"; type: "bool" }268 Property { name: "visible"; type: "bool"; isReadonly: true }
294 Property { name: "shortcut"; type: "string"; isReadonly: true }269 Property { name: "shortcut"; type: "string"; isReadonly: true }
295 Property {270 Property {
296 name: "categories"271 name: "categories"
@@ -298,27 +273,13 @@
298 isReadonly: true273 isReadonly: true
299 isPointer: true274 isPointer: true
300 }275 }
301 Property {
302 name: "settings"
303 type: "unity::shell::scopes::SettingsModelInterface"
304 isReadonly: true
305 isPointer: true
306 }
307 Property { name: "searchQuery"; type: "string" }276 Property { name: "searchQuery"; type: "string" }
308 Property { name: "noResultsHint"; type: "string" }277 Property { name: "noResultsHint"; type: "string" }
309 Property { name: "formFactor"; type: "string" }278 Property { name: "formFactor"; type: "string" }
310 Property { name: "isActive"; type: "bool" }279 Property { name: "isActive"; type: "bool" }
311 Property { name: "currentNavigationId"; type: "string"; isReadonly: true }280 Property { name: "currentDepartmentId"; type: "string"; isReadonly: true }
312 Property { name: "hasNavigation"; type: "bool"; isReadonly: true }281 Property { name: "hasDepartments"; type: "bool"; isReadonly: true }
313 Property { name: "currentAltNavigationId"; type: "string"; isReadonly: true }
314 Property { name: "hasAltNavigation"; type: "bool"; isReadonly: true }
315 Property { name: "customizations"; type: "QVariantMap"; isReadonly: true }282 Property { name: "customizations"; type: "QVariantMap"; isReadonly: true }
316 Property {
317 name: "status"
318 type: "unity::shell::scopes::ScopeInterface::Status"
319 isReadonly: true
320 }
321 Signal { name: "detailsChanged" }
322 Signal { name: "showDash" }283 Signal { name: "showDash" }
323 Signal { name: "hideDash" }284 Signal { name: "hideDash" }
324 Signal {285 Signal {
@@ -337,6 +298,10 @@
337 name: "openScope"298 name: "openScope"
338 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }299 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
339 }300 }
301 Signal {
302 name: "activateApplication"
303 Parameter { name: "desktop"; type: "string" }
304 }
340 Method {305 Method {
341 name: "activate"306 name: "activate"
342 Parameter { name: "result"; type: "QVariant" }307 Parameter { name: "result"; type: "QVariant" }
@@ -352,25 +317,14 @@
352 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }317 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
353 }318 }
354 Method {319 Method {
355 name: "getNavigation"320 name: "getDepartment"
356 type: "unity::shell::scopes::NavigationInterface*"321 type: "unity::shell::scopes::DepartmentInterface*"
357 Parameter { name: "navigationId"; type: "string" }322 Parameter { name: "departmentId"; type: "string" }
358 }323 }
359 Method {324 Method {
360 name: "getAltNavigation"325 name: "loadDepartment"
361 type: "unity::shell::scopes::NavigationInterface*"326 Parameter { name: "departmentId"; type: "string" }
362 Parameter { name: "altNavigationId"; type: "string" }327 }
363 }
364 Method {
365 name: "setNavigationState"
366 Parameter { name: "navId"; type: "string" }
367 Parameter { name: "altNavigation"; type: "bool" }
368 }
369 Method {
370 name: "performQuery"
371 Parameter { name: "cannedQuery"; type: "string" }
372 }
373 Method { name: "refresh" }
374 }328 }
375 Component {329 Component {
376 name: "unity::shell::scopes::ScopesInterface"330 name: "unity::shell::scopes::ScopesInterface"
@@ -380,17 +334,11 @@
380 values: {334 values: {
381 "RoleScope": 0,335 "RoleScope": 0,
382 "RoleId": 1,336 "RoleId": 1,
383 "RoleTitle": 2337 "RoleVisible": 2,
338 "RoleTitle": 3
384 }339 }
385 }340 }
386 Property { name: "loaded"; type: "bool"; isReadonly: true }341 Property { name: "loaded"; type: "bool"; isReadonly: true }
387 Property { name: "count"; type: "int"; isReadonly: true }
388 Property {
389 name: "overviewScope"
390 type: "unity::shell::scopes::ScopeInterface"
391 isReadonly: true
392 isPointer: true
393 }
394 Method {342 Method {
395 name: "getScope"343 name: "getScope"
396 type: "unity::shell::scopes::ScopeInterface*"344 type: "unity::shell::scopes::ScopeInterface*"
397345
=== renamed file 'tests/mocks/Unity/fake_navigation.cpp' => 'tests/mocks/Unity/fake_department.cpp'
--- tests/mocks/Unity/fake_navigation.cpp 2014-08-07 14:25:38 +0000
+++ tests/mocks/Unity/fake_department.cpp 2014-06-18 13:48:32 +0000
@@ -14,15 +14,14 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include "fake_navigation.h"17#include "fake_department.h"
1818
19#include "fake_scope.h"19#include "fake_scope.h"
2020
21#include <QDebug>
22#include <QTimer>21#include <QTimer>
2322
24Navigation::Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)23Department::Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)
25 : m_navigationId(navigationId)24 : m_departmentId(departmentId)
26 , m_label(label)25 , m_label(label)
27 , m_allLabel(allLabel)26 , m_allLabel(allLabel)
28 , m_parentId(parentId)27 , m_parentId(parentId)
@@ -31,87 +30,96 @@
31 , m_scope(scope)30 , m_scope(scope)
32{31{
33 QTimer::singleShot(1500, this, SLOT(slotLoaded()));32 QTimer::singleShot(1500, this, SLOT(slotLoaded()));
34 connect(scope, SIGNAL(currentNavigationIdChanged()), this, SLOT(slotCurrentNavigationChanged()));33 connect(scope, SIGNAL(currentDepartmentIdChanged()), this, SLOT(slotCurrentDepartmentChanged()));
35}34}
3635
37QString Navigation::navigationId() const36QString Department::departmentId() const
38{37{
39 return m_navigationId;38 return m_departmentId;
40}39}
4140
42QString Navigation::label() const41QString Department::label() const
43{42{
44 return m_label;43 return m_label;
45}44}
4645
47QString Navigation::allLabel() const46QString Department::allLabel() const
48{47{
49 return m_allLabel;48 return m_allLabel;
50}49}
5150
52QString Navigation::parentNavigationId() const51QString Department::parentDepartmentId() const
53{52{
54 return m_parentId;53 return m_parentId;
55}54}
5655
57QString Navigation::parentLabel() const56QString Department::parentLabel() const
58{57{
59 return m_parentLabel;58 return m_parentLabel;
60}59}
6160
62void Navigation::slotLoaded()61void Department::slotLoaded()
63{62{
64 m_loaded = true;63 m_loaded = true;
65 Q_EMIT loadedChanged();64 Q_EMIT loadedChanged();
66}65}
6766
68bool Navigation::loaded() const67bool Department::loaded() const
69{68{
70 return m_loaded;69 return m_loaded;
71}70}
7271
73int Navigation::count() const72int Department::count() const
74{73{
75 return rowCount();74 return rowCount();
76}75}
7776
78bool Navigation::isRoot() const77bool Department::isRoot() const
79{78{
80 return m_navigationId == "root" || m_navigationId == "altroot";79 return m_departmentId == "root";
81}80}
8281
83bool Navigation::hidden() const82int Department::rowCount(const QModelIndex & /*parent*/) const
84{83{
85 return m_navigationId == "altroot";84 if (!m_loaded || m_departmentId.startsWith("child") || m_departmentId == "middle3")
86}
87
88int Navigation::rowCount(const QModelIndex & /*parent*/) const
89{
90 if (!m_loaded || m_navigationId.startsWith("child") || m_navigationId == "middle3")
91 return 0;85 return 0;
92 else86 else
93 return 8;87 return 8;
94}88}
9589
96QVariant Navigation::data(const QModelIndex &index, int role) const90QHash<int, QByteArray> Department::roleNames() const
91{
92 QHash<int, QByteArray> res;
93 res[RoleDepartmentId] = "departmentId";
94 res[RoleLabel] = "label";
95 res[RoleHasChildren] = "hasChildren";
96 res[RoleIsActive] = "isActive";
97 return res;
98}
99
100QVariant Department::data(const QModelIndex &index, int role) const
97{101{
98 switch (role) {102 switch (role) {
99 case RoleNavigationId:103 case RoleDepartmentId:
100 if (m_navigationId == "root")104 if (m_departmentId == "root")
101 return QString("middle%1").arg(index.row());105 return QString("middle%1").arg(index.row());
102 else if (m_navigationId.startsWith("middle"))106 else if (m_departmentId.startsWith("middle"))
103 return QString("child%1%2").arg(m_navigationId).arg(index.row());107 return QString("child%1%2").arg(m_departmentId).arg(index.row());
108 break;
104 case RoleLabel:109 case RoleLabel:
105 return QString("%1Child%2").arg(m_navigationId).arg(index.row());110 return QString("%1Child%2").arg(m_departmentId).arg(index.row());
111 break;
106 case RoleHasChildren:112 case RoleHasChildren:
107 return m_navigationId == "root" && index.row() != 3;113 return m_departmentId == "root" && index.row() != 3;
114 break;
108 case RoleIsActive:115 case RoleIsActive:
109 return m_scope->currentNavigationId() == data(index, RoleNavigationId);116 return m_scope->currentDepartmentId() == data(index, RoleDepartmentId);
117 break;
110 }118 }
111 return QVariant();119 return QVariant();
112}120}
113121
114void Navigation::slotCurrentNavigationChanged()122void Department::slotCurrentDepartmentChanged()
115{123{
116 // This is wasteful, should only emit it if really something changed in this124 // This is wasteful, should only emit it if really something changed in this
117 // deparment, but this is a mock, so no need to optimize125 // deparment, but this is a mock, so no need to optimize
118126
=== renamed file 'tests/mocks/Unity/fake_navigation.h' => 'tests/mocks/Unity/fake_department.h'
--- tests/mocks/Unity/fake_navigation.h 2014-08-07 14:25:38 +0000
+++ tests/mocks/Unity/fake_department.h 2014-05-29 10:25:21 +0000
@@ -14,48 +14,48 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#ifndef FAKE_NAVIGATION_H17#ifndef FAKE_DEPARTMENT_H
18#define FAKE_NAVIGATION_H18#define FAKE_DEPARTMENT_H
1919
20#include <unity/shell/scopes/NavigationInterface.h>20#include <unity/shell/scopes/DepartmentInterface.h>
2121
22class Scope;22class Scope;
2323
24class Navigation : public unity::shell::scopes::NavigationInterface24class Department : public unity::shell::scopes::DepartmentInterface
25{25{
26 Q_OBJECT26 Q_OBJECT
2727
28public:28public:
29 Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);29 Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);
3030
31 QString navigationId() const override;31 QString departmentId() const override;
32 QString label() const override;32 QString label() const override;
33 QString allLabel() const override;33 QString allLabel() const override;
34 QString parentNavigationId() const override;34 QString parentDepartmentId() const override;
35 QString parentLabel() const override;35 QString parentLabel() const override;
36 bool loaded() const override;36 bool loaded() const override;
37 int count() const override;
37 bool isRoot() const override;38 bool isRoot() const override;
38 bool hidden() const override;
39 int count() const override;
4039
41 int rowCount(const QModelIndex &parent = QModelIndex()) const override;40 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
41 QHash<int, QByteArray> roleNames() const;
42 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;42 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
4343
44public Q_SLOTS:44public Q_SLOTS:
45 void slotCurrentNavigationChanged();45 void slotCurrentDepartmentChanged();
4646
47private Q_SLOTS:47private Q_SLOTS:
48 void slotLoaded();48 void slotLoaded();
4949
50private:50private:
51 QString m_navigationId;51 QString m_departmentId;
52 QString m_label;52 QString m_label;
53 QString m_allLabel;53 QString m_allLabel;
54 QString m_parentId;54 QString m_parentId;
55 QString m_parentLabel;55 QString m_parentLabel;
56 bool m_loaded;56 bool m_loaded;
57 QString m_currentNavigation;57 QString m_currentDepartment;
58 Scope *m_scope;58 Scope *m_scope;
59};59};
6060
61#endif // FAKE_NAVIGATION_H61#endif // FAKE_DEPARTMENT_H
6262
=== modified file 'tests/mocks/Unity/fake_scope.cpp'
--- tests/mocks/Unity/fake_scope.cpp 2014-08-07 14:25:38 +0000
+++ tests/mocks/Unity/fake_scope.cpp 2014-07-24 20:40:57 +0000
@@ -14,26 +14,24 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include <QDebug>
18#include <QUrl>17#include <QUrl>
1918
20#include "fake_scope.h"19#include "fake_scope.h"
21#include "fake_navigation.h"20#include "fake_department.h"
22#include "fake_resultsmodel.h"21#include "fake_resultsmodel.h"
2322
24Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)23Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
25{24{
26}25}
2726
28Scope::Scope(QString const& id, QString const& name, bool favorite, QObject* parent, int categories)27Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent, int categories)
29 : unity::shell::scopes::ScopeInterface(parent)28 : unity::shell::scopes::ScopeInterface(parent)
30 , m_id(id)29 , m_id(id)
31 , m_name(name)30 , m_name(name)
31 , m_visible(visible)
32 , m_searching(false)32 , m_searching(false)
33 , m_favorite(favorite)
34 , m_isActive(false)33 , m_isActive(false)
35 , m_currentNavigationId("root")34 , m_currentDeparment("root")
36 , m_currentAltNavigationId("altroot")
37 , m_previewRendererName("preview-generic")35 , m_previewRendererName("preview-generic")
38 , m_categories(new Categories(categories, this))36 , m_categories(new Categories(categories, this))
39{37{
@@ -79,11 +77,6 @@
79 return m_searching;77 return m_searching;
80}78}
8179
82bool Scope::favorite() const
83{
84 return m_favorite;
85}
86
87unity::shell::scopes::CategoriesInterface* Scope::categories() const80unity::shell::scopes::CategoriesInterface* Scope::categories() const
88{81{
89 return m_categories;82 return m_categories;
@@ -104,6 +97,11 @@
104 return m_formFactor;97 return m_formFactor;
105}98}
10699
100bool Scope::visible() const
101{
102 return m_visible;
103}
104
107bool Scope::isActive() const105bool Scope::isActive() const
108{106{
109 return m_isActive;107 return m_isActive;
@@ -133,13 +131,6 @@
133 }131 }
134}132}
135133
136void Scope::setFavorite(const bool favorite)
137{
138 if (favorite != m_favorite) {
139 m_favorite = favorite;
140 Q_EMIT favoriteChanged();
141 }
142}
143void Scope::setSearchInProgress(const bool inProg)134void Scope::setSearchInProgress(const bool inProg)
144{135{
145 if (inProg != m_searching) {136 if (inProg != m_searching) {
@@ -179,29 +170,14 @@
179 qFatal("Scope::closeScope is not implemented");170 qFatal("Scope::closeScope is not implemented");
180}171}
181172
182QString Scope::currentNavigationId() const173QString Scope::currentDepartmentId() const
183{174{
184 return m_currentNavigationId;175 return m_currentDeparment;
185}176}
186177
187bool Scope::hasNavigation() const178bool Scope::hasDepartments() const
188{179{
189 return true;180 return true;
190}
191
192QString Scope::currentAltNavigationId() const
193{
194 return m_currentAltNavigationId;
195}
196
197bool Scope::hasAltNavigation() const
198{
199 return true;
200}
201
202Scope::Status Scope::status() const
203{
204 return Status::Okay;
205}181}
206182
207QVariantMap Scope::customizations() const183QVariantMap Scope::customizations() const
@@ -220,12 +196,7 @@
220 return m;196 return m;
221}197}
222198
223void Scope::refresh()199unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
224{
225 qDebug() << "Scope::refresh is currently not implmented in the fake scopes plugin";
226}
227
228unity::shell::scopes::NavigationInterface* Scope::getNavigation(const QString& id)
229{200{
230 if (id.isEmpty())201 if (id.isEmpty())
231 return nullptr;202 return nullptr;
@@ -239,30 +210,11 @@
239 parentId = id.mid(5, 7);210 parentId = id.mid(5, 7);
240 parentLabel = parentId;211 parentLabel = parentId;
241 }212 }
242 return new Navigation(id, id, "all"+id, parentId, parentLabel, this);213 return new Department(id, id, "all"+id, parentId, parentLabel, this);
243}214}
244215
245unity::shell::scopes::NavigationInterface* Scope::getAltNavigation(QString const& id)216void Scope::loadDepartment(const QString& id)
246{217{
247 if (id.isEmpty())218 m_currentDeparment = id;
248 return nullptr;219 Q_EMIT currentDepartmentIdChanged();
249
250 QString parentId;
251 QString parentLabel;
252 if (id.startsWith("altmiddle")) {
253 parentId = "altroot";
254 parentLabel = "altroot";
255 }
256 return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
257}
258
259void Scope::setNavigationState(const QString &navigationId, bool isAltNavigation)
260{
261 if (isAltNavigation) {
262 m_currentAltNavigationId = navigationId;
263 Q_EMIT currentAltNavigationIdChanged();
264 } else {
265 m_currentNavigationId = navigationId;
266 Q_EMIT currentNavigationIdChanged();
267 }
268}220}
269221
=== modified file 'tests/mocks/Unity/fake_scope.h'
--- tests/mocks/Unity/fake_scope.h 2014-08-07 14:25:38 +0000
+++ tests/mocks/Unity/fake_scope.h 2014-07-11 16:39:33 +0000
@@ -30,7 +30,7 @@
3030
31public:31public:
32 Scope(QObject* parent = 0);32 Scope(QObject* parent = 0);
33 Scope(QString const& id, QString const& name, bool favorite, QObject* parent = 0, int categories = 20);33 Scope(QString const& id, QString const& name, bool visible, QObject* parent = 0, int categories = 20);
3434
35 /* getters */35 /* getters */
36 QString id() const override;36 QString id() const override;
@@ -38,9 +38,9 @@
38 QString iconHint() const override;38 QString iconHint() const override;
39 QString description() const override;39 QString description() const override;
40 QString searchHint() const override;40 QString searchHint() const override;
41 bool visible() const override;
41 QString shortcut() const override;42 QString shortcut() const override;
42 bool searchInProgress() const override;43 bool searchInProgress() const override;
43 bool favorite() const override;
44 unity::shell::scopes::CategoriesInterface* categories() const override;44 unity::shell::scopes::CategoriesInterface* categories() const override;
45 QString searchQuery() const override;45 QString searchQuery() const override;
46 QString noResultsHint() const override;46 QString noResultsHint() const override;
@@ -53,7 +53,6 @@
53 void setNoResultsHint(const QString& hint) override;53 void setNoResultsHint(const QString& hint) override;
54 void setFormFactor(const QString& form_factor) override;54 void setFormFactor(const QString& form_factor) override;
55 void setActive(const bool) override;55 void setActive(const bool) override;
56 void setFavorite(const bool) override;
57 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits56 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
5857
59 Q_INVOKABLE void activate(QVariant const& result) override;58 Q_INVOKABLE void activate(QVariant const& result) override;
@@ -61,20 +60,14 @@
61 Q_INVOKABLE void cancelActivation() override;60 Q_INVOKABLE void cancelActivation() override;
62 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;61 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
6362
64 QString currentNavigationId() const override;63 QString currentDepartmentId() const override;
65 bool hasNavigation() const override;64 bool hasDepartments() const override;
66 QString currentAltNavigationId() const override;65 Q_INVOKABLE unity::shell::scopes::DepartmentInterface* getDepartment(const QString& id) override;
67 bool hasAltNavigation() const override;66 Q_INVOKABLE void loadDepartment(const QString& id) override;
68 Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) override;
69 Q_INVOKABLE unity::shell::scopes::NavigationInterface* getAltNavigation(QString const& altNavigationId) override;
70 Q_INVOKABLE void setNavigationState(const QString &navigationId, bool isAltNavigation) override;
71 Q_SIGNAL void performQuery(const QString& query) override;67 Q_SIGNAL void performQuery(const QString& query) override;
7268
73 Status status() const override;
74 QVariantMap customizations() const override;69 QVariantMap customizations() const override;
7570
76 Q_INVOKABLE void refresh() override;
77
78protected:71protected:
7972
80 QString m_id;73 QString m_id;
@@ -84,11 +77,10 @@
84 QString m_searchQuery;77 QString m_searchQuery;
85 QString m_noResultsHint;78 QString m_noResultsHint;
86 QString m_formFactor;79 QString m_formFactor;
80 bool m_visible;
87 bool m_searching;81 bool m_searching;
88 bool m_favorite;
89 bool m_isActive;82 bool m_isActive;
90 QString m_currentNavigationId;83 QString m_currentDeparment;
91 QString m_currentAltNavigationId;
9284
93 QString m_previewRendererName;85 QString m_previewRendererName;
9486
9587
=== modified file 'tests/mocks/Unity/fake_scopes.cpp'
--- tests/mocks/Unity/fake_scopes.cpp 2014-08-07 14:25:38 +0000
+++ tests/mocks/Unity/fake_scopes.cpp 2014-07-25 13:25:45 +0000
@@ -32,11 +32,6 @@
32 timer.setSingleShot(true);32 timer.setSingleShot(true);
33 timer.setInterval(100);33 timer.setInterval(100);
34 QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));34 QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));
35
36 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
37 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
38 QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
39
40 load();35 load();
41}36}
4237
@@ -97,6 +92,8 @@
97 return QVariant::fromValue(scope);92 return QVariant::fromValue(scope);
98 } else if (role == Scopes::RoleId) {93 } else if (role == Scopes::RoleId) {
99 return QVariant::fromValue(scope->id());94 return QVariant::fromValue(scope->id());
95 } else if (role == Scopes::RoleVisible) {
96 return QVariant::fromValue(scope->visible());
100 } else if (role == Scopes::RoleTitle) {97 } else if (role == Scopes::RoleTitle) {
101 return QVariant::fromValue(scope->name());98 return QVariant::fromValue(scope->name());
102 } else {99 } else {
@@ -128,11 +125,6 @@
128 return m_loaded;125 return m_loaded;
129}126}
130127
131int Scopes::count() const
132{
133 return rowCount();
134}
135
136unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const128unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
137{129{
138 return nullptr;130 return nullptr;
139131
=== modified file 'tests/mocks/Unity/fake_scopes.h'
--- tests/mocks/Unity/fake_scopes.h 2014-08-07 14:25:38 +0000
+++ tests/mocks/Unity/fake_scopes.h 2014-07-25 13:25:45 +0000
@@ -50,7 +50,6 @@
50 QModelIndex parent ( const QModelIndex & index ) const;50 QModelIndex parent ( const QModelIndex & index ) const;
5151
52 bool loaded() const override;52 bool loaded() const override;
53 int count() const override;
54 unity::shell::scopes::ScopeInterface* overviewScope() const override;53 unity::shell::scopes::ScopeInterface* overviewScope() const override;
5554
56private Q_SLOTS:55private Q_SLOTS:
5756
=== modified file 'tests/mocks/Unity/fake_unity_plugin.cpp'
--- tests/mocks/Unity/fake_unity_plugin.cpp 2014-08-07 14:25:38 +0000
+++ tests/mocks/Unity/fake_unity_plugin.cpp 2014-07-08 11:26:44 +0000
@@ -22,7 +22,7 @@
22// local22// local
23#include "fake_scopes.h"23#include "fake_scopes.h"
24#include "fake_categories.h"24#include "fake_categories.h"
25#include "fake_navigation.h"25#include "fake_department.h"
26#include "fake_previewmodel.h"26#include "fake_previewmodel.h"
27#include "fake_previewwidgetmodel.h"27#include "fake_previewwidgetmodel.h"
28#include "fake_resultsmodel.h"28#include "fake_resultsmodel.h"
@@ -43,7 +43,7 @@
43 qmlRegisterType<Scopes>(uri, 0, 2, "Scopes");43 qmlRegisterType<Scopes>(uri, 0, 2, "Scopes");
44 qmlRegisterType<Scope>(uri, 0, 2, "MockScope");44 qmlRegisterType<Scope>(uri, 0, 2, "MockScope");
45 qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML.");45 qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML.");
46 qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML.");46 qmlRegisterUncreatableType<unity::shell::scopes::DepartmentInterface>(uri, 0, 2, "Department", "Can't create Department object in QML.");
47 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML.");47 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML.");
48 qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance.");48 qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance.");
49 qmlRegisterUncreatableType<ResultsModel>(uri, 0, 2, "ResultsModel", "Can't create ResultsModel object in QML.");49 qmlRegisterUncreatableType<ResultsModel>(uri, 0, 2, "ResultsModel", "Can't create ResultsModel object in QML.");
5050
=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
--- tests/qmltests/Dash/tst_Dash.qml 2014-08-07 14:25:38 +0000
+++ tests/qmltests/Dash/tst_Dash.qml 2014-07-29 11:35:10 +0000
@@ -64,10 +64,10 @@
6464
65 function get_scope_data() {65 function get_scope_data() {
66 return [66 return [
67 { tag: "MockScope1", visualIndex: 0 },67 { tag: "MockScope1", visualIndex: 0, shouldBeVisible: true },
68 { tag: "MockScope2", visualIndex: 1 },68 { tag: "MockScope2", visualIndex: -1, shouldBeVisible: false },
69 { tag: "clickscope", visualIndex: 2 },69 { tag: "clickscope", visualIndex: 1, shouldBeVisible: true },
70 { tag: "MockScope5", visualIndex: 3 },70 { tag: "MockScope5", visualIndex: 2, shouldBeVisible: true },
71 ]71 ]
72 }72 }
7373
@@ -76,6 +76,10 @@
76 }76 }
7777
78 function test_show_scope_on_load(data) {78 function test_show_scope_on_load(data) {
79 if (data.shouldBeVisible == false) {
80 console.log("Not testing " + data.tag + ": not visible");
81 return;
82 }
79 var dashContentList = findChild(dash, "dashContentList");83 var dashContentList = findChild(dash, "dashContentList");
8084
81 dash.showScopeOnLoaded = data.tag85 dash.showScopeOnLoaded = data.tag
@@ -83,7 +87,7 @@
83 tryCompare(dashContentList, "count", 0);87 tryCompare(dashContentList, "count", 0);
84 scopes.load();88 scopes.load();
85 tryCompare(scopes, "loaded", true);89 tryCompare(scopes, "loaded", true);
86 tryCompare(dashContentList, "count", 5);90 tryCompare(dashContentList, "count", 4);
8791
88 verify(dashContentList != undefined);92 verify(dashContentList != undefined);
89 tryCompare(dashContentList, "currentIndex", data.visualIndex);93 tryCompare(dashContentList, "currentIndex", data.visualIndex);
9094
=== modified file 'tests/qmltests/Dash/tst_DashContent.qml'
--- tests/qmltests/Dash/tst_DashContent.qml 2014-08-07 14:25:38 +0000
+++ tests/qmltests/Dash/tst_DashContent.qml 2014-07-21 13:28:35 +0000
@@ -43,6 +43,9 @@
43 id: dashContent43 id: dashContent
44 anchors.fill: parent44 anchors.fill: parent
4545
46 model: SortFilterProxyModel {
47 model: scopesModel
48 }
46 scopes : scopesModel49 scopes : scopesModel
47 }50 }
4851
@@ -265,119 +268,117 @@
265 verify(carouselLV.tileWidth / carouselLV.tileHeight == cardTool.components["art"]["aspect-ratio"]);268 verify(carouselLV.tileWidth / carouselLV.tileHeight == cardTool.components["art"]["aspect-ratio"]);
266 }269 }
267270
268 function test_navigations() {271 function test_departments() {
269 var dashContentList = findChild(dashContent, "dashContentList");272 var dashDepartments = findChild(dashContent, "dashDepartments");
270 tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);273 compare(dashDepartments.visible, true);
271 var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");274 compare(dashDepartments.showList, false);
272 tryCompare(dashNavigation, "visible", true);275 waitForRendering(dashDepartments);
273 compare(dashNavigation.showList, false);276 mouseClick(dashDepartments, 0, 0);
274 waitForRendering(dashNavigation);277 compare(dashDepartments.showList, true);
275 mouseClick(dashNavigation, 0, 0);278
276 compare(dashNavigation.showList, true);279 var departmentListView = findChild(dashDepartments, "departmentListView");
277280 compare(departmentListView.count, 1);
278 var navigationListView = findChild(dashNavigation, "navigationListView");281 tryCompare(departmentListView.currentItem.department, "loaded", true);
279 compare(navigationListView.count, 1);282
280 tryCompare(navigationListView.currentItem.navigation, "loaded", true);283 waitForRendering(departmentListView);
281284 waitForRendering(departmentListView.currentItem);
282 waitForRendering(navigationListView);285
283 waitForRendering(navigationListView.currentItem);286 var allButton = findChild(dashDepartments, "allButton");
284287 compare(allButton.visible, false);
285 var allButton = findChild(dashNavigation, "allButton");288
286 compare(allButton.visible, false);289 var department = findChild(dashDepartments, "department0child3");
287290 mouseClick(department, 0, 0);
288 var navigation = findChild(dashNavigation, "navigation0child3");291 compare(dashDepartments.showList, false);
289 mouseClick(navigation, 0, 0);292 tryCompare(dashDepartments.currentDepartment, "departmentId", "middle3");
290 compare(dashNavigation.showList, false);293 tryCompare(departmentListView.currentItem.department, "departmentId", "root");
291 tryCompare(dashNavigation.currentNavigation, "navigationId", "middle3");294
292 tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");295 mouseClick(dashDepartments, 0, 0);
293296 compare(dashDepartments.showList, true);
294 mouseClick(dashNavigation, 0, 0);297 waitForRendering(departmentListView);
295 compare(dashNavigation.showList, true);298 waitForRendering(departmentListView.currentItem);
296 waitForRendering(navigationListView);299 compare(allButton.visible, true);
297 waitForRendering(navigationListView.currentItem);300
298 compare(allButton.visible, true);301 mouseClick(allButton, 0, 0);
299302 compare(dashDepartments.showList, false);
300 mouseClick(allButton, 0, 0);303 tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
301 compare(dashNavigation.showList, false);304 tryCompare(departmentListView.currentItem.department, "departmentId", "root");
302 tryCompare(dashNavigation.currentNavigation, "navigationId", "root");305
303 tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");306 mouseClick(dashDepartments, 0, 0);
304307 compare(dashDepartments.showList, true);
305 mouseClick(dashNavigation, 0, 0);308 waitForRendering(departmentListView);
306 compare(dashNavigation.showList, true);309 waitForRendering(departmentListView.currentItem);
307 waitForRendering(navigationListView);310 compare(allButton.visible, false);
308 waitForRendering(navigationListView.currentItem);311
309 compare(allButton.visible, false);312 department = findChild(dashDepartments, "department0child2");
310313 mouseClick(department, 0, 0);
311 navigation = findChild(dashNavigation, "navigation0child2");314 compare(dashDepartments.showList, true);
312 mouseClick(navigation, 0, 0);315 tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
313 compare(dashNavigation.showList, true);316 tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
314 tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");317
315 tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");318 var departmentList1 = findChild(dashDepartments, "department1");
316319 allButton = findChild(departmentList1, "allButton");
317 var navigationList1 = findChild(dashNavigation, "navigation1");320 var backButton = findChild(findChild(departmentList1, "department1"), "backButton");
318 allButton = findChild(navigationList1, "allButton");321 compare(allButton.visible, true);
319 var backButton = findChild(findChild(navigationList1, "navigation1"), "backButton");322 compare(backButton.visible, true);
320 compare(allButton.visible, true);323
321 compare(backButton.visible, true);324 tryCompare(departmentListView, "contentX", departmentList1.x);
322325 waitForRendering(departmentListView);
323 tryCompare(navigationListView, "contentX", navigationList1.x);326 mouseClick(allButton, 0, 0);
324 waitForRendering(navigationListView);327 compare(dashDepartments.showList, false);
325 mouseClick(allButton, 0, 0);328 tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
326 compare(dashNavigation.showList, false);329 tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
327 tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");330
328 tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");331 mouseClick(dashDepartments, 0, 0);
329332 compare(dashDepartments.showList, true);
330 mouseClick(dashNavigation, 0, 0);333 waitForRendering(departmentListView);
331 compare(dashNavigation.showList, true);334 waitForRendering(departmentListView.currentItem);
332 waitForRendering(navigationListView);335 compare(allButton.visible, true);
333 waitForRendering(navigationListView.currentItem);336 compare(backButton.visible, true);
334 compare(allButton.visible, true);337
335 compare(backButton.visible, true);338 tryCompare(departmentList1.department, "loaded", true);
336339 department = findChild(dashDepartments, "department1child2");
337 tryCompare(navigationList1.navigation, "loaded", true);340 mouseClick(department, 0, 0);
338 navigation = findChild(dashNavigation, "navigation1child2");341 compare(dashDepartments.showList, false);
339 mouseClick(navigation, 0, 0);342 tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle22");
340 compare(dashNavigation.showList, false);343 tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
341 tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle22");344
342 tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");345 mouseClick(dashDepartments, 0, 0);
343346 compare(dashDepartments.showList, true);
344 mouseClick(dashNavigation, 0, 0);347 waitForRendering(departmentListView);
345 compare(dashNavigation.showList, true);348 waitForRendering(departmentListView.currentItem);
346 waitForRendering(navigationListView);349
347 waitForRendering(navigationListView.currentItem);350 tryCompare(departmentList1.department, "loaded", true);
348351 department = findChild(dashDepartments, "department1child3");
349 tryCompare(navigationList1.navigation, "loaded", true);352 mouseClick(department, 0, 0);
350 navigation = findChild(dashNavigation, "navigation1child3");353 compare(dashDepartments.showList, false);
351 mouseClick(navigation, 0, 0);354 tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle23");
352 compare(dashNavigation.showList, false);355 tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
353 tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle23");356
354 tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");357 mouseClick(dashDepartments, 0, 0);
355358 compare(dashDepartments.showList, true);
356 mouseClick(dashNavigation, 0, 0);359 waitForRendering(departmentListView);
357 compare(dashNavigation.showList, true);360 waitForRendering(departmentListView.currentItem);
358 waitForRendering(navigationListView);
359 waitForRendering(navigationListView.currentItem);
360 mouseClick(backButton, 0, 0);361 mouseClick(backButton, 0, 0);
361362
362 tryCompare(dashNavigation.currentNavigation, "navigationId", "root");363 tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
363 tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");364 tryCompare(departmentListView.currentItem.department, "departmentId", "root");
364 compare(dashNavigation.showList, true);365 compare(dashDepartments.showList, true);
365 mouseClick(dashNavigation, 0, 0);366 mouseClick(dashDepartments, 0, 0);
366 compare(dashNavigation.showList, false);367 compare(dashDepartments.showList, false);
367368
368 mouseClick(dashNavigation, 0, 0);369 mouseClick(dashDepartments, 0, 0);
369 compare(dashNavigation.showList, true);370 compare(dashDepartments.showList, true);
370 tryCompare(navigationListView.currentItem.navigation, "loaded", true);371 tryCompare(departmentListView.currentItem.department, "loaded", true);
371 navigation = findChild(dashNavigation, "navigation0child2");372 department = findChild(dashDepartments, "department0child2");
372 mouseClick(navigation, 0, 0);373 mouseClick(department, 0, 0);
373 compare(dashNavigation.showList, true);374 compare(dashDepartments.showList, true);
374 navigationList1 = findChild(dashNavigation, "navigation1");375 departmentList1 = findChild(dashDepartments, "department1");
375 compare(navigationList1.navigation.loaded, false);376 compare(departmentList1.department.loaded, false);
376 tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");377 tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
377 allButton = findChild(navigationList1, "allButton");378 allButton = findChild(departmentList1, "allButton");
378 tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");379 tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
379 mouseClick(allButton, 0, 0);380 mouseClick(allButton, 0, 0);
380 tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");381 tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
381 }382 }
382 }383 }
383}384}

Subscribers

People subscribed via source and target branches