on xenial help sign in
First attempt for the new scopes list
commit18b59bcc650d4a1c6d47bb55488374223f632050 authorAlbert Astals <albert.astals@canonical.com> dateThu 18 Sep 2014, 16:50 (12 years ago) parentbd05eec
5 files changed+48−879
qml/Dash/Dash.qml+48−111 qml/Dash/ScopesOverview.qml−567 qml/Dash/ScopesOverviewAll.qml−54 qml/Dash/ScopesOverviewFavorites.qml−73 qml/Dash/ScopesOverviewTab.qml−74
qml/Dash/Dash.qml+48−111
@@ -34,15 +34,12 @@ Showable {
3434 DashCommunicatorService {
3535 objectName: "dashCommunicatorService"
3636 onSetCurrentScopeRequested: {
37− if (!isSwipe || !window.active || overviewController.progress != 0) {
38− if (overviewController.progress != 0 && window.active) animate = false;
37+ if (!isSwipe || !window.active || bottomEdgeController.progress != 0) {
38+ if (bottomEdgeController.progress != 0 && window.active) animate = false;
3939 dash.setCurrentScope(scopeId, animate, isSwipe)
40− if (overviewController.progress != 0) {
41− if (window.active) {
42− dashContentCache.scheduleUpdate();
43− }
44− overviewController.enableAnimation = window.active;
45− overviewController.progress = 0;
40+ if (bottomEdgeController.progress != 0) {
41+ bottomEdgeController.enableAnimation = window.active;
42+ bottomEdgeController.progress = 0;
4643 }
4744 }
4845 }
@@ -85,8 +82,8 @@ Showable {
8582 }
8683
8784 QtObject {
88− id: overviewController
89− objectName: "overviewController"
85+ id: bottomEdgeController
86+ objectName: "bottomEdgeController"
9087
9188 property alias enableAnimation: progressAnimation.enabled
9289 property real progress: 0
@@ -96,74 +93,6 @@ Showable {
9693 }
9794 }
9895
99− ScopesOverview {
100− id: scopesOverview
101− objectName: "scopesOverview"
102− anchors.fill: parent
103− scope: scopes.overviewScope
104− progress: overviewController.progress
105− scopeScale: scopeItem.scope ? 0.4 : (1 - overviewController.progress * 0.6)
106− visible: scopeScale != 1
107− currentIndex: dashContent.currentIndex
108− onDone: {
109− if (currentTab == 1) {
110− animateDashFromAll(dashContent.currentScopeId);
111− }
112− hide();
113− }
114− onFavoriteSelected: {
115− setCurrentScope(scopeId, false, false);
116− dashContentCache.scheduleUpdate();
117− hide();
118− }
119− onAllFavoriteSelected: {
120− setCurrentScope(scopeId, false, false);
121− dashContentCache.scheduleUpdate();
122− animateDashFromAll(dashContent.currentScopeId);
123− hide();
124− }
125− onSearchSelected: {
126− var scopeIndex = -1;
127− for (var i = 0; i < scopes.count; ++i) {
128− if (scopes.getScope(i).id == scopeId) {
129− scopeIndex = i;
130− break;
131− }
132− }
133− if (scopeIndex >= 0) {
134− // Is a favorite one
135− setCurrentScope(scopeId, false, false);
136− dashContentCache.scheduleUpdate();
137− showDashFromPos(pos, size);
138− hide();
139− } else {
140− // Is not a favorite one, activate and get openScope
141− scope.activate(result);
142− }
143− }
144− function hide() {
145− overviewController.enableAnimation = true;
146− overviewController.progress = 0;
147− }
148− onProgressChanged: {
149− if (progress == 0) {
150− currentTab = scopeItem.scope ? 1 : 0;
151− }
152− }
153− }
154−
155− ShaderEffectSource {
156− id: dashContentCache
157− parent: scopesOverview.dashItemEater
158− z: 1
159− sourceItem: dashContent
160− height: sourceItem.height
161− width: sourceItem.width
162− opacity: 1 - overviewController.progress
163− visible: overviewController.progress != 0 && scopeItem.scope === null
164− live: false
165− }
166−
16796 DashContent {
16897 id: dashContent
16998
@@ -173,7 +102,7 @@ Showable {
173102 width: dash.width
174103 height: dash.height
175104 scopes: scopes
176− visible: !scopesOverview.showingNonFavoriteScope && x != -width
105+ visible: x != -width
177106 onGotoScope: {
178107 dash.setCurrentScope(scopeId, true, false);
179108 }
@@ -191,15 +120,15 @@ Showable {
191120 }
192121 }
193122 scale: dash.contentScale
194− clip: scale != 1.0 || scopeItem.visible || overviewController.progress != 0
123+ clip: scale != 1.0 || scopeItem.visible || bottomEdgeController.progress != 0
195124 Behavior on x {
196125 UbuntuNumberAnimation {
197− duration: overviewController.progress != 0 ? 0 : UbuntuAnimation.FastDuration
126+ duration: bottomEdgeController.progress != 0 ? 0 : UbuntuAnimation.FastDuration
198127 onRunningChanged: {
199128 if (!running && dashContent.x == 0) {
200129 dashContent.scopeThatOpenedScope.closeScope(scopeItem.scope);
201130 scopeItem.scope = null;
202− if (overviewController.progress == 0) {
131+ if (bottomEdgeController.progress == 0) {
203132 // Set tab to Favorites only if we are not showing the overview
204133 scopesOverview.currentTab = 0;
205134 }
@@ -208,8 +137,30 @@ Showable {
208137 }
209138 }
210139
211− enabled: overviewController.progress == 0
212− opacity: enabled ? 1 : 0
140+ enabled: bottomEdgeController.progress == 0
141+ }
142+
143+ Rectangle {
144+ color: "black"
145+ opacity: bottomEdgeController.progress
146+ anchors.fill: dashContent
147+ }
148+
149+ ScopesList {
150+ id: scopesList
151+ objectName: "scopesList"
152+ width: dash.width
153+ height: dash.height
154+ scope: scopes.overviewScope
155+ y: dash.height * (1 - bottomEdgeController.progress)
156+ onBackClicked: {
157+ bottomEdgeController.enableAnimation = true;
158+ bottomEdgeController.progress = 0;
159+ }
160+ onRequestFavorite: {
161+ // TODO This is not yet implemented in the backend
162+ scopes.setFavorite(scopeId, favorite);
163+ }
213164 }
214165
215166 DashBackground
@@ -232,22 +183,11 @@ Showable {
232183 return scopesOverview.allCardSize.width / scopeItem.width;
233184 }
234185 }
235− readonly property real overviewProgressScale: (1 - overviewController.progress * (1 - targetOverviewScale))
236− readonly property var targetOverviewPosition: scope ? scopesOverview.allScopeCardPosition(scope.id) : null
237− readonly property real overviewProgressX: scope && scopesOverview.currentTab == 1 && targetOverviewPosition ?
238− overviewController.progress * (targetOverviewPosition.x - (width - scopesOverview.allCardSize.width) / 2)
239− : 0
240− readonly property real overviewProgressY: scope && scopesOverview.currentTab == 1 && targetOverviewPosition ?
241− overviewController.progress * (targetOverviewPosition.y - (height - scopesOverview.allCardSize.height) / 2)
242− : 0
243−
244− x: overviewController.progress == 0 ? dashContent.x + width : overviewProgressX
245− y: overviewController.progress == 0 ? dashContent.y : overviewProgressY
186+ x: dashContent.x + width
187+ y: dashContent.y
246188 width: parent.width
247189 height: parent.height
248− scale: dash.contentScale * overviewProgressScale
249− enabled: opacity == 1
250− opacity: 1 - overviewController.progress
190+ scale: dash.contentScale
251191 clip: scale != 1.0
252192 visible: scope != null
253193 hasBackAction: true
@@ -281,7 +221,7 @@ Showable {
281221 opacity: 0
282222 visible: opacity > 0
283223
284− readonly property bool processing: dashContent.processing || scopeItem.processing || scopesOverview.processing
224+ readonly property bool processing: dashContent.processing || scopeItem.processing || scopesList.processing
285225
286226 Behavior on opacity {
287227 UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration }
@@ -338,12 +278,12 @@ Showable {
338278 source: "graphics/overview_hint.png"
339279 anchors.horizontalCenter: parent.horizontalCenter
340280 opacity: (scopeItem.scope ? scopeItem.pageHeaderTotallyVisible : dashContent.pageHeaderTotallyVisible) &&
341− (overviewDragHandle.enabled || overviewController.progress != 0) ? 1 : 0
281+ (overviewDragHandle.enabled || bottomEdgeController.progress != 0) ? 1 : 0
342282 Behavior on opacity {
343− enabled: overviewController.progress == 0
283+ enabled: bottomEdgeController.progress == 0
344284 UbuntuNumberAnimation {}
345285 }
346− y: parent.height - height * (1 - overviewController.progress * 4)
286+ y: parent.height - height * (1 - bottomEdgeController.progress * 4)
347287 }
348288
349289 EdgeDragArea {
@@ -355,24 +295,21 @@ Showable {
355295 dashContent.currentScope &&
356296 dashContent.currentScope.searchQuery == "" &&
357297 !scopeItem.subPageShown &&
358− (overviewController.progress == 0 || dragging)
298+ (bottomEdgeController.progress == 0 || dragging)
359299
360− readonly property real fullMovement: units.gu(20)
300+ readonly property real fullMovement: dash.height
361301
362302 anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
363303 height: units.gu(2)
364304
365305 onSceneDistanceChanged: {
366− if (overviewController.enableAnimation) {
367− dashContentCache.scheduleUpdate();
368− }
369− overviewController.enableAnimation = false;
370− overviewController.progress = Math.max(0, Math.min(1, sceneDistance / fullMovement));
306+ bottomEdgeController.enableAnimation = false;
307+ bottomEdgeController.progress = Math.max(0, Math.min(1, sceneDistance / fullMovement));
371308 }
372309
373310 onDraggingChanged: {
374− overviewController.enableAnimation = true;
375− overviewController.progress = (overviewController.progress > 0.7) ? 1 : 0;
311+ bottomEdgeController.enableAnimation = true;
312+ bottomEdgeController.progress = (bottomEdgeController.progress > 0.3) ? 1 : 0;
376313 }
377314 }
378315
qml/Dash/ScopesOverview.qmldeleted−567
@@ -1,567 +0,0 @@
1−/*
2− * Copyright (C) 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 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 General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Dash 0.1
19−import Ubuntu.Components 0.1
20−import "../Components"
21−
22−Item {
23− id: root
24−
25− // Properties set by parent
26− property real progress: 0
27− property var scope: null
28− property int currentIndex: 0
29− property real scopeScale: 1
30−
31− // Properties set and used by parent
32− property alias currentTab: tabBar.currentTab
33−
34− // Properties used by parent
35− readonly property bool processing: searchResultsViewer.processing || tempScopeItem.processing || previewListView.processing
36− property bool growingDashFromPos: false
37− readonly property bool searching: scope && scope.searchQuery == ""
38− readonly property bool showingNonFavoriteScope: tempScopeItem.scope != null
39− readonly property var dashItemEater: {
40− if (!forceXYScalerEater && tabBar.currentTab == 0 && middleItems.count > 0) {
41− var loaderItem = middleItems.itemAt(0).item;
42− return loaderItem && loaderItem.currentItem ? loaderItem.currentItem : null;
43− }
44− return scopesOverviewXYScaler;
45− }
46− readonly property size allCardSize: {
47− if (middleItems.count > 1) {
48− var loaderItem = middleItems.itemAt(1).item;
49− if (loaderItem) {
50− var cardTool = loaderItem.cardTool;
51− return Qt.size(cardTool.cardWidth, cardTool.cardHeight);
52− }
53− }
54− return Qt.size(0, 0);
55− }
56−
57− // Internal properties
58− property bool forceXYScalerEater: false
59−
60− signal done()
61− signal favoriteSelected(var scopeId)
62− signal allFavoriteSelected(var scopeId)
63− signal searchSelected(var scopeId, var result, var pos, var size)
64−
65− Connections {
66− target: scope
67− onOpenScope: {
68− var itemPos = scopesOverviewXYScaler.restorePosition;
69− var itemSize = scopesOverviewXYScaler.restoreSize;
70− scopesOverviewXYScaler.scale = itemSize.width / scopesOverviewXYScaler.width;
71− if (itemPos) {
72− scopesOverviewXYScaler.x = itemPos.x -(scopesOverviewXYScaler.width - scopesOverviewXYScaler.width * scopesOverviewXYScaler.scale) / 2;
73− scopesOverviewXYScaler.y = itemPos.y -(scopesOverviewXYScaler.height - scopesOverviewXYScaler.height * scopesOverviewXYScaler.scale) / 2;
74− } else {
75− scopesOverviewXYScaler.x = 0;
76− scopesOverviewXYScaler.y = 0;
77− }
78− scopesOverviewXYScaler.opacity = 0;
79− tempScopeItem.scope = scope;
80− middleItems.overrideOpacity = 0;
81− scopesOverviewXYScaler.scale = 1;
82− scopesOverviewXYScaler.x = 0;
83− scopesOverviewXYScaler.y = 0;
84− scopesOverviewXYScaler.opacity = 1;
85− }
86− onGotoScope: {
87− if (tabBar.currentTab == 0) {
88− root.favoriteSelected(scopeId);
89− } else {
90− root.allFavoriteSelected(scopeId);
91− }
92− }
93− }
94−
95− Binding {
96− target: scope
97− property: "isActive"
98− value: progress === 1
99− }
100−
101− function animateDashFromAll(scopeId) {
102− var currentScopePos = allScopeCardPosition(scopeId);
103− if (currentScopePos) {
104− showDashFromPos(currentScopePos, allCardSize);
105− } else {
106− console.log("Warning: Could not find Dash OverView All card position for scope", dashContent.currentScopeId);
107− }
108− }
109−
110− function showDashFromPos(itemPos, itemSize) {
111− scopesOverviewXYScaler.scale = itemSize.width / scopesOverviewXYScaler.width;
112− scopesOverviewXYScaler.x = itemPos.x -(scopesOverviewXYScaler.width - scopesOverviewXYScaler.width * scopesOverviewXYScaler.scale) / 2;
113− scopesOverviewXYScaler.y = itemPos.y -(scopesOverviewXYScaler.height - scopesOverviewXYScaler.height * scopesOverviewXYScaler.scale) / 2;
114− scopesOverviewXYScaler.opacity = 0;
115− root.growingDashFromPos = true;
116− scopesOverviewXYScaler.scale = 1;
117− scopesOverviewXYScaler.x = 0;
118− scopesOverviewXYScaler.y = 0;
119− scopesOverviewXYScaler.opacity = 1;
120− }
121−
122− function allScopeCardPosition(scopeId) {
123− if (middleItems.count > 1) {
124− var loaderItem = middleItems.itemAt(1).item;
125− if (loaderItem) {
126− var pos = loaderItem.scopeCardPosition(scopeId);
127− return loaderItem.mapToItem(null, pos.x, pos.y);
128− }
129− }
130− }
131−
132− function ensureAllScopeVisible(scopeId) {
133− if (middleItems.count > 1) {
134− var loaderItem = middleItems.itemAt(1).item;
135− if (loaderItem) {
136− var pos = loaderItem.scopeCardPosition(scopeId);
137− loaderItem.contentY = Math.min(pos.y, loaderItem.contentHeight - loaderItem.height);
138− }
139− }
140− }
141−
142− onProgressChanged: {
143− if (progress == 0) {
144− pageHeader.resetSearch();
145− pageHeader.unfocus(); // Shouldn't the previous call do this too?
146− }
147− }
148−
149− ScopeStyle {
150− id: overviewScopeStyle
151− style: { "foreground-color" : "white",
152− "background-color" : "transparent",
153− "page-header": {
154− "background": "color:///transparent"
155− }
156− }
157− }
158−
159− DashBackground {
160− anchors.fill: parent
161− source: "graphics/dark_background.jpg"
162− }
163−
164− Connections {
165− target: pageHeader
166− onSearchQueryChanged: {
167− // Need this in order, otherwise something gets unhappy in rendering
168− // of the overlay in carousels because the parent of the dash dies for
169− // a moment, this way we make sure it's reparented first
170− // by forceXYScalerEater making dashItemEater return scopesOverviewXYScaler
171− // before we kill the previous parent by scope.searchQuery
172− root.forceXYScalerEater = true;
173− root.scope.searchQuery = pageHeader.searchQuery;
174− root.forceXYScalerEater = false;
175− }
176− }
177−
178− Binding {
179− target: pageHeader
180− property: "searchQuery"
181− value: scope ? scope.searchQuery : ""
182− }
183−
184− Item {
185− id: scopesOverviewContent
186− x: previewListView.open ? -width : 0
187− Behavior on x { UbuntuNumberAnimation { } }
188− width: parent.width
189− height: parent.height
190−
191− PageHeader {
192− id: pageHeader
193− objectName: "scopesOverviewPageHeader"
194−
195− readonly property real yDisplacement: pageHeader.height + tabBar.height + tabBar.anchors.margins
196−
197− y: {
198− if (root.progress < 0.5) {
199− return -yDisplacement;
200− } else {
201− return -yDisplacement + (root.progress - 0.5) * yDisplacement * 2;
202− }
203− }
204− width: parent.width
205− clip: true
206− title: i18n.tr("Manage Dash")
207− scopeStyle: overviewScopeStyle
208− showSignatureLine: false
209− searchEntryEnabled: true
210− }
211−
212− ScopesOverviewTab {
213− id: tabBar
214− anchors {
215− left: parent.left
216− right: parent.right
217− top: pageHeader.bottom
218− margins: units.gu(2)
219− }
220− height: units.gu(4)
221−
222− enabled: opacity == 1
223− opacity: !scope || scope.searchQuery == "" ? 1 : 0
224− Behavior on opacity { UbuntuNumberAnimation { } }
225− }
226−
227− Repeater {
228− id: middleItems
229− objectName: "scopesOverviewRepeater"
230− property real overrideOpacity: -1
231− model: scope && scope.searchQuery == "" ? scope.categories : null
232− delegate: Loader {
233− id: loader
234− objectName: "scopesOverviewRepeaterChild" + index
235−
236− height: {
237− if (index == 0) {
238− return root.height;
239− } else {
240− return root.height - pageHeader.height - tabBar.height - tabBar.anchors.margins - units.gu(2);
241− }
242− }
243− width: {
244− if (index == 0) {
245− return root.width / scopeScale;
246− } else {
247− return root.width;
248− }
249− }
250− x: {
251− if (index == 0) {
252− return (root.width - width) / 2;
253− } else {
254− return 0;
255− }
256− }
257− anchors {
258− bottom: scopesOverviewContent.bottom
259− }
260−
261− scale: index == 0 ? scopeScale : 1
262−
263− opacity: {
264− if (middleItems.overrideOpacity >= 0)
265− return middleItems.overrideOpacity;
266−
267− if (tabBar.currentTab != index)
268− return 0;
269−
270− return index == 0 ? 1 : root.progress;
271− }
272− Behavior on opacity {
273− enabled: root.progress == 1
274− UbuntuNumberAnimation { }
275− }
276− enabled: opacity == 1
277−
278− clip: index == 1
279−
280− CardTool {
281− id: cardTool
282− objectName: "cardTool"
283− count: results.count
284− template: model.renderer
285− components: model.components
286− viewWidth: parent.width
287− }
288−
289− source: {
290− if (index == 0 && categoryId == "favorites") return "ScopesOverviewFavorites.qml";
291− else if (index == 1 && categoryId == "all") return "ScopesOverviewAll.qml";
292− else return "";
293− }
294−
295− onLoaded: {
296− item.model = Qt.binding(function() { return results; });
297− item.cardTool = cardTool;
298− if (index == 0) {
299− item.scopeWidth = Qt.binding(function() { return root.width; });
300− item.scopeHeight = Qt.binding(function() { return root.height; });
301− item.appliedScale = Qt.binding(function() { return loader.scale });
302− item.currentIndex = Qt.binding(function() { return root.currentIndex });
303− } else if (index == 1) {
304− item.extraHeight = bottomBar.height;
305− }
306− }
307−
308− Connections {
309− target: loader.item
310− onClicked: {
311− pageHeader.unfocus();
312− if (tabBar.currentTab == 0) {
313− root.favoriteSelected(itemModel.scopeId);
314− } else {
315− var favoriteScopesItem = middleItems.itemAt(0).item;
316− var scopeIndex = favoriteScopesItem.model.scopeIndex(itemModel.scopeId);
317− if (scopeIndex >= 0) {
318− root.allFavoriteSelected(itemModel.scopeId);
319− } else {
320− // Will result in an openScope from root.scope
321− scopesOverviewXYScaler.restorePosition = item.mapToItem(null, 0, 0);
322− scopesOverviewXYScaler.restoreSize = allCardSize;
323− root.scope.activate(result);
324− }
325− }
326− }
327− onPressAndHold: {
328− // Preview can call openScope so make sure restorePosition and restoreSize are set
329− scopesOverviewXYScaler.restorePosition = undefined;
330− scopesOverviewXYScaler.restoreSize = allCardSize;
331−
332− previewListView.model = target.model;
333− previewListView.currentIndex = -1;
334− previewListView.currentIndex = index;
335− previewListView.open = true;
336− }
337− }
338− }
339− }
340−
341− GenericScopeView {
342− id: searchResultsViewer
343− objectName: "searchResultsViewer"
344− anchors {
345− top: pageHeader.bottom
346− right: parent.right
347− left: parent.left
348− bottom: parent.bottom
349− }
350− scope: root.scope && root.scope.searchQuery != "" ? root.scope : null
351− scopeStyle: overviewScopeStyle
352− enabled: opacity == 1
353− showPageHeader: false
354− clip: true
355− opacity: searchResultsViewer.scope ? 1 : 0
356− isCurrent: true
357− Behavior on opacity { UbuntuNumberAnimation { } }
358−
359− function itemClicked(index, result, item, itemModel, resultsModel, limitedCategoryItemCount) {
360− pageHeader.unfocus();
361− pageHeader.closePopup();
362− if (itemModel.scopeId) {
363− // This can end up in openScope so save restorePosition and restoreSize
364− scopesOverviewXYScaler.restorePosition = item.mapToItem(null, 0, 0);
365− scopesOverviewXYScaler.restoreSize = Qt.size(item.width, item.height);
366− root.searchSelected(itemModel.scopeId, result, item.mapToItem(null, 0, 0), Qt.size(item.width, item.height));
367− } else {
368− // Not a scope, just activate it
369− searchResultsViewer.scope.activate(result);
370− }
371− }
372−
373− function itemPressedAndHeld(index, itemModel, resultsModel, limitedCategoryItemCount) {
374− if (itemModel.uri.indexOf("scope://") === 0) {
375− // Preview can call openScope so make sure restorePosition and restoreSize are set
376− scopesOverviewXYScaler.restorePosition = undefined;
377− scopesOverviewXYScaler.restoreSize = allCardSize;
378−
379− previewListView.model = resultsModel;
380− previewListView.currentIndex = -1;
381− previewListView.currentIndex = index;
382− previewListView.open = true;
383− }
384− }
385− }
386−
387− Rectangle {
388− id: bottomBar
389− objectName: "bottomBar"
390− color: "black"
391− height: units.gu(8)
392− width: parent.width
393− enabled: opacity == 1
394− opacity: scope && scope.searchQuery == "" ? 1 : 0
395− Behavior on opacity { UbuntuNumberAnimation { } }
396− y: {
397− if (root.progress < 0.5) {
398− return parent.height;
399− } else {
400− return parent.height - (root.progress - 0.5) * height * 2;
401− }
402− }
403−
404− MouseArea {
405− // Just eat any other press since this parent is black opaque
406− anchors.fill: parent
407− }
408−
409− AbstractButton {
410− objectName: "scopesOverviewDoneButton"
411− width: Math.max(label.width + units.gu(2), units.gu(10))
412− height: units.gu(4)
413− anchors {
414− left: parent.left
415− leftMargin: units.gu(2)
416− verticalCenter: parent.verticalCenter
417− }
418− Rectangle {
419− anchors.fill: parent
420− border.color: "white"
421− border.width: units.dp(1)
422− radius: units.dp(10)
423− color: parent.pressed ? Theme.palette.normal.baseText : "transparent"
424− }
425− Label {
426− id: label
427− anchors.centerIn: parent
428− text: i18n.tr("Done")
429− color: parent.pressed ? "black" : "white"
430− }
431− onClicked: root.done();
432− }
433−
434− AbstractButton {
435− objectName: "scopesOverviewStoreButton"
436− width: Math.max(storeLabel.width, units.gu(10))
437− height: units.gu(4)
438− anchors {
439− right: parent.right
440− verticalCenter: parent.verticalCenter
441− }
442− Icon {
443− id: storeImage
444− name: "ubuntu-store-symbolic"
445− color: "white"
446− anchors.horizontalCenter: parent.horizontalCenter
447− width: units.gu(2)
448− height: units.gu(2)
449− }
450− Label {
451− id: storeLabel
452− anchors.horizontalCenter: parent.horizontalCenter
453− anchors.top: storeImage.bottom
454− text: i18n.tr("Store")
455− color: "white"
456− }
457− onClicked: {
458− // Just zoom from the middle
459− scopesOverviewXYScaler.restorePosition = undefined;
460− scopesOverviewXYScaler.restoreSize = allCardSize;
461− scope.performQuery("scope://com.canonical.scopes.clickstore");
462− }
463− }
464− }
465− }
466−
467− PreviewListView {
468− id: previewListView
469− objectName: "scopesOverviewPreviewListView"
470− scope: root.scope
471− scopeStyle: overviewScopeStyle
472− showSignatureLine: false
473− visible: x != width
474− width: parent.width
475− height: parent.height
476− anchors.left: scopesOverviewContent.right
477−
478− onBackClicked: open = false
479− }
480−
481− Item {
482− id: scopesOverviewXYScaler
483− width: parent.width
484− height: parent.height
485−
486− clip: scale != 1.0
487− enabled: scale == 1
488−
489− property bool animationsEnabled: root.showingNonFavoriteScope || root.growingDashFromPos
490−
491− property var restorePosition
492− property var restoreSize
493−
494− Behavior on x {
495− enabled: scopesOverviewXYScaler.animationsEnabled
496− UbuntuNumberAnimation { }
497− }
498− Behavior on y {
499− enabled: scopesOverviewXYScaler.animationsEnabled
500− UbuntuNumberAnimation { }
501− }
502− Behavior on opacity {
503− enabled: scopesOverviewXYScaler.animationsEnabled
504− UbuntuNumberAnimation { }
505− }
506− Behavior on scale {
507− enabled: scopesOverviewXYScaler.animationsEnabled
508− UbuntuNumberAnimation {
509− onRunningChanged: {
510− if (!running) {
511− if (root.showingNonFavoriteScope && scopesOverviewXYScaler.scale != 1) {
512− root.scope.closeScope(tempScopeItem.scope);
513− tempScopeItem.scope = null;
514− } else if (root.growingDashFromPos) {
515− root.growingDashFromPos = false;
516− }
517− }
518− }
519− }
520− }
521−
522− DashBackground {
523− anchors.fill: tempScopeItem
524− visible: tempScopeItem.visible
525− parent: tempScopeItem.parent
526− }
527−
528− GenericScopeView {
529− id: tempScopeItem
530− objectName: "scopesOverviewTempScopeItem"
531−
532− width: parent.width
533− height: parent.height
534− scale: dash.contentScale
535− clip: scale != 1.0
536− visible: scope != null
537− hasBackAction: true
538− isCurrent: visible
539− onBackClicked: {
540− var v = scopesOverviewXYScaler.restoreSize.width / tempScopeItem.width;
541− scopesOverviewXYScaler.scale = v;
542− if (scopesOverviewXYScaler.restorePosition) {
543− scopesOverviewXYScaler.x = scopesOverviewXYScaler.restorePosition.x -(tempScopeItem.width - tempScopeItem.width * v) / 2;
544− scopesOverviewXYScaler.y = scopesOverviewXYScaler.restorePosition.y -(tempScopeItem.height - tempScopeItem.height * v) / 2;
545− } else {
546− scopesOverviewXYScaler.x = 0;
547− scopesOverviewXYScaler.y = 0;
548− }
549− scopesOverviewXYScaler.opacity = 0;
550− middleItems.overrideOpacity = -1;
551− }
552− // TODO Add tests for these connections
553− Connections {
554− target: tempScopeItem.scope
555− onOpenScope: {
556− // TODO Animate the newly opened scope into the foreground (stacked on top of the current scope)
557− tempScopeItem.scope = scope;
558− }
559− onGotoScope: {
560− tempScopeItem.backClicked();
561− root.currentTab = 0;
562− root.scope.gotoScope(scopeId);
563− }
564− }
565− }
566− }
567−}
qml/Dash/ScopesOverviewAll.qmldeleted−54
@@ -1,54 +0,0 @@
1−/*
2− * Copyright (C) 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 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 General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−
20−Flickable {
21− id: root
22−
23− property alias model: cardGrid.model
24− property alias cardTool: cardGrid.cardTool
25−
26− property real extraHeight: 0
27−
28− signal clicked(int index, var result, var item, var itemModel)
29− signal pressAndHold(int index)
30−
31− contentHeight: cardGrid.expandedHeight + extraHeight
32− contentWidth: cardGrid.width
33− flickableDirection: Flickable.VerticalFlick
34−
35− function scopeCardPosition(scopeId) {
36− var index = model.scopeIndex(scopeId);
37− var pos = cardGrid.cardPosition(index);
38− pos.y = pos.y - root.contentY;
39− return pos;
40− }
41−
42− CardGrid {
43− id: cardGrid
44− width: root.width
45− height: parent.height
46−
47− onClicked: {
48− root.clicked(index, result, item, itemModel);
49− }
50− onPressAndHold: {
51− root.pressAndHold(index);
52− }
53− }
54−}
qml/Dash/ScopesOverviewFavorites.qmldeleted−73
@@ -1,73 +0,0 @@
1−/*
2− * Copyright (C) 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 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 General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−
19−Flickable {
20− id: root
21−
22− signal clicked(int index, var result, var itemModel)
23− signal pressAndHold(int index)
24−
25− property var cardTool: null
26− property real scopeHeight: 0
27− property real scopeWidth: 0
28− property real appliedScale: 1
29− property int currentIndex: -1
30− property var currentItem: currentIndex < repeater.count ? repeater.itemAt(currentIndex) : null
31−
32− property alias model: repeater.model
33−
34− contentHeight: height
35− contentWidth: repeater.count * root.scopeWidth + units.gu(2) / appliedScale * (repeater.count - 1)
36−
37− contentX: {
38− var indexX = currentIndex * scopeWidth + units.gu(2) / appliedScale * currentIndex;
39− var newContentX = indexX - (width - scopeWidth) / 2;
40− newContentX = Math.min(Math.max(newContentX, 0), contentWidth - width);
41− return newContentX;
42− }
43−
44− Repeater {
45− id: repeater
46− objectName: "scopesOverviewFavoritesRepeater"
47−
48− delegate: Loader {
49− id: loader
50−
51− x: index * root.scopeWidth + units.gu(2) / appliedScale * index
52− asynchronous: true
53−
54− sourceComponent: cardTool.cardComponent
55− onLoaded: {
56− item.fixedArtShapeSize = Qt.binding(function() { return Qt.size(root.scopeWidth, root.scopeHeight); });
57− item.fixedHeaderHeight = Qt.binding(function() { return cardTool.headerHeight / appliedScale; });
58− item.fontScale = Qt.binding(function() { return 1 / appliedScale; });
59− item.height = Qt.binding(function() { return root.scopeHeight; });
60− item.width = Qt.binding(function() { return root.scopeWidth; });
61− item.cardData = Qt.binding(function() { return model; });
62− item.template = Qt.binding(function() { return cardTool.template; });
63− item.components = Qt.binding(function() { return cardTool.components; });
64− item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
65− }
66−
67− Connections {
68− target: loader.item
69− onClicked: root.clicked(index, result, model)
70− }
71− }
72− }
73−}
qml/Dash/ScopesOverviewTab.qmldeleted−74
@@ -1,74 +0,0 @@
1−/*
2− * Copyright (C) 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 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 General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.3
18−import Ubuntu.Components 0.1
19−
20−Item {
21− id: root
22−
23− property int currentTab: 0
24−
25− AbstractButton {
26− id: tab1
27− height: parent.height
28− width: parent.width / 2
29− Rectangle {
30− anchors.fill: parent
31− color: root.currentTab == 0 && root.enabled ? "white" : "transparent"
32− radius: units.dp(10)
33− }
34− Label {
35− anchors.centerIn: parent
36− text: i18n.tr("Favorites")
37− color: root.currentTab == 0 && root.enabled ? "black" : "white"
38− }
39− onClicked: root.currentTab = 0
40− }
41− AbstractButton {
42− id: tab2
43− objectName: "scopesOverviewAllTabButton"
44− x: width
45− height: parent.height
46− width: parent.width / 2
47− Rectangle {
48− anchors.fill: parent
49− color: root.currentTab == 1 && root.enabled ? "white" : "transparent"
50− radius: units.dp(10)
51− }
52− Label {
53− anchors.centerIn: parent
54− text: i18n.tr("All")
55− color: root.currentTab == 1 && root.enabled ? "black" : "white"
56− }
57− onClicked: root.currentTab = 1
58− }
59− Rectangle {
60− id: centerPiece
61− width: root.enabled ? units.dp(10) : units.dp(1)
62− height: parent.height
63− color: "white"
64− x: root.currentTab == 1 ? tab2.x : tab2.x - width
65− }
66− Rectangle {
67− id: border
68− anchors.fill: parent
69− radius: units.dp(10)
70− color: "transparent"
71− border.color: centerPiece.color
72− border.width: units.dp(1)
73− }
74−}