Merge lp:~aacid/unity8/menutool into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 2840
Merged at revision: 2864
Proposed branch: lp:~aacid/unity8/menutool
Merge into: lp:unity8
Diff against target: 259 lines (+210/-12)
6 files modified
tools/CMakeLists.txt (+2/-12)
tools/menutool/CMakeLists.txt (+5/-0)
tools/menutool/README (+11/-0)
tools/menutool/menutool.cpp (+62/-0)
tools/menutool/menutool.qml (+118/-0)
tools/scopetool/CMakeLists.txt (+12/-0)
To merge this branch: bzr merge lp:~aacid/unity8/menutool
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Lukáš Tinkl (community) Approve
Review via email: mp+318364@code.launchpad.net

Commit message

Add tool to browse menus of a running app

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
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?
N/A

To post a comment you must log in.
lp:~aacid/unity8/menutool updated
2838. By Albert Astals Cid

space--

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

PASSED: Continuous integration, rev:2838
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3218/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4222
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2496
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2496
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4250
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4085
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4085/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4085
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4085/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4085
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4085/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4085
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4085/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4085
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4085/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4085
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4085/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
lp:~aacid/unity8/menutool updated
2839. By Albert Astals Cid

Add a rotating rectangle, useful to see when the menus are being "slow" rebuilding themselves

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

FAILED: Continuous integration, rev:2839
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3233/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4242
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2516
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2516
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4270
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4105
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4105/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4105
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4105/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4105
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4105/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4105
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4105/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4105
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4105/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4105
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4105/artifact/output/*zip*/output.zip

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

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

FAILED: Continuous integration, rev:2839
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3239/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4248
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2520
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2520
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4276
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4112
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4112/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4112
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4112/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4112
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4112/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4112
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4112/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4112
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4112/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4112
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4112/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
lp:~aacid/unity8/menutool updated
2840. By Albert Astals Cid

Give you a hint that you did something wrong

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

Yes, works nicely! https://imgur.com/a/XZYxn

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

Yes

* Did CI run pass? If not, please explain why.

Unrelated flaky tests :/

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

PASSED: Continuous integration, rev:2840
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3276/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4313
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2572
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2572
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4341
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4175
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4175/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4175
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4175/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4175
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4175/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4175
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4175/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4175
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4175/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4175
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4175/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/CMakeLists.txt'
2--- tools/CMakeLists.txt 2016-05-09 12:38:10 +0000
3+++ tools/CMakeLists.txt 2017-03-03 12:17:19 +0000
4@@ -1,14 +1,4 @@
5-add_executable(${SCOPE_TOOL}
6- scopetool.cpp
7- registry-tracker.cpp
8- ../src/UnixSignalHandler.cpp
9- )
10-
11-qt5_use_modules(${SCOPE_TOOL} Qml Quick)
12-
13-# install binaries
14-install(TARGETS ${SCOPE_TOOL}
15- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
16- )
17+add_subdirectory(menutool)
18+add_subdirectory(scopetool)
19
20 install(FILES unlock-device DESTINATION ${SHELL_APP_DIR})
21
22=== added directory 'tools/menutool'
23=== added file 'tools/menutool/CMakeLists.txt'
24--- tools/menutool/CMakeLists.txt 1970-01-01 00:00:00 +0000
25+++ tools/menutool/CMakeLists.txt 2017-03-03 12:17:19 +0000
26@@ -0,0 +1,5 @@
27+add_executable(menutool
28+ menutool.cpp
29+ )
30+
31+qt5_use_modules(menutool Qml Quick)
32
33=== added file 'tools/menutool/README'
34--- tools/menutool/README 1970-01-01 00:00:00 +0000
35+++ tools/menutool/README 2017-03-03 12:17:19 +0000
36@@ -0,0 +1,11 @@
37+This tool can be used to browse the menus of another application
38+
39+How to use:
40+ * Start application that exports menus
41+ e.g. QT_QPA_PLATFORMTHEME=ubuntuappmenu kate
42+ * Figure out which is the dbus address
43+ * This is a bit tricky, but using qdbusviewer to see the addresses
44+ that appear when starting the app and looking for one that
45+ contains com/Ubuntu/Menu/0 should be enough
46+ * Start tool passing the dbus address
47+ builddir/menutool/menutool :1.293
48
49=== added file 'tools/menutool/menutool.cpp'
50--- tools/menutool/menutool.cpp 1970-01-01 00:00:00 +0000
51+++ tools/menutool/menutool.cpp 2017-03-03 12:17:19 +0000
52@@ -0,0 +1,62 @@
53+/*
54+ * Copyright (C) 2017 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+
69+// Qt
70+#include <QDebug>
71+#include <QCommandLineParser>
72+#include <QGuiApplication>
73+#include <QQmlContext>
74+#include <QQmlEngine>
75+#include <QQuickView>
76+
77+// local
78+#include <paths.h>
79+
80+int main(int argc, char *argv[])
81+{
82+ QGuiApplication::setApplicationName("Menu Test Tool");
83+ QGuiApplication *application = new QGuiApplication(argc, argv);
84+
85+ QCommandLineParser parser;
86+ parser.parse(application->arguments());
87+ const QStringList args = parser.positionalArguments();
88+
89+ if (args.count() != 1) {
90+ qWarning() << "You need to pass the dbus address";
91+ return 1;
92+ }
93+
94+ QQuickView* view = new QQuickView();
95+ view->setResizeMode(QQuickView::SizeRootObjectToView);
96+ view->setTitle(QGuiApplication::applicationName());
97+ view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
98+ view->rootContext()->setContextProperty("contextBusName", args[0]);
99+
100+ QUrl source(::sourceDirectory() + "/tools/menutool/menutool.qml");
101+ prependImportPaths(view->engine(), ::overrideImportPaths());
102+ prependImportPaths(view->engine(), ::nonMirImportPaths());
103+
104+ view->setSource(source);
105+
106+ view->show();
107+
108+ int result = application->exec();
109+
110+ delete view;
111+ delete application;
112+
113+ return result;
114+}
115
116=== added file 'tools/menutool/menutool.qml'
117--- tools/menutool/menutool.qml 1970-01-01 00:00:00 +0000
118+++ tools/menutool/menutool.qml 2017-03-03 12:17:19 +0000
119@@ -0,0 +1,118 @@
120+/*
121+* Copyright (C) 2017 Canonical, Ltd.
122+*
123+* This program is free software; you can redistribute it and/or modify
124+* it under the terms of the GNU General Public License as published by
125+* the Free Software Foundation; version 3.
126+*
127+* This program is distributed in the hope that it will be useful,
128+* but WITHOUT ANY WARRANTY; without even the implied warranty of
129+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
130+* GNU General Public License for more details.
131+*
132+* You should have received a copy of the GNU General Public License
133+* along with this program. If not, see <http://www.gnu.org/licenses/>.
134+*/
135+
136+import QtQuick 2.4
137+import Ubuntu.Components 1.3
138+
139+import "../../qml/ApplicationMenus"
140+import "../../qml/Panel"
141+import "../../qml/Components/PanelState"
142+
143+import QMenuModel 0.1
144+import Unity.Indicators 0.1 as Indicators
145+
146+Item {
147+ width: units.gu(180)
148+ height: units.gu(120)
149+
150+ UnityMenuModel {
151+ id: menuModel
152+ busName: contextBusName
153+ menuObjectPath: "/com/ubuntu/Menu/0"
154+ actions: { "unity": "/com/ubuntu/Menu/0" }
155+ }
156+
157+ readonly property bool hasMenus: repeater.count > 0
158+ Repeater {
159+ id: repeater
160+ model: menuModel
161+ delegate: Item {}
162+ }
163+
164+ Panel {
165+ id: panel
166+
167+ height: parent.height
168+ width: parent.width / 2
169+ minimizedPanelHeight: units.gu(6)
170+ visible: hasMenus
171+
172+ mode: "windowed"
173+
174+ applicationMenus {
175+ model: menuModel
176+ }
177+
178+ Rectangle {
179+ width: 50
180+ height: 50
181+ anchors.centerIn: parent
182+ color: "gray"
183+ rotation: 45
184+ Timer {
185+ interval: 20
186+ running: true
187+ repeat: true
188+ onTriggered: parent.rotation = parent.rotation+1
189+ }
190+ }
191+
192+ Rectangle {
193+ color: "green"
194+ anchors.bottom: parent.bottom
195+ anchors.right: parent.right
196+ Label {
197+ id: label
198+ anchors.centerIn: parent
199+ text: "Click here to open touch menu manually"
200+ }
201+ width: label.width + units.gu(2)
202+ height: label.height + units.gu(2)
203+ MouseArea {
204+ anchors.fill: parent
205+ onClicked: panel.applicationMenus.show();
206+ }
207+ visible: !panel.applicationMenus.shown
208+ }
209+ }
210+
211+ Rectangle {
212+ color: "blue"
213+ height: parent.height
214+ width: parent.width / 2
215+ x: width
216+ visible: hasMenus
217+
218+ MenuBar {
219+ id: menuBar
220+ height: units.gu(3)
221+ width: parent.width
222+ enableKeyFilter: true
223+ unityMenuModel: menuModel
224+ }
225+ }
226+
227+ Component.onCompleted: {
228+ theme.name = "Ubuntu.Components.Themes.SuruDark";
229+ PanelState.title = "Drag here to open touch menu";
230+ }
231+
232+ Text {
233+ anchors.centerIn: parent
234+ text: "The dbus address you gave has no menus. Make sure you read the README file."
235+ visible: !hasMenus
236+ }
237+}
238
239=== added directory 'tools/scopetool'
240=== added file 'tools/scopetool/CMakeLists.txt'
241--- tools/scopetool/CMakeLists.txt 1970-01-01 00:00:00 +0000
242+++ tools/scopetool/CMakeLists.txt 2017-03-03 12:17:19 +0000
243@@ -0,0 +1,12 @@
244+add_executable(${SCOPE_TOOL}
245+ scopetool.cpp
246+ registry-tracker.cpp
247+ ../../src/UnixSignalHandler.cpp
248+ )
249+
250+qt5_use_modules(${SCOPE_TOOL} Qml Quick)
251+
252+# install binaries
253+install(TARGETS ${SCOPE_TOOL}
254+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
255+ )
256
257=== renamed file 'tools/registry-tracker.cpp' => 'tools/scopetool/registry-tracker.cpp'
258=== renamed file 'tools/registry-tracker.h' => 'tools/scopetool/registry-tracker.h'
259=== renamed file 'tools/scopetool.cpp' => 'tools/scopetool/scopetool.cpp'

Subscribers

People subscribed via source and target branches