on xenial help sign in
Grow the temporary scope from its pos in the grid
dd0f9caAlbert Astals
qml/Dash/CardCarousel.qml+1−1
@@ -53,7 +53,7 @@ DashRenderer {
53
53
54 objectName: "carouselDelegate" + index
54 objectName: "carouselDelegate" + index
55
55
56− function clicked() { cardCarousel.clicked(index, model.result) }
56+ function clicked() { cardCarousel.clicked(index, model.result, loader.item) }
57 function pressAndHold() { cardCarousel.pressAndHold(index, model.result) }
57 function pressAndHold() { cardCarousel.pressAndHold(index, model.result) }
58
58
59 sourceComponent: cardTool.cardComponent
59 sourceComponent: cardTool.cardComponent
qml/Dash/CardFilterGrid.qml+1−1
@@ -63,7 +63,7 @@ DashRenderer {
63 }
63 }
64 Connections {
64 Connections {
65 target: loader.item
65 target: loader.item
66− onClicked: genericFilterGrid.clicked(index, result)
66+ onClicked: genericFilterGrid.clicked(index, result, loader.item)
67 onPressAndHold: genericFilterGrid.pressAndHold(index)
67 onPressAndHold: genericFilterGrid.pressAndHold(index)
68 }
68 }
69 }
69 }
qml/Dash/CardVerticalJournal.qml+1−1
@@ -79,7 +79,7 @@ DashRenderer {
79 }
79 }
80 Connections {
80 Connections {
81 target: loader.item
81 target: loader.item
82− onClicked: root.clicked(index, result)
82+ onClicked: root.clicked(index, result, loader.item)
83 onPressAndHold: root.pressAndHold(index)
83 onPressAndHold: root.pressAndHold(index)
84 }
84 }
85 }
85 }
qml/Dash/Dash.qml+22−3
@@ -111,9 +111,13 @@ Showable {
111 target: scopesOverview.scope
111 target: scopesOverview.scope
112 onOpenScope: {
112 onOpenScope: {
113 scopeItem.scope = scope;
113 scopeItem.scope = scope;
114− scopeItem.overviewScale = 0.4;
114+ scopeItem.overviewScale = scopesOverview.allCardSize.width / scopeItem.width;
115+ scopeItem.x = scopesOverview.allScopeClickedPos.x -(scopeItem.width - scopeItem.width * scopeItem.overviewScale) / 2;
116+ scopeItem.y = scopesOverview.allScopeClickedPos.y -(scopeItem.height - scopeItem.height * scopeItem.overviewScale) / 2;
115 overviewController.showingNonFavoriteScope = true;
117 overviewController.showingNonFavoriteScope = true;
116 scopeItem.overviewScale = 1;
118 scopeItem.overviewScale = 1;
119+ scopeItem.x = 0;
120+ scopeItem.y = 0;
117 }
121 }
118 }
122 }
119 }
123 }
@@ -161,6 +165,7 @@ Showable {
161 {
165 {
162 anchors.fill: scopeItem
166 anchors.fill: scopeItem
163 scale: scopeItem.scale
167 scale: scopeItem.scale
168+ visible: scopeItem.visible
164 }
169 }
165
170
166 GenericScopeView {
171 GenericScopeView {
@@ -168,15 +173,25 @@ Showable {
168
173
169 property real overviewScale: 1
174 property real overviewScale: 1
170
175
176+ // TODO test this width + dashContent.x still works
171 x: overviewController.showingNonFavoriteScope ? 0 : width + dashContent.x
177 x: overviewController.showingNonFavoriteScope ? 0 : width + dashContent.x
178+ Behavior on x {
179+ enabled: overviewController.showingNonFavoriteScope
180+ UbuntuNumberAnimation { }
181+ }
182+ Behavior on y {
183+ enabled: overviewController.showingNonFavoriteScope
184+ UbuntuNumberAnimation { }
185+ }
172 width: parent.width
186 width: parent.width
173 height: parent.height
187 height: parent.height
174 scale: dash.contentScale * overviewScale
188 scale: dash.contentScale * overviewScale
189+ enabled: scale == 1
175 Behavior on overviewScale {
190 Behavior on overviewScale {
176 enabled: overviewController.showingNonFavoriteScope
191 enabled: overviewController.showingNonFavoriteScope
177 UbuntuNumberAnimation {
192 UbuntuNumberAnimation {
178 onRunningChanged: {
193 onRunningChanged: {
179− if (!running && scopeItem.overviewScale == 0.4) {
194+ if (!running && scopeItem.overviewScale != 1) {
180 scopesOverview.scope.closeScope(scopeItem.scope);
195 scopesOverview.scope.closeScope(scopeItem.scope);
181 overviewController.showingNonFavoriteScope = false;
196 overviewController.showingNonFavoriteScope = false;
182 scopeItem.scope = null;
197 scopeItem.scope = null;
@@ -190,7 +205,10 @@ Showable {
190 isCurrent: visible
205 isCurrent: visible
191 onBackClicked: {
206 onBackClicked: {
192 if (overviewController.showingNonFavoriteScope) {
207 if (overviewController.showingNonFavoriteScope) {
208+ var v = scopesOverview.allCardSize.width / scopeItem.width;
193− scopeItem.overviewScale = 0.4;
209+ scopeItem.overviewScale = v;
210+ scopeItem.x = scopesOverview.allScopeClickedPos.x -(scopeItem.width - scopeItem.width * v) / 2;
211+ scopeItem.y = scopesOverview.allScopeClickedPos.y -(scopeItem.height - scopeItem.height * v) / 2;
194 } else {
212 } else {
195 closeOverlayScope();
213 closeOverlayScope();
196 closePreview();
214 closePreview();
@@ -213,6 +231,7 @@ Showable {
213 z: 1
231 z: 1
214 direction: Direction.Upwards
232 direction: Direction.Upwards
215 distanceThreshold: units.gu(20)
233 distanceThreshold: units.gu(20)
234+ // TODO this needs to be disabled in a few more cases
216 enabled: !overviewController.accepted || dragging
235 enabled: !overviewController.accepted || dragging
217
236
218 anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
237 anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
qml/Dash/DashRenderer.qml+2−1
@@ -45,7 +45,8 @@ Item {
45 /// Emitted when the user clicked on an item
45 /// Emitted when the user clicked on an item
46 /// @param index is the index of the clicked item
46 /// @param index is the index of the clicked item
47 /// @param result result model of the cliked item, used for activation
47 /// @param result result model of the cliked item, used for activation
48+ /// @param item item that has been clicked
48− signal clicked(int index, var result)
49+ signal clicked(int index, var result, var item)
49
50
50 /// Emitted when the user pressed and held on an item
51 /// Emitted when the user pressed and held on an item
51 /// @param index is the index of the held item
52 /// @param index is the index of the held item
qml/Dash/ScopesOverview.qml+16−4
@@ -24,9 +24,9 @@ Item {
24 property real progress: 0
24 property real progress: 0
25 property var scope: null
25 property var scope: null
26 property var dashItemEater: {
26 property var dashItemEater: {
27− if (middleItems.count > 1) {
27+ if (middleItems.count > 0) {
28− var loader = middleItems.itemAt(0).item;
28+ var loaderItem = middleItems.itemAt(0).item;
29− return loader && loader.currentItem ? loader.currentItem : null;
29+ return loaderItem && loaderItem.currentItem ? loaderItem.currentItem : null;
30 }
30 }
31 return null;
31 return null;
32 }
32 }
@@ -37,6 +37,17 @@ Item {
37 property string headerLogo: ""
37 property string headerLogo: ""
38 property color foreground: "white"
38 property color foreground: "white"
39 }
39 }
40+ property size allCardSize: {
41+ if (middleItems.count > 1) {
42+ var loaderItem = middleItems.itemAt(1).item;
43+ if (loaderItem) {
44+ var cardTool = loaderItem.cardTool;
45+ return Qt.size(cardTool.cardWidth, cardTool.cardHeight);
46+ }
47+ }
48+ return Qt.size(0, 0);
49+ }
50+ property var allScopeClickedPos
40
51
41 signal done()
52 signal done()
42 signal favoriteSelected(int index)
53 signal favoriteSelected(int index)
@@ -232,7 +243,8 @@ Item {
232 } else {
243 } else {
233 // This will result in an openScope
244 // This will result in an openScope
234 // that we handle in Dash.qml
245 // that we handle in Dash.qml
246+ root.allScopeClickedPos = item.mapToItem(null, 0, 0);
235− scope.activate(result)
247+ scope.activate(result);
236 }
248 }
237 }
249 }
238 onPressAndHold: {
250 onPressAndHold: {
qml/Dash/ScopesOverviewAll.qml+2−2
@@ -25,7 +25,7 @@ Flickable {
25
25
26 property real extraHeight: 0
26 property real extraHeight: 0
27
27
28− signal clicked(int index, var result)
28+ signal clicked(int index, var result, var item)
29 signal pressAndHold(int index)
29 signal pressAndHold(int index)
30
30
31 contentHeight: cardFilterGrid.height + extraHeight
31 contentHeight: cardFilterGrid.height + extraHeight
@@ -40,7 +40,7 @@ Flickable {
40 }
40 }
41
41
42 onClicked: {
42 onClicked: {
43− root.clicked(index, result);
43+ root.clicked(index, result, item);
44 }
44 }
45 onPressAndHold: {
45 onPressAndHold: {
46 root.pressAndHold(index);
46 root.pressAndHold(index);