on xenial help sign in
separate min/max/close buttons when the overlay is shown
4bc1d7aLukáš Tinkl
qml/Components/TouchControlsState/TouchControlsState.qmlnew file+24
@@ -0,0 +1,24 @@
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+pragma Singleton
18+import QtQuick 2.4
19+
20+QtObject {
21+ id: root
22+
23+ property bool overlayShown: false
24+}
qml/Components/TouchControlsState/qmldirnew file+1
@@ -0,0 +1 @@
1+singleton TouchControlsState 1.0 TouchControlsState.qml
qml/Components/WindowControlButtons.qml+5−4
@@ -16,10 +16,11 @@
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18import Ubuntu.Components 1.3
18import Ubuntu.Components 1.3
19+import "../Components/TouchControlsState"
19
20
20Row {
21Row {
21 id: root
22 id: root
22− spacing: units.gu(1)
23+ spacing: TouchControlsState.overlayShown && !windowIsMaximized ? units.gu(2) : units.gu(1)
23
24
24 // to be set from outside
25 // to be set from outside
25 property bool active: false
26 property bool active: false
@@ -41,7 +42,7 @@ Row {
41 anchors.fill: parent
42 anchors.fill: parent
42 radius: height / 2
43 radius: height / 2
43 color: UbuntuColors.red
44 color: UbuntuColors.red
44− visible: parent.containsMouse
45+ visible: parent.containsMouse && !TouchControlsState.overlayShown
45 }
46 }
46 Icon {
47 Icon {
47 anchors.fill: parent
48 anchors.fill: parent
@@ -63,7 +64,7 @@ Row {
63 anchors.fill: parent
64 anchors.fill: parent
64 radius: height / 2
65 radius: height / 2
65 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
66 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
66− visible: parent.containsMouse
67+ visible: parent.containsMouse && !TouchControlsState.overlayShown
67 }
68 }
68 Icon {
69 Icon {
69 anchors.fill: parent
70 anchors.fill: parent
@@ -85,7 +86,7 @@ Row {
85 anchors.fill: parent
86 anchors.fill: parent
86 radius: height / 2
87 radius: height / 2
87 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
88 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
88− visible: parent.containsMouse
89+ visible: parent.containsMouse && !TouchControlsState.overlayShown
89 }
90 }
90 Icon {
91 Icon {
91 anchors.fill: parent
92 anchors.fill: parent
qml/Stages/WindowControlsOverlay.qml+8−1
@@ -18,6 +18,7 @@ import QtQuick 2.4
18import Ubuntu.Components 1.3
18import Ubuntu.Components 1.3
19import Ubuntu.Gestures 0.1
19import Ubuntu.Gestures 0.1
20import "../Components/PanelState"
20import "../Components/PanelState"
21+import "../Components/TouchControlsState"
21
22
22Item {
23Item {
23 id: root
24 id: root
@@ -65,6 +66,11 @@ Item {
65 readonly property int borderThickness: priv.resizeArea ? priv.resizeArea.borderThickness : 0
66 readonly property int borderThickness: priv.resizeArea ? priv.resizeArea.borderThickness : 0
66 }
67 }
67
68
69+ Binding {
70+ target: TouchControlsState
71+ property: "overlayShown"
72+ value: overlay.visible
73+ }
68
74
69 // the visual overlay
75 // the visual overlay
70 Item {
76 Item {
@@ -123,10 +129,11 @@ Item {
123 anchors.fill: parent
129 anchors.fill: parent
124 visible: overlay.visible
130 visible: overlay.visible
125 enabled: visible
131 enabled: visible
126− onClicked: {
132+ onPressed: {
127 overlayTimer.stop();
133 overlayTimer.stop();
128 mouse.accepted = false;
134 mouse.accepted = false;
129 }
135 }
136+ propagateComposedEvents: true
130 }
137 }
131 }
138 }
132
139
qml/Stages/WindowDecoration.qml+2−1
@@ -19,6 +19,7 @@ import Unity.Application 0.1 // For Mir singleton
19import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
20import "../Components"
20import "../Components"
21import "../Components/PanelState"
21import "../Components/PanelState"
22+import "../Components/TouchControlsState"
22
23
23MouseArea {
24MouseArea {
24 id: root
25 id: root
@@ -73,7 +74,7 @@ MouseArea {
73 Row {
74 Row {
74 anchors {
75 anchors {
75 fill: parent
76 fill: parent
76− leftMargin: units.gu(1)
77+ leftMargin: TouchControlsState.overlayShown ? units.gu(5) : units.gu(1)
77 rightMargin: units.gu(1)
78 rightMargin: units.gu(1)
78 topMargin: units.gu(0.5)
79 topMargin: units.gu(0.5)
79 bottomMargin: units.gu(0.5)
80 bottomMargin: units.gu(0.5)