Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-metrics-module into lp:ubuntu-ui-toolkit/staging
- ubuntu-metrics-module
- Merge into staging
Status: | Superseded |
---|---|
Proposed branch: | lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-metrics-module |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Prerequisite: | lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-metrics-generic-events |
Diff against target: |
312 lines (+222/-35) 8 files modified
debian/bileto_convert_to_gles (+1/-1) debian/control (+16/-0) debian/qml-module-ubuntu-metrics.install (+3/-0) src/Ubuntu/Metrics/Metrics.pro (+7/-0) src/Ubuntu/Metrics/MetricsModule.pro (+19/-0) src/Ubuntu/Metrics/plugin.cpp (+127/-0) src/Ubuntu/Metrics/qmldir (+4/-0) src/src.pro (+45/-34) |
To merge this branch: | bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-metrics-module |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ubuntu-sdk-build-bot | continuous-integration | Needs Fixing | |
Ubuntu SDK team | Pending | ||
Review via email: mp+302361@code.launchpad.net |
Commit message
Wrapped libUbuntuMetrics to QML.
Generic event logging and loggers API haven't been wrapped yet.
Description of the change
Wrapped libUbuntuMetrics to QML.
Generic event logging and loggers API haven't been wrapped yet.
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
- 2058. By Loïc Molinari
-
Added Ubuntu.MEtrics to components.api.
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2057
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2057
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2057
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2057
https:/
Executed test runs:
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Unmerged revisions
Preview Diff
1 | === modified file 'debian/bileto_convert_to_gles' |
2 | --- debian/bileto_convert_to_gles 2016-08-09 03:12:01 +0000 |
3 | +++ debian/bileto_convert_to_gles 2016-08-09 03:12:01 +0000 |
4 | @@ -14,6 +14,6 @@ |
5 | |
6 | patch -p1 < debian/gles-disable-documentation.patch |
7 | |
8 | -for gles in libubuntugestures5-gles.install libubuntugestures5-gles-dev.install libubuntumetrics5-gles.install libubuntumetrics5-gles-dev.install libubuntutoolkit5-gles.install libubuntutoolkit5-gles-dev.install qml-module-ubuntu-components-gles.install qml-module-ubuntu-components-gles.lintian-overrides qml-module-ubuntu-performancemetrics-gles.install ; do |
9 | +for gles in libubuntugestures5-gles.install libubuntugestures5-gles-dev.install libubuntumetrics5-gles.install libubuntumetrics5-gles-dev.install libubuntutoolkit5-gles.install libubuntutoolkit5-gles-dev.install qml-module-ubuntu-components-gles.install qml-module-ubuntu-components-gles.lintian-overrides qml-module-ubuntu-performancemetrics-gles.install qml-module-ubuntu-metrics-gles.install ; do |
10 | mv --verbose debian/"$(echo $gles | sed 's/-gles//')" debian/$gles |
11 | done |
12 | |
13 | === modified file 'debian/control' |
14 | --- debian/control 2016-08-09 03:12:01 +0000 |
15 | +++ debian/control 2016-08-09 03:12:01 +0000 |
16 | @@ -176,6 +176,22 @@ |
17 | . |
18 | This package contains the Ubuntu PerformanceMetrics QML plugin. |
19 | |
20 | +Package: qml-module-ubuntu-metrics |
21 | +Architecture: any |
22 | +Multi-Arch: same |
23 | +Pre-Depends: dpkg (>= 1.15.6~), |
24 | + ${misc:Pre-Depends}, |
25 | +Depends: ${misc:Depends}, |
26 | + ${shlibs:Depends}, |
27 | +Breaks: qtdeclarative5-ubuntu-ui-toolkit-plugin (<< ${source:Version}), |
28 | + unity8 (<< 8.14), |
29 | +Replaces: qtdeclarative5-ubuntu-ui-toolkit-plugin (<< ${source:Version}), |
30 | +Description: Qt Components for Ubuntu - Metrics QML plugin |
31 | + Qt Components for Ubuntu offers a set of reusable user interface |
32 | + components for Qt Quick 2 / QML. |
33 | + . |
34 | + This package contains the Ubuntu Metrics QML plugin. |
35 | + |
36 | Package: qtdeclarative5-ubuntu-ui-toolkit-plugin |
37 | Architecture: any |
38 | Section: oldlibs |
39 | |
40 | === added file 'debian/qml-module-ubuntu-metrics.install' |
41 | --- debian/qml-module-ubuntu-metrics.install 1970-01-01 00:00:00 +0000 |
42 | +++ debian/qml-module-ubuntu-metrics.install 2016-08-09 03:12:01 +0000 |
43 | @@ -0,0 +1,3 @@ |
44 | +usr/lib/*/qt5/qml/Ubuntu/Metrics/libUbuntuMetrics.so |
45 | +usr/lib/*/qt5/qml/Ubuntu/Metrics/plugins.qmltypes |
46 | +usr/lib/*/qt5/qml/Ubuntu/Metrics/qmldir |
47 | |
48 | === added directory 'src/Ubuntu/Metrics' |
49 | === added file 'src/Ubuntu/Metrics/Metrics.pro' |
50 | --- src/Ubuntu/Metrics/Metrics.pro 1970-01-01 00:00:00 +0000 |
51 | +++ src/Ubuntu/Metrics/Metrics.pro 2016-08-09 03:12:01 +0000 |
52 | @@ -0,0 +1,7 @@ |
53 | +CXX_MODULE = qml |
54 | +TARGET = UbuntuMetrics |
55 | +TARGETPATH = Ubuntu/Metrics |
56 | +IMPORT_VERSION = 1.0 |
57 | +QT += qml UbuntuMetrics |
58 | +SOURCES += plugin.cpp |
59 | +load(ubuntu_qml_plugin) |
60 | |
61 | === added file 'src/Ubuntu/Metrics/MetricsModule.pro' |
62 | --- src/Ubuntu/Metrics/MetricsModule.pro 1970-01-01 00:00:00 +0000 |
63 | +++ src/Ubuntu/Metrics/MetricsModule.pro 2016-08-09 03:12:01 +0000 |
64 | @@ -0,0 +1,19 @@ |
65 | +TEMPLATE = aux |
66 | +CONFIG += ubuntu_qml_module |
67 | + |
68 | +uri = Ubuntu.Metrics |
69 | +installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) |
70 | +QMLDIR_FILE = qmldir |
71 | + |
72 | +qmldir_file.installPath = $$installPath |
73 | +qmldir_file.files = $$QMLDIR_FILE |
74 | +UBUNTU_QML_MODULE_FILES += qmldir_file |
75 | + |
76 | +plugins_qmltypes.path = $$installPath |
77 | +plugins_qmltypes.files = plugins.qmltypes |
78 | +# Silence spam on stderr due to fonts. |
79 | +# https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999 |
80 | +# https://bugreports.qt-project.org/browse/QTBUG-36243 |
81 | +plugins_qmltypes.extra = $$[QT_INSTALL_BINS]/qmlplugindump -notrelocatable $$uri 0.1 ../../ 2>/dev/null > $(INSTALL_ROOT)/$$installPath/plugins.qmltypes |
82 | + |
83 | +INSTALLS += plugins_qmltypes |
84 | |
85 | === added file 'src/Ubuntu/Metrics/plugin.cpp' |
86 | --- src/Ubuntu/Metrics/plugin.cpp 1970-01-01 00:00:00 +0000 |
87 | +++ src/Ubuntu/Metrics/plugin.cpp 2016-08-09 03:12:01 +0000 |
88 | @@ -0,0 +1,127 @@ |
89 | +// Copyright © 2016 Canonical Ltd. |
90 | +// |
91 | +// This file is part of Ubuntu UI Toolkit. |
92 | +// |
93 | +// Ubuntu UI Toolkit is free software: you can redistribute it and/or modify it |
94 | +// under the terms of the GNU Lesser General Public License as published by the |
95 | +// Free Software Foundation; version 3. |
96 | +// |
97 | +// Ubuntu UI Toolkit is distributed in the hope that it will be useful, but |
98 | +// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
99 | +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License |
100 | +// for more details. |
101 | +// |
102 | +// You should have received a copy of the GNU Lesser General Public License |
103 | +// along with Ubuntu UI Toolkit. If not, see <http://www.gnu.org/licenses/>. |
104 | + |
105 | +#include <QtQml/QtQml> |
106 | +#include <UbuntuMetrics/applicationmonitor.h> |
107 | + |
108 | +// FIXME(loicm) |
109 | +// - Not sure how to add support for the loggers API? |
110 | +// - Add support for the generic logging API. |
111 | + |
112 | +class ApplicationMonitorWrapper : public QObject |
113 | +{ |
114 | + Q_OBJECT |
115 | + |
116 | + Q_FLAGS(LoggingFilters); |
117 | + Q_ENUMS(Event); |
118 | + Q_PROPERTY(bool overlay READ overlay WRITE setOverlay NOTIFY overlayChanged) |
119 | + Q_PROPERTY(bool logging READ logging WRITE setLogging NOTIFY loggingChanged) |
120 | + Q_PROPERTY(LoggingFilters loggingFilter READ loggingFilter WRITE setLoggingFilter |
121 | + NOTIFY loggingFilterChanged) |
122 | + Q_PROPERTY(int processUpdateInterval READ processUpdateInterval |
123 | + WRITE setProcessUpdateInterval NOTIFY processUpdateIntervalChanged) |
124 | + |
125 | +public: |
126 | + ApplicationMonitorWrapper(QObject* parent = 0) |
127 | + : QObject(parent) |
128 | + , m_applicationMonitor(UMApplicationMonitor::instance()) |
129 | + { |
130 | + QObject::connect(m_applicationMonitor, SIGNAL(overlayChanged()), |
131 | + this, SIGNAL(overlayChanged())); |
132 | + QObject::connect(m_applicationMonitor, SIGNAL(loggingChanged()), |
133 | + this, SIGNAL(loggingChanged())); |
134 | + QObject::connect(m_applicationMonitor, SIGNAL(loggingFilterChanged()), |
135 | + this, SIGNAL(loggingFilterChanged())); |
136 | + QObject::connect(m_applicationMonitor, SIGNAL(updateIntervalChanged(UMEvent::Type)), |
137 | + this, SLOT(updateIntervalChanged(UMEvent::Type))); |
138 | + } |
139 | + ~ApplicationMonitorWrapper() {} |
140 | + |
141 | + enum LoggingFilter { |
142 | + ProcessEvent = UMApplicationMonitor::ProcessEvent, |
143 | + WindowEvent = UMApplicationMonitor::WindowEvent, |
144 | + FrameEvent = UMApplicationMonitor::FrameEvent, |
145 | + GenericEvent = UMApplicationMonitor::GenericEvent, |
146 | + AllEvents = UMApplicationMonitor::AllEvents |
147 | + }; |
148 | + Q_DECLARE_FLAGS(LoggingFilters, LoggingFilter) |
149 | + |
150 | + enum Event { |
151 | + UserInterfaceReady = UMApplicationMonitor::UserInterfaceReady |
152 | + }; |
153 | + |
154 | + bool overlay() const { return m_applicationMonitor->overlay(); } |
155 | + void setOverlay(bool overlay) { m_applicationMonitor->setOverlay(overlay); } |
156 | + bool logging() const { return m_applicationMonitor->logging(); } |
157 | + void setLogging(bool logging) { m_applicationMonitor->setLogging(logging); } |
158 | + LoggingFilters loggingFilter() const { |
159 | + return QFlags<LoggingFilters>::enum_type( |
160 | + QFlags<UMApplicationMonitor::LoggingFilters>::Int( |
161 | + m_applicationMonitor->loggingFilter())); } |
162 | + void setLoggingFilter(LoggingFilters filter) { |
163 | + m_applicationMonitor->setLoggingFilter( |
164 | + QFlags<UMApplicationMonitor::LoggingFilters>::enum_type( |
165 | + QFlags<LoggingFilters>::Int(filter))); } |
166 | + int processUpdateInterval() const { |
167 | + return m_applicationMonitor->updateInterval(UMEvent::Process); } |
168 | + void setProcessUpdateInterval(int interval) { |
169 | + m_applicationMonitor->setUpdateInterval(UMEvent::Process, interval); } |
170 | + |
171 | + Q_INVOKABLE bool logEvent(Event event) { |
172 | + return m_applicationMonitor->logEvent(static_cast<UMApplicationMonitor::Event>(event)); } |
173 | + |
174 | +Q_SIGNALS: |
175 | + void overlayChanged(); |
176 | + void loggingChanged(); |
177 | + void loggingFilterChanged(); |
178 | + void processUpdateIntervalChanged(); |
179 | + |
180 | +private Q_SLOTS: |
181 | + void updateIntervalChanged(UMEvent::Type type) |
182 | + { |
183 | + if (type == UMEvent::Process) { |
184 | + Q_EMIT processUpdateIntervalChanged(); |
185 | + } |
186 | + } |
187 | + |
188 | +private: |
189 | + UMApplicationMonitor* m_applicationMonitor; |
190 | +}; |
191 | + |
192 | +static QObject* applicationMonitorSingletonProvider(QQmlEngine* engine, QJSEngine* scriptEngine) |
193 | +{ |
194 | + Q_UNUSED(engine) |
195 | + Q_UNUSED(scriptEngine) |
196 | + return new ApplicationMonitorWrapper(); |
197 | +} |
198 | + |
199 | +class UbuntuMetricsPlugin : public QQmlExtensionPlugin |
200 | +{ |
201 | + Q_OBJECT |
202 | + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0") |
203 | + |
204 | +public: |
205 | + ~UbuntuMetricsPlugin() {} |
206 | + |
207 | + virtual void registerTypes(const char* uri) override |
208 | + { |
209 | + Q_ASSERT(QLatin1String(uri) == QLatin1String("Ubuntu.Metrics")); |
210 | + qmlRegisterSingletonType<ApplicationMonitorWrapper>( |
211 | + uri, 1, 0, "ApplicationMonitor", applicationMonitorSingletonProvider); |
212 | + } |
213 | +}; |
214 | + |
215 | +#include "plugin.moc" |
216 | |
217 | === added file 'src/Ubuntu/Metrics/qmldir' |
218 | --- src/Ubuntu/Metrics/qmldir 1970-01-01 00:00:00 +0000 |
219 | +++ src/Ubuntu/Metrics/qmldir 2016-08-09 03:12:01 +0000 |
220 | @@ -0,0 +1,4 @@ |
221 | +module Ubuntu.Metrics |
222 | +plugin UbuntuMetrics |
223 | +classname UbuntuMetricsPlugin |
224 | +typeinfo plugins.qmltypes |
225 | |
226 | === modified file 'src/src.pro' |
227 | --- src/src.pro 2016-08-09 03:12:01 +0000 |
228 | +++ src/src.pro 2016-08-09 03:12:01 +0000 |
229 | @@ -1,38 +1,49 @@ |
230 | TEMPLATE = subdirs |
231 | |
232 | -src_gestures.subdir = Ubuntu/UbuntuGestures |
233 | -src_gestures.target = sub-gestures |
234 | - |
235 | -src_metrics.subdir = Ubuntu/UbuntuMetrics |
236 | -src_metrics.target = sub-metrics |
237 | - |
238 | -src_metrics_lttng.subdir = Ubuntu/UbuntuMetrics/lttng |
239 | -src_metrics_lttng.target = sub-metrics-lttng |
240 | - |
241 | -src_toolkitlib.subdir = Ubuntu/UbuntuToolkit |
242 | -src_toolkitlib.target = sub-libtoolkit |
243 | -src_toolkitlib.depends = sub-gestures sub-metrics |
244 | - |
245 | -src_components.subdir = Ubuntu/Components |
246 | -src_components.target = sub-components |
247 | -src_components.depends = sub-libtoolkit |
248 | - |
249 | -src_layouts.subdir = Ubuntu/Layouts |
250 | -src_layouts.target = sub-layouts |
251 | - |
252 | -src_performance_metrics.subdir = Ubuntu/PerformanceMetrics |
253 | -src_performance_metrics.target = sub-performance-metrics |
254 | - |
255 | -src_test.subdir = Ubuntu/Test |
256 | -src_test.target = sub-test |
257 | -src_test.depends = sub-components |
258 | +# Libraries |
259 | + |
260 | +src_gestures_lib.subdir = Ubuntu/UbuntuGestures |
261 | +src_gestures_lib.target = sub-gestures-lib |
262 | + |
263 | +src_metrics_lib.subdir = Ubuntu/UbuntuMetrics |
264 | +src_metrics_lib.target = sub-metrics-lib |
265 | + |
266 | +src_toolkit_lib.subdir = Ubuntu/UbuntuToolkit |
267 | +src_toolkit_lib.target = sub-toolkit-lib |
268 | +src_toolkit_lib.depends = sub-gestures-lib sub-metrics-lib |
269 | + |
270 | +# Plugins |
271 | + |
272 | +src_metrics_lttng_plugin.subdir = Ubuntu/UbuntuMetrics/lttng |
273 | +src_metrics_lttng_plugin.target = sub-metrics-lttng-plugin |
274 | + |
275 | +# QML modules |
276 | + |
277 | +src_metrics_module.subdir = Ubuntu/Metrics |
278 | +src_metrics_module.target = sub-metrics-module |
279 | +src_metrics_module.depends = sub-metrics-lib |
280 | + |
281 | +src_components_module.subdir = Ubuntu/Components |
282 | +src_components_module.target = sub-components-module |
283 | +src_components_module.depends = sub-toolkit-lib |
284 | + |
285 | +src_layouts_module.subdir = Ubuntu/Layouts |
286 | +src_layouts_module.target = sub-layouts-module |
287 | + |
288 | +src_performance_metrics_module.subdir = Ubuntu/PerformanceMetrics |
289 | +src_performance_metrics_module.target = sub-performance-metrics-module |
290 | + |
291 | +src_test_module.subdir = Ubuntu/Test |
292 | +src_test_module.target = sub-test-module |
293 | +src_test_module.depends = sub-toolkit-lib |
294 | |
295 | SUBDIRS += \ |
296 | - src_gestures \ |
297 | - src_metrics \ |
298 | - src_metrics_lttng \ |
299 | - src_toolkitlib \ |
300 | - src_components \ |
301 | - src_layouts \ |
302 | - src_performance_metrics \ |
303 | - src_test |
304 | + src_gestures_lib \ |
305 | + src_metrics_lib \ |
306 | + src_toolkit_lib \ |
307 | + src_metrics_lttng_plugin \ |
308 | + src_metrics_module \ |
309 | + src_components_module \ |
310 | + src_layouts_module \ |
311 | + src_performance_metrics_module \ |
312 | + src_test_module |
FAILED: Continuous integration, rev:2057 /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- stable/ 1170/ /jenkins. ubuntu. com/ubuntu- sdk/job/ generic- update- mp/4946/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- stable/ 1170/rebuild
https:/