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