Merge lp:~aacid/unity8/menuToolBrowser into lp:unity8
- menuToolBrowser
- Merge into trunk
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 |
Related bugs: |
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 ApplicationMenu
... 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
- 2893. By Albert Astals Cid
-
hook up the unregistered signal too
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2893
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2893
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2893
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2893
https:/
Executed test runs:
Click here to trigger a rebuild:
https:/
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
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2893
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2893
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unmerged revisions
- 2893. By Albert Astals Cid
-
hook up the unregistered signal too
- 2892. By Albert Astals Cid
-
menutool: Use the ApplicationMenu
Registry instead of asking people to figure out the dbus service manually
Preview Diff
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 | 139 | } | 139 | } |
6 | 140 | return list; | 140 | return list; |
7 | 141 | } | 141 | } |
8 | 142 | |||
9 | 143 | QVariantMap ApplicationMenuRegistry::appMenus() const | ||
10 | 144 | { | ||
11 | 145 | QVariantMap result; | ||
12 | 146 | for (auto it = m_appMenus.begin(); it != m_appMenus.end(); ++it) { | ||
13 | 147 | result.insert(QString::number(it.key()), QVariant::fromValue(it.value())); | ||
14 | 148 | } | ||
15 | 149 | return result; | ||
16 | 150 | } | ||
17 | 142 | 151 | ||
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 | 66 | const QString &service); | 66 | const QString &service); |
23 | 67 | void UnregisterSurfaceMenu(const QString &surfaceId, const QDBusObjectPath &menuObjectPath); | 67 | void UnregisterSurfaceMenu(const QString &surfaceId, const QDBusObjectPath &menuObjectPath); |
24 | 68 | 68 | ||
25 | 69 | // for menutool | ||
26 | 70 | Q_INVOKABLE QVariantMap appMenus() const; | ||
27 | 71 | |||
28 | 69 | Q_SIGNALS: | 72 | Q_SIGNALS: |
29 | 70 | void appMenuRegistered(uint processId); | 73 | void appMenuRegistered(uint processId); |
30 | 71 | void appMenuUnregistered(uint processId); | 74 | void appMenuUnregistered(uint processId); |
31 | 72 | 75 | ||
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 | 3 | How to use: | 3 | How to use: |
37 | 4 | * Start application that exports menus | 4 | * Start application that exports menus |
38 | 5 | e.g. QT_QPA_PLATFORMTHEME=ubuntuappmenu kate | 5 | e.g. QT_QPA_PLATFORMTHEME=ubuntuappmenu kate |
45 | 6 | * Figure out which is the dbus address | 6 | * Start tool and choose the pid you want in the list |
46 | 7 | * This is a bit tricky, but using qdbusviewer to see the addresses | 7 | builddir/tools/menutool/menutool |
41 | 8 | that appear when starting the app and looking for one that | ||
42 | 9 | contains com/Ubuntu/Menu/0 should be enough | ||
43 | 10 | * Start tool passing the dbus address | ||
44 | 11 | builddir/menutool/menutool :1.293 | ||
47 | 12 | 8 | ||
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 | 30 | QGuiApplication::setApplicationName("Menu Test Tool"); | 30 | QGuiApplication::setApplicationName("Menu Test Tool"); |
53 | 31 | QGuiApplication *application = new QGuiApplication(argc, argv); | 31 | QGuiApplication *application = new QGuiApplication(argc, argv); |
54 | 32 | 32 | ||
55 | 33 | QCommandLineParser parser; | ||
56 | 34 | parser.parse(application->arguments()); | ||
57 | 35 | const QStringList args = parser.positionalArguments(); | ||
58 | 36 | |||
59 | 37 | if (args.count() != 1) { | ||
60 | 38 | qWarning() << "You need to pass the dbus address"; | ||
61 | 39 | return 1; | ||
62 | 40 | } | ||
63 | 41 | |||
64 | 42 | QQuickView* view = new QQuickView(); | 33 | QQuickView* view = new QQuickView(); |
65 | 43 | view->setResizeMode(QQuickView::SizeRootObjectToView); | 34 | view->setResizeMode(QQuickView::SizeRootObjectToView); |
66 | 44 | view->setTitle(QGuiApplication::applicationName()); | 35 | view->setTitle(QGuiApplication::applicationName()); |
67 | 45 | view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory())); | 36 | view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory())); |
68 | 46 | view->rootContext()->setContextProperty("contextBusName", args[0]); | ||
69 | 47 | 37 | ||
70 | 48 | QUrl source(::sourceDirectory() + "/tools/menutool/menutool.qml"); | 38 | QUrl source(::sourceDirectory() + "/tools/menutool/menutool.qml"); |
71 | 49 | prependImportPaths(view->engine(), ::overrideImportPaths()); | 39 | prependImportPaths(view->engine(), ::overrideImportPaths()); |
72 | 50 | 40 | ||
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 | 23 | 23 | ||
78 | 24 | import QMenuModel 0.1 | 24 | import QMenuModel 0.1 |
79 | 25 | import Unity.Indicators 0.1 as Indicators | 25 | import Unity.Indicators 0.1 as Indicators |
80 | 26 | import Unity.ApplicationMenu 0.1 | ||
81 | 26 | 27 | ||
82 | 27 | Item { | 28 | Item { |
83 | 28 | width: units.gu(180) | 29 | width: units.gu(180) |
84 | 29 | height: units.gu(120) | 30 | height: units.gu(120) |
85 | 30 | 31 | ||
86 | 32 | Connections { | ||
87 | 33 | target: ApplicationMenuRegistry | ||
88 | 34 | onAppMenuRegistered: rebuildAppList(); | ||
89 | 35 | onAppMenuUnregistered: rebuildAppList(); | ||
90 | 36 | } | ||
91 | 37 | |||
92 | 38 | function rebuildAppList() { | ||
93 | 39 | appsModel.clear(); | ||
94 | 40 | var theMenus = ApplicationMenuRegistry.appMenus(); | ||
95 | 41 | for (var i in theMenus) { | ||
96 | 42 | appsModel.append({"pid": i, "menuData": theMenus[i]}); | ||
97 | 43 | } | ||
98 | 44 | } | ||
99 | 45 | |||
100 | 46 | ListModel { | ||
101 | 47 | id: appsModel | ||
102 | 48 | } | ||
103 | 49 | |||
104 | 31 | UnityMenuModel { | 50 | UnityMenuModel { |
105 | 32 | id: menuModel | 51 | id: menuModel |
106 | 33 | busName: contextBusName | ||
107 | 34 | menuObjectPath: "/com/ubuntu/Menu/0" | ||
108 | 35 | actions: { "unity": "/com/ubuntu/Menu/0" } | ||
109 | 36 | } | 52 | } |
110 | 37 | 53 | ||
117 | 38 | readonly property bool hasMenus: repeater.count > 0 | 54 | property bool showingMenus: false |
112 | 39 | Repeater { | ||
113 | 40 | id: repeater | ||
114 | 41 | model: menuModel | ||
115 | 42 | delegate: Item {} | ||
116 | 43 | } | ||
118 | 44 | 55 | ||
119 | 45 | Panel { | 56 | Panel { |
120 | 46 | id: panel | 57 | id: panel |
121 | @@ -48,7 +59,7 @@ | |||
122 | 48 | height: parent.height | 59 | height: parent.height |
123 | 49 | width: parent.width / 2 | 60 | width: parent.width / 2 |
124 | 50 | minimizedPanelHeight: units.gu(6) | 61 | minimizedPanelHeight: units.gu(6) |
126 | 51 | visible: hasMenus | 62 | visible: showingMenus |
127 | 52 | 63 | ||
128 | 53 | mode: "windowed" | 64 | mode: "windowed" |
129 | 54 | 65 | ||
130 | @@ -94,7 +105,7 @@ | |||
131 | 94 | height: parent.height | 105 | height: parent.height |
132 | 95 | width: parent.width / 2 | 106 | width: parent.width / 2 |
133 | 96 | x: width | 107 | x: width |
135 | 97 | visible: hasMenus | 108 | visible: showingMenus |
136 | 98 | 109 | ||
137 | 99 | MenuBar { | 110 | MenuBar { |
138 | 100 | id: menuBar | 111 | id: menuBar |
139 | @@ -110,9 +121,29 @@ | |||
140 | 110 | PanelState.title = "Drag here to open touch menu"; | 121 | PanelState.title = "Drag here to open touch menu"; |
141 | 111 | } | 122 | } |
142 | 112 | 123 | ||
147 | 113 | Text { | 124 | Item { |
148 | 114 | anchors.centerIn: parent | 125 | anchors.fill: parent |
149 | 115 | text: "The dbus address you gave has no menus. Make sure you read the README file." | 126 | visible: !showingMenus |
150 | 116 | visible: !hasMenus | 127 | |
151 | 128 | Column { | ||
152 | 129 | anchors.centerIn: parent | ||
153 | 130 | Text { | ||
154 | 131 | text: appsModel.count > 0 ? "Please select a menu to show:" : "You are not running any application that exports menus. See the README" | ||
155 | 132 | } | ||
156 | 133 | |||
157 | 134 | Repeater { | ||
158 | 135 | model: appsModel | ||
159 | 136 | |||
160 | 137 | Button { | ||
161 | 138 | text: "PID: " + pid + "\tmenuPath: " + menuData.menuPath | ||
162 | 139 | onClicked: { | ||
163 | 140 | menuModel.busName = menuData.service; | ||
164 | 141 | menuModel.menuObjectPath = menuData.menuPath; | ||
165 | 142 | menuModel.actions = { "unity": menuData.actionPath }; | ||
166 | 143 | showingMenus = true; | ||
167 | 144 | } | ||
168 | 145 | } | ||
169 | 146 | } | ||
170 | 147 | } | ||
171 | 117 | } | 148 | } |
172 | 118 | } | 149 | } |
FAILED: Continuous integration, rev:2892 /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/3552/ /unity8- jenkins. ubuntu. com/job/ build/4712 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= xenial+ overlay, testname= qmluitests. sh/2866 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= zesty,testname= qmluitests. sh/2866/ console /unity8- jenkins. ubuntu. com/job/ build-0- fetch/4740 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 4563 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 4563/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/4563 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/4563/ artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 4563 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 4563/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/4563 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/4563/ artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 4563 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 4563/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/4563 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/4563/ artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/3552/ rebuild
https:/