on xenial help sign in
some more work. short right edge swipe seems to work mostly
commit5a88633dbfc1115d2c7cf578ad20fd86bd9e13e6 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 3 Jun 2016, 15:31 (10 years ago) parent17d4a51
2 files changed+82−19
qml/Stages/DesktopStage.qml+64−19 qml/Stages/WindowInfoItem.qml+18
qml/Stages/DesktopStage.qml+64−19
@@ -349,6 +349,13 @@ AbstractStage {
349349 }
350350 }
351351
352+// Timer {
353+// interval: 1000
354+// repeat: true
355+// running: index == 0
356+// onTriggered: print("index", index, "focused:", appDelegate.focus, "x", appDelegate.x, "state", appDelegate.state)
357+// }
358+
352359 onFocusChanged: {
353360 if (appRepeater.startingUp)
354361 return;
@@ -358,12 +365,8 @@ AbstractStage {
358365 print("setting focusedAppDelegate to", appDelegate.application.appId)
359366 priv.focusedAppDelegate = appDelegate;
360367
361− // If we're orphan (!parent) it means this stage is no longer the current one
362− // and will be deleted shortly. So we should no longer have a say over the model
363− if (root.parent) {
364− print("raising surface in model", model.id)
365− topLevelSurfaceList.raiseId(model.id);
366− }
368+ print("raising surface in model", model.id)
369+ topLevelSurfaceList.raiseId(model.id);
367370 } else if (!focus && priv.focusedAppDelegate === appDelegate) {
368371 priv.focusedAppDelegate = null;
369372 // FIXME: No idea why the Binding{} doens't update when focusedAppDelegate turns null
@@ -464,7 +467,14 @@ AbstractStage {
464467 }
465468
466469 function playFocusAnimation() {
467− focusAnimation.start()
470+ if (state == "stagedrightedge") {
471+ rightEdgeFocusAnimation.start()
472+ } else {
473+ focusAnimation.start()
474+ }
475+ }
476+ function playHidingAnimation() {
477+ hidingAnimation.start()
468478 }
469479
470480 UbuntuNumberAnimation {
@@ -475,6 +485,17 @@ AbstractStage {
475485 to: 1
476486 duration: UbuntuAnimation.SnapDuration
477487 }
488+ ParallelAnimation {
489+ id: rightEdgeFocusAnimation
490+ UbuntuNumberAnimation { target: appDelegate; properties: "x"; to: 0; duration: priv.animationDuration }
491+ UbuntuNumberAnimation { target: decoratedWindow; properties: "angle"; to: 0; duration: priv.animationDuration }
492+ onStopped: appDelegate.focus = true
493+ }
494+ ParallelAnimation {
495+ id: hidingAnimation
496+ UbuntuNumberAnimation { target: appDelegate; property: "opacity"; to: 0; duration: priv.animationDuration }
497+ onStopped: appDelegate.opacity = 1
498+ }
478499
479500 SpreadMaths {
480501 id: spreadMaths
@@ -492,8 +513,9 @@ AbstractStage {
492513 targetAngle: spreadMaths.animatedAngle
493514 }
494515
495−// onXChanged: if (model.application.appId == "unity8-dash") print("dash moved to", x)
496− onRequestedWidthChanged: if (index == 0) print("requestedWidth", requestedWidth)
516+ onXChanged: if (model.application.appId == "unity8-dash") print("dash moved to", x)
517+// onRequestedWidthChanged: if (index == 0) print("requestedWidth", requestedWidth)
518+ onStateChanged: if (model.application.appId == "unity8-dash") print("state changed", state)
497519 states: [
498520 State {
499521 name: "spread"; when: root.state == "spread"
@@ -502,21 +524,23 @@ AbstractStage {
502524 x: spreadMaths.animatedX
503525 y: spreadMaths.animatedY
504526 z: index
505− height: appContainer.height
527+ height: decoratedWindow.height + windowInfoItem.height + units.gu(2)
506528 }
507529 PropertyChanges {
508530 target: decoratedWindow;
509531 showDecoration: false;
510− height: units.gu(15)
511− width: units.gu(15)
532+ height: units.gu(40)
533+ width: units.gu(40)
512534 angle: spreadMaths.animatedAngle
513535 requestedWidth: decoratedWindow.oldRequestedWidth
514536 requestedHeight: decoratedWindow.oldRequestedHeight
515537 }
516538 PropertyChanges { target: inputBlocker; enabled: true }
539+ PropertyChanges { target: windowInfoItem; opacity: 1 }
517540 },
518541 State {
519− name: "stagedrightedge"; when: root.state == "stagedrightedge"
542+ name: "stagedrightedge";
543+ when: root.state == "stagedrightedge" || rightEdgeFocusAnimation.running || hidingAnimation.running
520544 PropertyChanges {
521545 target: stagedRightEdgeMaths
522546 progress: rightEdgeDragArea.progress
@@ -525,7 +549,7 @@ AbstractStage {
525549 target: appDelegate
526550 y: PanelState.panelHeight
527551 x: stagedRightEdgeMaths.animatedX
528− z: index
552+ z: index +1
529553 }
530554 PropertyChanges {
531555 target: decoratedWindow;
@@ -541,7 +565,8 @@ AbstractStage {
541565 name: "staged"; when: root.state == "staged"
542566 PropertyChanges {
543567 target: appDelegate
544− x: appDelegate.focus ? 0 : root.width; y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
568+ x: appDelegate.focus ? 0 : root.width
569+ y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
545570 visuallyMaximized: true
546571 }
547572 PropertyChanges {
@@ -687,16 +712,16 @@ AbstractStage {
687712 },
688713 Transition {
689714 to: "spread"
690− PropertyAnimation { target: appDelegate; properties: "x,y"; duration: priv.animationDuration }
715+ PropertyAnimation { target: appDelegate; properties: "x,y,height"; duration: priv.animationDuration }
691716 PropertyAnimation { target: decoratedWindow; properties: "width,height,angle"; duration: priv.animationDuration }
692717 },
693718 Transition {
694719 from: "spread"; to: "staged"
695− PropertyAnimation { target: appDelegate; properties: "x,y"; duration: priv.animationDuration }
720+ PropertyAnimation { target: appDelegate; properties: "x,y,height"; duration: priv.animationDuration }
696721 PropertyAnimation { target: decoratedWindow; properties: "angle,width,height"; duration: priv.animationDuration }
697722 },
698− Transition { // Ordering is important. This generic case needs to be after spread -> staged
699− to: "staged";
723+ Transition {
724+ from: "windowed"; to: "staged";
700725 PropertyAnimation { target: appDelegate; properties: "x,y,width,height"; duration: priv.animationDuration }
701726 }
702727 ]
@@ -813,6 +838,16 @@ AbstractStage {
813838 color: "blue"
814839 opacity: .4
815840 }
841+
842+ WindowInfoItem {
843+ id: windowInfoItem
844+ anchors { left: parent.left; bottom: parent.bottom }
845+ title: decoratedWindow.title
846+ iconSource: model.application.icon
847+ opacity: 0
848+ visible: opacity > 0
849+ Behavior on opacity { UbuntuNumberAnimation { duration: priv.animationDuration } }
850+ }
816851 }
817852 }
818853 }
@@ -850,6 +885,13 @@ AbstractStage {
850885
851886 }
852887
888+ PropertyAnimation {
889+ id: shortRightEdgeSwipeAnimation
890+ property: "x"
891+ to: 0
892+ duration: priv.animationDuration
893+ }
894+
853895 SwipeArea {
854896 id: rightEdgeDragArea
855897 direction: Direction.Leftwards
@@ -888,6 +930,9 @@ AbstractStage {
888930 } else {
889931 if (gesturePoints[gesturePoints.length - 1] < -root.width / 2) {
890932 priv.goneToSpread = true;
933+ } else {
934+ appRepeater.itemAt(0).playHidingAnimation()
935+ appRepeater.itemAt(1).playFocusAnimation()
891936 }
892937
893938// // Ok. The user released. Find out if it was a one-way movement.
qml/Stages/WindowInfoItem.qmlnew file+18
@@ -0,0 +1,18 @@
1+import QtQuick 2.4
2+import Ubuntu.Components 1.3
3+
4+Column {
5+ id: root
6+ property alias title: titleLabel.text
7+ property alias iconSource: icon.source
8+
9+
10+ Image {
11+ id: icon
12+ width: units.gu(5)
13+ height: width
14+ }
15+ Label {
16+ id: titleLabel
17+ }
18+}