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