on xenial help sign in
WIP: basic window controls overlay
commitbe4b0d4d81dbbd437ad25b9b91bf9dd9a097f001 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 30 Mar 2016, 00:10 (11 years ago) parent064b28f
5 files changed+144
qml/Stages/DecoratedWindow.qml+5 qml/Stages/ResizeGrip.qml+32 qml/Stages/WindowControlsOverlay.qml+107 qml/Stages/graphics/arrows-centre.png qml/Stages/graphics/arrows.png
qml/Stages/DecoratedWindow.qml+5
@@ -19,6 +19,7 @@
1919import QtQuick 2.4
2020import Ubuntu.Components 1.3
2121import Unity.Application 0.1
22+import Ubuntu.Gestures 0.1
2223
2324FocusScope {
2425 id: root
@@ -102,4 +103,8 @@ FocusScope {
102103 interactive: true
103104 focus: true
104105 }
106+
107+ WindowControlsOverlay {
108+ anchors.fill: root
109+ }
105110}
qml/Stages/ResizeGrip.qmlnew file+32
@@ -0,0 +1,32 @@
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+
17+import QtQuick 2.4
18+import Ubuntu.Components 1.3
19+
20+Rectangle {
21+ width: units.gu(4)
22+ height: width
23+ radius: height / 2
24+ color: theme.palette.normal.background
25+
26+ Image {
27+ source: "graphics/arrows.png"
28+ anchors.centerIn: parent
29+ width: units.gu(2)
30+ height: width
31+ }
32+}
qml/Stages/WindowControlsOverlay.qmlnew file+107
@@ -0,0 +1,107 @@
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+
17+import QtQuick 2.4
18+import Ubuntu.Components 1.3
19+import Ubuntu.Gestures 0.1
20+
21+Item {
22+ TabletSideStageTouchGesture {
23+ minimumTouchPoints: 2
24+ maximumTouchPoints: 2
25+ anchors.fill: parent
26+
27+ onRecognisedPressChanged: {
28+ print("Press recognized:", recognisedPress)
29+ if (recognisedPress) {
30+ overlayTimer.running = true;
31+ }
32+ }
33+ onDragStarted: print("Drag started")
34+ onDropped: print("Dropped")
35+ onCancelled: print("Cancelled")
36+ }
37+
38+ Timer {
39+ id: overlayTimer
40+ interval: 2000
41+ }
42+
43+ InverseMouseArea {
44+ anchors.fill: overlay
45+ onClicked: overlayTimer.stop()
46+ }
47+
48+ Item {
49+ id: overlay
50+ anchors.fill: parent
51+ visible: overlayTimer.running
52+ enabled: visible
53+
54+ Image {
55+ source: "graphics/arrows-centre.png"
56+ width: units.gu(6)
57+ height: width
58+ anchors.centerIn: parent
59+ }
60+
61+ ResizeGrip { // top left
62+ anchors.horizontalCenter: parent.left
63+ anchors.verticalCenter: parent.top
64+ }
65+
66+ ResizeGrip { // top center
67+ anchors.horizontalCenter: parent.horizontalCenter
68+ anchors.verticalCenter: parent.top
69+ rotation: 45
70+ }
71+
72+ ResizeGrip { // top right
73+ anchors.horizontalCenter: parent.right
74+ anchors.verticalCenter: parent.top
75+ rotation: 90
76+ }
77+
78+ ResizeGrip { // right
79+ anchors.horizontalCenter: parent.right
80+ anchors.verticalCenter: parent.verticalCenter
81+ rotation: 135
82+ }
83+
84+ ResizeGrip { // bottom right
85+ anchors.horizontalCenter: parent.right
86+ anchors.verticalCenter: parent.bottom
87+ }
88+
89+ ResizeGrip { // bottom center
90+ anchors.horizontalCenter: parent.horizontalCenter
91+ anchors.verticalCenter: parent.bottom
92+ rotation: 45
93+ }
94+
95+ ResizeGrip { // bottom left
96+ anchors.horizontalCenter: parent.left
97+ anchors.verticalCenter: parent.bottom
98+ rotation: 90
99+ }
100+
101+ ResizeGrip { // left
102+ anchors.horizontalCenter: parent.left
103+ anchors.verticalCenter: parent.verticalCenter
104+ rotation: 135
105+ }
106+ }
107+}
qml/Stages/graphics/arrows-centre.pngnew file

Binary file not shown.

qml/Stages/graphics/arrows.pngnew file

Binary file not shown.