Merge lp:~mzanetti/unity8/desktop-stage into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 1453
Merged at revision: 1488
Proposed branch: lp:~mzanetti/unity8/desktop-stage
Merge into: lp:unity8
Diff against target: 306 lines (+271/-1)
5 files modified
com.canonical.Unity8.gschema.xml (+14/-0)
debian/unity8-common.install (+1/-0)
qml/Shell.qml (+7/-1)
qml/Stages/DesktopStage.qml (+162/-0)
qml/Stages/WindowDecoration.qml (+87/-0)
To merge this branch: bzr merge lp:~mzanetti/unity8/desktop-stage
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Needs Fixing
PS Jenkins bot (community) continuous-integration Needs Fixing
Gerry Boland (community) Approve
Daniel d'Andrada (community) Needs Information
Ubuntu Unity PS integration team Pending
Review via email: mp+242140@code.launchpad.net

Commit message

Add an initial, rudimentary DesktopStage to get started

Description of the change

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

no

 * 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?

yes

 * If you changed the UI, has there been a design review?

not yet, there's no design yet and this is really work in progress

To post a comment you must log in.
Revision history for this message
Gerry Boland (gerboland) wrote :

I love it! Nice and simple. Plenty to do ofc, but great first go.

Only thing that is naughty is the window decoration clipping itself - breaks batching :) but no biggie

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Could it wait until shellRotation gets merged? It surely conflicts with it.

review: Needs Information
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> Could it wait until shellRotation gets merged? It surely conflicts with it.

More specifically, the approach used to select the "stage".

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

> > Could it wait until shellRotation gets merged? It surely conflicts with it.
>
> More specifically, the approach used to select the "stage".

It really depends on when Shell rotation lands. The fact that this is still waiting is blocking me already quite a bit...

Other than that, I don't think the conflict will be that big. In the end we just need to load the desktop stage if that gsettings option is set and do your stuff in the "else" case.

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

Blocking this work on shell rotation is unfair. Desktop support in its own QML files, changes of conflict are small. I'm approving

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

 * 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.
Waiting for rebuild to complete
 * Did you make sure that the branch does not contain spurious tags?
Y

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

Text conflict in debian/unity8-common.install
1 conflicts encountered.

Note: Was top approved before

review: Needs Fixing
lp:~mzanetti/unity8/desktop-stage updated
1454. By Michael Zanetti

merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'com.canonical.Unity8.gschema.xml'
2--- com.canonical.Unity8.gschema.xml 1970-01-01 00:00:00 +0000
3+++ com.canonical.Unity8.gschema.xml 2014-12-05 11:15:39 +0000
4@@ -0,0 +1,14 @@
5+<schemalist>
6+ <enum id="usage-mode-enum">
7+ <value nick="Staged" value="0" />
8+ <value nick="Windowed" value="1" />
9+ </enum>
10+
11+ <schema path="/com/canonical/unity8/" id="com.canonical.Unity8" gettext-domain="unity8">
12+ <key enum="usage-mode-enum" name="usage-mode">
13+ <default>"Staged"</default>
14+ <summary>The usage mode.</summary>
15+ <description>The usage mode chosen will affect the Window Management behaviour.</description>
16+ </key>
17+ </schema>
18+</schemalist>
19
20=== modified file 'debian/unity8-common.install'
21--- debian/unity8-common.install 2014-11-17 00:36:09 +0000
22+++ debian/unity8-common.install 2014-12-05 11:15:39 +0000
23@@ -3,4 +3,5 @@
24 usr/share/unity8/Dash
25 usr/share/unity8/Notifications
26 usr/share/unity8/graphics
27+com.canonical.Unity8.gschema.xml usr/share/glib-2.0/schemas/
28 var/lib/polkit-1/localauthority/10-vendor.d
29
30=== modified file 'qml/Shell.qml'
31--- qml/Shell.qml 2014-12-02 18:47:49 +0000
32+++ qml/Shell.qml 2014-12-05 11:15:39 +0000
33@@ -267,7 +267,13 @@
34 // the screen larger (maybe connects to monitor) and tries to enter
35 // tablet mode.
36 property bool tabletMode: shell.sideStageEnabled && !greeter.hasLockedApp
37- source: tabletMode ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
38+ source: usageModeSettings.usageMode === "Windowed" ? "Stages/DesktopStage.qml"
39+ : tabletMode ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
40+
41+ GSettings {
42+ id: usageModeSettings
43+ schema.id: "com.canonical.Unity8"
44+ }
45
46 Binding {
47 target: applicationsDisplayLoader.item
48
49=== added file 'qml/Stages/DesktopStage.qml'
50--- qml/Stages/DesktopStage.qml 1970-01-01 00:00:00 +0000
51+++ qml/Stages/DesktopStage.qml 2014-12-05 11:15:39 +0000
52@@ -0,0 +1,162 @@
53+/*
54+ * Copyright (C) 2014 Canonical, Ltd.
55+ *
56+ * This program is free software; you can redistribute it and/or modify
57+ * it under the terms of the GNU General Public License as published by
58+ * the Free Software Foundation; version 3.
59+ *
60+ * This program is distributed in the hope that it will be useful,
61+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
62+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63+ * GNU General Public License for more details.
64+ *
65+ * You should have received a copy of the GNU General Public License
66+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
67+ *
68+ * Authors: Michael Zanetti <michael.zanetti@canonical.com>
69+ */
70+
71+import QtQuick 2.3
72+import Ubuntu.Components 1.1
73+import Unity.Application 0.1
74+
75+Item {
76+ id: root
77+
78+ anchors.fill: parent
79+
80+ Connections {
81+ target: ApplicationManager
82+ onApplicationAdded: {
83+ // Initial placement to avoid having the window decoration behind the panel
84+ appRepeater.itemAt(ApplicationManager.count-1).y = units.gu(3)
85+ ApplicationManager.requestFocusApplication(ApplicationManager.get(ApplicationManager.count-1).appId)
86+ }
87+
88+ onFocusRequested: {
89+ var appIndex = priv.indexOf(appId);
90+ var appDelegate = appRepeater.itemAt(appIndex);
91+ if (appDelegate.state === "minimized") {
92+ appDelegate.state = "normal"
93+ }
94+ ApplicationManager.focusApplication(appId);
95+ }
96+ }
97+
98+ QtObject {
99+ id: priv
100+ function indexOf(appId) {
101+ for (var i = 0; i < ApplicationManager.count; i++) {
102+ if (ApplicationManager.get(i).appId == appId) {
103+ return i;
104+ }
105+ }
106+ return -1;
107+ }
108+ }
109+
110+ Repeater {
111+ id: appRepeater
112+ model: ApplicationManager
113+
114+ delegate: Item {
115+ id: appDelegate
116+ height: units.gu(30)
117+ width: units.gu(30)
118+ z: ApplicationManager.count - index
119+
120+ states: [
121+ State {
122+ name: "normal"
123+ },
124+ State {
125+ name: "maximized"
126+ PropertyChanges { target: appDelegate; x: 0; y: 0; width: root.width; height: root.height }
127+ },
128+ State {
129+ name: "minimized"
130+ PropertyChanges { target: appDelegate; x: -appDelegate.width / 2; scale: units.gu(5) / appDelegate.width; opacity: 0 }
131+ }
132+ ]
133+ transitions: [
134+ Transition {
135+ PropertyAnimation { target: appDelegate; properties: "x,y,opacity,width,height,scale" }
136+ }
137+ ]
138+
139+ BorderImage {
140+ anchors {
141+ fill: appDelegate
142+ margins: -units.gu(2)
143+ }
144+ source: "graphics/dropshadow2gu.sci"
145+ opacity: .3
146+ Behavior on opacity { UbuntuNumberAnimation {} }
147+ }
148+
149+ MouseArea {
150+ anchors.fill: parent
151+ anchors.margins: -units.gu(0.5)
152+
153+ property bool resizeWidth: false
154+ property bool resizeHeight: false
155+
156+ property int startX: 0
157+ property int startWidth: 0
158+ property int startY: 0
159+ property int startHeight: 0
160+
161+ onPressed: {
162+ ApplicationManager.requestFocusApplication(model.appId)
163+ if (mouseX > width - units.gu(1)) {
164+ resizeWidth = true;
165+ startX = mouseX;
166+ startWidth = appDelegate.width;
167+ }
168+ if (mouseY > height - units.gu(1)) {
169+ resizeHeight = true;
170+ startY = mouseY;
171+ startHeight = appDelegate.height;
172+ }
173+ if (!resizeHeight && !resizeWidth) {
174+ drag.target = appDelegate;
175+ }
176+ }
177+
178+ onMouseXChanged: {
179+ if (resizeWidth) {
180+ appDelegate.width = startWidth + (mouseX - startX)
181+ }
182+ }
183+ onMouseYChanged: {
184+ if (resizeHeight) {
185+ appDelegate.height = startHeight + (mouseY - startY)
186+ }
187+ }
188+
189+ onReleased: {
190+ resizeWidth = false;
191+ resizeHeight = false;
192+ drag.target = undefined;
193+ }
194+ }
195+
196+ WindowDecoration {
197+ anchors { left: parent.left; top: parent.top; right: parent.right }
198+ height: units.gu(3)
199+ title: model.name
200+ onClose: ApplicationManager.stopApplication(model.appId)
201+ onMaximize: appDelegate.state = (appDelegate.state == "maximized" ? "normal" : "maximized")
202+ onMinimize: appDelegate.state = "minimized"
203+ active: ApplicationManager.focusedApplicationId == model.appId
204+ }
205+
206+ ApplicationWindow {
207+ anchors.fill: parent
208+ anchors.topMargin: units.gu(3)
209+ application: ApplicationManager.get(index)
210+ interactive: index == 0
211+ }
212+ }
213+ }
214+}
215
216=== added file 'qml/Stages/WindowDecoration.qml'
217--- qml/Stages/WindowDecoration.qml 1970-01-01 00:00:00 +0000
218+++ qml/Stages/WindowDecoration.qml 2014-12-05 11:15:39 +0000
219@@ -0,0 +1,87 @@
220+/*
221+ * Copyright (C) 2014 Canonical, Ltd.
222+ *
223+ * This program is free software; you can redistribute it and/or modify
224+ * it under the terms of the GNU General Public License as published by
225+ * the Free Software Foundation; version 3.
226+ *
227+ * This program is distributed in the hope that it will be useful,
228+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
229+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
230+ * GNU General Public License for more details.
231+ *
232+ * You should have received a copy of the GNU General Public License
233+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
234+ *
235+ * Authors: Michael Zanetti <michael.zanetti@canonical.com>
236+ */
237+
238+import QtQuick 2.3
239+import Ubuntu.Components 1.1
240+
241+Item {
242+ id: root
243+ clip: true
244+
245+ property alias title: titleLabel.text
246+ property bool active: false
247+
248+ signal close()
249+ signal minimize()
250+ signal maximize()
251+
252+ Rectangle {
253+ anchors.fill: parent
254+ anchors.bottomMargin: -radius
255+ radius: units.gu(.5)
256+ gradient: Gradient {
257+ GradientStop { color: "#626055"; position: 0 }
258+ GradientStop { color: "#3C3B37"; position: 1 }
259+ }
260+ }
261+
262+ Row {
263+ anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: units.gu(0.7) }
264+ spacing: units.gu(0.5)
265+ opacity: root.active ? 1 : 0.5
266+ Rectangle {
267+ height: parent.height; width: height; radius: height / 2
268+ gradient: Gradient {
269+ GradientStop { color: "#F49073"; position: 0 }
270+ GradientStop { color: "#DF4F1C"; position: 1 }
271+ }
272+ border.width: units.dp(.5)
273+ border.color: "black"
274+ MouseArea { anchors.fill: parent; onClicked: root.close() }
275+ }
276+ Rectangle {
277+ height: parent.height; width: height; radius: height / 2
278+ gradient: Gradient {
279+ GradientStop { color: "#92918C"; position: 0 }
280+ GradientStop { color: "#5E5D58"; position: 1 }
281+ }
282+ border.width: units.dp(.5)
283+ border.color: "black"
284+ MouseArea { anchors.fill: parent; onClicked: root.minimize() }
285+ }
286+ Rectangle {
287+ height: parent.height; width: height; radius: height / 2
288+ gradient: Gradient {
289+ GradientStop { color: "#92918C"; position: 0 }
290+ GradientStop { color: "#5E5D58"; position: 1 }
291+ }
292+ border.width: units.dp(.5)
293+ border.color: "black"
294+ MouseArea { anchors.fill: parent; onClicked: root.maximize() }
295+ }
296+
297+ Label {
298+ id: titleLabel
299+ color: "#DFDBD2"
300+ height: parent.height
301+ verticalAlignment: Text.AlignVCenter
302+ fontSize: "small"
303+ font.bold: true
304+ }
305+ }
306+}

Subscribers

People subscribed via source and target branches