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
=== added directory 'qml/Components/PanelState'
=== added file 'qml/Components/PanelState/PanelState.qml'
--- qml/Components/PanelState/PanelState.qml 1970-01-01 00:00:00 +0000
+++ qml/Components/PanelState/PanelState.qml 2014-12-05 11:37:25 +0000
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2014 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
17pragma Singleton
18import QtQuick 2.0
19
20QtObject {
21 id: root
22
23 property string title: ""
24 property bool buttonsVisible: false
25
26 signal close()
27 signal minimize()
28 signal maximize()
29}
030
=== added file 'qml/Components/PanelState/qmldir'
--- qml/Components/PanelState/qmldir 1970-01-01 00:00:00 +0000
+++ qml/Components/PanelState/qmldir 2014-12-05 11:37:25 +0000
@@ -0,0 +1,1 @@
1singleton PanelState 1.0 PanelState.qml
02
=== added file 'qml/Components/WindowControlButtons.qml'
--- qml/Components/WindowControlButtons.qml 1970-01-01 00:00:00 +0000
+++ qml/Components/WindowControlButtons.qml 2014-12-05 11:37:25 +0000
@@ -0,0 +1,60 @@
1/*
2 * Copyright (C) 2014 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 * Authors: Michael Zanetti <michael.zanetti@canonical.com>
17 */
18
19import QtQuick 2.3
20import Ubuntu.Components 1.1
21
22Row {
23 id: root
24 spacing: units.gu(0.5)
25
26 signal close()
27 signal minimize()
28 signal maximize()
29
30 Rectangle {
31 height: parent.height; width: height; radius: height / 2
32 gradient: Gradient {
33 GradientStop { color: "#F49073"; position: 0 }
34 GradientStop { color: "#DF4F1C"; position: 1 }
35 }
36 border.width: units.dp(.5)
37 border.color: "black"
38 MouseArea { anchors.fill: parent; onClicked: root.close() }
39 }
40 Rectangle {
41 height: parent.height; width: height; radius: height / 2
42 gradient: Gradient {
43 GradientStop { color: "#92918C"; position: 0 }
44 GradientStop { color: "#5E5D58"; position: 1 }
45 }
46 border.width: units.dp(.5)
47 border.color: "black"
48 MouseArea { anchors.fill: parent; onClicked: root.minimize() }
49 }
50 Rectangle {
51 height: parent.height; width: height; radius: height / 2
52 gradient: Gradient {
53 GradientStop { color: "#92918C"; position: 0 }
54 GradientStop { color: "#5E5D58"; position: 1 }
55 }
56 border.width: units.dp(.5)
57 border.color: "black"
58 MouseArea { anchors.fill: parent; onClicked: root.maximize() }
59 }
60}
061
=== modified file 'qml/Panel/Panel.qml'
--- qml/Panel/Panel.qml 2014-10-13 20:39:07 +0000
+++ qml/Panel/Panel.qml 2014-12-05 11:37:25 +0000
@@ -18,6 +18,7 @@
18import Ubuntu.Components 1.118import Ubuntu.Components 1.1
19import Unity.Application 0.119import Unity.Application 0.1
20import "../Components"20import "../Components"
21import "../Components/PanelState"
21import ".."22import ".."
2223
23Item {24Item {
@@ -123,7 +124,7 @@
123 }124 }
124125
125 shown: false126 shown: false
126 width: root.width127 width: root.width - (PanelState.buttonsVisible ? windowControlButtons.width : 0)
127 minimizedPanelHeight: units.gu(3)128 minimizedPanelHeight: units.gu(3)
128 expandedPanelHeight: units.gu(7)129 expandedPanelHeight: units.gu(7)
129 openedHeight: root.height - indicatorOrangeLine.height130 openedHeight: root.height - indicatorOrangeLine.height
@@ -148,6 +149,20 @@
148 }149 }
149 }150 }
150151
152 WindowControlButtons {
153 id: windowControlButtons
154 anchors {
155 left: parent.left
156 top: parent.top
157 margins: units.gu(0.7)
158 }
159 height: indicators.minimizedPanelHeight - anchors.margins * 2
160 visible: PanelState.buttonsVisible
161 onClose: PanelState.close()
162 onMinimize: PanelState.minimize()
163 onMaximize: PanelState.maximize()
164 }
165
151 PanelSeparatorLine {166 PanelSeparatorLine {
152 id: indicatorOrangeLine167 id: indicatorOrangeLine
153 anchors {168 anchors {
@@ -161,7 +176,7 @@
161 id: __callHint176 id: __callHint
162 anchors {177 anchors {
163 top: parent.top178 top: parent.top
164 left: parent.left179 left: PanelState.buttonsVisible ? windowControlButtons.right : parent.left
165 }180 }
166 height: indicators.minimizedPanelHeight181 height: indicators.minimizedPanelHeight
167 visible: active && indicators.state == "initial"182 visible: active && indicators.state == "initial"
168183
=== modified file 'qml/Stages/DesktopStage.qml'
--- qml/Stages/DesktopStage.qml 2014-12-05 11:37:25 +0000
+++ qml/Stages/DesktopStage.qml 2014-12-05 11:37:25 +0000
@@ -19,6 +19,7 @@
19import QtQuick 2.319import QtQuick 2.3
20import Ubuntu.Components 1.120import Ubuntu.Components 1.1
21import Unity.Application 0.121import Unity.Application 0.1
22import "../Components/PanelState"
2223
23Item {24Item {
24 id: root25 id: root
@@ -54,6 +55,10 @@
5455
55 QtObject {56 QtObject {
56 id: priv57 id: priv
58
59 readonly property string focusedAppId: ApplicationManager.focusedApplicationId
60 readonly property var focusedAppDelegate: focusedAppId ? appRepeater.itemAt(indexOf(focusedAppId)) : null
61
57 function indexOf(appId) {62 function indexOf(appId) {
58 for (var i = 0; i < ApplicationManager.count; i++) {63 for (var i = 0; i < ApplicationManager.count; i++) {
59 if (ApplicationManager.get(i).appId == appId) {64 if (ApplicationManager.get(i).appId == appId) {
@@ -64,6 +69,21 @@
64 }69 }
65 }70 }
6671
72 Connections {
73 target: PanelState
74 onClose: {
75 ApplicationManager.stopApplication(ApplicationManager.focusedApplicationId)
76 }
77 onMinimize: appRepeater.itemAt(0).state = "minimized"
78 onMaximize: appRepeater.itemAt(0).state = "normal"
79 }
80
81 Binding {
82 target: PanelState
83 property: "buttonsVisible"
84 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.state === "maximized"
85 }
86
67 Repeater {87 Repeater {
68 id: appRepeater88 id: appRepeater
69 model: ApplicationManager89 model: ApplicationManager
7090
=== modified file 'qml/Stages/WindowDecoration.qml'
--- qml/Stages/WindowDecoration.qml 2014-12-05 11:37:25 +0000
+++ qml/Stages/WindowDecoration.qml 2014-12-05 11:37:25 +0000
@@ -18,6 +18,7 @@
1818
19import QtQuick 2.319import QtQuick 2.3
20import Ubuntu.Components 1.120import Ubuntu.Components 1.1
21import "../Components"
2122
22Item {23Item {
23 id: root24 id: root
@@ -42,37 +43,14 @@
4243
43 Row {44 Row {
44 anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: units.gu(0.7) }45 anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: units.gu(0.7) }
45 spacing: units.gu(0.5)46 spacing: units.gu(1)
46 opacity: root.active ? 1 : 0.547 opacity: root.active ? 1 : 0.5
47 Rectangle {48
48 height: parent.height; width: height; radius: height / 249 WindowControlButtons {
49 gradient: Gradient {50 height: parent.height
50 GradientStop { color: "#F49073"; position: 0 }51 onClose: root.close();
51 GradientStop { color: "#DF4F1C"; position: 1 }52 onMinimize: root.minimize();
52 }53 onMaximize: root.maximize();
53 border.width: units.dp(.5)
54 border.color: "black"
55 MouseArea { anchors.fill: parent; onClicked: root.close() }
56 }
57 Rectangle {
58 height: parent.height; width: height; radius: height / 2
59 gradient: Gradient {
60 GradientStop { color: "#92918C"; position: 0 }
61 GradientStop { color: "#5E5D58"; position: 1 }
62 }
63 border.width: units.dp(.5)
64 border.color: "black"
65 MouseArea { anchors.fill: parent; onClicked: root.minimize() }
66 }
67 Rectangle {
68 height: parent.height; width: height; radius: height / 2
69 gradient: Gradient {
70 GradientStop { color: "#92918C"; position: 0 }
71 GradientStop { color: "#5E5D58"; position: 1 }
72 }
73 border.width: units.dp(.5)
74 border.color: "black"
75 MouseArea { anchors.fill: parent; onClicked: root.maximize() }
76 }54 }
7755
78 Label {56 Label {

Subscribers

People subscribed via source and target branches