on xenial help sign in
rename stage to phase to avoid the obvious naming collision
3856e15Michael Zanetti
qml/Stages/PhoneStage.qml+19−19
@@ -74,7 +74,7 @@ Item {
74 }
74 }
75 } else {
75 } else {
76 spreadView.selectedIndex = -1;
76 spreadView.selectedIndex = -1;
77− spreadView.stage = 0;
77+ spreadView.phase = 0;
78 spreadView.contentX = -spreadView.shift;
78 spreadView.contentX = -spreadView.shift;
79 }
79 }
80 }
80 }
@@ -240,7 +240,7 @@ Item {
240 EdgeDragArea {
240 EdgeDragArea {
241 id: spreadDragArea
241 id: spreadDragArea
242 direction: Direction.Leftwards
242 direction: Direction.Leftwards
243− enabled: ApplicationManager.count > 1 && spreadView.stage != 2
243+ enabled: ApplicationManager.count > 1 && spreadView.phase != 2
244
244
245 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
245 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
246 width: root.dragAreaWidth
246 width: root.dragAreaWidth
@@ -256,7 +256,7 @@ Item {
256 if (!dragging && !priv.waitingForScreenshot) {
256 if (!dragging && !priv.waitingForScreenshot) {
257 // Initial touch. Let's update the screenshot and reset the spreadView to the starting position.
257 // Initial touch. Let's update the screenshot and reset the spreadView to the starting position.
258 priv.requestNewScreenshot();
258 priv.requestNewScreenshot();
259− spreadView.stage = 0;
259+ spreadView.phase = 0;
260 spreadView.contentX = -spreadView.shift;
260 spreadView.contentX = -spreadView.shift;
261 }
261 }
262 if (dragging && attachedToView) {
262 if (dragging && attachedToView) {
@@ -323,7 +323,7 @@ Item {
323 id: spreadView
323 id: spreadView
324 objectName: "spreadView"
324 objectName: "spreadView"
325 anchors.fill: parent
325 anchors.fill: parent
326− visible: spreadDragArea.status == DirectionalDragArea.Recognized || stage > 1 || snapAnimation.running
326+ visible: spreadDragArea.status == DirectionalDragArea.Recognized || phase > 1 || snapAnimation.running
327 contentWidth: spreadRow.width - shift
327 contentWidth: spreadRow.width - shift
328 contentX: -shift
328 contentX: -shift
329
329
@@ -350,26 +350,26 @@ Item {
350 // This is where the first app snaps to when bringing it in from the right edge.
350 // This is where the first app snaps to when bringing it in from the right edge.
351 property real snapPosition: 0.75
351 property real snapPosition: 0.75
352
352
353− // Stage of the animation:
353+ // Phase of the animation:
354 // 0: Starting from right edge, a new app (index 1) comes in from the right
354 // 0: Starting from right edge, a new app (index 1) comes in from the right
355 // 1: The app has reached the first snap position.
355 // 1: The app has reached the first snap position.
356− // 2: The list is dragged further and snaps into the spread view when entering stage 2
356+ // 2: The list is dragged further and snaps into the spread view when entering phase 2
357− property int stage: 0
357+ property int phase: 0
358
358
359 property int selectedIndex: -1
359 property int selectedIndex: -1
360
360
361 onShiftedContentXChanged: {
361 onShiftedContentXChanged: {
362− switch (stage) {
362+ switch (phase) {
363 case 0:
363 case 0:
364 if (shiftedContentX > width * positionMarker2) {
364 if (shiftedContentX > width * positionMarker2) {
365− stage = 1;
365+ phase = 1;
366 }
366 }
367 break;
367 break;
368 case 1:
368 case 1:
369 if (shiftedContentX < width * positionMarker2) {
369 if (shiftedContentX < width * positionMarker2) {
370− stage = 0;
370+ phase = 0;
371 } else if (shiftedContentX >= width * positionMarker4) {
371 } else if (shiftedContentX >= width * positionMarker4) {
372− stage = 2;
372+ phase = 2;
373 }
373 }
374 }
374 }
375 }
375 }
@@ -382,7 +382,7 @@ Item {
382 snapTo(1)
382 snapTo(1)
383 } else if (shiftedContentX < positionMarker3 * width) {
383 } else if (shiftedContentX < positionMarker3 * width) {
384 snapTo(1)
384 snapTo(1)
385− } else if (stage < 2){
385+ } else if (phase < 2){
386 // Add 1 pixel to make sure we definitely hit positionMarker4 even with rounding errors of the animation.
386 // Add 1 pixel to make sure we definitely hit positionMarker4 even with rounding errors of the animation.
387 snapAnimation.targetContentX = width * positionMarker4 + 1 - shift;
387 snapAnimation.targetContentX = width * positionMarker4 + 1 - shift;
388 snapAnimation.start();
388 snapAnimation.start();
@@ -411,12 +411,12 @@ Item {
411 if (spreadView.selectedIndex >= 0) {
411 if (spreadView.selectedIndex >= 0) {
412 ApplicationManager.focusApplication(ApplicationManager.get(spreadView.selectedIndex).appId);
412 ApplicationManager.focusApplication(ApplicationManager.get(spreadView.selectedIndex).appId);
413 spreadView.selectedIndex = -1
413 spreadView.selectedIndex = -1
414− spreadView.stage = 0;
414+ spreadView.phase = 0;
415 spreadView.contentX = -spreadView.shift;
415 spreadView.contentX = -spreadView.shift;
416 }
416 }
417 if (spreadView.shiftedContentX == spreadView.width * spreadView.positionMarker2) {
417 if (spreadView.shiftedContentX == spreadView.width * spreadView.positionMarker2) {
418− spreadView.stage = 4;
418+ spreadView.phase = 4;
419− spreadView.stage = 0;
419+ spreadView.phase = 0;
420 spreadView.contentX = -spreadView.shift;
420 spreadView.contentX = -spreadView.shift;
421 }
421 }
422 }
422 }
@@ -454,15 +454,15 @@ Item {
454 progress: {
454 progress: {
455 var tileProgress = (spreadView.shiftedContentX - index * spreadView.tileDistance) / spreadView.width;
455 var tileProgress = (spreadView.shiftedContentX - index * spreadView.tileDistance) / spreadView.width;
456 // Tile 1 needs to move directly from the beginning...
456 // Tile 1 needs to move directly from the beginning...
457− if (index == 1 && spreadView.stage < 2) {
457+ if (index == 1 && spreadView.phase < 2) {
458 tileProgress += spreadView.tileDistance / spreadView.width;
458 tileProgress += spreadView.tileDistance / spreadView.width;
459 }
459 }
460 return tileProgress;
460 return tileProgress;
461 }
461 }
462
462
463− // This mostly is the same as progress, just adds the snapping to stage 1 for tiles 0 and 1
463+ // This mostly is the same as progress, just adds the snapping to phase 1 for tiles 0 and 1
464 animatedProgress: {
464 animatedProgress: {
465− if (spreadView.stage == 0 && index < 2) {
465+ if (spreadView.phase == 0 && index < 2) {
466 if (progress < spreadView.positionMarker1) {
466 if (progress < spreadView.positionMarker1) {
467 return progress;
467 return progress;
468 } else if (progress < spreadView.positionMarker1 + snappingCurve.period){
468 } else if (progress < spreadView.positionMarker1 + snappingCurve.period){
@@ -482,7 +482,7 @@ Item {
482 }
482 }
483
483
484 onClicked: {
484 onClicked: {
485− if (spreadView.stage == 2) {
485+ if (spreadView.phase == 2) {
486 if (ApplicationManager.focusedApplicationId == ApplicationManager.get(index).appId) {
486 if (ApplicationManager.focusedApplicationId == ApplicationManager.get(index).appId) {
487 spreadView.snapTo(index);
487 spreadView.snapTo(index);
488 } else {
488 } else {
qml/Stages/TransformedSpreadDelegate.qml+46−46
@@ -58,20 +58,20 @@ SpreadDelegate {
58
58
59 Connections {
59 Connections {
60 target: spreadView
60 target: spreadView
61− onStageChanged: {
61+ onPhaseChanged: {
62− if (spreadView.stage == 1) {
62+ if (spreadView.phase == 1) {
63 if (index == 0) {
63 if (index == 0) {
64− priv.stage2startTranslate = priv.easingAnimation(0, spreadView.positionMarker4, 0, -spreadView.width, spreadView.positionMarker4) + spreadView.width;
64+ priv.phase2startTranslate = priv.easingAnimation(0, spreadView.positionMarker4, 0, -spreadView.width, spreadView.positionMarker4) + spreadView.width;
65− priv.stage2startAngle = priv.easingAnimation(0, spreadView.positionMarker4, root.startAngle, root.endAngle, spreadView.positionMarker4);
65+ priv.phase2startAngle = priv.easingAnimation(0, spreadView.positionMarker4, root.startAngle, root.endAngle, spreadView.positionMarker4);
66− priv.stage2startScale = priv.easingAnimation(0, spreadView.positionMarker4, root.startScale, root.endScale, spreadView.positionMarker4);
66+ priv.phase2startScale = priv.easingAnimation(0, spreadView.positionMarker4, root.startScale, root.endScale, spreadView.positionMarker4);
67− priv.stage2startTopMarginProgress = priv.easingAnimation(0, 1, 0, 1, spreadView.positionMarker4);
67+ priv.phase2startTopMarginProgress = priv.easingAnimation(0, 1, 0, 1, spreadView.positionMarker4);
68 } else if (index == 1) {
68 } else if (index == 1) {
69− // find where the main easing for Tile 1 would be when reaching stage 2
69+ // find where the main easing for Tile 1 would be when reaching phase 2
70− var stage2Progress = spreadView.positionMarker4 - spreadView.tileDistance / spreadView.width;
70+ var phase2Progress = spreadView.positionMarker4 - spreadView.tileDistance / spreadView.width;
71− priv.stage2startTranslate = priv.easingAnimation(0, stage2Progress, 0, -spreadView.width + root.endDistance, stage2Progress);
71+ priv.phase2startTranslate = priv.easingAnimation(0, phase2Progress, 0, -spreadView.width + root.endDistance, phase2Progress);
72− priv.stage2startAngle = priv.easingAnimation(0, stage2Progress, root.startAngle, root.endAngle, stage2Progress);
72+ priv.phase2startAngle = priv.easingAnimation(0, phase2Progress, root.startAngle, root.endAngle, phase2Progress);
73− priv.stage2startScale = priv.easingAnimation(0, stage2Progress, root.startScale, root.endScale, stage2Progress);
73+ priv.phase2startScale = priv.easingAnimation(0, phase2Progress, root.startScale, root.endScale, phase2Progress);
74− priv.stage2startTopMarginProgress = priv.easingAnimation(0, 1, 0, spreadView.positionMarker4, stage2Progress);
74+ priv.phase2startTopMarginProgress = priv.easingAnimation(0, 1, 0, spreadView.positionMarker4, phase2Progress);
75 }
75 }
76 }
76 }
77 }
77 }
@@ -88,12 +88,12 @@ SpreadDelegate {
88 property real selectedOpacity
88 property real selectedOpacity
89 property real selectedTopMarginProgress
89 property real selectedTopMarginProgress
90
90
91− // Those values are needed as target values for the end of stage 1.
91+ // Those values are needed as target values for the end of phase 1.
92− // As they are static values, lets caluclate them once when entering stage 1 instead of calculating them in each animation pass.
92+ // As they are static values, lets caluclate them once when entering phase 1 instead of calculating them in each animation pass.
93− property real stage2startTranslate
93+ property real phase2startTranslate
94− property real stage2startAngle
94+ property real phase2startAngle
95− property real stage2startScale
95+ property real phase2startScale
96− property real stage2startTopMarginProgress
96+ property real phase2startTopMarginProgress
97
97
98 function snapshot() {
98 function snapshot() {
99 selectedProgress = root.progress;
99 selectedProgress = root.progress;
@@ -106,7 +106,7 @@ SpreadDelegate {
106 }
106 }
107
107
108 property real negativeProgress: {
108 property real negativeProgress: {
109− if (index == 1 && spreadView.stage < 2) {
109+ if (index == 1 && spreadView.phase < 2) {
110 return 0;
110 return 0;
111 }
111 }
112 return -index * spreadView.tileDistance / spreadView.width;
112 return -index * spreadView.tileDistance / spreadView.width;
@@ -127,7 +127,7 @@ SpreadDelegate {
127
127
128 property real xTranslate: {
128 property real xTranslate: {
129 if (otherSelected) {
129 if (otherSelected) {
130− if (spreadView.stage < 2 && index == 0) {
130+ if (spreadView.phase < 2 && index == 0) {
131 return linearAnimation(selectedProgress, negativeProgress, selectedXTranslate, selectedXTranslate - spreadView.tileDistance, root.progress);
131 return linearAnimation(selectedProgress, negativeProgress, selectedXTranslate, selectedXTranslate - spreadView.tileDistance, root.progress);
132 }
132 }
133
133
@@ -136,13 +136,13 @@ SpreadDelegate {
136
136
137 switch (index) {
137 switch (index) {
138 case 0:
138 case 0:
139− if (spreadView.stage == 0) {
139+ if (spreadView.phase == 0) {
140 return Math.min(0, linearAnimation(0, spreadView.positionMarker2,
140 return Math.min(0, linearAnimation(0, spreadView.positionMarker2,
141 0, -spreadView.width * .25, root.animatedProgress));
141 0, -spreadView.width * .25, root.animatedProgress));
142− } else if (spreadView.stage == 1){
142+ } else if (spreadView.phase == 1){
143 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
143 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
144− -spreadView.width * .25, priv.stage2startTranslate, root.progress);
144+ -spreadView.width * .25, priv.phase2startTranslate, root.progress);
145− } else if (!priv.isSelected){ // Stage 2
145+ } else if (!priv.isSelected){ // phase 2
146 // Apply the same animation as with the rest but add spreadView.width to align it with the others.
146 // Apply the same animation as with the rest but add spreadView.width to align it with the others.
147 return -easingCurve.value * spreadView.width + spreadView.width;
147 return -easingCurve.value * spreadView.width + spreadView.width;
148 } else if (priv.isSelected) {
148 } else if (priv.isSelected) {
@@ -150,12 +150,12 @@ SpreadDelegate {
150 }
150 }
151
151
152 case 1:
152 case 1:
153− if (spreadView.stage == 0 && !priv.isSelected) {
153+ if (spreadView.phase == 0 && !priv.isSelected) {
154 return linearAnimation(0, spreadView.positionMarker2,
154 return linearAnimation(0, spreadView.positionMarker2,
155 0, -spreadView.width * spreadView.snapPosition, root.animatedProgress);
155 0, -spreadView.width * spreadView.snapPosition, root.animatedProgress);
156− } else if (spreadView.stage == 1 && !priv.isSelected) {
156+ } else if (spreadView.phase == 1 && !priv.isSelected) {
157 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
157 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
158− -spreadView.width * spreadView.snapPosition, priv.stage2startTranslate,
158+ -spreadView.width * spreadView.snapPosition, priv.phase2startTranslate,
159 root.progress);
159 root.progress);
160 }
160 }
161 }
161 }
@@ -183,20 +183,20 @@ SpreadDelegate {
183 }
183 }
184 switch (index) {
184 switch (index) {
185 case 0:
185 case 0:
186− if (spreadView.stage == 0) {
186+ if (spreadView.phase == 0) {
187 return Math.max(0, linearAnimation(0, spreadView.positionMarker2,
187 return Math.max(0, linearAnimation(0, spreadView.positionMarker2,
188 0, root.tile0SnapAngle, root.animatedProgress));
188 0, root.tile0SnapAngle, root.animatedProgress));
189− } else if (spreadView.stage == 1) {
189+ } else if (spreadView.phase == 1) {
190 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
190 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
191− root.tile0SnapAngle, stage2startAngle, root.progress);
191+ root.tile0SnapAngle, phase2startAngle, root.progress);
192 }
192 }
193 case 1:
193 case 1:
194− if (spreadView.stage == 0) {
194+ if (spreadView.phase == 0) {
195 return linearAnimation(0, spreadView.positionMarker2, root.startAngle,
195 return linearAnimation(0, spreadView.positionMarker2, root.startAngle,
196 root.startAngle * (1-spreadView.snapPosition), root.animatedProgress);
196 root.startAngle * (1-spreadView.snapPosition), root.animatedProgress);
197− } else if (spreadView.stage == 1) {
197+ } else if (spreadView.phase == 1) {
198 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
198 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
199− root.startAngle * (1-spreadView.snapPosition), priv.stage2startAngle,
199+ root.startAngle * (1-spreadView.snapPosition), priv.phase2startAngle,
200 root.progress);
200 root.progress);
201 }
201 }
202 }
202 }
@@ -213,21 +213,21 @@ SpreadDelegate {
213
213
214 switch (index) {
214 switch (index) {
215 case 0:
215 case 0:
216− if (spreadView.stage == 0) {
216+ if (spreadView.phase == 0) {
217 return 1;
217 return 1;
218− } else if(spreadView.stage == 1) {
218+ } else if(spreadView.phase == 1) {
219 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
219 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
220− 1, stage2startScale, root.progress);
220+ 1, phase2startScale, root.progress);
221 }
221 }
222 case 1:
222 case 1:
223− if (spreadView.stage == 0) {
223+ if (spreadView.phase == 0) {
224 var targetScale = tile1StartScale - ((tile1StartScale - 1) * spreadView.snapPosition);
224 var targetScale = tile1StartScale - ((tile1StartScale - 1) * spreadView.snapPosition);
225 return linearAnimation(0, spreadView.positionMarker2,
225 return linearAnimation(0, spreadView.positionMarker2,
226 root.tile1StartScale, targetScale, root.animatedProgress);
226 root.tile1StartScale, targetScale, root.animatedProgress);
227− } else if (spreadView.stage == 1) {
227+ } else if (spreadView.phase == 1) {
228 var startScale = tile1StartScale - ((tile1StartScale - 1) * spreadView.snapPosition);
228 var startScale = tile1StartScale - ((tile1StartScale - 1) * spreadView.snapPosition);
229 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
229 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
230− startScale, priv.stage2startScale, root.progress);
230+ startScale, priv.phase2startScale, root.progress);
231 }
231 }
232 }
232 }
233 return root.startScale - easingCurve.value * (root.startScale - root.endScale);
233 return root.startScale - easingCurve.value * (root.startScale - root.endScale);
@@ -239,7 +239,7 @@ SpreadDelegate {
239 selectedOpacity, 0, root.progress);
239 selectedOpacity, 0, root.progress);
240 }
240 }
241 if (index == 0) {
241 if (index == 0) {
242− switch (spreadView.stage) {
242+ switch (spreadView.phase) {
243 case 0:
243 case 0:
244 return linearAnimation(0, spreadView.positionMarker2, 1, .3, root.animatedProgress);
244 return linearAnimation(0, spreadView.positionMarker2, 1, .3, root.animatedProgress);
245 case 1:
245 case 1:
@@ -258,19 +258,19 @@ SpreadDelegate {
258
258
259 switch (index) {
259 switch (index) {
260 case 0:
260 case 0:
261− if (spreadView.stage == 0) {
261+ if (spreadView.phase == 0) {
262 return 0;
262 return 0;
263− } else if (spreadView.stage == 1) {
263+ } else if (spreadView.phase == 1) {
264 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
264 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
265− 0, priv.stage2startTopMarginProgress, root.progress);
265+ 0, priv.phase2startTopMarginProgress, root.progress);
266 }
266 }
267 break;
267 break;
268 case 1:
268 case 1:
269− if (spreadView.stage == 0) {
269+ if (spreadView.phase == 0) {
270 return 0;
270 return 0;
271− } else if (spreadView.stage == 1) {
271+ } else if (spreadView.phase == 1) {
272 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
272 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
273− 0, priv.stage2startTopMarginProgress, root.progress);
273+ 0, priv.phase2startTopMarginProgress, root.progress);
274 }
274 }
275 }
275 }
276
276