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
=== modified file 'tools/CMakeLists.txt'
--- tools/CMakeLists.txt 2016-05-09 12:38:10 +0000
+++ tools/CMakeLists.txt 2017-03-03 12:17:19 +0000
@@ -1,14 +1,4 @@
1add_executable(${SCOPE_TOOL}1add_subdirectory(menutool)
2 scopetool.cpp2add_subdirectory(scopetool)
3 registry-tracker.cpp
4 ../src/UnixSignalHandler.cpp
5 )
6
7qt5_use_modules(${SCOPE_TOOL} Qml Quick)
8
9# install binaries
10install(TARGETS ${SCOPE_TOOL}
11 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
12 )
133
14install(FILES unlock-device DESTINATION ${SHELL_APP_DIR})4install(FILES unlock-device DESTINATION ${SHELL_APP_DIR})
155
=== added directory 'tools/menutool'
=== added file 'tools/menutool/CMakeLists.txt'
--- tools/menutool/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tools/menutool/CMakeLists.txt 2017-03-03 12:17:19 +0000
@@ -0,0 +1,5 @@
1add_executable(menutool
2 menutool.cpp
3 )
4
5qt5_use_modules(menutool Qml Quick)
06
=== added file 'tools/menutool/README'
--- tools/menutool/README 1970-01-01 00:00:00 +0000
+++ tools/menutool/README 2017-03-03 12:17:19 +0000
@@ -0,0 +1,11 @@
1This tool can be used to browse the menus of another application
2
3How to use:
4 * Start application that exports menus
5 e.g. QT_QPA_PLATFORMTHEME=ubuntuappmenu kate
6 * Figure out which is the dbus address
7 * This is a bit tricky, but using qdbusviewer to see the addresses
8 that appear when starting the app and looking for one that
9 contains com/Ubuntu/Menu/0 should be enough
10 * Start tool passing the dbus address
11 builddir/menutool/menutool :1.293
012
=== added file 'tools/menutool/menutool.cpp'
--- tools/menutool/menutool.cpp 1970-01-01 00:00:00 +0000
+++ tools/menutool/menutool.cpp 2017-03-03 12:17:19 +0000
@@ -0,0 +1,62 @@
1/*
2 * Copyright (C) 2017 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
17// Qt
18#include <QDebug>
19#include <QCommandLineParser>
20#include <QGuiApplication>
21#include <QQmlContext>
22#include <QQmlEngine>
23#include <QQuickView>
24
25// local
26#include <paths.h>
27
28int main(int argc, char *argv[])
29{
30 QGuiApplication::setApplicationName("Menu Test Tool");
31 QGuiApplication *application = new QGuiApplication(argc, argv);
32
33 QCommandLineParser parser;
34 parser.parse(application->arguments());
35 const QStringList args = parser.positionalArguments();
36
37 if (args.count() != 1) {
38 qWarning() << "You need to pass the dbus address";
39 return 1;
40 }
41
42 QQuickView* view = new QQuickView();
43 view->setResizeMode(QQuickView::SizeRootObjectToView);
44 view->setTitle(QGuiApplication::applicationName());
45 view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
46 view->rootContext()->setContextProperty("contextBusName", args[0]);
47
48 QUrl source(::sourceDirectory() + "/tools/menutool/menutool.qml");
49 prependImportPaths(view->engine(), ::overrideImportPaths());
50 prependImportPaths(view->engine(), ::nonMirImportPaths());
51
52 view->setSource(source);
53
54 view->show();
55
56 int result = application->exec();
57
58 delete view;
59 delete application;
60
61 return result;
62}
063
=== added file 'tools/menutool/menutool.qml'
--- tools/menutool/menutool.qml 1970-01-01 00:00:00 +0000
+++ tools/menutool/menutool.qml 2017-03-03 12:17:19 +0000
@@ -0,0 +1,118 @@
1/*
2* Copyright (C) 2017 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
17import QtQuick 2.4
18import Ubuntu.Components 1.3
19
20import "../../qml/ApplicationMenus"
21import "../../qml/Panel"
22import "../../qml/Components/PanelState"
23
24import QMenuModel 0.1
25import Unity.Indicators 0.1 as Indicators
26
27Item {
28 width: units.gu(180)
29 height: units.gu(120)
30
31 UnityMenuModel {
32 id: menuModel
33 busName: contextBusName
34 menuObjectPath: "/com/ubuntu/Menu/0"
35 actions: { "unity": "/com/ubuntu/Menu/0" }
36 }
37
38 readonly property bool hasMenus: repeater.count > 0
39 Repeater {
40 id: repeater
41 model: menuModel
42 delegate: Item {}
43 }
44
45 Panel {
46 id: panel
47
48 height: parent.height
49 width: parent.width / 2
50 minimizedPanelHeight: units.gu(6)
51 visible: hasMenus
52
53 mode: "windowed"
54
55 applicationMenus {
56 model: menuModel
57 }
58
59 Rectangle {
60 width: 50
61 height: 50
62 anchors.centerIn: parent
63 color: "gray"
64 rotation: 45
65 Timer {
66 interval: 20
67 running: true
68 repeat: true
69 onTriggered: parent.rotation = parent.rotation+1
70 }
71 }
72
73 Rectangle {
74 color: "green"
75 anchors.bottom: parent.bottom
76 anchors.right: parent.right
77 Label {
78 id: label
79 anchors.centerIn: parent
80 text: "Click here to open touch menu manually"
81 }
82 width: label.width + units.gu(2)
83 height: label.height + units.gu(2)
84 MouseArea {
85 anchors.fill: parent
86 onClicked: panel.applicationMenus.show();
87 }
88 visible: !panel.applicationMenus.shown
89 }
90 }
91
92 Rectangle {
93 color: "blue"
94 height: parent.height
95 width: parent.width / 2
96 x: width
97 visible: hasMenus
98
99 MenuBar {
100 id: menuBar
101 height: units.gu(3)
102 width: parent.width
103 enableKeyFilter: true
104 unityMenuModel: menuModel
105 }
106 }
107
108 Component.onCompleted: {
109 theme.name = "Ubuntu.Components.Themes.SuruDark";
110 PanelState.title = "Drag here to open touch menu";
111 }
112
113 Text {
114 anchors.centerIn: parent
115 text: "The dbus address you gave has no menus. Make sure you read the README file."
116 visible: !hasMenus
117 }
118}
0119
=== added directory 'tools/scopetool'
=== added file 'tools/scopetool/CMakeLists.txt'
--- tools/scopetool/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tools/scopetool/CMakeLists.txt 2017-03-03 12:17:19 +0000
@@ -0,0 +1,12 @@
1add_executable(${SCOPE_TOOL}
2 scopetool.cpp
3 registry-tracker.cpp
4 ../../src/UnixSignalHandler.cpp
5 )
6
7qt5_use_modules(${SCOPE_TOOL} Qml Quick)
8
9# install binaries
10install(TARGETS ${SCOPE_TOOL}
11 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
12 )
013
=== renamed file 'tools/registry-tracker.cpp' => 'tools/scopetool/registry-tracker.cpp'
=== renamed file 'tools/registry-tracker.h' => 'tools/scopetool/registry-tracker.h'
=== renamed file 'tools/scopetool.cpp' => 'tools/scopetool/scopetool.cpp'

Subscribers

People subscribed via source and target branches