Lomiri
Loading...
Searching...
No Matches
SideStage.qml
1/*
2 * Copyright (C) 2016 Canonical Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 */
16
17import QtQuick 2.12
18import QtQuick.Layouts 1.1
19import Lomiri.Components 1.3
20import Lomiri.Gestures 0.1
21import "../Components"
22
23Showable {
24 id: root
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)
30
31 width: 0
32 shown: false
33
34 Handle {
35 id: sideStageDragHandle
36
37 opacity: root.shown ? 1 : 0
38 Behavior on opacity { LomiriNumberAnimation {} }
39
40 anchors {
41 right: root.left
42 top: root.top
43 bottom: root.bottom
44 }
45 width: root.handleWidth
46 active: hideSideStageDragArea.pressed
47
48 Image {
49 z: -1
50 anchors.centerIn: parent
51 width: hideSideStageDragArea.pressed ? parent.width * 3 : parent.width * 2
52 height: parent.height
53 source: "graphics/sidestage_handle@20.png"
54 Behavior on width { LomiriNumberAnimation {} }
55 }
56 }
57
58 Rectangle {
59 anchors.fill: parent
60 color: Qt.rgba(0,0,0,0.95)
61 }
62
63 Column {
64 anchors.verticalCenter: parent.verticalCenter
65 width: panelWidth - units.gu(6)
66 x: panelWidth/2 - width/2
67 spacing: units.gu(3)
68 opacity: 0.8
69 visible: showHint
70
71 Icon {
72 width: units.gu(30)
73 anchors.horizontalCenter: parent.horizontalCenter
74 source: "graphics/sidestage_drag.svg"
75 color: enabled ? Qt.rgba(1,1,1,1) : Qt.rgba(1,0,0,1)
76 keyColor: Qt.rgba(1,1,1,1)
77 }
78
79 Label {
80 text: i18n.tr("Drag using 3 fingers any application from one window to the other")
81 width: parent.width
82 wrapMode: Text.WordWrap
83 color: enabled ? Qt.rgba(1,1,1,1) : Qt.rgba(1,0,0,1)
84 }
85 }
86
87 showAnimation: NumberAnimation {
88 property: "width"
89 to: panelWidth
90 duration: LomiriAnimation.BriskDuration
91 easing.type: Easing.OutCubic
92 }
93
94 hideAnimation: NumberAnimation {
95 property: "width"
96 to: 0
97 duration: LomiriAnimation.BriskDuration
98 easing.type: Easing.OutCubic
99 }
100
101 DragHandle {
102 id: hideSideStageDragArea
103 objectName: "hideSideStageDragArea"
104
105 direction: Direction.Rightwards
106 enabled: root.shown
107 anchors.right: root.left
108 width: sideStageDragHandle.width
109 height: root.height
110 stretch: true
111
112 immediateRecognition: true
113 maxTotalDragDistance: panelWidth
114 autoCompleteDragThreshold: panelWidth / 2
115 }
116
117 // SideStage mouse event eater
118 MouseArea {
119 anchors.fill: parent
120 }
121}