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

Proposed by Albert Astals Cid
Status: Approved
Approved by: Lukáš Tinkl
Approved revision: 2893
Proposed branch: lp:~aacid/unity8/menuToolBrowser
Merge into: lp:unity8
Diff against target: 172 lines (+60/-31)
5 files modified
plugins/Unity/ApplicationMenu/applicationmenuregistry.cpp (+9/-0)
plugins/Unity/ApplicationMenu/applicationmenuregistry.h (+3/-0)
tools/menutool/README (+2/-6)
tools/menutool/menutool.cpp (+0/-10)
tools/menutool/menutool.qml (+46/-15)
To merge this branch: bzr merge lp:~aacid/unity8/menuToolBrowser
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Lukáš Tinkl (community) Approve
Review via email: mp+321071@code.launchpad.net

Commit message

menutool: Use the ApplicationMenuRegistry

... instead of asking people to figure out the dbus service manually

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/menuToolBrowser updated
2893. By Albert Astals Cid

hook up the unregistered signal too

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

FAILED: Continuous integration, rev:2892
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3552/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4712
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2866
    FAILURE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2866/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4740
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4563
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4563/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4563
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4563/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4563
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4563/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4563
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4563/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4563
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4563/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4563
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4563/artifact/output/*zip*/output.zip

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

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

FAILED: Continuous integration, rev:2893
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3557/
Executed test runs:
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build/4717/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4745
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4568
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4568/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4568
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4568/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4568/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4568
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4568/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4568
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4568/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4568
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4568/artifact/output/*zip*/output.zip

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

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

FAILED: Continuous integration, rev:2893
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3560/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4720
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2873
    FAILURE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2873/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4748
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4571
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4571/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4571
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4571/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4571
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4571/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4571
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4571/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4571
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4571/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4571
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4571/artifact/output/*zip*/output.zip

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

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

FAILED: Continuous integration, rev:2893
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3566/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4727
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2876
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2876
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4755
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4576
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4576/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4576
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4576/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4576
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4576/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4576
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4576/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4576
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4576/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4576
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4576/artifact/output/*zip*/output.zip

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

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

FAILED: Continuous integration, rev:2893
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3574/
Executed test runs:

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

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

Nice improvement, I like it

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

Waiting

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

PASSED: Continuous integration, rev:2893
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3567/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4728
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2880
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2880
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4756
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4580
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4580/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4580
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4580/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4580
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4580/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4580
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4580/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4580
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4580/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4580
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4580/artifact/output/*zip*/output.zip

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

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

PASSED: Continuous integration, rev:2893
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3572/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4734
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2886
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2886
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4762
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4585
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4585/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4585
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4585/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4585
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4585/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4585
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4585/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4585
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4585/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4585
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4585/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)

Unmerged revisions

2893. By Albert Astals Cid

hook up the unregistered signal too

2892. By Albert Astals Cid

menutool: Use the ApplicationMenuRegistry instead of asking people to figure out the dbus service manually

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Unity/ApplicationMenu/applicationmenuregistry.cpp'
2--- plugins/Unity/ApplicationMenu/applicationmenuregistry.cpp 2016-12-15 14:50:05 +0000
3+++ plugins/Unity/ApplicationMenu/applicationmenuregistry.cpp 2017-03-27 14:19:37 +0000
4@@ -139,3 +139,12 @@
5 }
6 return list;
7 }
8+
9+QVariantMap ApplicationMenuRegistry::appMenus() const
10+{
11+ QVariantMap result;
12+ for (auto it = m_appMenus.begin(); it != m_appMenus.end(); ++it) {
13+ result.insert(QString::number(it.key()), QVariant::fromValue(it.value()));
14+ }
15+ return result;
16+}
17
18=== modified file 'plugins/Unity/ApplicationMenu/applicationmenuregistry.h'
19--- plugins/Unity/ApplicationMenu/applicationmenuregistry.h 2016-12-15 14:50:05 +0000
20+++ plugins/Unity/ApplicationMenu/applicationmenuregistry.h 2017-03-27 14:19:37 +0000
21@@ -66,6 +66,9 @@
22 const QString &service);
23 void UnregisterSurfaceMenu(const QString &surfaceId, const QDBusObjectPath &menuObjectPath);
24
25+ // for menutool
26+ Q_INVOKABLE QVariantMap appMenus() const;
27+
28 Q_SIGNALS:
29 void appMenuRegistered(uint processId);
30 void appMenuUnregistered(uint processId);
31
32=== modified file 'tools/menutool/README'
33--- tools/menutool/README 2017-02-27 14:43:00 +0000
34+++ tools/menutool/README 2017-03-27 14:19:37 +0000
35@@ -3,9 +3,5 @@
36 How to use:
37 * Start application that exports menus
38 e.g. QT_QPA_PLATFORMTHEME=ubuntuappmenu kate
39- * Figure out which is the dbus address
40- * This is a bit tricky, but using qdbusviewer to see the addresses
41- that appear when starting the app and looking for one that
42- contains com/Ubuntu/Menu/0 should be enough
43- * Start tool passing the dbus address
44- builddir/menutool/menutool :1.293
45+ * Start tool and choose the pid you want in the list
46+ builddir/tools/menutool/menutool
47
48=== modified file 'tools/menutool/menutool.cpp'
49--- tools/menutool/menutool.cpp 2017-02-27 14:43:00 +0000
50+++ tools/menutool/menutool.cpp 2017-03-27 14:19:37 +0000
51@@ -30,20 +30,10 @@
52 QGuiApplication::setApplicationName("Menu Test Tool");
53 QGuiApplication *application = new QGuiApplication(argc, argv);
54
55- QCommandLineParser parser;
56- parser.parse(application->arguments());
57- const QStringList args = parser.positionalArguments();
58-
59- if (args.count() != 1) {
60- qWarning() << "You need to pass the dbus address";
61- return 1;
62- }
63-
64 QQuickView* view = new QQuickView();
65 view->setResizeMode(QQuickView::SizeRootObjectToView);
66 view->setTitle(QGuiApplication::applicationName());
67 view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
68- view->rootContext()->setContextProperty("contextBusName", args[0]);
69
70 QUrl source(::sourceDirectory() + "/tools/menutool/menutool.qml");
71 prependImportPaths(view->engine(), ::overrideImportPaths());
72
73=== modified file 'tools/menutool/menutool.qml'
74--- tools/menutool/menutool.qml 2017-03-03 12:16:51 +0000
75+++ tools/menutool/menutool.qml 2017-03-27 14:19:37 +0000
76@@ -23,24 +23,35 @@
77
78 import QMenuModel 0.1
79 import Unity.Indicators 0.1 as Indicators
80+import Unity.ApplicationMenu 0.1
81
82 Item {
83 width: units.gu(180)
84 height: units.gu(120)
85
86+ Connections {
87+ target: ApplicationMenuRegistry
88+ onAppMenuRegistered: rebuildAppList();
89+ onAppMenuUnregistered: rebuildAppList();
90+ }
91+
92+ function rebuildAppList() {
93+ appsModel.clear();
94+ var theMenus = ApplicationMenuRegistry.appMenus();
95+ for (var i in theMenus) {
96+ appsModel.append({"pid": i, "menuData": theMenus[i]});
97+ }
98+ }
99+
100+ ListModel {
101+ id: appsModel
102+ }
103+
104 UnityMenuModel {
105 id: menuModel
106- busName: contextBusName
107- menuObjectPath: "/com/ubuntu/Menu/0"
108- actions: { "unity": "/com/ubuntu/Menu/0" }
109 }
110
111- readonly property bool hasMenus: repeater.count > 0
112- Repeater {
113- id: repeater
114- model: menuModel
115- delegate: Item {}
116- }
117+ property bool showingMenus: false
118
119 Panel {
120 id: panel
121@@ -48,7 +59,7 @@
122 height: parent.height
123 width: parent.width / 2
124 minimizedPanelHeight: units.gu(6)
125- visible: hasMenus
126+ visible: showingMenus
127
128 mode: "windowed"
129
130@@ -94,7 +105,7 @@
131 height: parent.height
132 width: parent.width / 2
133 x: width
134- visible: hasMenus
135+ visible: showingMenus
136
137 MenuBar {
138 id: menuBar
139@@ -110,9 +121,29 @@
140 PanelState.title = "Drag here to open touch menu";
141 }
142
143- Text {
144- anchors.centerIn: parent
145- text: "The dbus address you gave has no menus. Make sure you read the README file."
146- visible: !hasMenus
147+ Item {
148+ anchors.fill: parent
149+ visible: !showingMenus
150+
151+ Column {
152+ anchors.centerIn: parent
153+ Text {
154+ text: appsModel.count > 0 ? "Please select a menu to show:" : "You are not running any application that exports menus. See the README"
155+ }
156+
157+ Repeater {
158+ model: appsModel
159+
160+ Button {
161+ text: "PID: " + pid + "\tmenuPath: " + menuData.menuPath
162+ onClicked: {
163+ menuModel.busName = menuData.service;
164+ menuModel.menuObjectPath = menuData.menuPath;
165+ menuModel.actions = { "unity": menuData.actionPath };
166+ showingMenus = true;
167+ }
168+ }
169+ }
170+ }
171 }
172 }

Subscribers

People subscribed via source and target branches