Merge lp:~bzoltan/ubuntu-ui-toolkit/landing_2006 into lp:ubuntu-ui-toolkit

Proposed by Zoltan Balogh
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
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://bugs.launchpad.net/bugs/1327189.*

  [ Zsombor Egri]
  * Default font for the toolkit: Ubuntu, medium sized and light
    weight. Fixes: https://bugs.launchpad.net/bugs/1263963.
  * Extend launcher to convert mouse to touch events.
    MouseTouchAdaptor taken from unity8 launcher.

  [ 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://bugs.launchpad.net/bugs/1327189.*

  [ Zsombor Egri]
  * Default font for the toolkit: Ubuntu, medium sized and light
    weight. Fixes: https://bugs.launchpad.net/bugs/1263963.
  * Extend launcher to convert mouse to touch events.
    MouseTouchAdaptor taken from unity8 launcher.

  [ Christian Dywan ]
  * Multi-arch aware alternative launcher.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1115. By Zoltan Balogh

Changelog update for the release

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

1115. By Zoltan Balogh

Changelog update for the release

1114. By Zoltan Balogh

Changelog update for the release

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2014-06-19 06:55:24 +0000
+++ debian/changelog 2014-06-20 19:21:15 +0000
@@ -1,3 +1,28 @@
1ubuntu-ui-toolkit (0.1.47+14.10.20140619-0ubuntu2) UNRELEASED; urgency=medium
2
3 [ Florian Boucault ]
4 * OrientationHelper: made rotation animation visually smoother.
5 * Icon: remove warning when Icon.visible is set to false:
6 ShaderEffect: Property 'source' is not assigned a valid
7 texture provider (QQuickImage*).
8 * OrientationHelper: prevent unnecessary changes of width
9 and height with a workaround.
10
11 [ Tim Peeters ]
12 * Fix empty toolbar bug with Qt 5.3.
13 Fixes: https://bugs.launchpad.net/bugs/1327189.*
14
15 [ Zsombor Egri]
16 * Default font for the toolkit: Ubuntu, medium sized and light
17 weight. Fixes: https://bugs.launchpad.net/bugs/1263963.
18 * Extend launcher to convert mouse to touch events.
19 MouseTouchAdaptor taken from unity8 launcher.
20
21 [ Christian Dywan ]   
22 * Multi-arch aware alternative launcher.
23
24 -- Zoltán Balogh <zoltan@bakter.hu> Fri, 20 Jun 2014 21:20:05 +0200
25
1ubuntu-ui-toolkit (0.1.47+14.10.20140619-0ubuntu1) utopic; urgency=low26ubuntu-ui-toolkit (0.1.47+14.10.20140619-0ubuntu1) utopic; urgency=low
227
3 [ Ubuntu daily release ]28 [ Ubuntu daily release ]
429
=== modified file 'debian/ubuntu-ui-toolkit-autopilot.install'
--- debian/ubuntu-ui-toolkit-autopilot.install 2014-05-14 11:00:20 +0000
+++ debian/ubuntu-ui-toolkit-autopilot.install 2014-06-20 19:21:15 +0000
@@ -1,3 +1,3 @@
1usr/lib/python31usr/lib/python3
2usr/lib/ubuntu-ui-toolkit/launcher2usr/lib/*/ubuntu-ui-toolkit/launcher
3usr/lib/python2.73usr/lib/python2.7
44
=== modified file 'modules/Ubuntu/Components/Icon.qml'
--- modules/Ubuntu/Components/Icon.qml 2014-04-23 08:50:20 +0000
+++ modules/Ubuntu/Components/Icon.qml 2014-06-20 19:21:15 +0000
@@ -103,12 +103,12 @@
103 id: colorizedImage103 id: colorizedImage
104104
105 anchors.fill: parent105 anchors.fill: parent
106 visible: active && image.status == Image.Ready106 visible: active
107107
108 // Whether or not a color has been set.108 // Whether or not a color has been set.
109 property bool active: keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0)109 property bool active: keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0)
110110
111 property Image source: visible ? image : null111 property Image source: active && image.status == Image.Ready ? image : null
112 property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0)112 property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0)
113 property color keyColorIn: "#808080"113 property color keyColorIn: "#808080"
114 property real threshold: 0.1114 property real threshold: 0.1
115115
=== modified file 'modules/Ubuntu/Components/Label.qml'
--- modules/Ubuntu/Components/Label.qml 2014-05-22 09:44:01 +0000
+++ modules/Ubuntu/Components/Label.qml 2014-06-20 19:21:15 +0000
@@ -55,8 +55,6 @@
55 property string fontSize: "medium"55 property string fontSize: "medium"
5656
57 font.pixelSize: FontUtils.sizeToPixels(fontSize)57 font.pixelSize: FontUtils.sizeToPixels(fontSize)
58 font.family: "Ubuntu"
59 font.weight: Font.Light
60 color: Theme.palette.selected.backgroundText58 color: Theme.palette.selected.backgroundText
6159
62 /* FIXME: workaround for QTBUG 35095 where Text's alignment is incorrect60 /* FIXME: workaround for QTBUG 35095 where Text's alignment is incorrect
6361
=== modified file 'modules/Ubuntu/Components/OrientationHelper.qml'
--- modules/Ubuntu/Components/OrientationHelper.qml 2014-06-09 09:07:40 +0000
+++ modules/Ubuntu/Components/OrientationHelper.qml 2014-06-20 19:21:15 +0000
@@ -14,7 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17import QtQuick 2.017import QtQuick 2.2
18import QtQuick.Window 2.018import QtQuick.Window 2.0
19import Ubuntu.Components 1.019import Ubuntu.Components 1.0
2020
@@ -136,6 +136,17 @@
136 target: orientationHelper136 target: orientationHelper
137 rotation: 0137 rotation: 0
138 }138 }
139 StateChangeScript {
140 name: "anchorsScript"
141 script: {
142 orientationHelper.anchors.fill = null;
143 orientationHelper.anchors.leftMargin = 0;
144 orientationHelper.anchors.rightMargin = 0;
145 orientationHelper.anchors.topMargin = 0;
146 orientationHelper.anchors.bottomMargin = 0;
147 orientationHelper.anchors.fill = orientationHelper.parent;
148 }
149 }
139 },150 },
140 State {151 State {
141 name: "180"152 name: "180"
@@ -143,17 +154,33 @@
143 target: orientationHelper154 target: orientationHelper
144 rotation: 180155 rotation: 180
145 }156 }
157 StateChangeScript {
158 name: "anchorsScript"
159 script: {
160 orientationHelper.anchors.fill = null;
161 orientationHelper.anchors.leftMargin = 0;
162 orientationHelper.anchors.rightMargin = 0;
163 orientationHelper.anchors.topMargin = 0;
164 orientationHelper.anchors.bottomMargin = 0;
165 orientationHelper.anchors.fill = orientationHelper.parent;
166 }
167 }
146 },168 },
147 State {169 State {
148 name: "270"170 name: "270"
149 PropertyChanges {171 PropertyChanges {
150 target: orientationHelper172 target: orientationHelper
151 rotation: 270173 rotation: 270
152 anchors {174 }
153 leftMargin: (parent.width - parent.height) / 2175 StateChangeScript {
154 rightMargin: anchors.leftMargin176 name: "anchorsScript"
155 topMargin: -anchors.leftMargin177 script: {
156 bottomMargin: anchors.topMargin178 orientationHelper.anchors.fill = null;
179 orientationHelper.anchors.topMargin = Qt.binding(function() {return -(parent.width - parent.height) / 2});
180 orientationHelper.anchors.bottomMargin = Qt.binding(function() {return -(parent.width - parent.height) / 2});
181 orientationHelper.anchors.leftMargin = Qt.binding(function() {return (parent.width - parent.height) / 2});
182 orientationHelper.anchors.rightMargin = Qt.binding(function() {return (parent.width - parent.height) / 2});
183 orientationHelper.anchors.fill = orientationHelper.parent;
157 }184 }
158 }185 }
159 },186 },
@@ -162,11 +189,16 @@
162 PropertyChanges {189 PropertyChanges {
163 target: orientationHelper190 target: orientationHelper
164 rotation: 90191 rotation: 90
165 anchors {192 }
166 leftMargin: (parent.width - parent.height) / 2193 StateChangeScript {
167 rightMargin: anchors.leftMargin194 name: "anchorsScript"
168 topMargin: -anchors.leftMargin195 script: {
169 bottomMargin: anchors.topMargin196 orientationHelper.anchors.fill = null;
197 orientationHelper.anchors.topMargin = Qt.binding(function() {return -(parent.width - parent.height) / 2});
198 orientationHelper.anchors.bottomMargin = Qt.binding(function() {return -(parent.width - parent.height) / 2});
199 orientationHelper.anchors.leftMargin = Qt.binding(function() {return (parent.width - parent.height) / 2});
200 orientationHelper.anchors.rightMargin = Qt.binding(function() {return (parent.width - parent.height) / 2});
201 orientationHelper.anchors.fill = orientationHelper.parent;
170 }202 }
171 }203 }
172 }204 }
@@ -176,18 +208,20 @@
176 Transition {208 Transition {
177 id: orientationTransition209 id: orientationTransition
178 ParallelAnimation {210 ParallelAnimation {
179 SequentialAnimation {211 /* FIXME: this is a workaround for 2 issues that trigger too many changes
180 PauseAnimation {212 to the width and height of orientationHelper which creates intermediary
181 duration: 25213 states of the UI with unexpected sizes:
182 }214 1) upon state change fast-forwarding is used which means that the final values are computed and applied
183 PropertyAction {215 then immediately reverted before the actual transition is applied
184 target: orientationHelper216 2) when margins are applied, width and height are updated separately
185 properties: "anchors.topMargin,anchors.bottomMargin,anchors.rightMargin,anchors.leftMargin"217
186 }218 Without these issues, regular PropertyChanges could be used to set the margins.
219 */
220 ScriptAction {
221 scriptName: "anchorsScript"
187 }222 }
188 RotationAnimation {223 RotationAnimator {
189 target: orientationHelper224 target: orientationHelper
190 properties: "rotation"
191 duration: UbuntuAnimation.FastDuration225 duration: UbuntuAnimation.FastDuration
192 easing: UbuntuAnimation.StandardEasing226 easing: UbuntuAnimation.StandardEasing
193 direction: RotationAnimation.Shortest227 direction: RotationAnimation.Shortest
194228
=== modified file 'modules/Ubuntu/Components/plugin/uctheme.cpp'
--- modules/Ubuntu/Components/plugin/uctheme.cpp 2014-06-09 08:43:30 +0000
+++ modules/Ubuntu/Components/plugin/uctheme.cpp 2014-06-20 19:21:15 +0000
@@ -21,6 +21,7 @@
21#include "listener.h"21#include "listener.h"
22#include "quickutils.h"22#include "quickutils.h"
23#include "i18n.h"23#include "i18n.h"
24#include "ucfontutils.h"
2425
25#include <QtQml/qqml.h>26#include <QtQml/qqml.h>
26#include <QtQml/qqmlinfo.h>27#include <QtQml/qqmlinfo.h>
@@ -32,6 +33,8 @@
32#include <QtCore/QTextStream>33#include <QtCore/QTextStream>
33#include <QtCore/QLibraryInfo>34#include <QtCore/QLibraryInfo>
34#include <QtCore/QStandardPaths>35#include <QtCore/QStandardPaths>
36#include <QtGui/QGuiApplication>
37#include <QtGui/QFont>
3538
36/*!39/*!
37 \qmltype Theme40 \qmltype Theme
@@ -114,6 +117,13 @@
114117
115 QObject::connect(this, SIGNAL(nameChanged()),118 QObject::connect(this, SIGNAL(nameChanged()),
116 this, SLOT(loadPalette()), Qt::UniqueConnection);119 this, SLOT(loadPalette()), Qt::UniqueConnection);
120
121 // set the default font
122 QFont defaultFont;
123 defaultFont.setFamily("Ubuntu");
124 defaultFont.setPixelSize(UCFontUtils::instance().sizeToPixels("medium"));
125 defaultFont.setWeight(QFont::Light);
126 QGuiApplication::setFont(defaultFont);
117}127}
118128
119void UCTheme::updateEnginePaths()129void UCTheme::updateEnginePaths()
120130
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-05-30 08:21:45 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-06-20 19:21:15 +0000
@@ -15,6 +15,7 @@
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import os17import os
18import subprocess
1819
19import testtools20import testtools
20import ubuntuuitoolkit21import ubuntuuitoolkit
@@ -206,8 +207,11 @@
206 if os.path.exists(path_to_local_launcher):207 if os.path.exists(path_to_local_launcher):
207 return path_to_local_launcher208 return path_to_local_launcher
208 else:209 else:
210 arch = subprocess.check_output(
211 ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"],
212 universal_newlines=True).strip()
209 path_to_installed_launcher = os.path.join(213 path_to_installed_launcher = os.path.join(
210 '/', 'usr', 'lib', 'ubuntu-ui-toolkit', 'launcher')214 '/', 'usr', 'lib', arch, 'ubuntu-ui-toolkit', 'launcher')
211 return path_to_installed_launcher215 return path_to_installed_launcher
212216
213 def test_get_unity_top_container(self):217 def test_get_unity_top_container(self):
214218
=== added file 'tests/launcher/MouseTouchAdaptor.cpp'
--- tests/launcher/MouseTouchAdaptor.cpp 1970-01-01 00:00:00 +0000
+++ tests/launcher/MouseTouchAdaptor.cpp 2014-06-20 19:21:15 +0000
@@ -0,0 +1,159 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
17 *
18 */
19
20#include "MouseTouchAdaptor.h"
21
22#include <qpa/qwindowsysteminterface.h>
23
24#include <QtGui/QMouseEvent>
25#include <QtTest/QTest>
26
27using QTest::QTouchEventSequence;
28
29namespace {
30Qt::MouseButton translateMouseButton(xcb_button_t detail)
31{
32 switch (detail) {
33 case 1: return Qt::LeftButton;
34 case 2: return Qt::MidButton;
35 case 3: return Qt::RightButton;
36 // Button values 4-7 are Wheel events
37 default: return Qt::NoButton;
38 }
39}
40} // end of anonymous namespace
41
42MouseTouchAdaptor::MouseTouchAdaptor()
43 : m_leftButtonIsPressed(false)
44{
45 m_touchDevice = new QTouchDevice;
46 m_touchDevice->setType(QTouchDevice::TouchScreen);
47 QWindowSystemInterface::registerTouchDevice(m_touchDevice);
48}
49
50bool MouseTouchAdaptor::nativeEventFilter(const QByteArray & eventType,
51 void * message, long * /*result*/)
52{
53 if (eventType != "xcb_generic_event_t") {
54 // wrong backend.
55 qWarning("MouseTouchAdaptor: XCB backend not in use. Adaptor inoperative!");
56 return false;
57 }
58
59 xcb_generic_event_t *xcbEvent = static_cast<xcb_generic_event_t *>(message);
60
61 switch (xcbEvent->response_type & ~0x80) {
62 case XCB_BUTTON_PRESS:
63 return handleButtonPress(reinterpret_cast<xcb_button_press_event_t *>(xcbEvent));
64 break;
65 case XCB_BUTTON_RELEASE:
66 return handleButtonRelease(reinterpret_cast<xcb_button_release_event_t *>(xcbEvent));
67 break;
68 case XCB_MOTION_NOTIFY:
69 return handleMotionNotify(reinterpret_cast<xcb_motion_notify_event_t *>(xcbEvent));
70 break;
71 default:
72 return false;
73 break;
74 };
75}
76
77bool MouseTouchAdaptor::handleButtonPress(xcb_button_press_event_t *pressEvent)
78{
79 Qt::MouseButton button = translateMouseButton(pressEvent->detail);
80
81 // Skip the event if it wasn't a left mouse press
82 if (button != Qt::LeftButton) {
83 return false;
84 }
85
86 QPoint windowPos(pressEvent->event_x, pressEvent->event_y);
87
88 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(pressEvent->event));
89
90 // no autoCommit
91 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice, false);
92 touchEvent.press(0, windowPos);
93 // do not process events when committed, let the events be processed with next event loop
94 touchEvent.commit(false);
95
96 m_leftButtonIsPressed = true;
97 return true;
98}
99
100bool MouseTouchAdaptor::handleButtonRelease(xcb_button_release_event_t *releaseEvent)
101{
102 Qt::MouseButton button = translateMouseButton(releaseEvent->detail);
103
104 // Skip the event if it wasn't a left mouse release
105 if (button != Qt::LeftButton) {
106 return false;
107 }
108
109 QPoint windowPos(releaseEvent->event_x, releaseEvent->event_y);
110
111 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(releaseEvent->event));
112
113 // no autoCommit
114 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice, false);
115 touchEvent.release(0, windowPos);
116 // do not process events when committed, let the events be processed with next event loop
117 touchEvent.commit(false);
118
119 m_leftButtonIsPressed = false;
120 return true;
121}
122
123bool MouseTouchAdaptor::handleMotionNotify(xcb_motion_notify_event_t *event)
124{
125 if (!m_leftButtonIsPressed) {
126 return false;
127 }
128
129 QPoint windowPos(event->event_x, event->event_y);
130
131 QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(event->event));
132
133 // no autoCommit
134 QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice, false);
135 touchEvent.move(0, windowPos);
136 // do not process events when committed, let the events be processed with next event loop
137 touchEvent.commit(false);
138
139 return true;
140}
141
142QWindow *MouseTouchAdaptor::findQWindowWithXWindowID(WId windowId)
143{
144 QWindowList windowList = QGuiApplication::topLevelWindows();
145 QWindow *foundWindow = 0;
146
147 int i = 0;
148 while (!foundWindow && i < windowList.count()) {
149 QWindow *window = windowList[i];
150 if (window->winId() == windowId) {
151 foundWindow = window;
152 } else {
153 ++i;
154 }
155 }
156
157 Q_ASSERT(foundWindow);
158 return foundWindow;
159}
0160
=== added file 'tests/launcher/MouseTouchAdaptor.h'
--- tests/launcher/MouseTouchAdaptor.h 1970-01-01 00:00:00 +0000
+++ tests/launcher/MouseTouchAdaptor.h 2014-06-20 19:21:15 +0000
@@ -0,0 +1,50 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
17 *
18 */
19
20#ifndef MOUSE_TOUCH_ADAPTOR_H
21#define MOUSE_TOUCH_ADAPTOR_H
22
23#include <QtCore/QAbstractNativeEventFilter>
24#include <QWindow>
25#include <xcb/xcb.h>
26
27class QMouseEvent;
28class QTouchDevice;
29
30// Transforms QMouseEvents into single-finger QTouchEvents.
31class MouseTouchAdaptor : public QAbstractNativeEventFilter {
32
33public:
34 MouseTouchAdaptor();
35
36 // Filters mouse events and posts the equivalent QTouchEvents.
37 virtual bool nativeEventFilter(const QByteArray & eventType, void *message, long *result);
38
39private:
40
41 bool handleButtonPress(xcb_button_press_event_t *pressEvent);
42 bool handleButtonRelease(xcb_button_release_event_t *releaseEvent);
43 bool handleMotionNotify(xcb_motion_notify_event_t *event);
44 QWindow *findQWindowWithXWindowID(WId windowId);
45
46 QTouchDevice *m_touchDevice;
47 bool m_leftButtonIsPressed;
48};
49
50#endif // MOUSE_TOUCH_ADAPTOR_H
051
=== modified file 'tests/launcher/launcher.cpp'
--- tests/launcher/launcher.cpp 2014-06-09 08:26:24 +0000
+++ tests/launcher/launcher.cpp 2014-06-20 19:21:15 +0000
@@ -30,16 +30,18 @@
30#include <QOpenGLContext>30#include <QOpenGLContext>
31#include <QtGui/private/qopenglcontext_p.h>31#include <QtGui/private/qopenglcontext_p.h>
32#include <QtQuick/private/qsgcontext_p.h>32#include <QtQuick/private/qsgcontext_p.h>
33#include <QtCore/QCommandLineParser>
34#include <QtCore/QCommandLineOption>
35#include "MouseTouchAdaptor.h"
36#include <QtGui/QTouchDevice>
3337
34int usage()38bool touchDevicePresent()
35{39{
36 QString self(QGuiApplication::instance()->arguments().at(0));40 Q_FOREACH(const QTouchDevice *device, QTouchDevice::devices()) {
37 std::cout << "Usage\n "41 if (device->type() == QTouchDevice::TouchScreen)
38 << qPrintable(self)42 return true;
39 << " -testability -frameless -engine"43 }
40 << " --desktop_file_path=DESKTOP_FILE"44 return false;
41 << " -I MODULE_PATH FILENAME\n";
42 return 1;
43}45}
4446
45int main(int argc, const char *argv[])47int main(int argc, const char *argv[])
@@ -58,25 +60,40 @@
58#endif60#endif
59 QGuiApplication::setApplicationName("UITK Launcher");61 QGuiApplication::setApplicationName("UITK Launcher");
60 QGuiApplication application(argc, (char**)argv);62 QGuiApplication application(argc, (char**)argv);
61 QStringList args (application.arguments());63
6264 QCommandLineParser args;
63 int _testability(args.indexOf("-testability"));65 QCommandLineOption _import("I", "Add <path> to the list of import paths", "path");
64 args.removeAt(_testability);66 QCommandLineOption _enableTouch("touch", "Enables mouse to touch conversion on desktop");
65 int _frameless(args.indexOf("-frameless"));67 QCommandLineOption _testability("testability", "Loads the testability driver");
66 args.removeAt(_frameless);68 QCommandLineOption _frameless("frameless", "Run without borders");
67 int _engine(args.indexOf("-engine"));69 QCommandLineOption _engine("engine", "Use quick engine from quick view");
68 args.removeAt(_engine);70 QCommandLineOption _desktop_file_hint("desktop_file_hint", "Desktop file - ignored", "desktop_file");
6971
70 Q_FOREACH(QString arg, args) {72 args.addOption(_import);
71 if (arg.startsWith("--desktop_file_hint")) {73 args.addOption(_enableTouch);
72 // This will not be used - it only needs to be ignored74 args.addOption(_testability);
73 int _desktop_file_hint(args.indexOf(arg));75 args.addOption(_frameless);
74 args.removeAt(_desktop_file_hint);76 args.addOption(_engine);
75 }77 args.addOption(_desktop_file_hint);
78 args.addPositionalArgument("filename", "Document to be viewed");
79 args.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
80 args.addHelpOption();
81 if (!args.parse(application.arguments())) {
82 qWarning() << args.errorText();
83 args.showHelp(1);
84 }
85
86 QString filename;
87 if (args.positionalArguments().count() > 0) {
88 filename = args.positionalArguments()[0];
89 }
90 if (filename.isEmpty()) {
91 // show usage and exit
92 args.showHelp(1);
76 }93 }
7794
78 // Testability is only supported out of the box by QApplication not QGuiApplication95 // Testability is only supported out of the box by QApplication not QGuiApplication
79 if (_testability > -1 || getenv("QT_LOAD_TESTABILITY")) {96 if (args.isSet(_testability) || getenv("QT_LOAD_TESTABILITY")) {
80 QLibrary testLib(QLatin1String("qttestability"));97 QLibrary testLib(QLatin1String("qttestability"));
81 if (testLib.load()) {98 if (testLib.load()) {
82 typedef void (*TasInitialize)(void);99 typedef void (*TasInitialize)(void);
@@ -96,7 +113,7 @@
96 QQmlEngine* engine;113 QQmlEngine* engine;
97 // The default constructor affects the components tree (autopilot vis)114 // The default constructor affects the components tree (autopilot vis)
98 QQuickView* view;115 QQuickView* view;
99 if (_engine > -1) {116 if (args.isSet(_engine)) {
100 view = new QQuickView();117 view = new QQuickView();
101 engine = view->engine();118 engine = view->engine();
102 } else {119 } else {
@@ -104,43 +121,31 @@
104 view = new QQuickView(engine, NULL);121 view = new QQuickView(engine, NULL);
105 }122 }
106123
107 int _import(args.indexOf("-I"));124 if (args.isSet(_import)) {
108 args.removeAt(_import);125 QStringList paths = args.values(_import);
109 if (_import > -1) {126 Q_FOREACH(const QString &path, paths) {
110 if (args.count() > _import) {127 engine->addImportPath(path);
111 QString importPath(args.at(_import));
112 args.removeAt(_import);
113 engine->addImportPath(importPath);
114 }128 }
115 }129 }
116130
117 view->setResizeMode(QQuickView::SizeRootObjectToView);131 view->setResizeMode(QQuickView::SizeRootObjectToView);
118 view->setTitle("UI Toolkit QQuickView");132 view->setTitle("UI Toolkit QQuickView");
119 if (_frameless > -1) {133 if (args.isSet(_frameless)) {
120 view->setFlags(Qt::FramelessWindowHint);134 view->setFlags(Qt::FramelessWindowHint);
121 }135 }
122136
123 // The remaining unnamed argument must be a filename137 if (args.isSet(_enableTouch) && !touchDevicePresent()) {
124 if (args.count() == 1) {138 // has no effect if we have touch screen
125 qCritical() << "Missing filename";139 application.installNativeEventFilter(new MouseTouchAdaptor);
126 return usage();
127 }140 }
128 QString filename(args.at(1));
129 // The first argument is the launcher itself
130 args.removeAt(0);
131141
132 QUrl source(QUrl::fromLocalFile(filename));142 QUrl source(QUrl::fromLocalFile(filename));
133 view->setSource(source);143 view->setSource(source);
134 if (view->errors().count() > 0) {144 if (view->errors().count() > 0) {
135 return usage();145 args.showHelp(3);
136 }146 }
137 view->show();147 view->show();
138148
139 if (args.count() > 1) {
140 qCritical() << "Invalid arguments passed" << args;
141 return usage();
142 }
143
144 return application.exec();149 return application.exec();
145}150}
146151
147152
=== modified file 'tests/launcher/launcher.pro'
--- tests/launcher/launcher.pro 2014-05-14 11:00:20 +0000
+++ tests/launcher/launcher.pro 2014-06-20 19:21:15 +0000
@@ -1,11 +1,13 @@
1TEMPLATE = app1TEMPLATE = app
2QT += qml quick2QT += qml quick
3# For setSharedOpenGLContext3# For setSharedOpenGLContext
4QT += core-private gui-private quick-private4QT += core-private gui-private testlib quick-private
5CONFIG += no_keywords5CONFIG += no_keywords
6SOURCES += \6HEADERS += MouseTouchAdaptor.h
7 launcher.cpp7SOURCES += launcher.cpp \
8launcher.path = /usr/lib/ubuntu-ui-toolkit8 MouseTouchAdaptor.cpp
9installPath = $$[QT_INSTALL_LIBS]/ubuntu-ui-toolkit
10launcher.path = $$installPath
9launcher.files = launcher11launcher.files = launcher
10INSTALLS += launcher12INSTALLS += launcher
1113
1214
=== modified file 'tests/unit/tst_components/tst_label.qml'
--- tests/unit/tst_components/tst_label.qml 2014-05-26 10:13:41 +0000
+++ tests/unit/tst_components/tst_label.qml 2014-06-20 19:21:15 +0000
@@ -21,6 +21,11 @@
21TestCase {21TestCase {
22 name: "LabelAPI"22 name: "LabelAPI"
2323
24 function test_0_defaults() {
25 compare(textCustom.font.family, "Ubuntu", "Default font family");
26 compare(textCustom.font.weight, Font.Light, "Default font weight");
27 }
28
24 function test_fontSize() {29 function test_fontSize() {
25 compare(textCustom.fontSize,"medium","fontSize is 'medium' by default")30 compare(textCustom.fontSize,"medium","fontSize is 'medium' by default")
2631

Subscribers

People subscribed via source and target branches

to status/vote changes: