Merge lp:~mzanetti/unity8/inputinfo-plugin into lp:unity8
- inputinfo-plugin
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~mzanetti/unity8/inputinfo-plugin |
Merge into: | lp:unity8 |
Prerequisite: | lp:~unity-team/unity8/shellRotation |
Diff against target: |
1072 lines (+984/-0) 13 files modified
debian/changelog (+6/-0) debian/control (+2/-0) plugins/Unity/CMakeLists.txt (+1/-0) plugins/Unity/InputInfo/CMakeLists.txt (+39/-0) plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp (+249/-0) plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h (+91/-0) plugins/Unity/InputInfo/plugin.cpp (+32/-0) plugins/Unity/InputInfo/plugin.h (+30/-0) plugins/Unity/InputInfo/qdeclarativeinputdeviceinfo.cpp (+143/-0) plugins/Unity/InputInfo/qdeclarativeinputdeviceinfo_p.h (+86/-0) plugins/Unity/InputInfo/qinputinfo.cpp (+159/-0) plugins/Unity/InputInfo/qinputinfo.h (+143/-0) plugins/Unity/InputInfo/qmldir (+3/-0) |
To merge this branch: | bzr merge lp:~mzanetti/unity8/inputinfo-plugin |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Albert Astals Cid (community) | Needs Fixing | ||
Review via email:
|
This proposal supersedes a proposal from 2015-05-05.
This proposal has been superseded by a proposal from 2015-06-23.
Commit message
Added a snapshot of the WIP Qt InputInfo API
Description of the change
WIP: Just trying to get it through Jenkins once.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1746
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1746
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1747
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1748
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1748
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : | # |
Text conflict in qml/Stages/
Text conflict in qml/Stages/
2 conflicts encountered.
- 1749. By Michael Zanetti
-
merge trunk
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1749
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1749
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : | # |
You have bad tags
- 1750. By Michael Zanetti
-
drop debug print
- 1751. By Michael Zanetti
-
merge trunk
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1751
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2015-06-16 15:12:59 +0000 |
3 | +++ debian/changelog 2015-06-22 12:17:35 +0000 |
4 | @@ -66,6 +66,12 @@ |
5 | |
6 | -- CI Train Bot <ci-train-bot@canonical.com> Fri, 12 Jun 2015 16:07:47 +0000 |
7 | |
8 | +unity8 (8.10-0ubuntu1) UNRELEASED; urgency=medium |
9 | + |
10 | + * Implement full-shell rotation (LP: #1210199) |
11 | + |
12 | + -- Michał Sawicz <michal.sawicz@canonical.com> Wed, 15 Apr 2015 14:47:17 +0200 |
13 | + |
14 | unity8 (8.02+15.10.20150603.1-0ubuntu1) wily; urgency=medium |
15 | |
16 | [ CI Train Bot ] |
17 | |
18 | === modified file 'debian/control' |
19 | --- debian/control 2015-06-16 15:12:46 +0000 |
20 | +++ debian/control 2015-06-22 12:17:35 +0000 |
21 | @@ -16,6 +16,7 @@ |
22 | graphviz, |
23 | gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140815), |
24 | libconnectivity-qt1-dev, |
25 | + libevdev-dev, |
26 | libgl1-mesa-dev[!armhf] | libgl-dev[!armhf], |
27 | libgl1-mesa-dri, |
28 | libgles2-mesa-dev[armhf], |
29 | @@ -28,6 +29,7 @@ |
30 | libqmenumodel-dev (>= 0.2.9), |
31 | libqt5xmlpatterns5-dev, |
32 | libsystemsettings-dev, |
33 | + libudev-dev, |
34 | libunity-api-dev (>= 7.97), |
35 | libusermetricsoutput1-dev, |
36 | libxcb1-dev, |
37 | |
38 | === modified file 'plugins/Unity/CMakeLists.txt' |
39 | --- plugins/Unity/CMakeLists.txt 2014-08-25 10:05:13 +0000 |
40 | +++ plugins/Unity/CMakeLists.txt 2015-06-22 12:17:35 +0000 |
41 | @@ -3,3 +3,4 @@ |
42 | add_subdirectory(Launcher) |
43 | add_subdirectory(Session) |
44 | add_subdirectory(DashCommunicator) |
45 | +add_subdirectory(InputInfo) |
46 | |
47 | === added directory 'plugins/Unity/InputInfo' |
48 | === added file 'plugins/Unity/InputInfo/CMakeLists.txt' |
49 | --- plugins/Unity/InputInfo/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
50 | +++ plugins/Unity/InputInfo/CMakeLists.txt 2015-06-22 12:17:35 +0000 |
51 | @@ -0,0 +1,39 @@ |
52 | +# This is a temporary snapshot of the WIP QInputInfo API as we |
53 | +# require this in unity now but upstream isn't finished yet. |
54 | +# Eventually this should be dropped in favor of the upstream |
55 | +# QInputInfo API. |
56 | + |
57 | +project(InputInfo) |
58 | + |
59 | +find_package(Qt5Core REQUIRED) |
60 | +find_package(Qt5Quick REQUIRED) |
61 | + |
62 | +pkg_check_modules(LIBUDEV REQUIRED libudev) |
63 | +pkg_check_modules(LIBEVDEV REQUIRED libevdev) |
64 | + |
65 | +include_directories( |
66 | + ${CMAKE_CURRENT_SOURCE_DIR} |
67 | + ${CMAKE_CURRENT_BINARY_DIR} |
68 | + ${LIBUDEV_INCLUDE_DIRS} |
69 | + ${LIBEVDEV_INCLUDE_DIRS} |
70 | +) |
71 | + |
72 | +set(InputInfo_SOURCES |
73 | + plugin.cpp |
74 | + qinputinfo.cpp |
75 | + qdeclarativeinputdeviceinfo.cpp |
76 | + linux/qinputdeviceinfo_linux.cpp |
77 | +) |
78 | + |
79 | +add_library(InputInfo SHARED |
80 | + ${InputInfo_SOURCES} |
81 | +) |
82 | + |
83 | +target_link_libraries(InputInfo |
84 | + ${LIBUDEV_LDFLAGS} |
85 | + ${LIBEVDEV_LDFLAGS} |
86 | +) |
87 | + |
88 | +qt5_use_modules(InputInfo Core Qml Quick) |
89 | + |
90 | +add_unity8_plugin(Unity.InputInfo 0.1 Unity/InputInfo TARGETS InputInfo) |
91 | |
92 | === added directory 'plugins/Unity/InputInfo/linux' |
93 | === added file 'plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp' |
94 | --- plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp 1970-01-01 00:00:00 +0000 |
95 | +++ plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux.cpp 2015-06-22 12:17:35 +0000 |
96 | @@ -0,0 +1,249 @@ |
97 | +/**************************************************************************** |
98 | +** |
99 | +** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
100 | +** Contact: http://www.qt-project.org/legal |
101 | +** |
102 | +** This file is part of the QtSystems module of the Qt Toolkit. |
103 | +** |
104 | +** $QT_BEGIN_LICENSE:LGPL$ |
105 | +** Commercial License Usage |
106 | +** Licensees holding valid commercial Qt licenses may use this file in |
107 | +** accordance with the commercial license agreement provided with the |
108 | +** Software or, alternatively, in accordance with the terms contained in |
109 | +** a written agreement between you and Digia. For licensing terms and |
110 | +** conditions see http://qt.digia.com/licensing. For further information |
111 | +** use the contact form at http://qt.digia.com/contact-us. |
112 | +** |
113 | +** GNU Lesser General Public License Usage |
114 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
115 | +** General Public License version 2.1 as published by the Free Software |
116 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
117 | +** packaging of this file. Please review the following information to |
118 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
119 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
120 | +** |
121 | +** In addition, as a special exception, Digia gives you certain additional |
122 | +** rights. These rights are described in the Digia Qt LGPL Exception |
123 | +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
124 | +** |
125 | +** GNU General Public License Usage |
126 | +** Alternatively, this file may be used under the terms of the GNU |
127 | +** General Public License version 3.0 as published by the Free Software |
128 | +** Foundation and appearing in the file LICENSE.GPL included in the |
129 | +** packaging of this file. Please review the following information to |
130 | +** ensure the GNU General Public License version 3.0 requirements will be |
131 | +** met: http://www.gnu.org/copyleft/gpl.html. |
132 | +** |
133 | +** |
134 | +** $QT_END_LICENSE$ |
135 | +** |
136 | +****************************************************************************/ |
137 | + |
138 | +#include "qinputdeviceinfo_linux_p.h" |
139 | + |
140 | +#include <libudev.h> |
141 | +#include <libevdev/libevdev.h> |
142 | +#include <fcntl.h> |
143 | +#include <QDebug> |
144 | +#include <QSocketNotifier> |
145 | +#include <QTimer> |
146 | + |
147 | +QInputDeviceInfoPrivate::QInputDeviceInfoPrivate(QObject *parent) : |
148 | + QObject(parent) |
149 | + , udev(0) |
150 | +{ |
151 | + QTimer::singleShot(250,this,SLOT(init())); |
152 | +} |
153 | + |
154 | +void QInputDeviceInfoPrivate::init() |
155 | +{ |
156 | + if (!udev) |
157 | + udev = udev_new(); |
158 | + |
159 | + struct udev_list_entry *devices, *dev_list_entry; |
160 | + struct udev_device *dev; |
161 | + |
162 | + QString subsystem = QStringLiteral("input"); |
163 | + struct udev_enumerate *enumerate = 0; |
164 | + |
165 | + if (udev) { |
166 | + |
167 | + udevMonitor = udev_monitor_new_from_netlink(udev, "udev"); |
168 | + udev_monitor_filter_add_match_subsystem_devtype(udevMonitor, subsystem.toLatin1(), NULL); |
169 | + enumerate = udev_enumerate_new(udev); |
170 | + udev_enumerate_add_match_subsystem(enumerate, subsystem.toLatin1()); |
171 | + |
172 | + |
173 | + udev_monitor_enable_receiving(udevMonitor); |
174 | + notifierFd = udev_monitor_get_fd(udevMonitor); |
175 | + |
176 | + notifier = new QSocketNotifier(notifierFd, QSocketNotifier::Read, this); |
177 | + connect(notifier, SIGNAL(activated(int)), this, SLOT(onUDevChanges())); |
178 | + |
179 | + |
180 | + udev_enumerate_scan_devices(enumerate); |
181 | + devices = udev_enumerate_get_list_entry(enumerate); |
182 | + |
183 | + udev_list_entry_foreach(dev_list_entry, devices) { |
184 | + const char *path; |
185 | + path = udev_list_entry_get_name(dev_list_entry); |
186 | + |
187 | + dev = udev_device_new_from_syspath(udev, path); |
188 | + |
189 | + QString eventPath = QString::fromLatin1(udev_device_get_sysname(dev)); |
190 | + |
191 | + if (qstrcmp(udev_device_get_subsystem(dev), "input") == 0 ) { |
192 | + |
193 | + if (eventPath.contains(QStringLiteral("event"))) { |
194 | + eventPath.prepend(QStringLiteral("/dev/input/")); |
195 | + |
196 | + QInputDevice *iDevice = addDevice(eventPath); |
197 | + if (!iDevice) |
198 | + continue; |
199 | + |
200 | + qDebug() << "*** ADDING DEVICE" << eventPath; |
201 | + |
202 | + iDevice->setTypes(getInputTypes(dev)); |
203 | + |
204 | + if (iDevice->switches().count() > 0 && iDevice->buttons().count() == 0) |
205 | + iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Switch); |
206 | + |
207 | + if (iDevice->buttons().count() > 0 && iDevice->types() == QInputDeviceInfo::Unknown) |
208 | + iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Button); |
209 | + |
210 | + deviceList.append(iDevice); |
211 | + deviceMap.insert(eventPath,iDevice); |
212 | + Q_EMIT newDevice(eventPath); |
213 | + |
214 | + } |
215 | + } |
216 | + } |
217 | + udev_enumerate_unref(enumerate); |
218 | + } |
219 | + Q_EMIT ready(); |
220 | +} |
221 | + |
222 | +QInputDeviceInfo::InputTypes QInputDeviceInfoPrivate::getInputTypes( struct udev_device *dev) |
223 | +{ |
224 | + qDebug() << "******* have input type Keyboard" << udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"); |
225 | + qDebug() << "******* have input type Mouse" << udev_device_get_property_value(dev, "ID_INPUT_MOUSE"); |
226 | + qDebug() << "******* have input type Touchpad" << udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD"); |
227 | + qDebug() << "******* have input type Touchscreen" << udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"); |
228 | + qDebug() << "******* have input type Tablet" << udev_device_get_property_value(dev, "ID_INPUT_TABLET"); |
229 | + qDebug() << "******* have input type joystick" << udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"); |
230 | + QInputDeviceInfo::InputTypes types = QInputDeviceInfo::Unknown; |
231 | + if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 ) |
232 | + types |= QInputDeviceInfo::Keyboard; |
233 | + |
234 | + if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_MOUSE"), "1") == 0) |
235 | + types |= QInputDeviceInfo::Mouse; |
236 | + |
237 | + if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD"), "1") == 0) |
238 | + types |= QInputDeviceInfo::TouchPad; |
239 | + |
240 | + if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"), "1") == 0 |
241 | + || qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TABLET"), "1") == 0) |
242 | + types |= QInputDeviceInfo::TouchScreen; |
243 | + |
244 | + return types; |
245 | +} |
246 | + |
247 | +QInputDevice *QInputDeviceInfoPrivate::addDevice(const QString &path) |
248 | +{ |
249 | + QInputDevice *inputDevice = new QInputDevice(this); |
250 | + |
251 | + struct libevdev *dev = NULL; |
252 | + int fd; |
253 | + int rc = 1; |
254 | + fd = open(path.toLatin1(), O_RDONLY|O_NONBLOCK); |
255 | + |
256 | + if (fd == -1) { |
257 | + qDebug() << "Failed to open"; |
258 | + return inputDevice; |
259 | + } |
260 | + rc = libevdev_new_from_fd(fd, &dev); |
261 | + if (rc < 0) { |
262 | + qDebug() << "Failed to init libevdev ("<< strerror(-rc) << ")"; |
263 | + return inputDevice; |
264 | + } |
265 | + |
266 | + inputDevice->setName(QString::fromLatin1(libevdev_get_name(dev))); |
267 | + inputDevice->setDevicePath(path); |
268 | + for (int i = 0; i < EV_MAX; i++) { |
269 | + if (i == EV_KEY || i == EV_SW || i == EV_REL |
270 | + || i == EV_REL || i == EV_ABS) { |
271 | + for (int j = 0; j < libevdev_event_type_get_max(i); j++) { |
272 | + if (libevdev_has_event_code(dev, i, j)) { |
273 | + switch (i) { |
274 | + case EV_KEY: |
275 | + inputDevice->addButton(j); |
276 | + break; |
277 | + case EV_SW: |
278 | + inputDevice->addSwitch(j); |
279 | + break; |
280 | + case EV_REL: |
281 | + inputDevice->addRelativeAxis(j); |
282 | + break; |
283 | + case EV_ABS: |
284 | + inputDevice->addAbsoluteAxis(j); |
285 | + break; |
286 | + }; |
287 | + } |
288 | + } |
289 | + } |
290 | + } |
291 | + return inputDevice; |
292 | +} |
293 | + |
294 | +void QInputDeviceInfoPrivate::removeDevice(const QString &path) |
295 | +{ |
296 | + for (int i = 0; i < deviceList.size(); ++i) { |
297 | + if (deviceList.at(i)->devicePath() == path) { |
298 | + delete deviceList.takeAt(i); |
299 | + deviceMap.remove(path); |
300 | + Q_EMIT deviceRemoved(path); |
301 | + } |
302 | + } |
303 | +} |
304 | + |
305 | +void QInputDeviceInfoPrivate::onUDevChanges() |
306 | +{ |
307 | + struct udev_device *dev = udev_monitor_receive_device(udevMonitor); |
308 | + if (dev) { |
309 | + if (qstrcmp(udev_device_get_subsystem(dev), "input") == 0 ) { |
310 | + QString eventPath = QString::fromLatin1(udev_device_get_sysname(dev)); |
311 | + |
312 | + if (eventPath.contains(QStringLiteral("input"))) |
313 | + return; |
314 | + |
315 | + QString action = QString::fromStdString(udev_device_get_action(dev)); |
316 | + |
317 | + if (!eventPath.contains(QStringLiteral("/dev/input/"))) |
318 | + eventPath.prepend(QStringLiteral("/dev/input/")); |
319 | + |
320 | + if (action == QStringLiteral("add")) { |
321 | + |
322 | + QInputDevice *iDevice = addDevice(eventPath); |
323 | + if (!iDevice) |
324 | + return; |
325 | + |
326 | + iDevice->setTypes(getInputTypes(dev)); |
327 | + udev_device_unref(dev); |
328 | + |
329 | + if (iDevice->switches().count() > 0 && iDevice->buttons().count() == 0) |
330 | + iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Switch); |
331 | + |
332 | + if (iDevice->buttons().count() > 0 && iDevice->types() == QInputDeviceInfo::Unknown) |
333 | + iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Button); |
334 | + |
335 | + deviceList.append(iDevice); |
336 | + deviceMap.insert(eventPath,iDevice); |
337 | + |
338 | + Q_EMIT newDevice(eventPath); |
339 | + |
340 | + } else if (action == QStringLiteral("remove")) { |
341 | + removeDevice(eventPath); |
342 | + } |
343 | + } |
344 | + } |
345 | +} |
346 | |
347 | === added file 'plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h' |
348 | --- plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h 1970-01-01 00:00:00 +0000 |
349 | +++ plugins/Unity/InputInfo/linux/qinputdeviceinfo_linux_p.h 2015-06-22 12:17:35 +0000 |
350 | @@ -0,0 +1,91 @@ |
351 | +/**************************************************************************** |
352 | +** |
353 | +** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
354 | +** Contact: http://www.qt-project.org/legal |
355 | +** |
356 | +** This file is part of the QtSystems module of the Qt Toolkit. |
357 | +** |
358 | +** $QT_BEGIN_LICENSE:LGPL$ |
359 | +** Commercial License Usage |
360 | +** Licensees holding valid commercial Qt licenses may use this file in |
361 | +** accordance with the commercial license agreement provided with the |
362 | +** Software or, alternatively, in accordance with the terms contained in |
363 | +** a written agreement between you and Digia. For licensing terms and |
364 | +** conditions see http://qt.digia.com/licensing. For further information |
365 | +** use the contact form at http://qt.digia.com/contact-us. |
366 | +** |
367 | +** GNU Lesser General Public License Usage |
368 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
369 | +** General Public License version 2.1 as published by the Free Software |
370 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
371 | +** packaging of this file. Please review the following information to |
372 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
373 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
374 | +** |
375 | +** In addition, as a special exception, Digia gives you certain additional |
376 | +** rights. These rights are described in the Digia Qt LGPL Exception |
377 | +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
378 | +** |
379 | +** GNU General Public License Usage |
380 | +** Alternatively, this file may be used under the terms of the GNU |
381 | +** General Public License version 3.0 as published by the Free Software |
382 | +** Foundation and appearing in the file LICENSE.GPL included in the |
383 | +** packaging of this file. Please review the following information to |
384 | +** ensure the GNU General Public License version 3.0 requirements will be |
385 | +** met: http://www.gnu.org/copyleft/gpl.html. |
386 | +** |
387 | +** |
388 | +** $QT_END_LICENSE$ |
389 | +** |
390 | +****************************************************************************/ |
391 | + |
392 | +#ifndef QINPUTDEVICEINFO_LINUX_P_H |
393 | +#define QINPUTDEVICEINFO_LINUX_P_H |
394 | + |
395 | +#include <QObject> |
396 | +#include "qinputinfo.h" |
397 | +#include <libudev.h> |
398 | + |
399 | +class QInputDevicePrivate : public QObject |
400 | +{ |
401 | + Q_OBJECT |
402 | +public: |
403 | + explicit QInputDevicePrivate(QObject *parent = 0); |
404 | + |
405 | + QString name; |
406 | + QString devicePath; |
407 | + QList <int> buttons; //keys |
408 | + QList <int> switches; |
409 | + QList <int> relativeAxis; |
410 | + QList <int> absoluteAxis; |
411 | + QInputDeviceInfo::InputTypes types; |
412 | +}; |
413 | + |
414 | +class QInputDeviceInfoPrivate : public QObject |
415 | +{ |
416 | + Q_OBJECT |
417 | +public: |
418 | + explicit QInputDeviceInfoPrivate(QObject *parent = 0); |
419 | + QVector <QInputDevice *> deviceList; |
420 | + QMap <QString, QInputDevice *> deviceMap; |
421 | + |
422 | +Q_SIGNALS: |
423 | + void newDevice(const QString &); |
424 | + void deviceRemoved(const QString &); |
425 | + void ready(); |
426 | + |
427 | +private: |
428 | + struct udev *udev; |
429 | + QInputDevice *addDevice(const QString &path); |
430 | + void removeDevice(const QString &path); |
431 | + QSocketNotifier *notifier; |
432 | + int notifierFd; |
433 | + struct udev_monitor *udevMonitor; |
434 | + QInputDeviceInfo::InputTypes getInputTypes( struct udev_device *); |
435 | + |
436 | +private Q_SLOTS: |
437 | + void onUDevChanges(); |
438 | + void init(); |
439 | +}; |
440 | + |
441 | +#endif // QINPUTDEVICEINFO_LINUX_P_H |
442 | |
443 | === added file 'plugins/Unity/InputInfo/plugin.cpp' |
444 | --- plugins/Unity/InputInfo/plugin.cpp 1970-01-01 00:00:00 +0000 |
445 | +++ plugins/Unity/InputInfo/plugin.cpp 2015-06-22 12:17:35 +0000 |
446 | @@ -0,0 +1,32 @@ |
447 | +/* |
448 | + * Copyright 2015 Canonical Ltd. |
449 | + * |
450 | + * This program is free software; you can redistribute it and/or modify |
451 | + * it under the terms of the GNU Lesser General Public License as published by |
452 | + * the Free Software Foundation; version 3. |
453 | + * |
454 | + * This program is distributed in the hope that it will be useful, |
455 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
456 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
457 | + * GNU Lesser General Public License for more details. |
458 | + * |
459 | + * You should have received a copy of the GNU Lesser General Public License |
460 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
461 | + */ |
462 | + |
463 | +// Qt |
464 | +#include <QtQml/qqml.h> |
465 | + |
466 | +// self |
467 | +#include "plugin.h" |
468 | + |
469 | +// local |
470 | +#include "qdeclarativeinputdeviceinfo_p.h" |
471 | + |
472 | +void InputInfoPlugin::registerTypes(const char *uri) |
473 | +{ |
474 | + int major = 0; |
475 | + int minor = 1; |
476 | + qmlRegisterType<QDeclarativeInputDeviceInfo>(uri, major, minor, "InputDeviceInfo"); |
477 | + qmlRegisterType<QInputDevice>(uri, major, minor, "InputInfo"); |
478 | +} |
479 | |
480 | === added file 'plugins/Unity/InputInfo/plugin.h' |
481 | --- plugins/Unity/InputInfo/plugin.h 1970-01-01 00:00:00 +0000 |
482 | +++ plugins/Unity/InputInfo/plugin.h 2015-06-22 12:17:35 +0000 |
483 | @@ -0,0 +1,30 @@ |
484 | +/* |
485 | + * Copyright 2015 Canonical Ltd. |
486 | + * |
487 | + * This program is free software; you can redistribute it and/or modify |
488 | + * it under the terms of the GNU Lesser General Public License as published by |
489 | + * the Free Software Foundation; version 3. |
490 | + * |
491 | + * This program is distributed in the hope that it will be useful, |
492 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
493 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
494 | + * GNU Lesser General Public License for more details. |
495 | + * |
496 | + * You should have received a copy of the GNU Lesser General Public License |
497 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
498 | + */ |
499 | + |
500 | +#ifndef INPUTINFO_PLUGIN_H |
501 | +#define INPUTINFO_PLUGIN_H |
502 | + |
503 | +#include <QtQml/QQmlExtensionPlugin> |
504 | + |
505 | +class InputInfoPlugin : public QQmlExtensionPlugin |
506 | +{ |
507 | + Q_OBJECT |
508 | + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") |
509 | +public: |
510 | + void registerTypes(const char *uri); |
511 | +}; |
512 | + |
513 | +#endif // INPUTINFO_PLUGIN_H |
514 | |
515 | === added file 'plugins/Unity/InputInfo/qdeclarativeinputdeviceinfo.cpp' |
516 | --- plugins/Unity/InputInfo/qdeclarativeinputdeviceinfo.cpp 1970-01-01 00:00:00 +0000 |
517 | +++ plugins/Unity/InputInfo/qdeclarativeinputdeviceinfo.cpp 2015-06-22 12:17:35 +0000 |
518 | @@ -0,0 +1,143 @@ |
519 | +/**************************************************************************** |
520 | +** |
521 | +** Copyright (C) 2015 Jolla. |
522 | +** Contact: http://www.qt-project.org/legal |
523 | +** |
524 | +** This file is part of the QtSystems module of the Qt Toolkit. |
525 | +** |
526 | +** $QT_BEGIN_LICENSE:LGPL$ |
527 | +** Commercial License Usage |
528 | +** Licensees holding valid commercial Qt licenses may use this file in |
529 | +** accordance with the commercial license agreement provided with the |
530 | +** Software or, alternatively, in accordance with the terms contained in |
531 | +** a written agreement between you and Digia. For licensing terms and |
532 | +** conditions see http://qt.digia.com/licensing. For further information |
533 | +** use the contact form at http://qt.digia.com/contact-us. |
534 | +** |
535 | +** GNU Lesser General Public License Usage |
536 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
537 | +** General Public License version 2.1 as published by the Free Software |
538 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
539 | +** packaging of this file. Please review the following information to |
540 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
541 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
542 | +** |
543 | +** In addition, as a special exception, Digia gives you certain additional |
544 | +** rights. These rights are described in the Digia Qt LGPL Exception |
545 | +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
546 | +** |
547 | +** GNU General Public License Usage |
548 | +** Alternatively, this file may be used under the terms of the GNU |
549 | +** General Public License version 3.0 as published by the Free Software |
550 | +** Foundation and appearing in the file LICENSE.GPL included in the |
551 | +** packaging of this file. Please review the following information to |
552 | +** ensure the GNU General Public License version 3.0 requirements will be |
553 | +** met: http://www.gnu.org/copyleft/gpl.html. |
554 | +** |
555 | +** |
556 | +** $QT_END_LICENSE$ |
557 | +** |
558 | +****************************************************************************/ |
559 | +#include "qdeclarativeinputdeviceinfo_p.h" |
560 | + |
561 | +QDeclarativeInputDeviceInfo::QDeclarativeInputDeviceInfo(QObject *parent) : |
562 | + QAbstractListModel(parent), |
563 | + deviceInfo(new QInputDeviceInfo) |
564 | +{ |
565 | + connect(deviceInfo,SIGNAL(ready()),this,SLOT(updateDeviceList())); |
566 | + connect(deviceInfo, &QInputDeviceInfo::deviceAdded,this,&QDeclarativeInputDeviceInfo::addedDevice); |
567 | + connect(deviceInfo, &QInputDeviceInfo::deviceRemoved,this,&QDeclarativeInputDeviceInfo::removedDevice); |
568 | +} |
569 | + |
570 | +QDeclarativeInputDeviceInfo::~QDeclarativeInputDeviceInfo() |
571 | +{ |
572 | + delete deviceInfo; |
573 | +} |
574 | + |
575 | +QVariant QDeclarativeInputDeviceInfo::data(const QModelIndex &index, int role) const |
576 | +{ |
577 | + switch (role) { |
578 | + case ServiceRole: |
579 | + return QVariant::fromValue(static_cast<QObject *>(inputDevices.value(index.row()))); |
580 | + } |
581 | + |
582 | + return QVariant(); |
583 | +} |
584 | + |
585 | +int QDeclarativeInputDeviceInfo::rowCount(const QModelIndex &parent) const |
586 | +{ |
587 | + Q_UNUSED(parent); |
588 | + |
589 | + return inputDevices.count(); |
590 | +} |
591 | + |
592 | +int QDeclarativeInputDeviceInfo::indexOf(const QString &devicePath) const |
593 | +{ |
594 | + int idx(-1); |
595 | + Q_FOREACH (QInputDevice *device, inputDevices) { |
596 | + idx++; |
597 | + if (device->devicePath() == devicePath) return idx; |
598 | + } |
599 | + |
600 | + return -1; |
601 | +} |
602 | + |
603 | +QInputDevice *QDeclarativeInputDeviceInfo::get(int index) const |
604 | +{ |
605 | + if (index < 0 || index > inputDevices.count()) |
606 | + return 0; |
607 | + return inputDevices.value(index); |
608 | +} |
609 | + |
610 | +void QDeclarativeInputDeviceInfo::updateDeviceList() |
611 | +{ |
612 | + QVector <QInputDevice *> newDevices = deviceInfo->deviceList(); |
613 | + |
614 | + int numNew = newDevices.count(); |
615 | + |
616 | + for (int i = 0; i < numNew; i++) { |
617 | + int j = inputDevices.indexOf(newDevices.value(i)); |
618 | + if (j == -1) { |
619 | + // not found -> remove from list |
620 | + beginInsertRows(QModelIndex(), i, i); |
621 | + inputDevices.insert(i, newDevices.value(i)); |
622 | + endInsertRows(); |
623 | + } else if (i != j) { |
624 | + // changed its position -> move it |
625 | + QInputDevice* device = inputDevices.value(j); |
626 | + beginMoveRows(QModelIndex(), j, j, QModelIndex(), i); |
627 | + inputDevices.remove(j); |
628 | + inputDevices.insert(i, device); |
629 | + endMoveRows(); |
630 | + } else { |
631 | + QModelIndex changedIndex(this->index(j, 0, QModelIndex())); |
632 | + Q_EMIT dataChanged(changedIndex, changedIndex); |
633 | + } |
634 | + } |
635 | + |
636 | + int numOld = inputDevices.count(); |
637 | + if (numOld > numNew) { |
638 | + beginRemoveRows(QModelIndex(), numNew, numOld - 1); |
639 | + inputDevices.remove(numNew, numOld - numNew); |
640 | + endRemoveRows(); |
641 | + } |
642 | +} |
643 | + |
644 | +void QDeclarativeInputDeviceInfo::addedDevice(const QString &devicePath) |
645 | +{ |
646 | + updateDeviceList(); |
647 | + Q_EMIT newDevice(devicePath); |
648 | +} |
649 | + |
650 | +void QDeclarativeInputDeviceInfo::removedDevice(const QString &devicePath) |
651 | +{ |
652 | + updateDeviceList(); |
653 | + Q_EMIT deviceRemoved(devicePath); |
654 | +} |
655 | + |
656 | +QHash<int, QByteArray> QDeclarativeInputDeviceInfo::roleNames() const |
657 | +{ |
658 | + QHash<int, QByteArray> roles; |
659 | + roles.insert(ServiceRole, "service"); |
660 | + return roles; |
661 | +} |
662 | |
663 | === added file 'plugins/Unity/InputInfo/qdeclarativeinputdeviceinfo_p.h' |
664 | --- plugins/Unity/InputInfo/qdeclarativeinputdeviceinfo_p.h 1970-01-01 00:00:00 +0000 |
665 | +++ plugins/Unity/InputInfo/qdeclarativeinputdeviceinfo_p.h 2015-06-22 12:17:35 +0000 |
666 | @@ -0,0 +1,86 @@ |
667 | +/**************************************************************************** |
668 | +** |
669 | +** Copyright (C) 2015 Jolla. |
670 | +** Contact: http://www.qt-project.org/legal |
671 | +** |
672 | +** This file is part of the QtSystems module of the Qt Toolkit. |
673 | +** |
674 | +** $QT_BEGIN_LICENSE:LGPL$ |
675 | +** Commercial License Usage |
676 | +** Licensees holding valid commercial Qt licenses may use this file in |
677 | +** accordance with the commercial license agreement provided with the |
678 | +** Software or, alternatively, in accordance with the terms contained in |
679 | +** a written agreement between you and Digia. For licensing terms and |
680 | +** conditions see http://qt.digia.com/licensing. For further information |
681 | +** use the contact form at http://qt.digia.com/contact-us. |
682 | +** |
683 | +** GNU Lesser General Public License Usage |
684 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
685 | +** General Public License version 2.1 as published by the Free Software |
686 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
687 | +** packaging of this file. Please review the following information to |
688 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
689 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
690 | +** |
691 | +** In addition, as a special exception, Digia gives you certain additional |
692 | +** rights. These rights are described in the Digia Qt LGPL Exception |
693 | +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
694 | +** |
695 | +** GNU General Public License Usage |
696 | +** Alternatively, this file may be used under the terms of the GNU |
697 | +** General Public License version 3.0 as published by the Free Software |
698 | +** Foundation and appearing in the file LICENSE.GPL included in the |
699 | +** packaging of this file. Please review the following information to |
700 | +** ensure the GNU General Public License version 3.0 requirements will be |
701 | +** met: http://www.gnu.org/copyleft/gpl.html. |
702 | +** |
703 | +** |
704 | +** $QT_END_LICENSE$ |
705 | +** |
706 | +****************************************************************************/ |
707 | + |
708 | +#ifndef QDECLARATIVEINPUTDEVICEINFO_H |
709 | +#define QDECLARATIVEINPUTDEVICEINFO_H |
710 | + |
711 | +#include <QObject> |
712 | +#include <QAbstractListModel> |
713 | +#include "qinputinfo.h" |
714 | + |
715 | +class QDeclarativeInputDeviceInfo : public QAbstractListModel |
716 | +{ |
717 | + Q_OBJECT |
718 | + Q_DISABLE_COPY(QDeclarativeInputDeviceInfo) |
719 | + |
720 | +public: |
721 | + enum ItemRoles { |
722 | + ServiceRole = Qt::UserRole + 1 |
723 | + }; |
724 | + |
725 | + explicit QDeclarativeInputDeviceInfo(QObject *parent = 0); |
726 | + virtual ~QDeclarativeInputDeviceInfo(); |
727 | + |
728 | + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
729 | + int rowCount(const QModelIndex &parent = QModelIndex()) const; |
730 | + |
731 | + QHash<int, QByteArray> roleNames() const; |
732 | + |
733 | + Q_INVOKABLE int indexOf(const QString &devicePath) const; |
734 | + |
735 | + Q_INVOKABLE QInputDevice *get(int index) const; |
736 | + |
737 | +Q_SIGNALS: |
738 | + void newDevice(const QString &devicePath); |
739 | + void deviceRemoved(const QString &devicePath); |
740 | + |
741 | +public Q_SLOTS: |
742 | + void updateDeviceList(); |
743 | +private: |
744 | + QInputDeviceInfo *deviceInfo; |
745 | + QVector<QInputDevice *> inputDevices; |
746 | +private Q_SLOTS: |
747 | + void addedDevice(const QString &); |
748 | + void removedDevice(const QString &path); |
749 | + |
750 | +}; |
751 | + |
752 | +#endif // QDECLARATIVEINPUTDEVICEINFO_H |
753 | |
754 | === added file 'plugins/Unity/InputInfo/qinputinfo.cpp' |
755 | --- plugins/Unity/InputInfo/qinputinfo.cpp 1970-01-01 00:00:00 +0000 |
756 | +++ plugins/Unity/InputInfo/qinputinfo.cpp 2015-06-22 12:17:35 +0000 |
757 | @@ -0,0 +1,159 @@ |
758 | +/**************************************************************************** |
759 | +** |
760 | +** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
761 | +** Contact: http://www.qt-project.org/legal |
762 | +** |
763 | +** This file is part of the QtSystems module of the Qt Toolkit. |
764 | +** |
765 | +** $QT_BEGIN_LICENSE:LGPL$ |
766 | +** Commercial License Usage |
767 | +** Licensees holding valid commercial Qt licenses may use this file in |
768 | +** accordance with the commercial license agreement provided with the |
769 | +** Software or, alternatively, in accordance with the terms contained in |
770 | +** a written agreement between you and Digia. For licensing terms and |
771 | +** conditions see http://qt.digia.com/licensing. For further information |
772 | +** use the contact form at http://qt.digia.com/contact-us. |
773 | +** |
774 | +** GNU Lesser General Public License Usage |
775 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
776 | +** General Public License version 2.1 as published by the Free Software |
777 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
778 | +** packaging of this file. Please review the following information to |
779 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
780 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
781 | +** |
782 | +** In addition, as a special exception, Digia gives you certain additional |
783 | +** rights. These rights are described in the Digia Qt LGPL Exception |
784 | +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
785 | +** |
786 | +** GNU General Public License Usage |
787 | +** Alternatively, this file may be used under the terms of the GNU |
788 | +** General Public License version 3.0 as published by the Free Software |
789 | +** Foundation and appearing in the file LICENSE.GPL included in the |
790 | +** packaging of this file. Please review the following information to |
791 | +** ensure the GNU General Public License version 3.0 requirements will be |
792 | +** met: http://www.gnu.org/copyleft/gpl.html. |
793 | +** |
794 | +** |
795 | +** $QT_END_LICENSE$ |
796 | +** |
797 | +****************************************************************************/ |
798 | + |
799 | +#include "qinputinfo.h" |
800 | + |
801 | +#if defined(Q_OS_LINUX) |
802 | +#include "linux/qinputdeviceinfo_linux_p.h" |
803 | +#endif |
804 | + |
805 | +QT_BEGIN_NAMESPACE |
806 | + |
807 | + |
808 | +QInputDevicePrivate::QInputDevicePrivate(QObject *parent) : |
809 | + QObject(parent), |
810 | + types(QInputDeviceInfo::Unknown) |
811 | +{ |
812 | +} |
813 | + |
814 | +QInputDevice::QInputDevice(QObject *parent) : |
815 | + QObject(parent), |
816 | + d_ptr(new QInputDevicePrivate(this)) |
817 | +{ |
818 | +} |
819 | + |
820 | +QString QInputDevice::name() const |
821 | +{ |
822 | + return d_ptr->name; |
823 | +} |
824 | + |
825 | +void QInputDevice::setName(const QString &name) |
826 | +{ |
827 | + d_ptr->name = name; |
828 | +} |
829 | + |
830 | +QString QInputDevice::devicePath() const |
831 | +{ |
832 | + return d_ptr->devicePath; |
833 | +} |
834 | + |
835 | +void QInputDevice::setDevicePath(const QString &path) |
836 | +{ |
837 | + d_ptr->devicePath = path; |
838 | +} |
839 | + |
840 | +QList <int> QInputDevice::buttons() const |
841 | +{ |
842 | + return d_ptr->buttons; |
843 | +} |
844 | + |
845 | +void QInputDevice::addButton(int buttonCode) |
846 | +{ |
847 | + d_ptr->buttons.append(buttonCode); |
848 | +} |
849 | + |
850 | +QList <int> QInputDevice::switches() const |
851 | +{ |
852 | + return d_ptr->switches; |
853 | +} |
854 | + |
855 | +void QInputDevice::addSwitch(int switchCode) |
856 | +{ |
857 | + d_ptr->switches.append(switchCode); |
858 | +} |
859 | + |
860 | +QList <int> QInputDevice::relativeAxis() const |
861 | +{ |
862 | + return d_ptr->relativeAxis; |
863 | +} |
864 | + |
865 | +void QInputDevice::addRelativeAxis(int axisCode) |
866 | +{ |
867 | + d_ptr->relativeAxis.append(axisCode); |
868 | +} |
869 | + |
870 | +QList <int> QInputDevice::absoluteAxis() const |
871 | +{ |
872 | + return d_ptr->absoluteAxis; |
873 | +} |
874 | + |
875 | +void QInputDevice::addAbsoluteAxis(int axisCode) |
876 | +{ |
877 | + d_ptr->absoluteAxis.append(axisCode); |
878 | +} |
879 | + |
880 | +QInputDeviceInfo::InputTypes QInputDevice::types() |
881 | +{ |
882 | + return d_ptr->types; |
883 | +} |
884 | + |
885 | +void QInputDevice::setTypes(QInputDeviceInfo::InputTypes types) |
886 | +{ |
887 | + d_ptr->types = types; |
888 | +} |
889 | + |
890 | + |
891 | +QInputDeviceInfo::QInputDeviceInfo(QObject *parent) : |
892 | + QObject(parent), |
893 | + d_ptr(new QInputDeviceInfoPrivate(this)) |
894 | +{ |
895 | + connect(d_ptr, &QInputDeviceInfoPrivate::newDevice,this,&QInputDeviceInfo::addedDevice); |
896 | + connect(d_ptr, &QInputDeviceInfoPrivate::deviceRemoved,this,&QInputDeviceInfo::deviceRemoved); |
897 | + |
898 | + connect(d_ptr,SIGNAL(ready()),this,SIGNAL(ready())); |
899 | +} |
900 | + |
901 | +QVector <QInputDevice *> QInputDeviceInfo::deviceList() |
902 | +{ |
903 | + return d_ptr->deviceList; |
904 | +} |
905 | + |
906 | +QMap <QString, QInputDevice *> QInputDeviceInfo::deviceMap() |
907 | +{ |
908 | + return d_ptr->deviceMap; |
909 | +} |
910 | + |
911 | +void QInputDeviceInfo::addedDevice(const QString & devicePath) |
912 | +{ |
913 | + Q_EMIT deviceAdded(devicePath); |
914 | +} |
915 | + |
916 | +QT_END_NAMESPACE |
917 | |
918 | === added file 'plugins/Unity/InputInfo/qinputinfo.h' |
919 | --- plugins/Unity/InputInfo/qinputinfo.h 1970-01-01 00:00:00 +0000 |
920 | +++ plugins/Unity/InputInfo/qinputinfo.h 2015-06-22 12:17:35 +0000 |
921 | @@ -0,0 +1,143 @@ |
922 | +/**************************************************************************** |
923 | +** |
924 | +** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
925 | +** Contact: http://www.qt-project.org/legal |
926 | +** |
927 | +** This file is part of the QtSystems module of the Qt Toolkit. |
928 | +** |
929 | +** $QT_BEGIN_LICENSE:LGPL$ |
930 | +** Commercial License Usage |
931 | +** Licensees holding valid commercial Qt licenses may use this file in |
932 | +** accordance with the commercial license agreement provided with the |
933 | +** Software or, alternatively, in accordance with the terms contained in |
934 | +** a written agreement between you and Digia. For licensing terms and |
935 | +** conditions see http://qt.digia.com/licensing. For further information |
936 | +** use the contact form at http://qt.digia.com/contact-us. |
937 | +** |
938 | +** GNU Lesser General Public License Usage |
939 | +** Alternatively, this file may be used under the terms of the GNU Lesser |
940 | +** General Public License version 2.1 as published by the Free Software |
941 | +** Foundation and appearing in the file LICENSE.LGPL included in the |
942 | +** packaging of this file. Please review the following information to |
943 | +** ensure the GNU Lesser General Public License version 2.1 requirements |
944 | +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
945 | +** |
946 | +** In addition, as a special exception, Digia gives you certain additional |
947 | +** rights. These rights are described in the Digia Qt LGPL Exception |
948 | +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
949 | +** |
950 | +** GNU General Public License Usage |
951 | +** Alternatively, this file may be used under the terms of the GNU |
952 | +** General Public License version 3.0 as published by the Free Software |
953 | +** Foundation and appearing in the file LICENSE.GPL included in the |
954 | +** packaging of this file. Please review the following information to |
955 | +** ensure the GNU General Public License version 3.0 requirements will be |
956 | +** met: http://www.gnu.org/copyleft/gpl.html. |
957 | +** |
958 | +** |
959 | +** $QT_END_LICENSE$ |
960 | +** |
961 | +****************************************************************************/ |
962 | + |
963 | +#ifndef QINPUTINFO_H |
964 | +#define QINPUTINFO_H |
965 | + |
966 | +#include <QObject> |
967 | +#include <QVector> |
968 | +#include <QMap> |
969 | +#include <QSocketNotifier> |
970 | +#include <QDebug> |
971 | + |
972 | +class QInputDeviceInfoPrivate; |
973 | +class QInputDevicePrivate; |
974 | +class QInputDevice; |
975 | + |
976 | +class QInputDeviceInfoPrivate; |
977 | +class QInputDeviceInfo : public QObject |
978 | +{ |
979 | + Q_OBJECT |
980 | + Q_PROPERTY(int deviceCount READ deviceCount) |
981 | +public: |
982 | + |
983 | + enum InputType { |
984 | + Unknown = 0, |
985 | + Button = 1, |
986 | + Mouse = 2, |
987 | + TouchPad = 4, |
988 | + TouchScreen = 8, |
989 | + Keyboard = 16, |
990 | + Switch = 32 |
991 | + }; |
992 | + Q_ENUMS(InputType) |
993 | + Q_FLAGS(InputTypes) |
994 | + Q_DECLARE_FLAGS(InputTypes, InputType) |
995 | + |
996 | + explicit QInputDeviceInfo(QObject *parent = 0); |
997 | + |
998 | + Q_INVOKABLE QVector <QInputDevice *> deviceList(); |
999 | + |
1000 | + Q_INVOKABLE QMap <QString, QInputDevice *> deviceMap(); |
1001 | + int deviceCount() { return deviceList().count(); } |
1002 | +Q_SIGNALS: |
1003 | + |
1004 | + void deviceAdded(const QString & devicePath); |
1005 | + void deviceRemoved(const QString & devicePath); |
1006 | + |
1007 | + void ready(); |
1008 | + |
1009 | +public Q_SLOTS: |
1010 | + void addedDevice(const QString & devicePath); |
1011 | + |
1012 | +private: |
1013 | + Q_DISABLE_COPY(QInputDeviceInfo) |
1014 | +#if !defined(QT_SIMULATOR) |
1015 | + QInputDeviceInfoPrivate *const d_ptr; |
1016 | + Q_DECLARE_PRIVATE(QInputDeviceInfo) |
1017 | +#endif |
1018 | +}; |
1019 | + |
1020 | +class QInputDevice : public QObject |
1021 | +{ |
1022 | + friend class QInputDeviceInfoPrivate; |
1023 | + Q_OBJECT |
1024 | + Q_ENUMS(InputType) |
1025 | + Q_FLAGS(InputTypes) |
1026 | + Q_PROPERTY(QString name READ name NOTIFY nameChanged) |
1027 | + Q_PROPERTY(QString devicePath READ devicePath NOTIFY devicePathChanged) |
1028 | + Q_PROPERTY(QList <int> buttons READ buttons NOTIFY buttonsChanged) |
1029 | + Q_PROPERTY(QList <int> switches READ switches NOTIFY switchesChanged) |
1030 | + Q_PROPERTY(QList <int> relativeAxis READ relativeAxis NOTIFY relativeAxisChanged) |
1031 | + Q_PROPERTY(QList <int> absoluteAxis READ absoluteAxis NOTIFY absoluteAxisChanged) |
1032 | + Q_PROPERTY(QInputDeviceInfo::InputTypes types READ types NOTIFY typesChanged) |
1033 | + |
1034 | +public: |
1035 | + explicit QInputDevice(QObject *parent = 0); |
1036 | + |
1037 | + QString name() const; |
1038 | + QString devicePath() const; |
1039 | + QList <int> buttons() const; //keys event code |
1040 | + QList <int> switches() const; |
1041 | + QList <int> relativeAxis() const; |
1042 | + QList <int> absoluteAxis() const; |
1043 | + |
1044 | + QInputDeviceInfo::InputTypes types(); |
1045 | +Q_SIGNALS: |
1046 | + void nameChanged(); |
1047 | + void devicePathChanged(); |
1048 | + void buttonsChanged(); |
1049 | + void switchesChanged(); |
1050 | + void relativeAxisChanged(); |
1051 | + void absoluteAxisChanged(); |
1052 | + void typesChanged(); |
1053 | +private: |
1054 | + QInputDevicePrivate *d_ptr; |
1055 | + void setName(const QString &); |
1056 | + void setDevicePath(const QString &); |
1057 | + void addButton(int); |
1058 | + void addSwitch(int); |
1059 | + void addRelativeAxis(int); |
1060 | + void addAbsoluteAxis(int); |
1061 | + void setTypes(QInputDeviceInfo::InputTypes); |
1062 | +}; |
1063 | + |
1064 | +#endif // QINPUTINFO_H |
1065 | |
1066 | === added file 'plugins/Unity/InputInfo/qmldir' |
1067 | --- plugins/Unity/InputInfo/qmldir 1970-01-01 00:00:00 +0000 |
1068 | +++ plugins/Unity/InputInfo/qmldir 2015-06-22 12:17:35 +0000 |
1069 | @@ -0,0 +1,3 @@ |
1070 | +module Unity.InputInfo |
1071 | +plugin InputInfo |
1072 | +typeinfo InputInfo.qmltypes |
FAILED: Continuous integration, rev:1746 jenkins. qa.ubuntu. com/job/ unity8- ci/5675/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- vivid-touch/ 2628/console jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- vivid/840/ console jenkins. qa.ubuntu. com/job/ unity8- vivid-amd64- ci/840/ console jenkins. qa.ubuntu. com/job/ unity8- vivid-i386- ci/840/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 2626/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/5675/ rebuild
http://