Merge lp:~mzanetti/unity8/buttons-in-panel into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 1461
Merged at revision: 1491
Proposed branch: lp:~mzanetti/unity8/buttons-in-panel
Merge into: lp:unity8
Prerequisite: lp:~mzanetti/unity8/wallpaper
Diff against target: 258 lines (+135/-32)
6 files modified
qml/Components/PanelState/PanelState.qml (+29/-0)
qml/Components/PanelState/qmldir (+1/-0)
qml/Components/WindowControlButtons.qml (+60/-0)
qml/Panel/Panel.qml (+17/-2)
qml/Stages/DesktopStage.qml (+20/-0)
qml/Stages/WindowDecoration.qml (+8/-30)
To merge this branch: bzr merge lp:~mzanetti/unity8/buttons-in-panel
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Albert Astals Cid (community) Needs Fixing
Gerry Boland (community) Approve
Review via email: mp+242644@code.launchpad.net

Commit message

Add window control buttons to panel for fullscreen applications

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.

see prerequisites

 * Did you perform an exploratory manual test run of your code change and any related functionality?

yes

 * Did you make sure that your branch does not contain spurious tags?

yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

n/a

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

+ readonly property string focusedAppId: ApplicationManager.focusedApplicationId
175 + onFocusedAppIdChanged: print("focused app id changed", focusedAppId)
176 + readonly property var focusedAppDelegate: focusedAppId ? appRepeater.itemAt(indexOf(focusedAppId)) : null
177 + onFocusedAppDelegateChanged: print("focused app delegate changed", focusedAppDelegate)

Debug info wanted?

review: Needs Information
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Debug info wanted?

dropped

Revision history for this message
Gerry Boland (gerboland) wrote :

Encapsulating panel state in a singleton is a good idea. Multi-monitor will complicate things, but one thing at a time.

Works well here. Approved

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Y
 * Did CI run pass? If not, please explain why.
Y
 * Did you make sure that the branch does not contain spurious tags?
Y

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in tests/qmltests/tst_Shell.qml
1 conflicts encountered.

Note: was top approved before this

review: Needs Fixing
lp:~mzanetti/unity8/buttons-in-panel updated
1461. By Michael Zanetti

merge prereq

Revision history for this message
Michael Zanetti (mzanetti) wrote :

merged with prereq

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~mzanetti/unity8/buttons-in-panel updated
1462. By Michael Zanetti

merge prereq

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'qml/Components/PanelState'
2=== added file 'qml/Components/PanelState/PanelState.qml'
3--- qml/Components/PanelState/PanelState.qml 1970-01-01 00:00:00 +0000
4+++ qml/Components/PanelState/PanelState.qml 2014-12-05 11:37:25 +0000
5@@ -0,0 +1,29 @@
6+/*
7+ * Copyright (C) 2014 Canonical, Ltd.
8+ *
9+ * This program is free software; you can redistribute it and/or modify
10+ * it under the terms of the GNU General Public License as published by
11+ * the Free Software Foundation; version 3.
12+ *
13+ * This program is distributed in the hope that it will be useful,
14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+ * GNU General Public License for more details.
17+ *
18+ * You should have received a copy of the GNU General Public License
19+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20+ */
21+
22+pragma Singleton
23+import QtQuick 2.0
24+
25+QtObject {
26+ id: root
27+
28+ property string title: ""
29+ property bool buttonsVisible: false
30+
31+ signal close()
32+ signal minimize()
33+ signal maximize()
34+}
35
36=== added file 'qml/Components/PanelState/qmldir'
37--- qml/Components/PanelState/qmldir 1970-01-01 00:00:00 +0000
38+++ qml/Components/PanelState/qmldir 2014-12-05 11:37:25 +0000
39@@ -0,0 +1,1 @@
40+singleton PanelState 1.0 PanelState.qml
41
42=== added file 'qml/Components/WindowControlButtons.qml'
43--- qml/Components/WindowControlButtons.qml 1970-01-01 00:00:00 +0000
44+++ qml/Components/WindowControlButtons.qml 2014-12-05 11:37:25 +0000
45@@ -0,0 +1,60 @@
46+/*
47+ * Copyright (C) 2014 Canonical, Ltd.
48+ *
49+ * This program is free software; you can redistribute it and/or modify
50+ * it under the terms of the GNU General Public License as published by
51+ * the Free Software Foundation; version 3.
52+ *
53+ * This program is distributed in the hope that it will be useful,
54+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
55+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56+ * GNU General Public License for more details.
57+ *
58+ * You should have received a copy of the GNU General Public License
59+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
60+ *
61+ * Authors: Michael Zanetti <michael.zanetti@canonical.com>
62+ */
63+
64+import QtQuick 2.3
65+import Ubuntu.Components 1.1
66+
67+Row {
68+ id: root
69+ spacing: units.gu(0.5)
70+
71+ signal close()
72+ signal minimize()
73+ signal maximize()
74+
75+ Rectangle {
76+ height: parent.height; width: height; radius: height / 2
77+ gradient: Gradient {
78+ GradientStop { color: "#F49073"; position: 0 }
79+ GradientStop { color: "#DF4F1C"; position: 1 }
80+ }
81+ border.width: units.dp(.5)
82+ border.color: "black"
83+ MouseArea { anchors.fill: parent; onClicked: root.close() }
84+ }
85+ Rectangle {
86+ height: parent.height; width: height; radius: height / 2
87+ gradient: Gradient {
88+ GradientStop { color: "#92918C"; position: 0 }
89+ GradientStop { color: "#5E5D58"; position: 1 }
90+ }
91+ border.width: units.dp(.5)
92+ border.color: "black"
93+ MouseArea { anchors.fill: parent; onClicked: root.minimize() }
94+ }
95+ Rectangle {
96+ height: parent.height; width: height; radius: height / 2
97+ gradient: Gradient {
98+ GradientStop { color: "#92918C"; position: 0 }
99+ GradientStop { color: "#5E5D58"; position: 1 }
100+ }
101+ border.width: units.dp(.5)
102+ border.color: "black"
103+ MouseArea { anchors.fill: parent; onClicked: root.maximize() }
104+ }
105+}
106
107=== modified file 'qml/Panel/Panel.qml'
108--- qml/Panel/Panel.qml 2014-10-13 20:39:07 +0000
109+++ qml/Panel/Panel.qml 2014-12-05 11:37:25 +0000
110@@ -18,6 +18,7 @@
111 import Ubuntu.Components 1.1
112 import Unity.Application 0.1
113 import "../Components"
114+import "../Components/PanelState"
115 import ".."
116
117 Item {
118@@ -123,7 +124,7 @@
119 }
120
121 shown: false
122- width: root.width
123+ width: root.width - (PanelState.buttonsVisible ? windowControlButtons.width : 0)
124 minimizedPanelHeight: units.gu(3)
125 expandedPanelHeight: units.gu(7)
126 openedHeight: root.height - indicatorOrangeLine.height
127@@ -148,6 +149,20 @@
128 }
129 }
130
131+ WindowControlButtons {
132+ id: windowControlButtons
133+ anchors {
134+ left: parent.left
135+ top: parent.top
136+ margins: units.gu(0.7)
137+ }
138+ height: indicators.minimizedPanelHeight - anchors.margins * 2
139+ visible: PanelState.buttonsVisible
140+ onClose: PanelState.close()
141+ onMinimize: PanelState.minimize()
142+ onMaximize: PanelState.maximize()
143+ }
144+
145 PanelSeparatorLine {
146 id: indicatorOrangeLine
147 anchors {
148@@ -161,7 +176,7 @@
149 id: __callHint
150 anchors {
151 top: parent.top
152- left: parent.left
153+ left: PanelState.buttonsVisible ? windowControlButtons.right : parent.left
154 }
155 height: indicators.minimizedPanelHeight
156 visible: active && indicators.state == "initial"
157
158=== modified file 'qml/Stages/DesktopStage.qml'
159--- qml/Stages/DesktopStage.qml 2014-12-05 11:37:25 +0000
160+++ qml/Stages/DesktopStage.qml 2014-12-05 11:37:25 +0000
161@@ -19,6 +19,7 @@
162 import QtQuick 2.3
163 import Ubuntu.Components 1.1
164 import Unity.Application 0.1
165+import "../Components/PanelState"
166
167 Item {
168 id: root
169@@ -54,6 +55,10 @@
170
171 QtObject {
172 id: priv
173+
174+ readonly property string focusedAppId: ApplicationManager.focusedApplicationId
175+ readonly property var focusedAppDelegate: focusedAppId ? appRepeater.itemAt(indexOf(focusedAppId)) : null
176+
177 function indexOf(appId) {
178 for (var i = 0; i < ApplicationManager.count; i++) {
179 if (ApplicationManager.get(i).appId == appId) {
180@@ -64,6 +69,21 @@
181 }
182 }
183
184+ Connections {
185+ target: PanelState
186+ onClose: {
187+ ApplicationManager.stopApplication(ApplicationManager.focusedApplicationId)
188+ }
189+ onMinimize: appRepeater.itemAt(0).state = "minimized"
190+ onMaximize: appRepeater.itemAt(0).state = "normal"
191+ }
192+
193+ Binding {
194+ target: PanelState
195+ property: "buttonsVisible"
196+ value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.state === "maximized"
197+ }
198+
199 Repeater {
200 id: appRepeater
201 model: ApplicationManager
202
203=== modified file 'qml/Stages/WindowDecoration.qml'
204--- qml/Stages/WindowDecoration.qml 2014-12-05 11:37:25 +0000
205+++ qml/Stages/WindowDecoration.qml 2014-12-05 11:37:25 +0000
206@@ -18,6 +18,7 @@
207
208 import QtQuick 2.3
209 import Ubuntu.Components 1.1
210+import "../Components"
211
212 Item {
213 id: root
214@@ -42,37 +43,14 @@
215
216 Row {
217 anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: units.gu(0.7) }
218- spacing: units.gu(0.5)
219+ spacing: units.gu(1)
220 opacity: root.active ? 1 : 0.5
221- Rectangle {
222- height: parent.height; width: height; radius: height / 2
223- gradient: Gradient {
224- GradientStop { color: "#F49073"; position: 0 }
225- GradientStop { color: "#DF4F1C"; position: 1 }
226- }
227- border.width: units.dp(.5)
228- border.color: "black"
229- MouseArea { anchors.fill: parent; onClicked: root.close() }
230- }
231- Rectangle {
232- height: parent.height; width: height; radius: height / 2
233- gradient: Gradient {
234- GradientStop { color: "#92918C"; position: 0 }
235- GradientStop { color: "#5E5D58"; position: 1 }
236- }
237- border.width: units.dp(.5)
238- border.color: "black"
239- MouseArea { anchors.fill: parent; onClicked: root.minimize() }
240- }
241- Rectangle {
242- height: parent.height; width: height; radius: height / 2
243- gradient: Gradient {
244- GradientStop { color: "#92918C"; position: 0 }
245- GradientStop { color: "#5E5D58"; position: 1 }
246- }
247- border.width: units.dp(.5)
248- border.color: "black"
249- MouseArea { anchors.fill: parent; onClicked: root.maximize() }
250+
251+ WindowControlButtons {
252+ height: parent.height
253+ onClose: root.close();
254+ onMinimize: root.minimize();
255+ onMaximize: root.maximize();
256 }
257
258 Label {

Subscribers

People subscribed via source and target branches