on xenial help sign in
separate min/max/close buttons when the overlay is shown
commit4bc1d7a1bbb550f7d9aa5e5195fadd8ad833ab99 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 26 Apr 2016, 14:01 (10 years ago) parent9c5a77d
5 files changed+40−6
qml/Components/TouchControlsState/TouchControlsState.qml+24 qml/Components/TouchControlsState/qmldir+1 qml/Components/WindowControlButtons.qml+5−4 qml/Stages/WindowControlsOverlay.qml+8−1 qml/Stages/WindowDecoration.qml+2−1
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 @@
1616
1717import QtQuick 2.4
1818import Ubuntu.Components 1.3
19+import "../Components/TouchControlsState"
1920
2021Row {
2122 id: root
22− spacing: units.gu(1)
23+ spacing: TouchControlsState.overlayShown && !windowIsMaximized ? units.gu(2) : units.gu(1)
2324
2425 // to be set from outside
2526 property bool active: false
@@ -41,7 +42,7 @@ Row {
4142 anchors.fill: parent
4243 radius: height / 2
4344 color: UbuntuColors.red
44− visible: parent.containsMouse
45+ visible: parent.containsMouse && !TouchControlsState.overlayShown
4546 }
4647 Icon {
4748 anchors.fill: parent
@@ -63,7 +64,7 @@ Row {
6364 anchors.fill: parent
6465 radius: height / 2
6566 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
66− visible: parent.containsMouse
67+ visible: parent.containsMouse && !TouchControlsState.overlayShown
6768 }
6869 Icon {
6970 anchors.fill: parent
@@ -85,7 +86,7 @@ Row {
8586 anchors.fill: parent
8687 radius: height / 2
8788 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
88− visible: parent.containsMouse
89+ visible: parent.containsMouse && !TouchControlsState.overlayShown
8990 }
9091 Icon {
9192 anchors.fill: parent
qml/Stages/WindowControlsOverlay.qml+8−1
@@ -18,6 +18,7 @@ import QtQuick 2.4
1818import Ubuntu.Components 1.3
1919import Ubuntu.Gestures 0.1
2020import "../Components/PanelState"
21+import "../Components/TouchControlsState"
2122
2223Item {
2324 id: root
@@ -65,6 +66,11 @@ Item {
6566 readonly property int borderThickness: priv.resizeArea ? priv.resizeArea.borderThickness : 0
6667 }
6768
69+ Binding {
70+ target: TouchControlsState
71+ property: "overlayShown"
72+ value: overlay.visible
73+ }
6874
6975 // the visual overlay
7076 Item {
@@ -123,10 +129,11 @@ Item {
123129 anchors.fill: parent
124130 visible: overlay.visible
125131 enabled: visible
126− onClicked: {
132+ onPressed: {
127133 overlayTimer.stop();
128134 mouse.accepted = false;
129135 }
136+ propagateComposedEvents: true
130137 }
131138 }
132139
qml/Stages/WindowDecoration.qml+2−1
@@ -19,6 +19,7 @@ import Unity.Application 0.1 // For Mir singleton
1919import Ubuntu.Components 1.3
2020import "../Components"
2121import "../Components/PanelState"
22+import "../Components/TouchControlsState"
2223
2324MouseArea {
2425 id: root
@@ -73,7 +74,7 @@ MouseArea {
7374 Row {
7475 anchors {
7576 fill: parent
76− leftMargin: units.gu(1)
77+ leftMargin: TouchControlsState.overlayShown ? units.gu(5) : units.gu(1)
7778 rightMargin: units.gu(1)
7879 topMargin: units.gu(0.5)
7980 bottomMargin: units.gu(0.5)