Merge lp:~nick-dedekind/unity8/menus.local.global into lp:unity8

Proposed by Nick Dedekind
Status: Work in progress
Proposed branch: lp:~nick-dedekind/unity8/menus.local.global
Merge into: lp:unity8
Prerequisite: lp:~nick-dedekind/unity8/menu.overflow
Diff against target: 733 lines (+234/-111)
13 files modified
data/com.canonical.Unity8.gschema.xml (+5/-0)
qml/Panel/Panel.qml (+96/-57)
qml/Panel/PanelBar.qml (+1/-2)
qml/Panel/PanelItemRow.qml (+8/-28)
qml/Panel/PanelMenu.qml (+2/-3)
qml/Shell.qml (+4/-1)
qml/Stage/DecoratedWindow.qml (+6/-4)
qml/Stage/Stage.qml (+2/-0)
tests/mocks/GSettings.1.0/fake_gsettings.cpp (+33/-0)
tests/mocks/GSettings.1.0/fake_gsettings.h (+9/-0)
tests/qmltests/Panel/tst_Panel.qml (+53/-15)
tests/qmltests/Stage/tst_DesktopStage.qml (+1/-0)
tests/qmltests/tst_Shell.qml (+14/-1)
To merge this branch: bzr merge lp:~nick-dedekind/unity8/menus.local.global
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Needs Fixing
Unity8 CI Bot continuous-integration Approve
Review via email: mp+315556@code.launchpad.net

Commit message

Added global menu support.

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

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

 * If you changed the UI, has there been a design review?
No. need to confirm defualt for global/LIM option.

To post a comment you must log in.
2785. By Nick Dedekind

merged with parent

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2784
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3017/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3924
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2300
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2300
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3952
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3797
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3797/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3797
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3797/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3797
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3797/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3797
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3797/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3797
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3797/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3797
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3797/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3017/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2785
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3019/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3926
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2302
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2302
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3954
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3799
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3799/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3799
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3799/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3799
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3799/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3799
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3799/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3799
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3799/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3799
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3799/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3019/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in data/com.canonical.Unity8.gschema.xml
Text conflict in plugins/Utils/CMakeLists.txt
Text conflict in plugins/Utils/plugin.cpp
Text conflict in qml/Stage/DecoratedWindow.qml
Text conflict in tests/mocks/GSettings.1.0/fake_gsettings.cpp
Text conflict in tests/mocks/GSettings.1.0/fake_gsettings.h
Text conflict in tests/mocks/Utils/CMakeLists.txt
Text conflict in tests/mocks/Utils/plugin.cpp
Text conflict in tests/qmltests/ApplicationMenus/tst_MenuBar.qml
9 conflicts encountered.

2786. By Nick Dedekind

merged with parent

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2786
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3045/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3960
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2316
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2316
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3988
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3833
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3833/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3833
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3833/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3833
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3833/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3833
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3833/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3833
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3833/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3833
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3833/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3045/rebuild

review: Needs Fixing (continuous-integration)
2787. By Nick Dedekind

fixed tests

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2787
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3051/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3966
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2321
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2321
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3994
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3838
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3838/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3838
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3838/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3838
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3838/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3838
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3838/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3838
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3838/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3838
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3838/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3051/rebuild

review: Approve (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Just a couple of minor issues inline, otherwise the code looks good; haven't tested yet

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in qml/Stage/Stage.qml
1 conflicts encountered

Revision history for this message
Albert Astals Cid (aacid) wrote :

A month without merging → WiP

Unmerged revisions

2787. By Nick Dedekind

fixed tests

2786. By Nick Dedekind

merged with parent

2785. By Nick Dedekind

merged with parent

2784. By Nick Dedekind

shader for long title names

2783. By Nick Dedekind

fixed animation duration

2782. By Nick Dedekind

merged with parent

2781. By Nick Dedekind

Global/LI Menus

2780. By Nick Dedekind

merged with parent

2779. By Nick Dedekind

global menus

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/com.canonical.Unity8.gschema.xml'
2--- data/com.canonical.Unity8.gschema.xml 2016-12-10 14:06:18 +0000
3+++ data/com.canonical.Unity8.gschema.xml 2017-01-26 14:02:24 +0000
4@@ -58,6 +58,11 @@
5 <summary>The uri to the app store</summary>
6 <description>This will be used whenever the user triggers an action to open the app store.</description>
7 </key>
8+ <key type="b" name="enable-global-menus">
9+ <default>true</default>
10+ <summary>Enable/disable global application menus.</summary>
11+ <description>When this is enabled, the application menus will always be shown in the top panel. Otherwise they will appear in the window decoration.</description>
12+ </key>
13 </schema>
14
15 <schema path="/com/canonical/unity8/greeter/" id="com.canonical.Unity8.Greeter" gettext-domain="unity8">
16
17=== modified file 'qml/Panel/Panel.qml'
18--- qml/Panel/Panel.qml 2017-01-26 14:02:23 +0000
19+++ qml/Panel/Panel.qml 2017-01-26 14:02:24 +0000
20@@ -1,4 +1,4 @@
21-/*
22+/*
23 * Copyright (C) 2013-2016 Canonical, Ltd.
24 *
25 * This program is free software; you can redistribute it and/or modify
26@@ -15,6 +15,7 @@
27 */
28
29 import QtQuick 2.4
30+import QtGraphicalEffects 1.0
31 import Ubuntu.Components 1.3
32 import Ubuntu.Layouts 1.0
33 import Unity.Application 0.1
34@@ -41,6 +42,7 @@
35 property real expandedPanelHeight: units.gu(7)
36 property real indicatorMenuWidth: width
37 property real applicationMenuWidth: width
38+ property bool globalMenus: true
39
40 property alias applicationMenus: __applicationMenus
41 property alias indicators: __indicators
42@@ -87,7 +89,9 @@
43 PanelState.decorationsAlwaysVisible
44
45 property bool showPointerMenu: revealControls &&
46- (PanelState.decorationsVisible || mode == "staged")
47+ (PanelState.decorationsVisible || root.globalMenus || mode == "staged")
48+
49+ property bool showPointerMenuApplicationTitle: showPointerMenu && !showWindowDecorationControls
50
51 property bool enablePointerMenu: revealControls &&
52 applicationMenus.available &&
53@@ -178,59 +182,95 @@
54 }
55 }
56
57- Row {
58- anchors.fill: parent
59- spacing: units.gu(2)
60-
61- // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
62- // cf. https://bugreports.qt.io/browse/QTBUG-32909
63- WindowControlButtons {
64- id: windowControlButtons
65- objectName: "panelWindowControlButtons"
66- height: indicators.minimizedPanelHeight
67- opacity: d.showWindowDecorationControls ? 1 : 0
68- visible: opacity != 0
69- Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
70-
71- active: PanelState.decorationsVisible || PanelState.decorationsAlwaysVisible
72- windowIsMaximized: true
73- onCloseClicked: PanelState.closeClicked()
74- onMinimizeClicked: PanelState.minimizeClicked()
75- onMaximizeClicked: PanelState.restoreClicked()
76- closeButtonShown: PanelState.closeButtonShown
77+ WindowControlButtons {
78+ id: windowControlButtons
79+ objectName: "panelWindowControlButtons"
80+ height: parent.height
81+
82+ opacity: d.showWindowDecorationControls ? 1 : 0
83+ visible: opacity !== 0
84+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
85+
86+ active: PanelState.decorationsVisible || PanelState.decorationsAlwaysVisible
87+ windowIsMaximized: true
88+ onCloseClicked: PanelState.closeClicked()
89+ onMinimizeClicked: PanelState.minimizeClicked()
90+ onMaximizeClicked: PanelState.restoreClicked()
91+ closeButtonShown: PanelState.closeButtonShown
92+ }
93+
94+ Label {
95+ id: titleLabel
96+ anchors.verticalCenter: parent.verticalCenter
97+ anchors.left: parent.left
98+ anchors.leftMargin: units.gu(1)
99+
100+ maximumLineCount: 1
101+ fontSize: "medium"
102+ font.weight: Font.Medium
103+ text: PanelState.title
104+ visible: false
105+ }
106+
107+ LinearGradient {
108+ id: titleGradient
109+ objectName: "panelTitle"
110+ width: titleLabel.width
111+ height: titleLabel.height
112+ anchors.verticalCenter: parent.verticalCenter
113+ anchors.left: parent.left
114+ anchors.leftMargin: units.gu(1)
115+
116+ source: titleLabel
117+ gradient: Gradient {
118+ GradientStop { position: 0; color: theme.palette.selected.backgroundText }
119+ GradientStop { position: 0.7; color: theme.palette.selected.backgroundText }
120+ GradientStop { position: 1; color: "transparent" }
121 }
122-
123- Loader {
124- id: menuBarLoader
125- height: parent.height
126- enabled: d.enablePointerMenu
127- opacity: d.showPointerMenu ? 1 : 0
128- visible: opacity != 0
129- Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
130- active: __applicationMenus.model
131-
132- width: parent.width - windowControlButtons.width - units.gu(2) - __indicators.barWidth
133-
134- property bool menusRequested: menuBarLoader.item ? menuBarLoader.item.showRequested : false
135-
136- sourceComponent: MenuBar {
137- id: bar
138- objectName: "menuBar"
139- anchors.left: parent.left
140- anchors.margins: units.gu(1)
141- height: menuBarLoader.height
142- enableKeyFilter: valid && PanelState.decorationsVisible
143- unityMenuModel: __applicationMenus.model
144-
145- Connections {
146- target: __applicationMenus
147- onShownChanged: bar.dismiss();
148- }
149-
150- Connections {
151- target: __indicators
152- onShownChanged: bar.dismiss();
153- }
154+ start: Qt.point(0, 0)
155+ end: Qt.point(endpoint, 0)
156+
157+ property real endpoint: d.showPointerMenuApplicationTitle ? menuBarLoader.anchors.leftMargin :
158+ parent.width - __indicators.barWidth
159+
160+ opacity: d.showTouchMenu || d.showPointerMenuApplicationTitle ? 1 : 0
161+ visible: opacity !== 0
162+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
163+ }
164+
165+ Loader {
166+ id: menuBarLoader
167+ anchors.left: parent.left
168+ anchors.leftMargin: d.showPointerMenuApplicationTitle ? units.gu(8) : (windowControlButtons.width + units.gu(2))
169+ height: parent.height
170+ enabled: d.enablePointerMenu
171+ active: __applicationMenus.model
172+
173+ opacity: d.showPointerMenu ? 1 : 0
174+ visible: opacity !== 0
175+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
176+
177+ width: parent.width - anchors.leftMargin - __indicators.barWidth
178+
179+ property bool menusRequested: menuBarLoader.item ? menuBarLoader.item.showRequested : false
180+
181+ sourceComponent: MenuBar {
182+ id: bar
183+ objectName: "menuBar"
184+ anchors.left: parent.left
185+ anchors.margins: units.gu(1)
186+ height: menuBarLoader.height
187+ enableKeyFilter: valid && PanelState.decorationsVisible
188+ unityMenuModel: __applicationMenus.model
189+
190+ Connections {
191+ target: __applicationMenus
192+ onShownChanged: bar.dismiss();
193+ }
194+
195+ Connections {
196+ target: __indicators
197+ onShownChanged: bar.dismiss();
198 }
199 }
200 }
201@@ -259,6 +299,7 @@
202 enableHint: !callHint.active && !fullscreenMode
203 showOnClick: false
204 panelColor: panelAreaBackground.color
205+ barWidth: Math.max(titleLabel.width, units.gu(10))
206
207 onShowTapped: {
208 if (callHint.active) {
209@@ -266,8 +307,7 @@
210 }
211 }
212
213- showRowTitle: !expanded
214- rowTitle: PanelState.title
215+ showRow: expanded
216 rowItemDelegate: ActionItem {
217 id: actionItem
218 property int ownIndex: index
219@@ -300,7 +340,6 @@
220
221 enabled: d.enableTouchMenus
222 opacity: d.showTouchMenu ? 1 : 0
223- visible: opacity != 0
224 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
225
226 onEnabledChanged: {
227
228=== modified file 'qml/Panel/PanelBar.qml'
229--- qml/Panel/PanelBar.qml 2017-01-16 08:51:52 +0000
230+++ qml/Panel/PanelBar.qml 2017-01-26 14:02:24 +0000
231@@ -30,8 +30,7 @@
232 property real lateralPosition: -1
233 property int alignment: Qt.AlignRight
234
235- property alias showRowTitle: row.showRowTitle
236- property alias rowTitle: row.rowTitle
237+ property alias showRow: row.showRow
238 property alias rowItemDelegate: row.delegate
239
240 implicitWidth: flickable.contentWidth
241
242=== modified file 'qml/Panel/PanelItemRow.qml'
243--- qml/Panel/PanelItemRow.qml 2017-01-10 00:44:47 +0000
244+++ qml/Panel/PanelItemRow.qml 2017-01-26 14:02:24 +0000
245@@ -16,29 +16,28 @@
246
247 import QtQuick 2.4
248 import Ubuntu.Components 1.3
249+import QtGraphicalEffects 1.0
250 import "../Components"
251
252 Item {
253 id: root
254- implicitWidth: showRowTitle && !expanded ? rowTitle != "" ? rowLabel.width : 0 : row.width
255+ implicitWidth: row.width
256 implicitHeight: units.gu(3)
257
258- property bool showRowTitle: false
259- property alias rowTitle: rowLabel.text
260+ property bool showRow: true
261 property QtObject model: null
262 property real overFlowWidth: width
263 property bool expanded: false
264- readonly property alias currentItem: row.currentItem
265- readonly property alias currentItemIndex: row.currentIndex
266-
267 property real unitProgress: 0.0
268 property real selectionChangeBuffer: units.gu(2)
269 property bool enableLateralChanges: false
270 property color hightlightColor: "#ffffff"
271-
272 property alias delegate: row.delegate
273-
274 property real lateralPosition: -1
275+
276+ readonly property alias currentItem: row.currentItem
277+ readonly property alias currentItemIndex: row.currentIndex
278+
279 onLateralPositionChanged: {
280 updateItemFromLateralPosition();
281 }
282@@ -138,31 +137,12 @@
283 d.previousItem = currentItem;
284 }
285
286- Label {
287- id: rowLabel
288- objectName: "panelTitle"
289- anchors {
290- left: parent.left
291- leftMargin: units.gu(1)
292- verticalCenter: parent.verticalCenter
293- }
294- width: implicitWidth + units.gu(2)
295- elide: Text.ElideRight
296- maximumLineCount: 1
297- fontSize: "medium"
298- font.weight: Font.Medium
299- color: Theme.palette.selected.backgroundText
300- opacity: showRowTitle ? 1 : 0
301- visible: opacity != 0
302- Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
303- }
304-
305 ListView {
306 id: row
307 objectName: "panelRow"
308 orientation: ListView.Horizontal
309 model: root.model
310- opacity: showRowTitle ? 0 : 1
311+ opacity: showRow ? 1 : 0
312 // dont set visible on basis of opacity; otherwise width will not be calculated correctly
313 anchors {
314 top: parent.top
315
316=== modified file 'qml/Panel/PanelMenu.qml'
317--- qml/Panel/PanelMenu.qml 2017-01-16 08:51:52 +0000
318+++ qml/Panel/PanelMenu.qml 2017-01-26 14:02:24 +0000
319@@ -35,8 +35,7 @@
320 property color panelColor: theme.palette.normal.background
321
322 property alias alignment: bar.alignment
323- property alias rowTitle: bar.rowTitle
324- property alias showRowTitle: bar.showRowTitle
325+ property alias showRow: bar.showRow
326 property alias rowItemDelegate: bar.rowItemDelegate
327 property alias pageDelegate: content.pageDelegate
328
329@@ -45,7 +44,7 @@
330 readonly property bool partiallyOpened: unitProgress > 0 && unitProgress < 1.0
331 readonly property bool fullyClosed: unitProgress == 0
332 readonly property alias expanded: bar.expanded
333- readonly property int barWidth: Math.min(bar.width, bar.implicitWidth)
334+ property int barWidth: Math.min(bar.width, bar.implicitWidth)
335
336 signal showTapped()
337
338
339=== modified file 'qml/Shell.qml'
340--- qml/Shell.qml 2017-01-24 07:43:54 +0000
341+++ qml/Shell.qml 2017-01-26 14:02:24 +0000
342@@ -314,6 +314,7 @@
343 altTabPressed: physicalKeysMapper.altTabPressed
344 oskEnabled: shell.oskEnabled
345 spreadEnabled: tutorial.spreadEnabled && (!greeter || (!greeter.hasLockedApp && !greeter.shown))
346+ globalMenus : settings.enableGlobalMenus
347
348 onSpreadShownChanged: {
349 panel.indicators.hide();
350@@ -492,12 +493,14 @@
351 id: panel
352 objectName: "panel"
353 anchors.fill: parent //because this draws indicator menus
354+ z: shell.usageScenario === "desktop" ? 1 : 0 // otherwise the menus are drawn below the panel.
355
356- mode: shell.usageScenario == "desktop" ? "windowed" : "staged"
357+ mode: shell.usageScenario === "desktop" ? "windowed" : "staged"
358 minimizedPanelHeight: units.gu(3)
359 expandedPanelHeight: units.gu(7)
360 indicatorMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
361 applicationMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
362+ globalMenus: settings.enableGlobalMenus
363
364 indicators {
365 hides: [launcher]
366
367=== modified file 'qml/Stage/DecoratedWindow.qml'
368--- qml/Stage/DecoratedWindow.qml 2017-01-18 17:34:57 +0000
369+++ qml/Stage/DecoratedWindow.qml 2017-01-26 14:02:24 +0000
370@@ -48,6 +48,7 @@
371 property int highlightSize: units.gu(1)
372 property real shadowOpacity: 0
373 property bool darkening: false
374+ property bool enableMenus: false
375
376 property real requestedWidth
377 property real requestedHeight
378@@ -224,11 +225,12 @@
379 onMinimizeClicked: root.minimizeClicked();
380
381 enableMenus: {
382- return active &&
383- surface &&
384- (PanelState.focusedPersistentSurfaceId === surface.persistentId && !PanelState.decorationsVisible)
385+ return root.enableMenus &&
386+ active &&
387+ surface &&
388+ (PanelState.focusedPersistentSurfaceId === surface.persistentId && !PanelState.decorationsVisible)
389 }
390- menu: sharedAppModel.model
391+ menu: root.enableMenus ? sharedAppModel.model : undefined
392
393 Indicators.SharedUnityMenuModel {
394 id: sharedAppModel
395
396=== modified file 'qml/Stage/Stage.qml'
397--- qml/Stage/Stage.qml 2017-01-03 12:04:08 +0000
398+++ qml/Stage/Stage.qml 2017-01-26 14:02:24 +0000
399@@ -46,6 +46,7 @@
400 property int leftMargin: 0
401 property bool oskEnabled: false
402 property rect inputMethodRect
403+ property bool globalMenus: true
404
405 // Configuration
406 property string mode: "staged"
407@@ -1550,6 +1551,7 @@
408 highlightSize: windowInfoItem.iconMargin / 2
409 stageWidth: appContainer.width
410 stageHeight: appContainer.height
411+ enableMenus: !root.globalMenus
412
413 requestedWidth: appDelegate.requestedWidth
414 requestedHeight: appDelegate.requestedHeight
415
416=== modified file 'tests/mocks/GSettings.1.0/fake_gsettings.cpp'
417--- tests/mocks/GSettings.1.0/fake_gsettings.cpp 2016-12-10 14:06:18 +0000
418+++ tests/mocks/GSettings.1.0/fake_gsettings.cpp 2017-01-26 14:02:24 +0000
419@@ -29,6 +29,7 @@
420 , m_edgeDragWidth(2)
421 , m_enableLauncher(true)
422 , m_enableIndicatorMenu(true)
423+ , m_enableGlobalMenus(true)
424 , m_appstoreUri("http://uappexplorer.com")
425 {
426 }
427@@ -179,6 +180,19 @@
428 return m_appstoreUri;
429 }
430
431+bool GSettingsControllerQml::enableGlobalMenus() const
432+{
433+ return m_enableGlobalMenus;
434+}
435+
436+void GSettingsControllerQml::setEnableGlobalMenus(bool enableGlobalMenus)
437+{
438+ if (m_enableGlobalMenus != enableGlobalMenus) {
439+ m_enableGlobalMenus = enableGlobalMenus;
440+ Q_EMIT enableGlobalMenusChanged(enableGlobalMenus);
441+ }
442+}
443+
444 GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
445 }
446
447@@ -247,6 +261,8 @@
448 this, &GSettingsQml::enableLauncherChanged);
449 connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::enableIndicatorMenuChanged,
450 this, &GSettingsQml::enableIndicatorMenuChanged);
451+ connect(GSettingsControllerQml::instance(), &GSettingsControllerQml::enableGlobalMenusChanged,
452+ this, &GSettingsQml::enableGlobalMenusChanged);
453
454 Q_EMIT disableHeightChanged();
455 Q_EMIT pictureUriChanged();
456@@ -258,6 +274,7 @@
457 Q_EMIT edgeDragWidthChanged();
458 Q_EMIT enableLauncherChanged();
459 Q_EMIT enableIndicatorMenuChanged();
460+ Q_EMIT enableGlobalMenusChanged();
461 }
462
463 GSettingsSchemaQml * GSettingsQml::schema() const {
464@@ -390,6 +407,15 @@
465 return QVariant();
466 }
467
468+QVariant GSettingsQml::enableGlobalMenus() const
469+{
470+ if (m_valid && m_schema->id() == "com.canonical.Unity8") {
471+ return GSettingsControllerQml::instance()->enableGlobalMenus();
472+ } else {
473+ return QVariant();
474+ }
475+}
476+
477 void GSettingsQml::setLifecycleExemptAppids(const QVariant &appIds)
478 {
479 if (m_valid && m_schema->id() == "com.canonical.qtmir") {
480@@ -431,3 +457,10 @@
481 GSettingsControllerQml::instance()->setEnableIndicatorMenu(enableIndicatorMenu.toBool());
482 }
483 }
484+
485+void GSettingsQml::setEnableGlobalMenus(const QVariant &enableGlobalMenus)
486+{
487+ if (m_valid && m_schema->id() == "com.canonical.Unity8") {
488+ GSettingsControllerQml::instance()->setEnableGlobalMenus(enableGlobalMenus.toBool());
489+ }
490+}
491
492=== modified file 'tests/mocks/GSettings.1.0/fake_gsettings.h'
493--- tests/mocks/GSettings.1.0/fake_gsettings.h 2016-12-10 14:06:18 +0000
494+++ tests/mocks/GSettings.1.0/fake_gsettings.h 2017-01-26 14:02:24 +0000
495@@ -59,6 +59,7 @@
496 Q_PROPERTY(QVariant edgeDragWidth READ edgeDragWidth WRITE setEdgeDragWidth NOTIFY edgeDragWidthChanged)
497 Q_PROPERTY(QVariant enableLauncher READ enableLauncher WRITE setEnableLauncher NOTIFY enableLauncherChanged)
498 Q_PROPERTY(QVariant enableIndicatorMenu READ enableIndicatorMenu WRITE setEnableIndicatorMenu NOTIFY enableIndicatorMenuChanged)
499+ Q_PROPERTY(QVariant enableGlobalMenus READ enableGlobalMenus WRITE setEnableGlobalMenus NOTIFY enableGlobalMenusChanged)
500 Q_PROPERTY(QVariant appstoreUri READ appstoreUri NOTIFY appstoreUriChanged)
501
502 public:
503@@ -78,6 +79,7 @@
504 QVariant edgeDragWidth() const;
505 QVariant enableLauncher() const;
506 QVariant enableIndicatorMenu() const;
507+ QVariant enableGlobalMenus() const;
508 QVariant appstoreUri() const;
509
510 void setDisableHeight(const QVariant &val);
511@@ -90,6 +92,7 @@
512 void setEdgeDragWidth(const QVariant &edgeDragWidth);
513 void setEnableLauncher(const QVariant &enableLauncher);
514 void setEnableIndicatorMenu(const QVariant &enableIndicatorMenu);
515+ void setEnableGlobalMenus(const QVariant &enableGlobalMenus);
516
517 Q_SIGNALS:
518 void disableHeightChanged();
519@@ -103,6 +106,7 @@
520 void edgeDragWidthChanged();
521 void enableLauncherChanged();
522 void enableIndicatorMenuChanged();
523+ void enableGlobalMenusChanged();
524 void appstoreUriChanged();
525
526 private:
527@@ -150,6 +154,9 @@
528 bool enableIndicatorMenu() const;
529 Q_INVOKABLE void setEnableIndicatorMenu(bool enableIndicatorMenu);
530
531+ bool enableGlobalMenus() const;
532+ Q_INVOKABLE void setEnableGlobalMenus(bool enableGlobalMenus);
533+
534 QString appstoreUri() const;
535
536 Q_SIGNALS:
537@@ -163,6 +170,7 @@
538 void edgeDragWidthChanged(uint edgeDragWidth);
539 void enableLauncherChanged(bool enableLauncher);
540 void enableIndicatorMenuChanged(bool enableIndicatorMenu);
541+ void enableGlobalMenusChanged(bool enableGlobalMenus);
542 void appstoreUriChanged(const QString &appstoreUri);
543
544 private:
545@@ -178,6 +186,7 @@
546 uint m_edgeDragWidth;
547 bool m_enableLauncher;
548 bool m_enableIndicatorMenu;
549+ bool m_enableGlobalMenus;
550 QString m_appstoreUri;
551
552 static GSettingsControllerQml* s_controllerInstance;
553
554=== modified file 'tests/qmltests/Panel/tst_Panel.qml'
555--- tests/qmltests/Panel/tst_Panel.qml 2017-01-24 07:44:18 +0000
556+++ tests/qmltests/Panel/tst_Panel.qml 2017-01-26 14:02:24 +0000
557@@ -78,6 +78,7 @@
558 id: panel
559 anchors.fill: parent
560 mode: modeSelector.model[modeSelector.selectedIndex]
561+ globalMenus: false
562
563 indicatorMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
564 applicationMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
565@@ -225,6 +226,18 @@
566 color: "white"
567 }
568 }
569+
570+ RowLayout {
571+ Layout.fillWidth: true
572+ CheckBox {
573+ checked: panel.globalMenus
574+ onCheckedChanged: panel.globalMenus = checked
575+ }
576+ Label {
577+ text: "Global Menus"
578+ color: "white"
579+ }
580+ }
581 }
582 }
583
584@@ -251,6 +264,7 @@
585
586 function init() {
587 panel.mode = "staged";
588+ panel.globalMenus = true;
589 mouseEmulation.checked = true;
590 panel.fullscreenMode = false;
591 callManager.foregroundCall = null;
592@@ -269,12 +283,13 @@
593 compare(windowControlButtonsSpy.valid, true);
594
595 waitForRendering(panel);
596+ waitForAllAnimationToComplete("initial");
597 }
598
599 function cleanup() {
600 panel.indicators.hide();
601 panel.applicationMenus.hide();
602- waitForAllAnimationToComplete("initial");
603+ mouseMove(panel, -1, -1);
604 }
605
606 function get_indicator_item(index) {
607@@ -761,44 +776,67 @@
608 }
609 }
610
611- function test_stagedApplicationMenuBarShowOnMouseHover() {
612+ function test_stagedApplicationMenuBarShowOnMouseHover_data() {
613+ return [
614+ { tag: "windowed-global", mode: "windowed", global: true },
615+ { tag: "windowed-local", mode: "windowed", global: false },
616+ { tag: "staged-global", mode: "staged", global: true },
617+ { tag: "staged-local", mode: "staged", global: false },
618+ ];
619+ }
620+
621+ function test_stagedApplicationMenuBarShowOnMouseHover(data) {
622 PanelState.title = "Fake Title";
623- panel.mode = "staged";
624+ panel.mode = data.mode;
625+ panel.globalMenus = data.global;
626 mouseEmulation.checked = false;
627
628- var appTitle = findChild(panel.applicationMenus, "panelTitle"); verify(appTitle);
629+ var panelTitle = findChild(panel, "panelTitle"); verify(panelTitle);
630 var appMenuRow = findChild(panel.applicationMenus, "panelRow"); verify(appMenuRow);
631 var appMenuBar = findChild(panel, "menuBar"); verify(appMenuBar);
632
633- tryCompare(appTitle, "visible", true, undefined, "App title should be visible");
634+ tryCompare(panelTitle, "visible", true, undefined, "App title should be visible");
635 tryCompare(appMenuBar, "visible", false, undefined, "App menu bar should not be visible");
636
637 mouseMove(panel, panel.width/2, panel.panelHeight);
638
639- tryCompare(appTitle, "visible", false, undefined, "App title should not be visible on mouse hover");
640- tryCompare(appMenuBar, "visible", true, undefined, "App menu bar should be visible on mouse hover");
641- }
642-
643- function test_windowedApplicationMenuShowOnMouseHoverWhenDecorationsShown() {
644+ tryCompare(panelTitle, "visible", true, undefined, "App title should be visible");
645+ tryCompare(appMenuBar, "visible", data.mode == "staged" || data.global, undefined, "App menu bar should be visible on mouse hover");
646+
647+ mouseMove(panel, panel.width/2, panel.panelHeight * 2);
648+
649+ tryCompare(panelTitle, "visible", true, undefined, "App title should be visible");
650+ tryCompare(appMenuBar, "visible", false, undefined, "App menu bar should not be visible");
651+ }
652+
653+ function test_windowedApplicationMenuShowOnMouseHoverWhenDecorationsShown_data() {
654+ return [
655+ { tag: "global", global: true },
656+ { tag: "local", global: false }
657+ ];
658+ }
659+
660+ function test_windowedApplicationMenuShowOnMouseHoverWhenDecorationsShown(data) {
661 PanelState.title = "Fake Title";
662 panel.mode = "windowed";
663+ panel.globalMenus = data.global;
664 mouseEmulation.checked = false;
665
666- var appTitle = findChild(panel.applicationMenus, "panelTitle"); verify(appTitle);
667+ var panelTitle = findChild(panel, "panelTitle"); verify(panelTitle);
668 var appMenuRow = findChild(panel.applicationMenus, "panelRow"); verify(appMenuRow);
669 var appMenuBar = findChild(panel, "menuBar"); verify(appMenuBar);
670
671- tryCompare(appTitle, "visible", true, undefined, "App title should be visible");
672+ tryCompare(panelTitle, "visible", true, undefined, "App title should be visible");
673 tryCompare(appMenuBar, "visible", false, undefined, "App menu bar should not be visible");
674
675 mouseMove(panel, panel.width/2, panel.panelHeight);
676
677- tryCompare(appTitle, "visible", true, undefined, "App title should still be visible on mouse hover when panel decorations are not visible");
678- tryCompare(appMenuBar, "visible", false, undefined, "App menu bar should be visible on mouse hover when panel decorations are not visible");
679+ tryCompare(panelTitle, "visible", true, undefined, "App title should still be visible on mouse hover when panel decorations are not visible");
680+ tryCompare(appMenuBar, "visible", data.global, undefined, "App menu bar should only be visible on mouse hover if using globl menus");
681
682 PanelState.decorationsVisible = true;
683
684- tryCompare(appTitle, "visible", false, undefined, "App title should still be visible on mouse hover when panel decorations are visible");
685+ tryCompare(panelTitle, "visible", false, undefined, "App title should still be visible on mouse hover when panel decorations are visible");
686 tryCompare(appMenuBar, "visible", true, undefined, "App menu bar should be visible on mouse hover when panel decorations not visible");
687 }
688
689
690=== modified file 'tests/qmltests/Stage/tst_DesktopStage.qml'
691--- tests/qmltests/Stage/tst_DesktopStage.qml 2017-01-10 14:44:29 +0000
692+++ tests/qmltests/Stage/tst_DesktopStage.qml 2017-01-26 14:02:24 +0000
693@@ -84,6 +84,7 @@
694 property bool itemDestroyed: false
695 sourceComponent: Component {
696 Stage {
697+ globalMenus: false
698 anchors.fill: parent
699 background: "/usr/share/backgrounds/warty-final-ubuntu.png"
700 focus: true
701
702=== modified file 'tests/qmltests/tst_Shell.qml'
703--- tests/qmltests/tst_Shell.qml 2017-01-24 07:43:54 +0000
704+++ tests/qmltests/tst_Shell.qml 2017-01-26 14:02:24 +0000
705@@ -308,6 +308,19 @@
706 }
707 }
708
709+ Row {
710+ anchors { left: parent.left; right: parent.right }
711+ CheckBox {
712+ checked: GSettingsController.enableGlobalMenus
713+ onCheckedChanged: {
714+ GSettingsController.setEnableGlobalMenus(checked)
715+ }
716+ }
717+ Label {
718+ text: "Enable Global Menus"
719+ }
720+ }
721+
722 Label { text: "Applications"; font.bold: true }
723
724 Button {
725@@ -2744,7 +2757,7 @@
726 loadShell(data.tag);
727
728 var panel = findChild(shell, "panel"); verify(panel);
729- var panelTitle = findChild(panel.applicationMenus, "panelTitle"); verify(panelTitle);
730+ var panelTitle = findChild(panel, "panelTitle"); verify(panelTitle);
731 compare(panelTitle.visible, false, "Panel title should not be visible when greeter is shown");
732
733 swipeAwayGreeter();

Subscribers

People subscribed via source and target branches