2 * Copyright (C) 2016 Canonical Ltd.
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.
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.
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/>.
18import QtQuick.Layouts 1.1
19import Lomiri.Components 1.3
20import Lomiri.Gestures 0.1
25 property bool showHint: true
26 property int panelWidth: units.gu(40)
27 readonly property alias dragging: hideSideStageDragArea.dragging
28 readonly property real progress: width / panelWidth
29 readonly property real handleWidth: units.gu(2)
35 id: sideStageDragHandle
37 opacity: root.shown ? 1 : 0
38 Behavior on opacity { LomiriNumberAnimation {} }
45 width: root.handleWidth
46 active: hideSideStageDragArea.pressed
50 anchors.centerIn: parent
51 width: hideSideStageDragArea.pressed ? parent.width * 3 : parent.width * 2
53 source: "graphics/sidestage_handle@20.png"
54 Behavior on width { LomiriNumberAnimation {} }
60 color: Qt.rgba(0,0,0,0.95)
61 visible: showHint || hideAnimation.running
65 anchors.verticalCenter: parent.verticalCenter
66 width: panelWidth - units.gu(6)
67 x: panelWidth/2 - width/2
70 visible: showHint && !hideAnimation.running
74 anchors.horizontalCenter: parent.horizontalCenter
75 source: "graphics/sidestage_drag.svg"
76 color: enabled ? Qt.rgba(1,1,1,1) : Qt.rgba(1,0,0,1)
77 keyColor: Qt.rgba(1,1,1,1)
81 text: i18n.tr("Drag using 3 fingers any application from one window to the other")
83 wrapMode: Text.WordWrap
84 color: enabled ? Qt.rgba(1,1,1,1) : Qt.rgba(1,0,0,1)
88 showAnimation: NumberAnimation {
91 duration: LomiriAnimation.BriskDuration
92 easing.type: Easing.OutCubic
95 hideAnimation: NumberAnimation {
98 duration: LomiriAnimation.BriskDuration
99 easing.type: Easing.OutCubic
103 id: hideSideStageDragArea
104 objectName: "hideSideStageDragArea"
106 direction: Direction.Rightwards
108 anchors.right: root.left
109 width: sideStageDragHandle.width
113 immediateRecognition: true
114 maxTotalDragDistance: panelWidth
115 autoCompleteDragThreshold: panelWidth / 2
118 // SideStage mouse event eater