on xenial help sign in
add support for the right edge push barrier
commit481dd7146ae1cdb997d839d6d2293c81e8cc0b3e authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 7 Sep 2016, 14:41 (10 years ago) parent7fc0f94
4 files changed+20−13
qml/Components/EdgeBarrier.qml+2 qml/Stage/Stage.qml+15−10 tests/qmltests/CMakeLists.txt+1−1 tests/qmltests/Stage/tst_DesktopStage.qml+2−2
qml/Components/EdgeBarrier.qml+2
@@ -29,6 +29,8 @@ Item {
2929 // Supported values are: Qt.LeftEdge, Qt.RightEdge
3030 property int edge: Qt.LeftEdge
3131
32+ readonly property alias progress: controller.progress
33+
3234 property Item target: parent
3335 function push(amount) { controller.push(amount); }
3436 signal passed()
qml/Stage/Stage.qml+15−10
@@ -34,9 +34,9 @@ AbstractStage {
3434 function updateFocusedAppOrientation() { /* TODO */ }
3535 function updateFocusedAppOrientationAnimated() { /* TODO */}
3636 function pushRightEdge(amount) {
37− if (spread.state === "") {
37+// if (state === "windowed" || state == "") {
3838 edgeBarrier.push(amount);
39− }
39+// }
4040 }
4141 function closeFocusedDelegate() {
4242 if (priv.focusedAppDelegate && !priv.focusedAppDelegate.isDash) {
@@ -340,14 +340,14 @@ AbstractStage {
340340 PropertyChanges { target: hoverMouseArea; enabled: true }
341341 },
342342 State {
343− name: "stagedRightEdge"; when: rightEdgeDragArea.dragging && root.mode == "staged"
343+ name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "staged"
344344 },
345345 State {
346− name: "sideStagedRightEdge"; when: rightEdgeDragArea.dragging && root.mode == "stagedWithSideStage"
346+ name: "sideStagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "stagedWithSideStage"
347347// PropertyChanges { target: priv; nextInStack: priv.sideStageDelegate && priv.sideStageDelegate.itemIndex < 2 ? 2 : 1 }
348348 },
349349 State {
350− name: "windowedRightEdge"; when: rightEdgeDragArea.dragging && root.mode == "windowed"
350+ name: "windowedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "windowed"
351351 },
352352 State {
353353 name: "staged"; when: root.mode === "staged"
@@ -932,7 +932,7 @@ AbstractStage {
932932 when: (root.mode == "staged" || root.mode == "stagedWithSideStage") && (root.state == "sideStagedRightEdge" || root.state == "stagedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running)
933933 PropertyChanges {
934934 target: stagedRightEdgeMaths
935− progress: rightEdgeDragArea.progress
935+ progress: Math.max(edgeBarrier.progress, rightEdgeDragArea.progress)
936936 }
937937 PropertyChanges {
938938 target: appDelegate
@@ -955,10 +955,10 @@ AbstractStage {
955955 },
956956 State {
957957 name: "windowedRightEdge"
958− when: root.mode == "windowed" && (root.state == "windowedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running)
958+ when: root.mode == "windowed" && (root.state == "windowedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running || edgeBarrier.progress > 0)
959959 PropertyChanges {
960960 target: windowedRightEdgeMaths
961− progress: rightEdgeDragArea.progress
961+ progress: Math.max(rightEdgeDragArea.progress, edgeBarrier.progress)
962962 }
963963 PropertyChanges {
964964 target: appDelegate
@@ -1439,7 +1439,12 @@ AbstractStage {
14391439 // NB: it does its own positioning according to the specified edge
14401440 edge: Qt.RightEdge
14411441
1442− onPassed: { spread.show(); }
1442+ onProgressChanged: {
1443+ if (progress > spreadItem.rightEdgeBreakPoint) {
1444+ priv.goneToSpread = true;
1445+ }
1446+ }
1447+
14431448 material: Component {
14441449 Item {
14451450 Rectangle {
@@ -1533,7 +1538,7 @@ AbstractStage {
15331538 property var gesturePoints: new Array()
15341539 property bool cancelled: false
15351540
1536− property real progress: -touchPosition.x / root.width
1541+ property real progress: dragging ? -touchPosition.x / root.width : 0
15371542
15381543 onTouchPositionChanged: {
15391544 gesturePoints.push(touchPosition.x);
tests/qmltests/CMakeLists.txt+1−1
@@ -87,7 +87,7 @@ add_unity8_qmltest(Panel/Indicators IndicatorsLight)
8787add_unity8_qmltest(Panel/Indicators MenuItemFactory)
8888add_unity8_qmltest(Panel/Indicators MessageMenuItemFactory)
8989add_unity8_qmltest(Stages ApplicationWindow)
90−add_unity8_qmltest(Stages DesktopStage)
90+add_unity8_qmltest(Stage DesktopStage)
9191add_unity8_qmltest(Stages PhoneStage)
9292add_unity8_qmltest(Stages SpreadDelegate)
9393add_unity8_qmltest(Stages SurfaceContainer)
tests/qmltests/Stage/tst_DesktopStage.qml+2−2
@@ -24,7 +24,7 @@ import WindowManager 0.1
2424import Utils 0.1
2525
2626import ".." // For EdgeBarrierControls
27−import "../../../qml/Stages"
27+import "../../../qml/Stage"
2828import "../../../qml/Components"
2929import "../../../qml/Components/PanelState"
3030
@@ -73,7 +73,7 @@ Item {
7373
7474 property bool itemDestroyed: false
7575 sourceComponent: Component {
76− DesktopStage {
76+ Stage {
7777 anchors.fill: parent
7878 background: "../../../qml/graphics/tablet_background.jpg"
7979 focus: true