Merge lp:~aacid/unity8/new-scopes-scope-activation into lp:~unity-team/unity8/new-scopes

Proposed by Albert Astals Cid
Status: Superseded
Proposed branch: lp:~aacid/unity8/new-scopes-scope-activation
Merge into: lp:~unity-team/unity8/new-scopes
Diff against target: 276 lines (+177/-6)
4 files modified
qml/Dash/Dash.qml (+44/-2)
qml/Dash/DashContent.qml (+21/-4)
qml/Dash/PreviewListView.qml (+1/-0)
qml/Dash/ScopeItem.qml (+111/-0)
To merge this branch: bzr merge lp:~aacid/unity8/new-scopes-scope-activation
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+206958@code.launchpad.net

This proposal has been superseded by a proposal from 2014-02-18.

Commit message

Scope activation support

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Dash/Dash.qml'
2--- qml/Dash/Dash.qml 2014-01-09 09:05:57 +0000
3+++ qml/Dash/Dash.qml 2014-02-18 15:14:40 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright (C) 2013 Canonical, Ltd.
7+ * Copyright (C) 2013, 2014 Canonical, Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11@@ -62,10 +62,19 @@
12 DashContent {
13 id: dashContent
14 objectName: "dashContent"
15- anchors.fill: parent
16+ width: parent.width
17+ height: parent.height
18 model: filteredScopes
19 scopes: scopes
20 searchHistory: dash.searchHistory
21+ visible: x != -width
22+ onGotoScope: {
23+ dash.setCurrentScope(scopeId, true, false);
24+ }
25+ onOpenScope: {
26+ scopeItem.scope = scope;
27+ x = -width;
28+ }
29 onScopeLoaded: {
30 if (scopeId == dash.showScopeOnLoaded) {
31 dash.setCurrentScope(scopeId, false, false)
32@@ -74,5 +83,38 @@
33 }
34 scale: dash.contentScale
35 clip: scale != 1.0
36+ Behavior on x {
37+ UbuntuNumberAnimation {
38+ onStopped: {
39+ if (dashContent.x == 0) {
40+ dashContent.closeScope(scopeItem.scope);
41+ scopeItem.scope = null;
42+ }
43+ }
44+ }
45+ }
46+ }
47+
48+ ScopeItem {
49+ id: scopeItem
50+ anchors.left: dashContent.right
51+ width: parent.width
52+ height: parent.height
53+ searchHistory: dash.searchHistory
54+ scale: dash.contentScale
55+ clip: scale != 1.0
56+ visible: scope != null
57+ onBack: {
58+ dashContent.x = 0;
59+ }
60+ onGotoScope: {
61+ // TODO
62+ console.log("gotoScope from an openScope scope is not implemented");
63+ }
64+ onOpenScope: {
65+ // TODO
66+ console.log("openScope from an openScope scope is not implemented");
67+ }
68+
69 }
70 }
71
72=== modified file 'qml/Dash/DashContent.qml'
73--- qml/Dash/DashContent.qml 2014-02-14 15:36:43 +0000
74+++ qml/Dash/DashContent.qml 2014-02-18 15:14:40 +0000
75@@ -1,5 +1,5 @@
76 /*
77- * Copyright (C) 2013 Canonical, Ltd.
78+ * Copyright (C) 2013, 2014 Canonical, Ltd.
79 *
80 * This program is free software; you can redistribute it and/or modify
81 * it under the terms of the GNU General Public License as published by
82@@ -36,6 +36,8 @@
83 signal contentEndReached()
84 signal scopeLoaded(string scopeId)
85 signal positionedAtBeginning()
86+ signal gotoScope(string scopeId)
87+ signal openScope(var scope)
88
89 // If we set the current scope index before the scopes have been added,
90 // then we need to wait until the loaded signals gets emitted from the scopes
91@@ -80,6 +82,10 @@
92 }
93 }
94
95+ function closeScope(scope) {
96+ dashContentList.currentItem.theScope.closeScope(scope)
97+ }
98+
99 Item {
100 id: dashContentListHolder
101 anchors.fill: parent
102@@ -136,8 +142,8 @@
103 onLoaded: {
104 item.scope = Qt.binding(function() { return scope })
105 item.isCurrent = Qt.binding(function() { return visible && ListView.isCurrentItem })
106- item.tabBarHeight = pageHeader.implicitHeight;
107- item.pageHeader = pageHeader;
108+ item.tabBarHeight = dashPageHeader.implicitHeight;
109+ item.pageHeader = dashPageHeader;
110 item.openEffect = openEffect;
111 item.previewListView = previewListView;
112 dashContentList.movementStarted.connect(item.movementStarted)
113@@ -149,13 +155,23 @@
114 ignoreUnknownSignals: true
115 onEndReached: contentEndReached()
116 }
117+ Connections {
118+ target: isCurrent ? scope : null
119+ onGotoScope: {
120+ // Note here scopeId is the signal parameter and not the loader property
121+ dashContent.gotoScope(scopeId);
122+ }
123+ onOpenScope: {
124+ dashContent.openScope(scope);
125+ }
126+ }
127
128 Component.onDestruction: active = false
129 }
130 }
131
132 PageHeader {
133- id: pageHeader
134+ id: dashPageHeader
135 objectName: "pageHeader"
136 width: parent.width
137 searchEntryEnabled: true
138@@ -218,6 +234,7 @@
139 openEffect: openEffect
140 categoryView: dashContentList.currentItem ? dashContentList.currentItem.categoryView : null
141 scope: dashContentList.currentItem ? dashContentList.currentItem.theScope : null
142+ pageHeader: dashPageHeader
143 anchors.fill: parent
144 }
145 }
146
147=== modified file 'qml/Dash/PreviewListView.qml'
148--- qml/Dash/PreviewListView.qml 2014-02-14 13:10:46 +0000
149+++ qml/Dash/PreviewListView.qml 2014-02-18 15:14:40 +0000
150@@ -26,6 +26,7 @@
151 property OpenEffect openEffect: null
152 property ScopeListView categoryView: null
153 property Scope scope: null
154+ property var pageHeader: null
155
156 property alias open: previewListView.open
157 property alias onScreen: previewListView.onScreen
158
159=== added file 'qml/Dash/ScopeItem.qml'
160--- qml/Dash/ScopeItem.qml 1970-01-01 00:00:00 +0000
161+++ qml/Dash/ScopeItem.qml 2014-02-18 15:14:40 +0000
162@@ -0,0 +1,111 @@
163+/*
164+ * Copyright (C) 2014 Canonical, Ltd.
165+ *
166+ * This program is free software; you can redistribute it and/or modify
167+ * it under the terms of the GNU General Public License as published by
168+ * the Free Software Foundation; version 3.
169+ *
170+ * This program is distributed in the hope that it will be useful,
171+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
172+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
173+ * GNU General Public License for more details.
174+ *
175+ * You should have received a copy of the GNU General Public License
176+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
177+ */
178+
179+import QtQuick 2.0
180+import Ubuntu.Components 0.1
181+import Unity 0.2
182+import "../Components"
183+
184+Item {
185+ id: root
186+
187+ property alias scope: scopeView.scope
188+
189+ property ListModel searchHistory
190+
191+ signal back
192+ signal gotoScope(string scopeId)
193+ signal openScope(var scope)
194+
195+ Item {
196+ id: scopeViewHolder
197+ anchors.fill: parent
198+
199+ GenericScopeView {
200+ id: scopeView
201+ width: parent.width
202+ height: parent.height
203+ isCurrent: scope != null
204+ tabBarHeight: scopeItemPageHeader.implicitHeight
205+ pageHeader: scopeItemPageHeader
206+ openEffect: openEffect
207+ previewListView: previewListView
208+
209+ Connections {
210+ target: isCurrent ? scope : null
211+ onGotoScope: root.gotoScope(scopeId);
212+ onOpenScope: root.openScope(scope);
213+ }
214+ }
215+
216+ PageHeader {
217+ id: scopeItemPageHeader
218+ width: parent.width
219+ searchEntryEnabled: true
220+ searchHistory: root.searchHistory
221+ scope: root.scope
222+ height: units.gu(7)
223+
224+ childItem: Row {
225+ anchors {
226+ fill: parent
227+ leftMargin: units.gu(2)
228+ }
229+ spacing: units.gu(1)
230+ Image {
231+ anchors.verticalCenter: parent.verticalCenter
232+ source: "graphics/dashback.png"
233+ MouseArea {
234+ anchors.fill: parent
235+ onClicked: root.back();
236+ }
237+ }
238+ Label {
239+ id: label
240+ anchors.verticalCenter: parent.verticalCenter
241+
242+ text: scope ? scope.name : ""
243+ color: "grey"
244+ font.family: "Ubuntu"
245+ font.weight: Font.Light
246+ fontSize: "x-large"
247+ elide: Text.ElideRight
248+ style: Text.Raised
249+ styleColor: "black"
250+ }
251+ }
252+ }
253+ }
254+
255+ DashContentOpenEffect {
256+ id: openEffect
257+ anchors {
258+ fill: parent
259+ bottomMargin: -bottomOverflow
260+ }
261+ sourceItem: scopeViewHolder
262+ previewListView: previewListView
263+ }
264+
265+ PreviewListView {
266+ id: previewListView
267+ openEffect: openEffect
268+ categoryView: scopeView.categoryView
269+ pageHeader: scopeItemPageHeader
270+ scope: root.scope
271+ anchors.fill: parent
272+ }
273+}
274
275=== added file 'qml/Dash/graphics/dashback@27.png'
276Binary files qml/Dash/graphics/dashback@27.png 1970-01-01 00:00:00 +0000 and qml/Dash/graphics/dashback@27.png 2014-02-18 15:14:40 +0000 differ

Subscribers

People subscribed via source and target branches

to all changes: