Merge lp:~bzoltan/ubuntu-ui-toolkit/landing_2006 into lp:ubuntu-ui-toolkit
- landing_2006
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Zoltan Balogh |
Proposed branch: | lp:~bzoltan/ubuntu-ui-toolkit/landing_2006 |
Merge into: | lp:ubuntu-ui-toolkit |
Diff against target: |
662 lines (+369/-77) 12 files modified
debian/changelog (+25/-0) debian/ubuntu-ui-toolkit-autopilot.install (+1/-1) modules/Ubuntu/Components/Icon.qml (+2/-2) modules/Ubuntu/Components/Label.qml (+0/-2) modules/Ubuntu/Components/OrientationHelper.qml (+55/-21) modules/Ubuntu/Components/plugin/uctheme.cpp (+10/-0) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+5/-1) tests/launcher/MouseTouchAdaptor.cpp (+159/-0) tests/launcher/MouseTouchAdaptor.h (+50/-0) tests/launcher/launcher.cpp (+51/-46) tests/launcher/launcher.pro (+6/-4) tests/unit/tst_components/tst_label.qml (+5/-0) |
To merge this branch: | bzr merge lp:~bzoltan/ubuntu-ui-toolkit/landing_2006 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Zsombor Egri | Pending | ||
Review via email: mp+223858@code.launchpad.net |
Commit message
[ Florian Boucault ]
* OrientationHelper: made rotation animation visually smoother.
* Icon: remove warning when Icon.visible is set to false:
ShaderEffect: Property 'source' is not assigned a valid
texture provider (QQuickImage*).
* OrientationHelper: prevent unnecessary changes of width
and height with a workaround.
[ Tim Peeters ]
* Fix empty toolbar bug with Qt 5.3.
Fixes: https:/
[ Zsombor Egri]
* Default font for the toolkit: Ubuntu, medium sized and light
weight. Fixes: https:/
* Extend launcher to convert mouse to touch events.
MouseTouchA
[ Christian Dywan ]
* Multi-arch aware alternative launcher.
Description of the change
[ Florian Boucault ]
* OrientationHelper: made rotation animation visually smoother.
* Icon: remove warning when Icon.visible is set to false:
ShaderEffect: Property 'source' is not assigned a valid
texture provider (QQuickImage*).
* OrientationHelper: prevent unnecessary changes of width
and height with a workaround.
[ Tim Peeters ]
* Fix empty toolbar bug with Qt 5.3.
Fixes: https:/
[ Zsombor Egri]
* Default font for the toolkit: Ubuntu, medium sized and light
weight. Fixes: https:/
* Extend launcher to convert mouse to touch events.
MouseTouchA
[ Christian Dywan ]
* Multi-arch aware alternative launcher.
PS Jenkins bot (ps-jenkins) wrote : | # |
- 1115. By Zoltan Balogh
-
Changelog update for the release
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1115
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
- 1115. By Zoltan Balogh
-
Changelog update for the release
- 1114. By Zoltan Balogh
-
Changelog update for the release
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2014-06-19 06:55:24 +0000 |
3 | +++ debian/changelog 2014-06-20 19:21:15 +0000 |
4 | @@ -1,3 +1,28 @@ |
5 | +ubuntu-ui-toolkit (0.1.47+14.10.20140619-0ubuntu2) UNRELEASED; urgency=medium |
6 | + |
7 | + [ Florian Boucault ] |
8 | + * OrientationHelper: made rotation animation visually smoother. |
9 | + * Icon: remove warning when Icon.visible is set to false: |
10 | + ShaderEffect: Property 'source' is not assigned a valid |
11 | + texture provider (QQuickImage*). |
12 | + * OrientationHelper: prevent unnecessary changes of width |
13 | + and height with a workaround. |
14 | + |
15 | + [ Tim Peeters ] |
16 | + * Fix empty toolbar bug with Qt 5.3. |
17 | + Fixes: https://bugs.launchpad.net/bugs/1327189.* |
18 | + |
19 | + [ Zsombor Egri] |
20 | + * Default font for the toolkit: Ubuntu, medium sized and light |
21 | + weight. Fixes: https://bugs.launchpad.net/bugs/1263963. |
22 | + * Extend launcher to convert mouse to touch events. |
23 | + MouseTouchAdaptor taken from unity8 launcher. |
24 | + |
25 | + [ Christian Dywan ] |
26 | + * Multi-arch aware alternative launcher. |
27 | + |
28 | + -- Zoltán Balogh <zoltan@bakter.hu> Fri, 20 Jun 2014 21:20:05 +0200 |
29 | + |
30 | ubuntu-ui-toolkit (0.1.47+14.10.20140619-0ubuntu1) utopic; urgency=low |
31 | |
32 | [ Ubuntu daily release ] |
33 | |
34 | === modified file 'debian/ubuntu-ui-toolkit-autopilot.install' |
35 | --- debian/ubuntu-ui-toolkit-autopilot.install 2014-05-14 11:00:20 +0000 |
36 | +++ debian/ubuntu-ui-toolkit-autopilot.install 2014-06-20 19:21:15 +0000 |
37 | @@ -1,3 +1,3 @@ |
38 | usr/lib/python3 |
39 | -usr/lib/ubuntu-ui-toolkit/launcher |
40 | +usr/lib/*/ubuntu-ui-toolkit/launcher |
41 | usr/lib/python2.7 |
42 | |
43 | === modified file 'modules/Ubuntu/Components/Icon.qml' |
44 | --- modules/Ubuntu/Components/Icon.qml 2014-04-23 08:50:20 +0000 |
45 | +++ modules/Ubuntu/Components/Icon.qml 2014-06-20 19:21:15 +0000 |
46 | @@ -103,12 +103,12 @@ |
47 | id: colorizedImage |
48 | |
49 | anchors.fill: parent |
50 | - visible: active && image.status == Image.Ready |
51 | + visible: active |
52 | |
53 | // Whether or not a color has been set. |
54 | property bool active: keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0) |
55 | |
56 | - property Image source: visible ? image : null |
57 | + property Image source: active && image.status == Image.Ready ? image : null |
58 | property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0) |
59 | property color keyColorIn: "#808080" |
60 | property real threshold: 0.1 |
61 | |
62 | === modified file 'modules/Ubuntu/Components/Label.qml' |
63 | --- modules/Ubuntu/Components/Label.qml 2014-05-22 09:44:01 +0000 |
64 | +++ modules/Ubuntu/Components/Label.qml 2014-06-20 19:21:15 +0000 |
65 | @@ -55,8 +55,6 @@ |
66 | property string fontSize: "medium" |
67 | |
68 | font.pixelSize: FontUtils.sizeToPixels(fontSize) |
69 | - font.family: "Ubuntu" |
70 | - font.weight: Font.Light |
71 | color: Theme.palette.selected.backgroundText |
72 | |
73 | /* FIXME: workaround for QTBUG 35095 where Text's alignment is incorrect |
74 | |
75 | === modified file 'modules/Ubuntu/Components/OrientationHelper.qml' |
76 | --- modules/Ubuntu/Components/OrientationHelper.qml 2014-06-09 09:07:40 +0000 |
77 | +++ modules/Ubuntu/Components/OrientationHelper.qml 2014-06-20 19:21:15 +0000 |
78 | @@ -14,7 +14,7 @@ |
79 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
80 | */ |
81 | |
82 | -import QtQuick 2.0 |
83 | +import QtQuick 2.2 |
84 | import QtQuick.Window 2.0 |
85 | import Ubuntu.Components 1.0 |
86 | |
87 | @@ -136,6 +136,17 @@ |
88 | target: orientationHelper |
89 | rotation: 0 |
90 | } |
91 | + StateChangeScript { |
92 | + name: "anchorsScript" |
93 | + script: { |
94 | + orientationHelper.anchors.fill = null; |
95 | + orientationHelper.anchors.leftMargin = 0; |
96 | + orientationHelper.anchors.rightMargin = 0; |
97 | + orientationHelper.anchors.topMargin = 0; |
98 | + orientationHelper.anchors.bottomMargin = 0; |
99 | + orientationHelper.anchors.fill = orientationHelper.parent; |
100 | + } |
101 | + } |
102 | }, |
103 | State { |
104 | name: "180" |
105 | @@ -143,17 +154,33 @@ |
106 | target: orientationHelper |
107 | rotation: 180 |
108 | } |
109 | + StateChangeScript { |
110 | + name: "anchorsScript" |
111 | + script: { |
112 | + orientationHelper.anchors.fill = null; |
113 | + orientationHelper.anchors.leftMargin = 0; |
114 | + orientationHelper.anchors.rightMargin = 0; |
115 | + orientationHelper.anchors.topMargin = 0; |
116 | + orientationHelper.anchors.bottomMargin = 0; |
117 | + orientationHelper.anchors.fill = orientationHelper.parent; |
118 | + } |
119 | + } |
120 | }, |
121 | State { |
122 | name: "270" |
123 | PropertyChanges { |
124 | target: orientationHelper |
125 | rotation: 270 |
126 | - anchors { |
127 | - leftMargin: (parent.width - parent.height) / 2 |
128 | - rightMargin: anchors.leftMargin |
129 | - topMargin: -anchors.leftMargin |
130 | - bottomMargin: anchors.topMargin |
131 | + } |
132 | + StateChangeScript { |
133 | + name: "anchorsScript" |
134 | + script: { |
135 | + orientationHelper.anchors.fill = null; |
136 | + orientationHelper.anchors.topMargin = Qt.binding(function() {return -(parent.width - parent.height) / 2}); |
137 | + orientationHelper.anchors.bottomMargin = Qt.binding(function() {return -(parent.width - parent.height) / 2}); |
138 | + orientationHelper.anchors.leftMargin = Qt.binding(function() {return (parent.width - parent.height) / 2}); |
139 | + orientationHelper.anchors.rightMargin = Qt.binding(function() {return (parent.width - parent.height) / 2}); |
140 | + orientationHelper.anchors.fill = orientationHelper.parent; |
141 | } |
142 | } |
143 | }, |
144 | @@ -162,11 +189,16 @@ |
145 | PropertyChanges { |
146 | target: orientationHelper |
147 | rotation: 90 |
148 | - anchors { |
149 | - leftMargin: (parent.width - parent.height) / 2 |
150 | - rightMargin: anchors.leftMargin |
151 | - topMargin: -anchors.leftMargin |
152 | - bottomMargin: anchors.topMargin |
153 | + } |
154 | + StateChangeScript { |
155 | + name: "anchorsScript" |
156 | + script: { |
157 | + orientationHelper.anchors.fill = null; |
158 | + orientationHelper.anchors.topMargin = Qt.binding(function() {return -(parent.width - parent.height) / 2}); |
159 | + orientationHelper.anchors.bottomMargin = Qt.binding(function() {return -(parent.width - parent.height) / 2}); |
160 | + orientationHelper.anchors.leftMargin = Qt.binding(function() {return (parent.width - parent.height) / 2}); |
161 | + orientationHelper.anchors.rightMargin = Qt.binding(function() {return (parent.width - parent.height) / 2}); |
162 | + orientationHelper.anchors.fill = orientationHelper.parent; |
163 | } |
164 | } |
165 | } |
166 | @@ -176,18 +208,20 @@ |
167 | Transition { |
168 | id: orientationTransition |
169 | ParallelAnimation { |
170 | - SequentialAnimation { |
171 | - PauseAnimation { |
172 | - duration: 25 |
173 | - } |
174 | - PropertyAction { |
175 | - target: orientationHelper |
176 | - properties: "anchors.topMargin,anchors.bottomMargin,anchors.rightMargin,anchors.leftMargin" |
177 | - } |
178 | + /* FIXME: this is a workaround for 2 issues that trigger too many changes |
179 | + to the width and height of orientationHelper which creates intermediary |
180 | + states of the UI with unexpected sizes: |
181 | + 1) upon state change fast-forwarding is used which means that the final values are computed and applied |
182 | + then immediately reverted before the actual transition is applied |
183 | + 2) when margins are applied, width and height are updated separately |
184 | + |
185 | + Without these issues, regular PropertyChanges could be used to set the margins. |
186 | + */ |
187 | + ScriptAction { |
188 | + scriptName: "anchorsScript" |
189 | } |
190 | - RotationAnimation { |
191 | + RotationAnimator { |
192 | target: orientationHelper |
193 | - properties: "rotation" |
194 | duration: UbuntuAnimation.FastDuration |
195 | easing: UbuntuAnimation.StandardEasing |
196 | direction: RotationAnimation.Shortest |
197 | |
198 | === modified file 'modules/Ubuntu/Components/plugin/uctheme.cpp' |
199 | --- modules/Ubuntu/Components/plugin/uctheme.cpp 2014-06-09 08:43:30 +0000 |
200 | +++ modules/Ubuntu/Components/plugin/uctheme.cpp 2014-06-20 19:21:15 +0000 |
201 | @@ -21,6 +21,7 @@ |
202 | #include "listener.h" |
203 | #include "quickutils.h" |
204 | #include "i18n.h" |
205 | +#include "ucfontutils.h" |
206 | |
207 | #include <QtQml/qqml.h> |
208 | #include <QtQml/qqmlinfo.h> |
209 | @@ -32,6 +33,8 @@ |
210 | #include <QtCore/QTextStream> |
211 | #include <QtCore/QLibraryInfo> |
212 | #include <QtCore/QStandardPaths> |
213 | +#include <QtGui/QGuiApplication> |
214 | +#include <QtGui/QFont> |
215 | |
216 | /*! |
217 | \qmltype Theme |
218 | @@ -114,6 +117,13 @@ |
219 | |
220 | QObject::connect(this, SIGNAL(nameChanged()), |
221 | this, SLOT(loadPalette()), Qt::UniqueConnection); |
222 | + |
223 | + // set the default font |
224 | + QFont defaultFont; |
225 | + defaultFont.setFamily("Ubuntu"); |
226 | + defaultFont.setPixelSize(UCFontUtils::instance().sizeToPixels("medium")); |
227 | + defaultFont.setWeight(QFont::Light); |
228 | + QGuiApplication::setFont(defaultFont); |
229 | } |
230 | |
231 | void UCTheme::updateEnginePaths() |
232 | |
233 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py' |
234 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-05-30 08:21:45 +0000 |
235 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-06-20 19:21:15 +0000 |
236 | @@ -15,6 +15,7 @@ |
237 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
238 | |
239 | import os |
240 | +import subprocess |
241 | |
242 | import testtools |
243 | import ubuntuuitoolkit |
244 | @@ -206,8 +207,11 @@ |
245 | if os.path.exists(path_to_local_launcher): |
246 | return path_to_local_launcher |
247 | else: |
248 | + arch = subprocess.check_output( |
249 | + ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"], |
250 | + universal_newlines=True).strip() |
251 | path_to_installed_launcher = os.path.join( |
252 | - '/', 'usr', 'lib', 'ubuntu-ui-toolkit', 'launcher') |
253 | + '/', 'usr', 'lib', arch, 'ubuntu-ui-toolkit', 'launcher') |
254 | return path_to_installed_launcher |
255 | |
256 | def test_get_unity_top_container(self): |
257 | |
258 | === added file 'tests/launcher/MouseTouchAdaptor.cpp' |
259 | --- tests/launcher/MouseTouchAdaptor.cpp 1970-01-01 00:00:00 +0000 |
260 | +++ tests/launcher/MouseTouchAdaptor.cpp 2014-06-20 19:21:15 +0000 |
261 | @@ -0,0 +1,159 @@ |
262 | +/* |
263 | + * Copyright 2014 Canonical Ltd. |
264 | + * |
265 | + * This program is free software; you can redistribute it and/or modify |
266 | + * it under the terms of the GNU Lesser General Public License as published by |
267 | + * the Free Software Foundation; version 3. |
268 | + * |
269 | + * This program is distributed in the hope that it will be useful, |
270 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
271 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
272 | + * GNU Lesser General Public License for more details. |
273 | + * |
274 | + * You should have received a copy of the GNU Lesser General Public License |
275 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
276 | + * |
277 | + * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com> |
278 | + * |
279 | + */ |
280 | + |
281 | +#include "MouseTouchAdaptor.h" |
282 | + |
283 | +#include <qpa/qwindowsysteminterface.h> |
284 | + |
285 | +#include <QtGui/QMouseEvent> |
286 | +#include <QtTest/QTest> |
287 | + |
288 | +using QTest::QTouchEventSequence; |
289 | + |
290 | +namespace { |
291 | +Qt::MouseButton translateMouseButton(xcb_button_t detail) |
292 | +{ |
293 | + switch (detail) { |
294 | + case 1: return Qt::LeftButton; |
295 | + case 2: return Qt::MidButton; |
296 | + case 3: return Qt::RightButton; |
297 | + // Button values 4-7 are Wheel events |
298 | + default: return Qt::NoButton; |
299 | + } |
300 | +} |
301 | +} // end of anonymous namespace |
302 | + |
303 | +MouseTouchAdaptor::MouseTouchAdaptor() |
304 | + : m_leftButtonIsPressed(false) |
305 | +{ |
306 | + m_touchDevice = new QTouchDevice; |
307 | + m_touchDevice->setType(QTouchDevice::TouchScreen); |
308 | + QWindowSystemInterface::registerTouchDevice(m_touchDevice); |
309 | +} |
310 | + |
311 | +bool MouseTouchAdaptor::nativeEventFilter(const QByteArray & eventType, |
312 | + void * message, long * /*result*/) |
313 | +{ |
314 | + if (eventType != "xcb_generic_event_t") { |
315 | + // wrong backend. |
316 | + qWarning("MouseTouchAdaptor: XCB backend not in use. Adaptor inoperative!"); |
317 | + return false; |
318 | + } |
319 | + |
320 | + xcb_generic_event_t *xcbEvent = static_cast<xcb_generic_event_t *>(message); |
321 | + |
322 | + switch (xcbEvent->response_type & ~0x80) { |
323 | + case XCB_BUTTON_PRESS: |
324 | + return handleButtonPress(reinterpret_cast<xcb_button_press_event_t *>(xcbEvent)); |
325 | + break; |
326 | + case XCB_BUTTON_RELEASE: |
327 | + return handleButtonRelease(reinterpret_cast<xcb_button_release_event_t *>(xcbEvent)); |
328 | + break; |
329 | + case XCB_MOTION_NOTIFY: |
330 | + return handleMotionNotify(reinterpret_cast<xcb_motion_notify_event_t *>(xcbEvent)); |
331 | + break; |
332 | + default: |
333 | + return false; |
334 | + break; |
335 | + }; |
336 | +} |
337 | + |
338 | +bool MouseTouchAdaptor::handleButtonPress(xcb_button_press_event_t *pressEvent) |
339 | +{ |
340 | + Qt::MouseButton button = translateMouseButton(pressEvent->detail); |
341 | + |
342 | + // Skip the event if it wasn't a left mouse press |
343 | + if (button != Qt::LeftButton) { |
344 | + return false; |
345 | + } |
346 | + |
347 | + QPoint windowPos(pressEvent->event_x, pressEvent->event_y); |
348 | + |
349 | + QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(pressEvent->event)); |
350 | + |
351 | + // no autoCommit |
352 | + QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice, false); |
353 | + touchEvent.press(0, windowPos); |
354 | + // do not process events when committed, let the events be processed with next event loop |
355 | + touchEvent.commit(false); |
356 | + |
357 | + m_leftButtonIsPressed = true; |
358 | + return true; |
359 | +} |
360 | + |
361 | +bool MouseTouchAdaptor::handleButtonRelease(xcb_button_release_event_t *releaseEvent) |
362 | +{ |
363 | + Qt::MouseButton button = translateMouseButton(releaseEvent->detail); |
364 | + |
365 | + // Skip the event if it wasn't a left mouse release |
366 | + if (button != Qt::LeftButton) { |
367 | + return false; |
368 | + } |
369 | + |
370 | + QPoint windowPos(releaseEvent->event_x, releaseEvent->event_y); |
371 | + |
372 | + QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(releaseEvent->event)); |
373 | + |
374 | + // no autoCommit |
375 | + QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice, false); |
376 | + touchEvent.release(0, windowPos); |
377 | + // do not process events when committed, let the events be processed with next event loop |
378 | + touchEvent.commit(false); |
379 | + |
380 | + m_leftButtonIsPressed = false; |
381 | + return true; |
382 | +} |
383 | + |
384 | +bool MouseTouchAdaptor::handleMotionNotify(xcb_motion_notify_event_t *event) |
385 | +{ |
386 | + if (!m_leftButtonIsPressed) { |
387 | + return false; |
388 | + } |
389 | + |
390 | + QPoint windowPos(event->event_x, event->event_y); |
391 | + |
392 | + QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(event->event)); |
393 | + |
394 | + // no autoCommit |
395 | + QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice, false); |
396 | + touchEvent.move(0, windowPos); |
397 | + // do not process events when committed, let the events be processed with next event loop |
398 | + touchEvent.commit(false); |
399 | + |
400 | + return true; |
401 | +} |
402 | + |
403 | +QWindow *MouseTouchAdaptor::findQWindowWithXWindowID(WId windowId) |
404 | +{ |
405 | + QWindowList windowList = QGuiApplication::topLevelWindows(); |
406 | + QWindow *foundWindow = 0; |
407 | + |
408 | + int i = 0; |
409 | + while (!foundWindow && i < windowList.count()) { |
410 | + QWindow *window = windowList[i]; |
411 | + if (window->winId() == windowId) { |
412 | + foundWindow = window; |
413 | + } else { |
414 | + ++i; |
415 | + } |
416 | + } |
417 | + |
418 | + Q_ASSERT(foundWindow); |
419 | + return foundWindow; |
420 | +} |
421 | |
422 | === added file 'tests/launcher/MouseTouchAdaptor.h' |
423 | --- tests/launcher/MouseTouchAdaptor.h 1970-01-01 00:00:00 +0000 |
424 | +++ tests/launcher/MouseTouchAdaptor.h 2014-06-20 19:21:15 +0000 |
425 | @@ -0,0 +1,50 @@ |
426 | +/* |
427 | + * Copyright 2014 Canonical Ltd. |
428 | + * |
429 | + * This program is free software; you can redistribute it and/or modify |
430 | + * it under the terms of the GNU Lesser General Public License as published by |
431 | + * the Free Software Foundation; version 3. |
432 | + * |
433 | + * This program is distributed in the hope that it will be useful, |
434 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
435 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
436 | + * GNU Lesser General Public License for more details. |
437 | + * |
438 | + * You should have received a copy of the GNU Lesser General Public License |
439 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
440 | + * |
441 | + * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com> |
442 | + * |
443 | + */ |
444 | + |
445 | +#ifndef MOUSE_TOUCH_ADAPTOR_H |
446 | +#define MOUSE_TOUCH_ADAPTOR_H |
447 | + |
448 | +#include <QtCore/QAbstractNativeEventFilter> |
449 | +#include <QWindow> |
450 | +#include <xcb/xcb.h> |
451 | + |
452 | +class QMouseEvent; |
453 | +class QTouchDevice; |
454 | + |
455 | +// Transforms QMouseEvents into single-finger QTouchEvents. |
456 | +class MouseTouchAdaptor : public QAbstractNativeEventFilter { |
457 | + |
458 | +public: |
459 | + MouseTouchAdaptor(); |
460 | + |
461 | + // Filters mouse events and posts the equivalent QTouchEvents. |
462 | + virtual bool nativeEventFilter(const QByteArray & eventType, void *message, long *result); |
463 | + |
464 | +private: |
465 | + |
466 | + bool handleButtonPress(xcb_button_press_event_t *pressEvent); |
467 | + bool handleButtonRelease(xcb_button_release_event_t *releaseEvent); |
468 | + bool handleMotionNotify(xcb_motion_notify_event_t *event); |
469 | + QWindow *findQWindowWithXWindowID(WId windowId); |
470 | + |
471 | + QTouchDevice *m_touchDevice; |
472 | + bool m_leftButtonIsPressed; |
473 | +}; |
474 | + |
475 | +#endif // MOUSE_TOUCH_ADAPTOR_H |
476 | |
477 | === modified file 'tests/launcher/launcher.cpp' |
478 | --- tests/launcher/launcher.cpp 2014-06-09 08:26:24 +0000 |
479 | +++ tests/launcher/launcher.cpp 2014-06-20 19:21:15 +0000 |
480 | @@ -30,16 +30,18 @@ |
481 | #include <QOpenGLContext> |
482 | #include <QtGui/private/qopenglcontext_p.h> |
483 | #include <QtQuick/private/qsgcontext_p.h> |
484 | +#include <QtCore/QCommandLineParser> |
485 | +#include <QtCore/QCommandLineOption> |
486 | +#include "MouseTouchAdaptor.h" |
487 | +#include <QtGui/QTouchDevice> |
488 | |
489 | -int usage() |
490 | +bool touchDevicePresent() |
491 | { |
492 | - QString self(QGuiApplication::instance()->arguments().at(0)); |
493 | - std::cout << "Usage\n " |
494 | - << qPrintable(self) |
495 | - << " -testability -frameless -engine" |
496 | - << " --desktop_file_path=DESKTOP_FILE" |
497 | - << " -I MODULE_PATH FILENAME\n"; |
498 | - return 1; |
499 | + Q_FOREACH(const QTouchDevice *device, QTouchDevice::devices()) { |
500 | + if (device->type() == QTouchDevice::TouchScreen) |
501 | + return true; |
502 | + } |
503 | + return false; |
504 | } |
505 | |
506 | int main(int argc, const char *argv[]) |
507 | @@ -58,25 +60,40 @@ |
508 | #endif |
509 | QGuiApplication::setApplicationName("UITK Launcher"); |
510 | QGuiApplication application(argc, (char**)argv); |
511 | - QStringList args (application.arguments()); |
512 | - |
513 | - int _testability(args.indexOf("-testability")); |
514 | - args.removeAt(_testability); |
515 | - int _frameless(args.indexOf("-frameless")); |
516 | - args.removeAt(_frameless); |
517 | - int _engine(args.indexOf("-engine")); |
518 | - args.removeAt(_engine); |
519 | - |
520 | - Q_FOREACH(QString arg, args) { |
521 | - if (arg.startsWith("--desktop_file_hint")) { |
522 | - // This will not be used - it only needs to be ignored |
523 | - int _desktop_file_hint(args.indexOf(arg)); |
524 | - args.removeAt(_desktop_file_hint); |
525 | - } |
526 | + |
527 | + QCommandLineParser args; |
528 | + QCommandLineOption _import("I", "Add <path> to the list of import paths", "path"); |
529 | + QCommandLineOption _enableTouch("touch", "Enables mouse to touch conversion on desktop"); |
530 | + QCommandLineOption _testability("testability", "Loads the testability driver"); |
531 | + QCommandLineOption _frameless("frameless", "Run without borders"); |
532 | + QCommandLineOption _engine("engine", "Use quick engine from quick view"); |
533 | + QCommandLineOption _desktop_file_hint("desktop_file_hint", "Desktop file - ignored", "desktop_file"); |
534 | + |
535 | + args.addOption(_import); |
536 | + args.addOption(_enableTouch); |
537 | + args.addOption(_testability); |
538 | + args.addOption(_frameless); |
539 | + args.addOption(_engine); |
540 | + args.addOption(_desktop_file_hint); |
541 | + args.addPositionalArgument("filename", "Document to be viewed"); |
542 | + args.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); |
543 | + args.addHelpOption(); |
544 | + if (!args.parse(application.arguments())) { |
545 | + qWarning() << args.errorText(); |
546 | + args.showHelp(1); |
547 | + } |
548 | + |
549 | + QString filename; |
550 | + if (args.positionalArguments().count() > 0) { |
551 | + filename = args.positionalArguments()[0]; |
552 | + } |
553 | + if (filename.isEmpty()) { |
554 | + // show usage and exit |
555 | + args.showHelp(1); |
556 | } |
557 | |
558 | // Testability is only supported out of the box by QApplication not QGuiApplication |
559 | - if (_testability > -1 || getenv("QT_LOAD_TESTABILITY")) { |
560 | + if (args.isSet(_testability) || getenv("QT_LOAD_TESTABILITY")) { |
561 | QLibrary testLib(QLatin1String("qttestability")); |
562 | if (testLib.load()) { |
563 | typedef void (*TasInitialize)(void); |
564 | @@ -96,7 +113,7 @@ |
565 | QQmlEngine* engine; |
566 | // The default constructor affects the components tree (autopilot vis) |
567 | QQuickView* view; |
568 | - if (_engine > -1) { |
569 | + if (args.isSet(_engine)) { |
570 | view = new QQuickView(); |
571 | engine = view->engine(); |
572 | } else { |
573 | @@ -104,43 +121,31 @@ |
574 | view = new QQuickView(engine, NULL); |
575 | } |
576 | |
577 | - int _import(args.indexOf("-I")); |
578 | - args.removeAt(_import); |
579 | - if (_import > -1) { |
580 | - if (args.count() > _import) { |
581 | - QString importPath(args.at(_import)); |
582 | - args.removeAt(_import); |
583 | - engine->addImportPath(importPath); |
584 | + if (args.isSet(_import)) { |
585 | + QStringList paths = args.values(_import); |
586 | + Q_FOREACH(const QString &path, paths) { |
587 | + engine->addImportPath(path); |
588 | } |
589 | } |
590 | |
591 | view->setResizeMode(QQuickView::SizeRootObjectToView); |
592 | view->setTitle("UI Toolkit QQuickView"); |
593 | - if (_frameless > -1) { |
594 | + if (args.isSet(_frameless)) { |
595 | view->setFlags(Qt::FramelessWindowHint); |
596 | } |
597 | |
598 | - // The remaining unnamed argument must be a filename |
599 | - if (args.count() == 1) { |
600 | - qCritical() << "Missing filename"; |
601 | - return usage(); |
602 | + if (args.isSet(_enableTouch) && !touchDevicePresent()) { |
603 | + // has no effect if we have touch screen |
604 | + application.installNativeEventFilter(new MouseTouchAdaptor); |
605 | } |
606 | - QString filename(args.at(1)); |
607 | - // The first argument is the launcher itself |
608 | - args.removeAt(0); |
609 | |
610 | QUrl source(QUrl::fromLocalFile(filename)); |
611 | view->setSource(source); |
612 | if (view->errors().count() > 0) { |
613 | - return usage(); |
614 | + args.showHelp(3); |
615 | } |
616 | view->show(); |
617 | |
618 | - if (args.count() > 1) { |
619 | - qCritical() << "Invalid arguments passed" << args; |
620 | - return usage(); |
621 | - } |
622 | - |
623 | return application.exec(); |
624 | } |
625 | |
626 | |
627 | === modified file 'tests/launcher/launcher.pro' |
628 | --- tests/launcher/launcher.pro 2014-05-14 11:00:20 +0000 |
629 | +++ tests/launcher/launcher.pro 2014-06-20 19:21:15 +0000 |
630 | @@ -1,11 +1,13 @@ |
631 | TEMPLATE = app |
632 | QT += qml quick |
633 | # For setSharedOpenGLContext |
634 | -QT += core-private gui-private quick-private |
635 | +QT += core-private gui-private testlib quick-private |
636 | CONFIG += no_keywords |
637 | -SOURCES += \ |
638 | - launcher.cpp |
639 | -launcher.path = /usr/lib/ubuntu-ui-toolkit |
640 | +HEADERS += MouseTouchAdaptor.h |
641 | +SOURCES += launcher.cpp \ |
642 | + MouseTouchAdaptor.cpp |
643 | +installPath = $$[QT_INSTALL_LIBS]/ubuntu-ui-toolkit |
644 | +launcher.path = $$installPath |
645 | launcher.files = launcher |
646 | INSTALLS += launcher |
647 | |
648 | |
649 | === modified file 'tests/unit/tst_components/tst_label.qml' |
650 | --- tests/unit/tst_components/tst_label.qml 2014-05-26 10:13:41 +0000 |
651 | +++ tests/unit/tst_components/tst_label.qml 2014-06-20 19:21:15 +0000 |
652 | @@ -21,6 +21,11 @@ |
653 | TestCase { |
654 | name: "LabelAPI" |
655 | |
656 | + function test_0_defaults() { |
657 | + compare(textCustom.font.family, "Ubuntu", "Default font family"); |
658 | + compare(textCustom.font.weight, Font.Light, "Default font weight"); |
659 | + } |
660 | + |
661 | function test_fontSize() { |
662 | compare(textCustom.fontSize,"medium","fontSize is 'medium' by default") |
663 |
FAILED: Continuous integration, rev:1114 jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- ci/2094/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/1055/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- utopic/ 951/console jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- utopic- amd64-ci/ 40/console jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- utopic- armhf-ci/ 40/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/1854/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/1094/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- ui-toolkit- ci/2094/ rebuild
http://