Merge lp:~mzanetti/ubuntu/vivid/qtsystems-opensource-src/inputinfo into lp:ubuntu/vivid-proposed/qtsystems-opensource-src
- Vivid (15.04)
- inputinfo
- Merge into vivid-proposed
Proposed by
Michael Zanetti
Status: | Work in progress |
---|---|
Proposed branch: | lp:~mzanetti/ubuntu/vivid/qtsystems-opensource-src/inputinfo |
Merge into: | lp:ubuntu/vivid-proposed/qtsystems-opensource-src |
Diff against target: |
1561 lines (+1501/-2) 7 files modified
debian/control (+3/-0) debian/patches/inputinfo.patch (+1487/-0) debian/patches/series (+2/-0) debian/qtsystems5-dev.install (+3/-0) debian/qtsystems5-examples.install (+2/-0) debian/qtsystems5-private-dev.install (+2/-0) debian/rules (+2/-2) |
To merge this branch: | bzr merge lp:~mzanetti/ubuntu/vivid/qtsystems-opensource-src/inputinfo |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dmitry Shachnev | Abstain | ||
Review via email: mp+248418@code.launchpad.net |
This proposal supersedes a proposal from 2015-02-03.
Commit message
Description of the change
Qt input info for mouse & keyboard detection
To post a comment you must log in.
Revision history for this message
Michael Zanetti (mzanetti) wrote : | # |
Yeah, this is not meant to land right now... We just need it for some demo work. The input info api is not final yet and should not end up in the archive yet.
- 10. By Timo Jyrinki
-
[ Timo Jyrinki ]
* Rebuild against Qt 5.4.0[ Dmitry Shachnev ]
* New upstream snapshot.
* Drop all patches that have been applied upstream.
* Update install files. - 11. By Michael Zanetti
-
applyinputinfo patch
- 12. By Michael Zanetti
-
fix pkgconfig
- 13. By Michael Zanetti
-
fix PKGCONFIG
- 14. By Michael Zanetti
-
next try
- 15. By Michael Zanetti
-
add pkg-config to deps
- 16. By Michael Zanetti
-
disable tests
- 17. By Michael Zanetti
-
add installs
- 18. By Michael Zanetti
-
make type a flag
Unmerged revisions
- 18. By Michael Zanetti
-
make type a flag
- 17. By Michael Zanetti
-
add installs
- 16. By Michael Zanetti
-
disable tests
- 15. By Michael Zanetti
-
add pkg-config to deps
- 14. By Michael Zanetti
-
next try
- 13. By Michael Zanetti
-
fix PKGCONFIG
- 12. By Michael Zanetti
-
fix pkgconfig
- 11. By Michael Zanetti
-
applyinputinfo patch
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/control' |
2 | --- debian/control 2015-02-13 06:45:19 +0000 |
3 | +++ debian/control 2015-02-18 17:03:28 +0000 |
4 | @@ -3,7 +3,10 @@ |
5 | Priority: optional |
6 | Maintainer: Timo Jyrinki <timo-jyrinki@ubuntu.com> |
7 | Build-Depends: debhelper (>= 9), |
8 | + libevdev-dev, |
9 | libqt5sql5-sqlite (>= 5.4.0~), |
10 | + libudev-dev, |
11 | + pkg-config, |
12 | pkg-kde-tools, |
13 | qtbase5-private-dev (>= 5.4.0~), |
14 | qtdeclarative5-private-dev (>= 5.4.0~), |
15 | |
16 | === added file 'debian/patches/inputinfo.patch' |
17 | --- debian/patches/inputinfo.patch 1970-01-01 00:00:00 +0000 |
18 | +++ debian/patches/inputinfo.patch 2015-02-18 17:03:28 +0000 |
19 | @@ -0,0 +1,1487 @@ |
20 | +=== added directory 'examples/systeminfo/inputinfo' |
21 | +=== added file 'examples/systeminfo/inputinfo/inputinfo.pro' |
22 | +--- old/examples/systeminfo/inputinfo/inputinfo.pro 1970-01-01 00:00:00 +0000 |
23 | ++++ new/examples/systeminfo/inputinfo/inputinfo.pro 2015-02-18 12:13:36 +0000 |
24 | +@@ -0,0 +1,22 @@ |
25 | ++#------------------------------------------------- |
26 | ++# |
27 | ++# Project created by QtCreator 2014-11-28T12:25:04 |
28 | ++# |
29 | ++#------------------------------------------------- |
30 | ++ |
31 | ++QT += core systeminfo |
32 | ++ |
33 | ++QT -= gui |
34 | ++ |
35 | ++TARGET = inputinfo |
36 | ++CONFIG += console |
37 | ++CONFIG -= app_bundle |
38 | ++ |
39 | ++TEMPLATE = app |
40 | ++ |
41 | ++ |
42 | ++SOURCES += main.cpp \ |
43 | ++ inputtest.cpp |
44 | ++ |
45 | ++HEADERS += \ |
46 | ++ inputtest.h |
47 | + |
48 | +=== added file 'examples/systeminfo/inputinfo/inputtest.cpp' |
49 | +--- old/examples/systeminfo/inputinfo/inputtest.cpp 1970-01-01 00:00:00 +0000 |
50 | ++++ new/examples/systeminfo/inputinfo/inputtest.cpp 2015-02-18 16:30:59 +0000 |
51 | +@@ -0,0 +1,83 @@ |
52 | ++/**************************************************************************** |
53 | ++** |
54 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
55 | ++** Contact: http://www.qt-project.org/legal |
56 | ++** |
57 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
58 | ++** |
59 | ++** $QT_BEGIN_LICENSE:LGPL$ |
60 | ++** Commercial License Usage |
61 | ++** Licensees holding valid commercial Qt licenses may use this file in |
62 | ++** accordance with the commercial license agreement provided with the |
63 | ++** Software or, alternatively, in accordance with the terms contained in |
64 | ++** a written agreement between you and Digia. For licensing terms and |
65 | ++** conditions see http://qt.digia.com/licensing. For further information |
66 | ++** use the contact form at http://qt.digia.com/contact-us. |
67 | ++** |
68 | ++** GNU Lesser General Public License Usage |
69 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
70 | ++** General Public License version 2.1 as published by the Free Software |
71 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
72 | ++** packaging of this file. Please review the following information to |
73 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
74 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
75 | ++** |
76 | ++** In addition, as a special exception, Digia gives you certain additional |
77 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
78 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
79 | ++** |
80 | ++** GNU General Public License Usage |
81 | ++** Alternatively, this file may be used under the terms of the GNU |
82 | ++** General Public License version 3.0 as published by the Free Software |
83 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
84 | ++** packaging of this file. Please review the following information to |
85 | ++** ensure the GNU General Public License version 3.0 requirements will be |
86 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
87 | ++** |
88 | ++** |
89 | ++** $QT_END_LICENSE$ |
90 | ++** |
91 | ++****************************************************************************/ |
92 | ++ |
93 | ++#include "inputtest.h" |
94 | ++#include <qinputinfo.h> |
95 | ++#include <QDebug> |
96 | ++ |
97 | ++Inputtest::Inputtest(QObject *parent) : |
98 | ++ QObject(parent) |
99 | ++{ |
100 | ++ inputDeviceInfo = new QInputDeviceInfo(this); |
101 | ++ connect(inputDeviceInfo, &QInputDeviceInfo::deviceAdded,this,&Inputtest::deviceAdded); |
102 | ++ connect(inputDeviceInfo, &QInputDeviceInfo::deviceRemoved,this,&Inputtest::deviceRemoved); |
103 | ++ |
104 | ++} |
105 | ++ |
106 | ++void Inputtest::deviceAdded(const QString &devicePath) |
107 | ++{ |
108 | ++ QInputDevice *device = inputDeviceInfo->deviceMap().value(devicePath); |
109 | ++ |
110 | ++ qDebug() << inputDeviceInfo->deviceMap().count(); |
111 | ++ qDebug() << device->name() << device->devicePath(); |
112 | ++ qDebug() << "buttons count"<< device->buttons().count(); |
113 | ++ qDebug() << "switch count"<< device->switches().count(); |
114 | ++ qDebug() << "relativeAxis count"<< device->relativeAxis().count(); |
115 | ++ qDebug() << "absoluteAxis count"<< device->absoluteAxis().count(); |
116 | ++ qDebug() << "types" << device->types(); |
117 | ++ qDebug(); |
118 | ++ |
119 | ++ QMapIterator<QString, QInputDevice*> i(inputDeviceInfo->deviceMap()); |
120 | ++ while (i.hasNext()) { |
121 | ++ i.next(); |
122 | ++ qDebug() << i.value()->name(); |
123 | ++ } |
124 | ++} |
125 | ++ |
126 | ++void Inputtest::deviceRemoved(const QString &path) |
127 | ++{ |
128 | ++ qDebug() << Q_FUNC_INFO << path; |
129 | ++ QMapIterator<QString, QInputDevice*> i(inputDeviceInfo->deviceMap()); |
130 | ++ while (i.hasNext()) { |
131 | ++ i.next(); |
132 | ++ qDebug() << i.value()->name(); |
133 | ++ } |
134 | ++} |
135 | + |
136 | +=== added file 'examples/systeminfo/inputinfo/inputtest.h' |
137 | +--- old/examples/systeminfo/inputinfo/inputtest.h 1970-01-01 00:00:00 +0000 |
138 | ++++ new/examples/systeminfo/inputinfo/inputtest.h 2015-02-18 12:13:36 +0000 |
139 | +@@ -0,0 +1,63 @@ |
140 | ++/**************************************************************************** |
141 | ++** |
142 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
143 | ++** Contact: http://www.qt-project.org/legal |
144 | ++** |
145 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
146 | ++** |
147 | ++** $QT_BEGIN_LICENSE:LGPL$ |
148 | ++** Commercial License Usage |
149 | ++** Licensees holding valid commercial Qt licenses may use this file in |
150 | ++** accordance with the commercial license agreement provided with the |
151 | ++** Software or, alternatively, in accordance with the terms contained in |
152 | ++** a written agreement between you and Digia. For licensing terms and |
153 | ++** conditions see http://qt.digia.com/licensing. For further information |
154 | ++** use the contact form at http://qt.digia.com/contact-us. |
155 | ++** |
156 | ++** GNU Lesser General Public License Usage |
157 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
158 | ++** General Public License version 2.1 as published by the Free Software |
159 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
160 | ++** packaging of this file. Please review the following information to |
161 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
162 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
163 | ++** |
164 | ++** In addition, as a special exception, Digia gives you certain additional |
165 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
166 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
167 | ++** |
168 | ++** GNU General Public License Usage |
169 | ++** Alternatively, this file may be used under the terms of the GNU |
170 | ++** General Public License version 3.0 as published by the Free Software |
171 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
172 | ++** packaging of this file. Please review the following information to |
173 | ++** ensure the GNU General Public License version 3.0 requirements will be |
174 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
175 | ++** |
176 | ++** |
177 | ++** $QT_END_LICENSE$ |
178 | ++** |
179 | ++****************************************************************************/ |
180 | ++ |
181 | ++#ifndef INPUTTEST_H |
182 | ++#define INPUTTEST_H |
183 | ++ |
184 | ++#include <QObject> |
185 | ++#include <qinputinfo.h> |
186 | ++ |
187 | ++class Inputtest : public QObject |
188 | ++{ |
189 | ++ Q_OBJECT |
190 | ++public: |
191 | ++ explicit Inputtest(QObject *parent = 0); |
192 | ++ |
193 | ++ QInputDeviceInfo *inputDeviceInfo; |
194 | ++signals: |
195 | ++ |
196 | ++public slots: |
197 | ++ |
198 | ++ void deviceAdded(const QString &); |
199 | ++ void deviceRemoved(const QString &path); |
200 | ++}; |
201 | ++ |
202 | ++#endif // INPUTTEST_H |
203 | + |
204 | +=== added file 'examples/systeminfo/inputinfo/main.cpp' |
205 | +--- old/examples/systeminfo/inputinfo/main.cpp 1970-01-01 00:00:00 +0000 |
206 | ++++ new/examples/systeminfo/inputinfo/main.cpp 2015-02-18 12:13:36 +0000 |
207 | +@@ -0,0 +1,50 @@ |
208 | ++/**************************************************************************** |
209 | ++** |
210 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
211 | ++** Contact: http://www.qt-project.org/legal |
212 | ++** |
213 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
214 | ++** |
215 | ++** $QT_BEGIN_LICENSE:LGPL$ |
216 | ++** Commercial License Usage |
217 | ++** Licensees holding valid commercial Qt licenses may use this file in |
218 | ++** accordance with the commercial license agreement provided with the |
219 | ++** Software or, alternatively, in accordance with the terms contained in |
220 | ++** a written agreement between you and Digia. For licensing terms and |
221 | ++** conditions see http://qt.digia.com/licensing. For further information |
222 | ++** use the contact form at http://qt.digia.com/contact-us. |
223 | ++** |
224 | ++** GNU Lesser General Public License Usage |
225 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
226 | ++** General Public License version 2.1 as published by the Free Software |
227 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
228 | ++** packaging of this file. Please review the following information to |
229 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
230 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
231 | ++** |
232 | ++** In addition, as a special exception, Digia gives you certain additional |
233 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
234 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
235 | ++** |
236 | ++** GNU General Public License Usage |
237 | ++** Alternatively, this file may be used under the terms of the GNU |
238 | ++** General Public License version 3.0 as published by the Free Software |
239 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
240 | ++** packaging of this file. Please review the following information to |
241 | ++** ensure the GNU General Public License version 3.0 requirements will be |
242 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
243 | ++** |
244 | ++** |
245 | ++** $QT_END_LICENSE$ |
246 | ++** |
247 | ++****************************************************************************/ |
248 | ++#include <QCoreApplication> |
249 | ++#include "inputtest.h" |
250 | ++ |
251 | ++int main(int argc, char *argv[]) |
252 | ++{ |
253 | ++ QCoreApplication a(argc, argv); |
254 | ++ |
255 | ++ Inputtest inputest(&a); |
256 | ++ return a.exec(); |
257 | ++} |
258 | + |
259 | +=== added directory 'examples/systeminfo/qml-inputinfo' |
260 | +=== added file 'examples/systeminfo/qml-inputinfo/main.cpp' |
261 | +--- old/examples/systeminfo/qml-inputinfo/main.cpp 1970-01-01 00:00:00 +0000 |
262 | ++++ new/examples/systeminfo/qml-inputinfo/main.cpp 2015-02-18 12:13:36 +0000 |
263 | +@@ -0,0 +1,43 @@ |
264 | ++/**************************************************************************** |
265 | ++** |
266 | ++** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
267 | ++** Contact: http://www.qt-project.org/legal |
268 | ++** |
269 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
270 | ++** |
271 | ++** $QT_BEGIN_LICENSE:LGPL$ |
272 | ++** Commercial License Usage |
273 | ++** Licensees holding valid commercial Qt licenses may use this file in |
274 | ++** accordance with the commercial license agreement provided with the |
275 | ++** Software or, alternatively, in accordance with the terms contained in |
276 | ++** a written agreement between you and Digia. For licensing terms and |
277 | ++** conditions see http://qt.digia.com/licensing. For further information |
278 | ++** use the contact form at http://qt.digia.com/contact-us. |
279 | ++** |
280 | ++** GNU Lesser General Public License Usage |
281 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
282 | ++** General Public License version 2.1 as published by the Free Software |
283 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
284 | ++** packaging of this file. Please review the following information to |
285 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
286 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
287 | ++** |
288 | ++** In addition, as a special exception, Digia gives you certain additional |
289 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
290 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
291 | ++** |
292 | ++** GNU General Public License Usage |
293 | ++** Alternatively, this file may be used under the terms of the GNU |
294 | ++** General Public License version 3.0 as published by the Free Software |
295 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
296 | ++** packaging of this file. Please review the following information to |
297 | ++** ensure the GNU General Public License version 3.0 requirements will be |
298 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
299 | ++** |
300 | ++** |
301 | ++** $QT_END_LICENSE$ |
302 | ++** |
303 | ++****************************************************************************/ |
304 | ++ |
305 | ++#include"../stub.h" |
306 | ++SYSINFO_EXAMPLE_MAIN(qml-inputinfo) |
307 | + |
308 | +=== added file 'examples/systeminfo/qml-inputinfo/qml-inputinfo.pro' |
309 | +--- old/examples/systeminfo/qml-inputinfo/qml-inputinfo.pro 1970-01-01 00:00:00 +0000 |
310 | ++++ new/examples/systeminfo/qml-inputinfo/qml-inputinfo.pro 2015-02-18 12:13:36 +0000 |
311 | +@@ -0,0 +1,14 @@ |
312 | ++TEMPLATE = app |
313 | ++TARGET = qml-inputinfo |
314 | ++QT += quick |
315 | ++SOURCES = main.cpp |
316 | ++ |
317 | ++app.files = \ |
318 | ++ $$files(*.qml) \ |
319 | ++ |
320 | ++target.path = $$[QT_INSTALL_EXAMPLES]/sysinfo/qml-inputinfo |
321 | ++app.path = $$[QT_INSTALL_EXAMPLES]/sysinfo/qml-inputinfo |
322 | ++INSTALLS += target app |
323 | ++ |
324 | ++RESOURCES += \ |
325 | ++ qml-inputinfo.qrc |
326 | + |
327 | +=== added file 'examples/systeminfo/qml-inputinfo/qml-inputinfo.qml' |
328 | +--- old/examples/systeminfo/qml-inputinfo/qml-inputinfo.qml 1970-01-01 00:00:00 +0000 |
329 | ++++ new/examples/systeminfo/qml-inputinfo/qml-inputinfo.qml 2015-02-18 12:13:36 +0000 |
330 | +@@ -0,0 +1,97 @@ |
331 | ++/**************************************************************************** |
332 | ++** |
333 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
334 | ++** Contact: http://www.qt-project.org/legal |
335 | ++** |
336 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
337 | ++** |
338 | ++** $QT_BEGIN_LICENSE:LGPL$ |
339 | ++** Commercial License Usage |
340 | ++** Licensees holding valid commercial Qt licenses may use this file in |
341 | ++** accordance with the commercial license agreement provided with the |
342 | ++** Software or, alternatively, in accordance with the terms contained in |
343 | ++** a written agreement between you and Digia. For licensing terms and |
344 | ++** conditions see http://qt.digia.com/licensing. For further information |
345 | ++** use the contact form at http://qt.digia.com/contact-us. |
346 | ++** |
347 | ++** GNU Lesser General Public License Usage |
348 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
349 | ++** General Public License version 2.1 as published by the Free Software |
350 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
351 | ++** packaging of this file. Please review the following information to |
352 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
353 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
354 | ++** |
355 | ++** In addition, as a special exception, Digia gives you certain additional |
356 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
357 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
358 | ++** |
359 | ++** GNU General Public License Usage |
360 | ++** Alternatively, this file may be used under the terms of the GNU |
361 | ++** General Public License version 3.0 as published by the Free Software |
362 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
363 | ++** packaging of this file. Please review the following information to |
364 | ++** ensure the GNU General Public License version 3.0 requirements will be |
365 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
366 | ++** |
367 | ++** |
368 | ++** $QT_END_LICENSE$ |
369 | ++** |
370 | ++****************************************************************************/ |
371 | ++import QtQuick 2.0 |
372 | ++import QtSystemInfo 5.0 |
373 | ++ |
374 | ++Rectangle { |
375 | ++ width: 640 |
376 | ++ height: 480 |
377 | ++ |
378 | ++ ListView { |
379 | ++ anchors.fill: parent |
380 | ++ id: inputModel |
381 | ++ model: systemInputs |
382 | ++ delegate: deviceDelegate |
383 | ++ } |
384 | ++ |
385 | ++ Component { |
386 | ++ id: deviceDelegate |
387 | ++ Row { |
388 | ++ spacing: 10 |
389 | ++ Text { text: systemInputs.get(index).name} |
390 | ++ Text { text: typeToString(systemInputs.get(index).type)} |
391 | ++ } |
392 | ++ } |
393 | ++ |
394 | ++ InputDeviceInfo { |
395 | ++ id: systemInputs |
396 | ++ } |
397 | ++ |
398 | ++ function typeToString(deviceType) { |
399 | ++ console.log(deviceType +" "+systemInputs.Keyboard) |
400 | ++ |
401 | ++ switch (deviceType) { |
402 | ++ case 0: |
403 | ++ return "Unknown" |
404 | ++ break; |
405 | ++ case 1: |
406 | ++ return "Button" |
407 | ++ break; |
408 | ++ case 2: |
409 | ++ return "Mouse" |
410 | ++ break; |
411 | ++ case 3: |
412 | ++ return "TouchPad" |
413 | ++ break; |
414 | ++ case 4: |
415 | ++ return "TouchScreen" |
416 | ++ break; |
417 | ++ case 5: |
418 | ++ return "Keyboard" |
419 | ++ break; |
420 | ++ case 6: |
421 | ++ return "Switch" |
422 | ++ break; |
423 | ++ } |
424 | ++ return "" |
425 | ++ } |
426 | ++ |
427 | ++} |
428 | + |
429 | +=== added file 'examples/systeminfo/qml-inputinfo/qml-inputinfo.qrc' |
430 | +--- old/examples/systeminfo/qml-inputinfo/qml-inputinfo.qrc 1970-01-01 00:00:00 +0000 |
431 | ++++ new/examples/systeminfo/qml-inputinfo/qml-inputinfo.qrc 2015-02-18 12:13:36 +0000 |
432 | +@@ -0,0 +1,5 @@ |
433 | ++<RCC> |
434 | ++ <qresource prefix="/"> |
435 | ++ <file>qml-inputinfo.qml</file> |
436 | ++ </qresource> |
437 | ++</RCC> |
438 | + |
439 | +=== modified file 'examples/systeminfo/systeminfo.pro' |
440 | +--- old/examples/systeminfo/systeminfo.pro 2015-02-13 06:45:19 +0000 |
441 | ++++ new/examples/systeminfo/systeminfo.pro 2015-02-18 12:13:36 +0000 |
442 | +@@ -2,7 +2,9 @@ |
443 | + |
444 | + SUBDIRS += \ |
445 | + qml-deviceinfo \ |
446 | +- qml-battery |
447 | ++ qml-battery \ |
448 | ++ qml-inputinfo\ |
449 | ++ inputinfo |
450 | + |
451 | + #qtHaveModule(widgets): SUBDIRS += \ |
452 | + |
453 | + |
454 | +=== modified file 'src/imports/systeminfo/plugins.qmltypes' |
455 | +--- old/src/imports/systeminfo/plugins.qmltypes 2015-02-13 06:45:19 +0000 |
456 | ++++ new/src/imports/systeminfo/plugins.qmltypes 2015-02-18 12:13:36 +0000 |
457 | +@@ -378,6 +378,43 @@ |
458 | + } |
459 | + } |
460 | + Component { |
461 | ++ name: "QInputDevice" |
462 | ++ prototype: "QObject" |
463 | ++ exports: ["QtSystemInfo/InputInfo 5.0"] |
464 | ++ exportMetaObjectRevisions: [0] |
465 | ++ Enum { |
466 | ++ name: "InputType" |
467 | ++ values: { |
468 | ++ "Unknown": 0, |
469 | ++ "Button": 1, |
470 | ++ "Mouse": 2, |
471 | ++ "TouchPad": 3, |
472 | ++ "TouchScreen": 4, |
473 | ++ "Keyboard": 5, |
474 | ++ "Switch": 6 |
475 | ++ } |
476 | ++ } |
477 | ++ Property { name: "name"; type: "string"; isReadonly: true } |
478 | ++ Property { name: "devicePath"; type: "string"; isReadonly: true } |
479 | ++ Property { name: "buttons"; type: "QList<int>"; isReadonly: true } |
480 | ++ Property { name: "switches"; type: "QList<int>"; isReadonly: true } |
481 | ++ Property { name: "relativeAxis"; type: "QList<int>"; isReadonly: true } |
482 | ++ Property { name: "absoluteAxis"; type: "QList<int>"; isReadonly: true } |
483 | ++ Property { name: "type"; type: "QInputDevice::InputType"; isReadonly: true } |
484 | ++ } |
485 | ++ Component { |
486 | ++ name: "QInputDeviceInfo" |
487 | ++ prototype: "QObject" |
488 | ++ exports: ["QtSystemInfo/InputDeviceInfo 5.0"] |
489 | ++ exportMetaObjectRevisions: [0] |
490 | ++ Property { name: "deviceCount"; type: "int"; isReadonly: true } |
491 | ++ Signal { name: "deviceAdded" } |
492 | ++ Signal { name: "deviceRemoved" } |
493 | ++ Signal { name: "ready" } |
494 | ++ Method { name: "addedDevice" } |
495 | ++ Method { name: "deviceList"; type: "QList<QInputDevice*>" } |
496 | ++ } |
497 | ++ Component { |
498 | + name: "QScreenSaver" |
499 | + prototype: "QObject" |
500 | + exports: ["QtSystemInfo/ScreenSaver 5.0"] |
501 | + |
502 | +=== added file 'src/imports/systeminfo/qdeclarativeinputdeviceinfo.cpp' |
503 | +--- old/src/imports/systeminfo/qdeclarativeinputdeviceinfo.cpp 1970-01-01 00:00:00 +0000 |
504 | ++++ new/src/imports/systeminfo/qdeclarativeinputdeviceinfo.cpp 2015-02-18 12:13:36 +0000 |
505 | +@@ -0,0 +1,143 @@ |
506 | ++/**************************************************************************** |
507 | ++** |
508 | ++** Copyright (C) 2015 Jolla. |
509 | ++** Contact: http://www.qt-project.org/legal |
510 | ++** |
511 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
512 | ++** |
513 | ++** $QT_BEGIN_LICENSE:LGPL$ |
514 | ++** Commercial License Usage |
515 | ++** Licensees holding valid commercial Qt licenses may use this file in |
516 | ++** accordance with the commercial license agreement provided with the |
517 | ++** Software or, alternatively, in accordance with the terms contained in |
518 | ++** a written agreement between you and Digia. For licensing terms and |
519 | ++** conditions see http://qt.digia.com/licensing. For further information |
520 | ++** use the contact form at http://qt.digia.com/contact-us. |
521 | ++** |
522 | ++** GNU Lesser General Public License Usage |
523 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
524 | ++** General Public License version 2.1 as published by the Free Software |
525 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
526 | ++** packaging of this file. Please review the following information to |
527 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
528 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
529 | ++** |
530 | ++** In addition, as a special exception, Digia gives you certain additional |
531 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
532 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
533 | ++** |
534 | ++** GNU General Public License Usage |
535 | ++** Alternatively, this file may be used under the terms of the GNU |
536 | ++** General Public License version 3.0 as published by the Free Software |
537 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
538 | ++** packaging of this file. Please review the following information to |
539 | ++** ensure the GNU General Public License version 3.0 requirements will be |
540 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
541 | ++** |
542 | ++** |
543 | ++** $QT_END_LICENSE$ |
544 | ++** |
545 | ++****************************************************************************/ |
546 | ++#include "qdeclarativeinputdeviceinfo_p.h" |
547 | ++ |
548 | ++QDeclarativeInputDeviceInfo::QDeclarativeInputDeviceInfo(QObject *parent) : |
549 | ++ QAbstractListModel(parent), |
550 | ++ deviceInfo(new QInputDeviceInfo) |
551 | ++{ |
552 | ++ connect(deviceInfo,SIGNAL(ready()),this,SLOT(updateDeviceList())); |
553 | ++ connect(deviceInfo, &QInputDeviceInfo::deviceAdded,this,&QDeclarativeInputDeviceInfo::addedDevice); |
554 | ++ connect(deviceInfo, &QInputDeviceInfo::deviceRemoved,this,&QDeclarativeInputDeviceInfo::removedDevice); |
555 | ++} |
556 | ++ |
557 | ++QDeclarativeInputDeviceInfo::~QDeclarativeInputDeviceInfo() |
558 | ++{ |
559 | ++ delete deviceInfo; |
560 | ++} |
561 | ++ |
562 | ++QVariant QDeclarativeInputDeviceInfo::data(const QModelIndex &index, int role) const |
563 | ++{ |
564 | ++ switch (role) { |
565 | ++ case ServiceRole: |
566 | ++ return QVariant::fromValue(static_cast<QObject *>(inputDevices.value(index.row()))); |
567 | ++ } |
568 | ++ |
569 | ++ return QVariant(); |
570 | ++} |
571 | ++ |
572 | ++int QDeclarativeInputDeviceInfo::rowCount(const QModelIndex &parent) const |
573 | ++{ |
574 | ++ Q_UNUSED(parent); |
575 | ++ |
576 | ++ return inputDevices.count(); |
577 | ++} |
578 | ++ |
579 | ++int QDeclarativeInputDeviceInfo::indexOf(const QString &devicePath) const |
580 | ++{ |
581 | ++ int idx(-1); |
582 | ++ Q_FOREACH (QInputDevice *device, inputDevices) { |
583 | ++ idx++; |
584 | ++ if (device->devicePath() == devicePath) return idx; |
585 | ++ } |
586 | ++ |
587 | ++ return -1; |
588 | ++} |
589 | ++ |
590 | ++QInputDevice *QDeclarativeInputDeviceInfo::get(int index) const |
591 | ++{ |
592 | ++ if (index < 0 || index > inputDevices.count()) |
593 | ++ return 0; |
594 | ++ return inputDevices.value(index); |
595 | ++} |
596 | ++ |
597 | ++void QDeclarativeInputDeviceInfo::updateDeviceList() |
598 | ++{ |
599 | ++ QVector <QInputDevice *> newDevices = deviceInfo->deviceList(); |
600 | ++ |
601 | ++ int numNew = newDevices.count(); |
602 | ++ |
603 | ++ for (int i = 0; i < numNew; i++) { |
604 | ++ int j = inputDevices.indexOf(newDevices.value(i)); |
605 | ++ if (j == -1) { |
606 | ++ // not found -> remove from list |
607 | ++ beginInsertRows(QModelIndex(), i, i); |
608 | ++ inputDevices.insert(i, newDevices.value(i)); |
609 | ++ endInsertRows(); |
610 | ++ } else if (i != j) { |
611 | ++ // changed its position -> move it |
612 | ++ QInputDevice* device = inputDevices.value(j); |
613 | ++ beginMoveRows(QModelIndex(), j, j, QModelIndex(), i); |
614 | ++ inputDevices.remove(j); |
615 | ++ inputDevices.insert(i, device); |
616 | ++ endMoveRows(); |
617 | ++ } else { |
618 | ++ QModelIndex changedIndex(this->index(j, 0, QModelIndex())); |
619 | ++ Q_EMIT dataChanged(changedIndex, changedIndex); |
620 | ++ } |
621 | ++ } |
622 | ++ |
623 | ++ int numOld = inputDevices.count(); |
624 | ++ if (numOld > numNew) { |
625 | ++ beginRemoveRows(QModelIndex(), numNew, numOld - 1); |
626 | ++ inputDevices.remove(numNew, numOld - numNew); |
627 | ++ endRemoveRows(); |
628 | ++ } |
629 | ++} |
630 | ++ |
631 | ++void QDeclarativeInputDeviceInfo::addedDevice(const QString &devicePath) |
632 | ++{ |
633 | ++ updateDeviceList(); |
634 | ++ Q_EMIT newDevice(devicePath); |
635 | ++} |
636 | ++ |
637 | ++void QDeclarativeInputDeviceInfo::removedDevice(const QString &devicePath) |
638 | ++{ |
639 | ++ updateDeviceList(); |
640 | ++ Q_EMIT deviceRemoved(devicePath); |
641 | ++} |
642 | ++ |
643 | ++QHash<int, QByteArray> QDeclarativeInputDeviceInfo::roleNames() const |
644 | ++{ |
645 | ++ QHash<int, QByteArray> roles; |
646 | ++ roles.insert(ServiceRole, "service"); |
647 | ++ return roles; |
648 | ++} |
649 | + |
650 | +=== added file 'src/imports/systeminfo/qdeclarativeinputdeviceinfo_p.h' |
651 | +--- old/src/imports/systeminfo/qdeclarativeinputdeviceinfo_p.h 1970-01-01 00:00:00 +0000 |
652 | ++++ new/src/imports/systeminfo/qdeclarativeinputdeviceinfo_p.h 2015-02-18 12:13:36 +0000 |
653 | +@@ -0,0 +1,86 @@ |
654 | ++/**************************************************************************** |
655 | ++** |
656 | ++** Copyright (C) 2015 Jolla. |
657 | ++** Contact: http://www.qt-project.org/legal |
658 | ++** |
659 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
660 | ++** |
661 | ++** $QT_BEGIN_LICENSE:LGPL$ |
662 | ++** Commercial License Usage |
663 | ++** Licensees holding valid commercial Qt licenses may use this file in |
664 | ++** accordance with the commercial license agreement provided with the |
665 | ++** Software or, alternatively, in accordance with the terms contained in |
666 | ++** a written agreement between you and Digia. For licensing terms and |
667 | ++** conditions see http://qt.digia.com/licensing. For further information |
668 | ++** use the contact form at http://qt.digia.com/contact-us. |
669 | ++** |
670 | ++** GNU Lesser General Public License Usage |
671 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
672 | ++** General Public License version 2.1 as published by the Free Software |
673 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
674 | ++** packaging of this file. Please review the following information to |
675 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
676 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
677 | ++** |
678 | ++** In addition, as a special exception, Digia gives you certain additional |
679 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
680 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
681 | ++** |
682 | ++** GNU General Public License Usage |
683 | ++** Alternatively, this file may be used under the terms of the GNU |
684 | ++** General Public License version 3.0 as published by the Free Software |
685 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
686 | ++** packaging of this file. Please review the following information to |
687 | ++** ensure the GNU General Public License version 3.0 requirements will be |
688 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
689 | ++** |
690 | ++** |
691 | ++** $QT_END_LICENSE$ |
692 | ++** |
693 | ++****************************************************************************/ |
694 | ++ |
695 | ++#ifndef QDECLARATIVEINPUTDEVICEINFO_H |
696 | ++#define QDECLARATIVEINPUTDEVICEINFO_H |
697 | ++ |
698 | ++#include <QObject> |
699 | ++#include <QAbstractListModel> |
700 | ++#include "qinputinfo.h" |
701 | ++ |
702 | ++class QDeclarativeInputDeviceInfo : public QAbstractListModel |
703 | ++{ |
704 | ++ Q_OBJECT |
705 | ++ Q_DISABLE_COPY(QDeclarativeInputDeviceInfo) |
706 | ++ |
707 | ++public: |
708 | ++ enum ItemRoles { |
709 | ++ ServiceRole = Qt::UserRole + 1 |
710 | ++ }; |
711 | ++ |
712 | ++ explicit QDeclarativeInputDeviceInfo(QObject *parent = 0); |
713 | ++ virtual ~QDeclarativeInputDeviceInfo(); |
714 | ++ |
715 | ++ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
716 | ++ int rowCount(const QModelIndex &parent = QModelIndex()) const; |
717 | ++ |
718 | ++ QHash<int, QByteArray> roleNames() const; |
719 | ++ |
720 | ++ Q_INVOKABLE int indexOf(const QString &devicePath) const; |
721 | ++ |
722 | ++ Q_INVOKABLE QInputDevice *get(int index) const; |
723 | ++ |
724 | ++signals: |
725 | ++ void newDevice(const QString &devicePath); |
726 | ++ void deviceRemoved(const QString &devicePath); |
727 | ++ |
728 | ++public slots: |
729 | ++ void updateDeviceList(); |
730 | ++private: |
731 | ++ QInputDeviceInfo *deviceInfo; |
732 | ++ QVector<QInputDevice *> inputDevices; |
733 | ++private slots: |
734 | ++ void addedDevice(const QString &); |
735 | ++ void removedDevice(const QString &path); |
736 | ++ |
737 | ++}; |
738 | ++ |
739 | ++#endif // QDECLARATIVEINPUTDEVICEINFO_H |
740 | + |
741 | +=== modified file 'src/imports/systeminfo/qsysteminfo.cpp' |
742 | +--- old/src/imports/systeminfo/qsysteminfo.cpp 2015-02-13 06:45:19 +0000 |
743 | ++++ new/src/imports/systeminfo/qsysteminfo.cpp 2015-02-18 12:13:36 +0000 |
744 | +@@ -45,7 +45,10 @@ |
745 | + #include "qbatteryinfo.h" |
746 | + #include "qdeclarativedeviceinfo_p.h" |
747 | + #include "qdeclarativenetworkinfo_p.h" |
748 | ++#include "qdeclarativeinputdeviceinfo_p.h" |
749 | ++ |
750 | + #include <qscreensaver.h> |
751 | ++#include "qinputinfo.h" |
752 | + |
753 | + QT_BEGIN_NAMESPACE |
754 | + |
755 | +@@ -65,6 +68,8 @@ |
756 | + qmlRegisterType<QDeclarativeDeviceInfo>(uri, major, minor, "DeviceInfo"); |
757 | + qmlRegisterType<QDeclarativeNetworkInfo>(uri, major, minor, "NetworkInfo"); |
758 | + qmlRegisterType<QScreenSaver>(uri, major, minor, "ScreenSaver"); |
759 | ++ qmlRegisterType<QDeclarativeInputDeviceInfo>(uri, major, minor, "InputDeviceInfo"); |
760 | ++ qmlRegisterType<QInputDevice>(uri, major, minor, "InputInfo"); |
761 | + } |
762 | + }; |
763 | + |
764 | + |
765 | +=== modified file 'src/imports/systeminfo/systeminfo.pro' |
766 | +--- old/src/imports/systeminfo/systeminfo.pro 2015-02-13 06:45:19 +0000 |
767 | ++++ new/src/imports/systeminfo/systeminfo.pro 2015-02-18 12:13:36 +0000 |
768 | +@@ -3,11 +3,13 @@ |
769 | + |
770 | + HEADERS += \ |
771 | + qdeclarativedeviceinfo_p.h \ |
772 | +- qdeclarativenetworkinfo_p.h |
773 | ++ qdeclarativenetworkinfo_p.h \ |
774 | ++ qdeclarativeinputdeviceinfo_p.h |
775 | + |
776 | + SOURCES += \ |
777 | + qdeclarativedeviceinfo.cpp \ |
778 | + qdeclarativenetworkinfo.cpp \ |
779 | +- qsysteminfo.cpp |
780 | ++ qsysteminfo.cpp \ |
781 | ++ qdeclarativeinputdeviceinfo.cpp |
782 | + |
783 | + load(qml_plugin) |
784 | + |
785 | +=== added file 'src/systeminfo/linux/qinputdeviceinfo_linux.cpp' |
786 | +--- old/src/systeminfo/linux/qinputdeviceinfo_linux.cpp 1970-01-01 00:00:00 +0000 |
787 | ++++ new/src/systeminfo/linux/qinputdeviceinfo_linux.cpp 2015-02-18 15:35:06 +0000 |
788 | +@@ -0,0 +1,249 @@ |
789 | ++/**************************************************************************** |
790 | ++** |
791 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
792 | ++** Contact: http://www.qt-project.org/legal |
793 | ++** |
794 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
795 | ++** |
796 | ++** $QT_BEGIN_LICENSE:LGPL$ |
797 | ++** Commercial License Usage |
798 | ++** Licensees holding valid commercial Qt licenses may use this file in |
799 | ++** accordance with the commercial license agreement provided with the |
800 | ++** Software or, alternatively, in accordance with the terms contained in |
801 | ++** a written agreement between you and Digia. For licensing terms and |
802 | ++** conditions see http://qt.digia.com/licensing. For further information |
803 | ++** use the contact form at http://qt.digia.com/contact-us. |
804 | ++** |
805 | ++** GNU Lesser General Public License Usage |
806 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
807 | ++** General Public License version 2.1 as published by the Free Software |
808 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
809 | ++** packaging of this file. Please review the following information to |
810 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
811 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
812 | ++** |
813 | ++** In addition, as a special exception, Digia gives you certain additional |
814 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
815 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
816 | ++** |
817 | ++** GNU General Public License Usage |
818 | ++** Alternatively, this file may be used under the terms of the GNU |
819 | ++** General Public License version 3.0 as published by the Free Software |
820 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
821 | ++** packaging of this file. Please review the following information to |
822 | ++** ensure the GNU General Public License version 3.0 requirements will be |
823 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
824 | ++** |
825 | ++** |
826 | ++** $QT_END_LICENSE$ |
827 | ++** |
828 | ++****************************************************************************/ |
829 | ++ |
830 | ++#include "qinputdeviceinfo_linux_p.h" |
831 | ++ |
832 | ++#include <libudev.h> |
833 | ++#include <libevdev/libevdev.h> |
834 | ++#include <fcntl.h> |
835 | ++#include <QDebug> |
836 | ++#include <QSocketNotifier> |
837 | ++#include <QTimer> |
838 | ++ |
839 | ++QInputDeviceInfoPrivate::QInputDeviceInfoPrivate(QObject *parent) : |
840 | ++ QObject(parent) |
841 | ++ , udev(0) |
842 | ++{ |
843 | ++ QTimer::singleShot(250,this,SLOT(init())); |
844 | ++} |
845 | ++ |
846 | ++void QInputDeviceInfoPrivate::init() |
847 | ++{ |
848 | ++ if (!udev) |
849 | ++ udev = udev_new(); |
850 | ++ |
851 | ++ struct udev_list_entry *devices, *dev_list_entry; |
852 | ++ struct udev_device *dev; |
853 | ++ |
854 | ++ QString subsystem = QStringLiteral("input"); |
855 | ++ struct udev_enumerate *enumerate = 0; |
856 | ++ |
857 | ++ if (udev) { |
858 | ++ |
859 | ++ udevMonitor = udev_monitor_new_from_netlink(udev, "udev"); |
860 | ++ udev_monitor_filter_add_match_subsystem_devtype(udevMonitor, subsystem.toLatin1(), NULL); |
861 | ++ enumerate = udev_enumerate_new(udev); |
862 | ++ udev_enumerate_add_match_subsystem(enumerate, subsystem.toLatin1()); |
863 | ++ |
864 | ++ |
865 | ++ udev_monitor_enable_receiving(udevMonitor); |
866 | ++ notifierFd = udev_monitor_get_fd(udevMonitor); |
867 | ++ |
868 | ++ notifier = new QSocketNotifier(notifierFd, QSocketNotifier::Read, this); |
869 | ++ connect(notifier, SIGNAL(activated(int)), this, SLOT(onUDevChanges())); |
870 | ++ |
871 | ++ |
872 | ++ udev_enumerate_scan_devices(enumerate); |
873 | ++ devices = udev_enumerate_get_list_entry(enumerate); |
874 | ++ |
875 | ++ udev_list_entry_foreach(dev_list_entry, devices) { |
876 | ++ const char *path; |
877 | ++ path = udev_list_entry_get_name(dev_list_entry); |
878 | ++ |
879 | ++ dev = udev_device_new_from_syspath(udev, path); |
880 | ++ |
881 | ++ QString eventPath = QString::fromLatin1(udev_device_get_sysname(dev)); |
882 | ++ |
883 | ++ if (qstrcmp(udev_device_get_subsystem(dev), "input") == 0 ) { |
884 | ++ |
885 | ++ if (eventPath.contains(QStringLiteral("event"))) { |
886 | ++ eventPath.prepend(QStringLiteral("/dev/input/")); |
887 | ++ |
888 | ++ QInputDevice *iDevice = addDevice(eventPath); |
889 | ++ if (!iDevice) |
890 | ++ continue; |
891 | ++ |
892 | ++ qDebug() << "*** ADDING DEVICE" << eventPath; |
893 | ++ |
894 | ++ iDevice->setTypes(getInputTypes(dev)); |
895 | ++ |
896 | ++ if (iDevice->switches().count() > 0 && iDevice->buttons().count() == 0) |
897 | ++ iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Switch); |
898 | ++ |
899 | ++ if (iDevice->buttons().count() > 0 && iDevice->types() == QInputDeviceInfo::Unknown) |
900 | ++ iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Button); |
901 | ++ |
902 | ++ deviceList.append(iDevice); |
903 | ++ deviceMap.insert(eventPath,iDevice); |
904 | ++ Q_EMIT newDevice(eventPath); |
905 | ++ |
906 | ++ } |
907 | ++ } |
908 | ++ } |
909 | ++ udev_enumerate_unref(enumerate); |
910 | ++ } |
911 | ++ Q_EMIT ready(); |
912 | ++} |
913 | ++ |
914 | ++QInputDeviceInfo::InputTypes QInputDeviceInfoPrivate::getInputTypes( struct udev_device *dev) |
915 | ++{ |
916 | ++ qDebug() << "******* have input type Keyboard" << udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"); |
917 | ++ qDebug() << "******* have input type Mouse" << udev_device_get_property_value(dev, "ID_INPUT_MOUSE"); |
918 | ++ qDebug() << "******* have input type Touchpad" << udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD"); |
919 | ++ qDebug() << "******* have input type Touchscreen" << udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"); |
920 | ++ qDebug() << "******* have input type Tablet" << udev_device_get_property_value(dev, "ID_INPUT_TABLET"); |
921 | ++ qDebug() << "******* have input type joystick" << udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"); |
922 | ++ QInputDeviceInfo::InputTypes types = QInputDeviceInfo::Unknown; |
923 | ++ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 ) |
924 | ++ types |= QInputDeviceInfo::Keyboard; |
925 | ++ |
926 | ++ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_MOUSE"), "1") == 0) |
927 | ++ types |= QInputDeviceInfo::Mouse; |
928 | ++ |
929 | ++ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD"), "1") == 0) |
930 | ++ types |= QInputDeviceInfo::TouchPad; |
931 | ++ |
932 | ++ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"), "1") == 0 |
933 | ++ || qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TABLET"), "1") == 0) |
934 | ++ types |= QInputDeviceInfo::TouchScreen; |
935 | ++ |
936 | ++ return types; |
937 | ++} |
938 | ++ |
939 | ++QInputDevice *QInputDeviceInfoPrivate::addDevice(const QString &path) |
940 | ++{ |
941 | ++ QInputDevice *inputDevice = new QInputDevice(this); |
942 | ++ |
943 | ++ struct libevdev *dev = NULL; |
944 | ++ int fd; |
945 | ++ int rc = 1; |
946 | ++ fd = open(path.toLatin1(), O_RDONLY|O_NONBLOCK); |
947 | ++ |
948 | ++ if (fd == -1) { |
949 | ++ qDebug() << "Failed to open"; |
950 | ++ return inputDevice; |
951 | ++ } |
952 | ++ rc = libevdev_new_from_fd(fd, &dev); |
953 | ++ if (rc < 0) { |
954 | ++ qDebug() << "Failed to init libevdev ("<< strerror(-rc) << ")"; |
955 | ++ return inputDevice; |
956 | ++ } |
957 | ++ |
958 | ++ inputDevice->setName(QString::fromLatin1(libevdev_get_name(dev))); |
959 | ++ inputDevice->setDevicePath(path); |
960 | ++ for (int i = 0; i < EV_MAX; i++) { |
961 | ++ if (i == EV_KEY || i == EV_SW || i == EV_REL |
962 | ++ || i == EV_REL || i == EV_ABS) { |
963 | ++ for (int j = 0; j < libevdev_event_type_get_max(i); j++) { |
964 | ++ if (libevdev_has_event_code(dev, i, j)) { |
965 | ++ switch (i) { |
966 | ++ case EV_KEY: |
967 | ++ inputDevice->addButton(j); |
968 | ++ break; |
969 | ++ case EV_SW: |
970 | ++ inputDevice->addSwitch(j); |
971 | ++ break; |
972 | ++ case EV_REL: |
973 | ++ inputDevice->addRelativeAxis(j); |
974 | ++ break; |
975 | ++ case EV_ABS: |
976 | ++ inputDevice->addAbsoluteAxis(j); |
977 | ++ break; |
978 | ++ }; |
979 | ++ } |
980 | ++ } |
981 | ++ } |
982 | ++ } |
983 | ++ return inputDevice; |
984 | ++} |
985 | ++ |
986 | ++void QInputDeviceInfoPrivate::removeDevice(const QString &path) |
987 | ++{ |
988 | ++ for (int i = 0; i < deviceList.size(); ++i) { |
989 | ++ if (deviceList.at(i)->devicePath() == path) { |
990 | ++ delete deviceList.takeAt(i); |
991 | ++ deviceMap.remove(path); |
992 | ++ Q_EMIT deviceRemoved(path); |
993 | ++ } |
994 | ++ } |
995 | ++} |
996 | ++ |
997 | ++void QInputDeviceInfoPrivate::onUDevChanges() |
998 | ++{ |
999 | ++ struct udev_device *dev = udev_monitor_receive_device(udevMonitor); |
1000 | ++ if (dev) { |
1001 | ++ if (qstrcmp(udev_device_get_subsystem(dev), "input") == 0 ) { |
1002 | ++ QString eventPath = QString::fromLatin1(udev_device_get_sysname(dev)); |
1003 | ++ |
1004 | ++ if (eventPath.contains(QStringLiteral("input"))) |
1005 | ++ return; |
1006 | ++ |
1007 | ++ QString action = QString::fromStdString(udev_device_get_action(dev)); |
1008 | ++ |
1009 | ++ if (!eventPath.contains(QStringLiteral("/dev/input/"))) |
1010 | ++ eventPath.prepend(QStringLiteral("/dev/input/")); |
1011 | ++ |
1012 | ++ if (action == QStringLiteral("add")) { |
1013 | ++ |
1014 | ++ QInputDevice *iDevice = addDevice(eventPath); |
1015 | ++ if (!iDevice) |
1016 | ++ return; |
1017 | ++ |
1018 | ++ iDevice->setTypes(getInputTypes(dev)); |
1019 | ++ udev_device_unref(dev); |
1020 | ++ |
1021 | ++ if (iDevice->switches().count() > 0 && iDevice->buttons().count() == 0) |
1022 | ++ iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Switch); |
1023 | ++ |
1024 | ++ if (iDevice->buttons().count() > 0 && iDevice->types() == QInputDeviceInfo::Unknown) |
1025 | ++ iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Button); |
1026 | ++ |
1027 | ++ deviceList.append(iDevice); |
1028 | ++ deviceMap.insert(eventPath,iDevice); |
1029 | ++ |
1030 | ++ Q_EMIT newDevice(eventPath); |
1031 | ++ |
1032 | ++ } else if (action == QStringLiteral("remove")) { |
1033 | ++ removeDevice(eventPath); |
1034 | ++ } |
1035 | ++ } |
1036 | ++ } |
1037 | ++} |
1038 | + |
1039 | +=== added file 'src/systeminfo/linux/qinputdeviceinfo_linux_p.h' |
1040 | +--- old/src/systeminfo/linux/qinputdeviceinfo_linux_p.h 1970-01-01 00:00:00 +0000 |
1041 | ++++ new/src/systeminfo/linux/qinputdeviceinfo_linux_p.h 2015-02-18 13:36:29 +0000 |
1042 | +@@ -0,0 +1,91 @@ |
1043 | ++/**************************************************************************** |
1044 | ++** |
1045 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
1046 | ++** Contact: http://www.qt-project.org/legal |
1047 | ++** |
1048 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
1049 | ++** |
1050 | ++** $QT_BEGIN_LICENSE:LGPL$ |
1051 | ++** Commercial License Usage |
1052 | ++** Licensees holding valid commercial Qt licenses may use this file in |
1053 | ++** accordance with the commercial license agreement provided with the |
1054 | ++** Software or, alternatively, in accordance with the terms contained in |
1055 | ++** a written agreement between you and Digia. For licensing terms and |
1056 | ++** conditions see http://qt.digia.com/licensing. For further information |
1057 | ++** use the contact form at http://qt.digia.com/contact-us. |
1058 | ++** |
1059 | ++** GNU Lesser General Public License Usage |
1060 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
1061 | ++** General Public License version 2.1 as published by the Free Software |
1062 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
1063 | ++** packaging of this file. Please review the following information to |
1064 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
1065 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
1066 | ++** |
1067 | ++** In addition, as a special exception, Digia gives you certain additional |
1068 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
1069 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
1070 | ++** |
1071 | ++** GNU General Public License Usage |
1072 | ++** Alternatively, this file may be used under the terms of the GNU |
1073 | ++** General Public License version 3.0 as published by the Free Software |
1074 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
1075 | ++** packaging of this file. Please review the following information to |
1076 | ++** ensure the GNU General Public License version 3.0 requirements will be |
1077 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
1078 | ++** |
1079 | ++** |
1080 | ++** $QT_END_LICENSE$ |
1081 | ++** |
1082 | ++****************************************************************************/ |
1083 | ++ |
1084 | ++#ifndef QINPUTDEVICEINFO_LINUX_P_H |
1085 | ++#define QINPUTDEVICEINFO_LINUX_P_H |
1086 | ++ |
1087 | ++#include <QObject> |
1088 | ++#include "qinputinfo.h" |
1089 | ++#include <libudev.h> |
1090 | ++ |
1091 | ++class QInputDevicePrivate : public QObject |
1092 | ++{ |
1093 | ++ Q_OBJECT |
1094 | ++public: |
1095 | ++ explicit QInputDevicePrivate(QObject *parent = 0); |
1096 | ++ |
1097 | ++ QString name; |
1098 | ++ QString devicePath; |
1099 | ++ QList <int> buttons; //keys |
1100 | ++ QList <int> switches; |
1101 | ++ QList <int> relativeAxis; |
1102 | ++ QList <int> absoluteAxis; |
1103 | ++ QInputDeviceInfo::InputTypes types; |
1104 | ++}; |
1105 | ++ |
1106 | ++class QInputDeviceInfoPrivate : public QObject |
1107 | ++{ |
1108 | ++ Q_OBJECT |
1109 | ++public: |
1110 | ++ explicit QInputDeviceInfoPrivate(QObject *parent = 0); |
1111 | ++ QVector <QInputDevice *> deviceList; |
1112 | ++ QMap <QString, QInputDevice *> deviceMap; |
1113 | ++ |
1114 | ++signals: |
1115 | ++ void newDevice(const QString &); |
1116 | ++ void deviceRemoved(const QString &); |
1117 | ++ void ready(); |
1118 | ++ |
1119 | ++private: |
1120 | ++ struct udev *udev; |
1121 | ++ QInputDevice *addDevice(const QString &path); |
1122 | ++ void removeDevice(const QString &path); |
1123 | ++ QSocketNotifier *notifier; |
1124 | ++ int notifierFd; |
1125 | ++ struct udev_monitor *udevMonitor; |
1126 | ++ QInputDeviceInfo::InputTypes getInputTypes( struct udev_device *); |
1127 | ++ |
1128 | ++private Q_SLOTS: |
1129 | ++ void onUDevChanges(); |
1130 | ++ void init(); |
1131 | ++}; |
1132 | ++ |
1133 | ++#endif // QINPUTDEVICEINFO_LINUX_P_H |
1134 | + |
1135 | +=== added file 'src/systeminfo/qinputinfo.cpp' |
1136 | +--- old/src/systeminfo/qinputinfo.cpp 1970-01-01 00:00:00 +0000 |
1137 | ++++ new/src/systeminfo/qinputinfo.cpp 2015-02-18 15:30:58 +0000 |
1138 | +@@ -0,0 +1,159 @@ |
1139 | ++/**************************************************************************** |
1140 | ++** |
1141 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
1142 | ++** Contact: http://www.qt-project.org/legal |
1143 | ++** |
1144 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
1145 | ++** |
1146 | ++** $QT_BEGIN_LICENSE:LGPL$ |
1147 | ++** Commercial License Usage |
1148 | ++** Licensees holding valid commercial Qt licenses may use this file in |
1149 | ++** accordance with the commercial license agreement provided with the |
1150 | ++** Software or, alternatively, in accordance with the terms contained in |
1151 | ++** a written agreement between you and Digia. For licensing terms and |
1152 | ++** conditions see http://qt.digia.com/licensing. For further information |
1153 | ++** use the contact form at http://qt.digia.com/contact-us. |
1154 | ++** |
1155 | ++** GNU Lesser General Public License Usage |
1156 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
1157 | ++** General Public License version 2.1 as published by the Free Software |
1158 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
1159 | ++** packaging of this file. Please review the following information to |
1160 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
1161 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
1162 | ++** |
1163 | ++** In addition, as a special exception, Digia gives you certain additional |
1164 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
1165 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
1166 | ++** |
1167 | ++** GNU General Public License Usage |
1168 | ++** Alternatively, this file may be used under the terms of the GNU |
1169 | ++** General Public License version 3.0 as published by the Free Software |
1170 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
1171 | ++** packaging of this file. Please review the following information to |
1172 | ++** ensure the GNU General Public License version 3.0 requirements will be |
1173 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
1174 | ++** |
1175 | ++** |
1176 | ++** $QT_END_LICENSE$ |
1177 | ++** |
1178 | ++****************************************************************************/ |
1179 | ++ |
1180 | ++#include "qinputinfo.h" |
1181 | ++ |
1182 | ++#if defined(Q_OS_LINUX) |
1183 | ++#include "linux/qinputdeviceinfo_linux_p.h" |
1184 | ++#endif |
1185 | ++ |
1186 | ++QT_BEGIN_NAMESPACE |
1187 | ++ |
1188 | ++ |
1189 | ++QInputDevicePrivate::QInputDevicePrivate(QObject *parent) : |
1190 | ++ QObject(parent), |
1191 | ++ types(QInputDeviceInfo::Unknown) |
1192 | ++{ |
1193 | ++} |
1194 | ++ |
1195 | ++QInputDevice::QInputDevice(QObject *parent) : |
1196 | ++ QObject(parent), |
1197 | ++ d_ptr(new QInputDevicePrivate(this)) |
1198 | ++{ |
1199 | ++} |
1200 | ++ |
1201 | ++QString QInputDevice::name() const |
1202 | ++{ |
1203 | ++ return d_ptr->name; |
1204 | ++} |
1205 | ++ |
1206 | ++void QInputDevice::setName(const QString &name) |
1207 | ++{ |
1208 | ++ d_ptr->name = name; |
1209 | ++} |
1210 | ++ |
1211 | ++QString QInputDevice::devicePath() const |
1212 | ++{ |
1213 | ++ return d_ptr->devicePath; |
1214 | ++} |
1215 | ++ |
1216 | ++void QInputDevice::setDevicePath(const QString &path) |
1217 | ++{ |
1218 | ++ d_ptr->devicePath = path; |
1219 | ++} |
1220 | ++ |
1221 | ++QList <int> QInputDevice::buttons() const |
1222 | ++{ |
1223 | ++ return d_ptr->buttons; |
1224 | ++} |
1225 | ++ |
1226 | ++void QInputDevice::addButton(int buttonCode) |
1227 | ++{ |
1228 | ++ d_ptr->buttons.append(buttonCode); |
1229 | ++} |
1230 | ++ |
1231 | ++QList <int> QInputDevice::switches() const |
1232 | ++{ |
1233 | ++ return d_ptr->switches; |
1234 | ++} |
1235 | ++ |
1236 | ++void QInputDevice::addSwitch(int switchCode) |
1237 | ++{ |
1238 | ++ d_ptr->switches.append(switchCode); |
1239 | ++} |
1240 | ++ |
1241 | ++QList <int> QInputDevice::relativeAxis() const |
1242 | ++{ |
1243 | ++ return d_ptr->relativeAxis; |
1244 | ++} |
1245 | ++ |
1246 | ++void QInputDevice::addRelativeAxis(int axisCode) |
1247 | ++{ |
1248 | ++ d_ptr->relativeAxis.append(axisCode); |
1249 | ++} |
1250 | ++ |
1251 | ++QList <int> QInputDevice::absoluteAxis() const |
1252 | ++{ |
1253 | ++ return d_ptr->absoluteAxis; |
1254 | ++} |
1255 | ++ |
1256 | ++void QInputDevice::addAbsoluteAxis(int axisCode) |
1257 | ++{ |
1258 | ++ d_ptr->absoluteAxis.append(axisCode); |
1259 | ++} |
1260 | ++ |
1261 | ++QInputDeviceInfo::InputTypes QInputDevice::types() |
1262 | ++{ |
1263 | ++ return d_ptr->types; |
1264 | ++} |
1265 | ++ |
1266 | ++void QInputDevice::setTypes(QInputDeviceInfo::InputTypes types) |
1267 | ++{ |
1268 | ++ d_ptr->types = types; |
1269 | ++} |
1270 | ++ |
1271 | ++ |
1272 | ++QInputDeviceInfo::QInputDeviceInfo(QObject *parent) : |
1273 | ++ QObject(parent), |
1274 | ++ d_ptr(new QInputDeviceInfoPrivate(this)) |
1275 | ++{ |
1276 | ++ connect(d_ptr, &QInputDeviceInfoPrivate::newDevice,this,&QInputDeviceInfo::addedDevice); |
1277 | ++ connect(d_ptr, &QInputDeviceInfoPrivate::deviceRemoved,this,&QInputDeviceInfo::deviceRemoved); |
1278 | ++ |
1279 | ++ connect(d_ptr,SIGNAL(ready()),this,SIGNAL(ready())); |
1280 | ++} |
1281 | ++ |
1282 | ++QVector <QInputDevice *> QInputDeviceInfo::deviceList() |
1283 | ++{ |
1284 | ++ return d_ptr->deviceList; |
1285 | ++} |
1286 | ++ |
1287 | ++QMap <QString, QInputDevice *> QInputDeviceInfo::deviceMap() |
1288 | ++{ |
1289 | ++ return d_ptr->deviceMap; |
1290 | ++} |
1291 | ++ |
1292 | ++void QInputDeviceInfo::addedDevice(const QString & devicePath) |
1293 | ++{ |
1294 | ++ Q_EMIT deviceAdded(devicePath); |
1295 | ++} |
1296 | ++ |
1297 | ++QT_END_NAMESPACE |
1298 | + |
1299 | +=== added file 'src/systeminfo/qinputinfo.h' |
1300 | +--- old/src/systeminfo/qinputinfo.h 1970-01-01 00:00:00 +0000 |
1301 | ++++ new/src/systeminfo/qinputinfo.h 2015-02-18 16:44:32 +0000 |
1302 | +@@ -0,0 +1,144 @@ |
1303 | ++/**************************************************************************** |
1304 | ++** |
1305 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
1306 | ++** Contact: http://www.qt-project.org/legal |
1307 | ++** |
1308 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
1309 | ++** |
1310 | ++** $QT_BEGIN_LICENSE:LGPL$ |
1311 | ++** Commercial License Usage |
1312 | ++** Licensees holding valid commercial Qt licenses may use this file in |
1313 | ++** accordance with the commercial license agreement provided with the |
1314 | ++** Software or, alternatively, in accordance with the terms contained in |
1315 | ++** a written agreement between you and Digia. For licensing terms and |
1316 | ++** conditions see http://qt.digia.com/licensing. For further information |
1317 | ++** use the contact form at http://qt.digia.com/contact-us. |
1318 | ++** |
1319 | ++** GNU Lesser General Public License Usage |
1320 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
1321 | ++** General Public License version 2.1 as published by the Free Software |
1322 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
1323 | ++** packaging of this file. Please review the following information to |
1324 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
1325 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
1326 | ++** |
1327 | ++** In addition, as a special exception, Digia gives you certain additional |
1328 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
1329 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
1330 | ++** |
1331 | ++** GNU General Public License Usage |
1332 | ++** Alternatively, this file may be used under the terms of the GNU |
1333 | ++** General Public License version 3.0 as published by the Free Software |
1334 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
1335 | ++** packaging of this file. Please review the following information to |
1336 | ++** ensure the GNU General Public License version 3.0 requirements will be |
1337 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
1338 | ++** |
1339 | ++** |
1340 | ++** $QT_END_LICENSE$ |
1341 | ++** |
1342 | ++****************************************************************************/ |
1343 | ++ |
1344 | ++#ifndef QINPUTINFO_H |
1345 | ++#define QINPUTINFO_H |
1346 | ++ |
1347 | ++#include <QtSystemInfo/qsysteminfoglobal.h> |
1348 | ++#include <QObject> |
1349 | ++#include <QVector> |
1350 | ++#include <QMap> |
1351 | ++#include <QSocketNotifier> |
1352 | ++#include <QDebug> |
1353 | ++ |
1354 | ++class QInputDeviceInfoPrivate; |
1355 | ++class QInputDevicePrivate; |
1356 | ++class QInputDevice; |
1357 | ++ |
1358 | ++class QInputDeviceInfoPrivate; |
1359 | ++class Q_SYSTEMINFO_EXPORT QInputDeviceInfo : public QObject |
1360 | ++{ |
1361 | ++ Q_OBJECT |
1362 | ++ Q_PROPERTY(int deviceCount READ deviceCount) |
1363 | ++public: |
1364 | ++ |
1365 | ++ enum InputType { |
1366 | ++ Unknown = 0, |
1367 | ++ Button = 1, |
1368 | ++ Mouse = 2, |
1369 | ++ TouchPad = 4, |
1370 | ++ TouchScreen = 8, |
1371 | ++ Keyboard = 16, |
1372 | ++ Switch = 32 |
1373 | ++ }; |
1374 | ++ Q_ENUMS(InputType) |
1375 | ++ Q_FLAGS(InputTypes) |
1376 | ++ Q_DECLARE_FLAGS(InputTypes, InputType) |
1377 | ++ |
1378 | ++ explicit QInputDeviceInfo(QObject *parent = 0); |
1379 | ++ |
1380 | ++ Q_INVOKABLE QVector <QInputDevice *> deviceList(); |
1381 | ++ |
1382 | ++ Q_INVOKABLE QMap <QString, QInputDevice *> deviceMap(); |
1383 | ++ int deviceCount() { return deviceList().count(); } |
1384 | ++signals: |
1385 | ++ |
1386 | ++ void deviceAdded(const QString & devicePath); |
1387 | ++ void deviceRemoved(const QString & devicePath); |
1388 | ++ |
1389 | ++ void ready(); |
1390 | ++ |
1391 | ++public slots: |
1392 | ++ void addedDevice(const QString & devicePath); |
1393 | ++ |
1394 | ++private: |
1395 | ++ Q_DISABLE_COPY(QInputDeviceInfo) |
1396 | ++#if !defined(QT_SIMULATOR) |
1397 | ++ QInputDeviceInfoPrivate *const d_ptr; |
1398 | ++ Q_DECLARE_PRIVATE(QInputDeviceInfo) |
1399 | ++#endif |
1400 | ++}; |
1401 | ++ |
1402 | ++class Q_SYSTEMINFO_EXPORT QInputDevice : public QObject |
1403 | ++{ |
1404 | ++ friend class QInputDeviceInfoPrivate; |
1405 | ++ Q_OBJECT |
1406 | ++ Q_ENUMS(InputType) |
1407 | ++ Q_FLAGS(InputTypes) |
1408 | ++ Q_PROPERTY(QString name READ name NOTIFY nameChanged) |
1409 | ++ Q_PROPERTY(QString devicePath READ devicePath NOTIFY devicePathChanged) |
1410 | ++ Q_PROPERTY(QList <int> buttons READ buttons NOTIFY buttonsChanged) |
1411 | ++ Q_PROPERTY(QList <int> switches READ switches NOTIFY switchesChanged) |
1412 | ++ Q_PROPERTY(QList <int> relativeAxis READ relativeAxis NOTIFY relativeAxisChanged) |
1413 | ++ Q_PROPERTY(QList <int> absoluteAxis READ absoluteAxis NOTIFY absoluteAxisChanged) |
1414 | ++ Q_PROPERTY(QInputDeviceInfo::InputTypes types READ types NOTIFY typesChanged) |
1415 | ++ |
1416 | ++public: |
1417 | ++ explicit QInputDevice(QObject *parent = 0); |
1418 | ++ |
1419 | ++ QString name() const; |
1420 | ++ QString devicePath() const; |
1421 | ++ QList <int> buttons() const; //keys event code |
1422 | ++ QList <int> switches() const; |
1423 | ++ QList <int> relativeAxis() const; |
1424 | ++ QList <int> absoluteAxis() const; |
1425 | ++ |
1426 | ++ QInputDeviceInfo::InputTypes types(); |
1427 | ++signals: |
1428 | ++ void nameChanged(); |
1429 | ++ void devicePathChanged(); |
1430 | ++ void buttonsChanged(); |
1431 | ++ void switchesChanged(); |
1432 | ++ void relativeAxisChanged(); |
1433 | ++ void absoluteAxisChanged(); |
1434 | ++ void typesChanged(); |
1435 | ++private: |
1436 | ++ QInputDevicePrivate *d_ptr; |
1437 | ++ void setName(const QString &); |
1438 | ++ void setDevicePath(const QString &); |
1439 | ++ void addButton(int); |
1440 | ++ void addSwitch(int); |
1441 | ++ void addRelativeAxis(int); |
1442 | ++ void addAbsoluteAxis(int); |
1443 | ++ void setTypes(QInputDeviceInfo::InputTypes); |
1444 | ++}; |
1445 | ++ |
1446 | ++#endif // QINPUTINFO_H |
1447 | + |
1448 | +=== modified file 'src/systeminfo/systeminfo.pro' |
1449 | +--- old/src/systeminfo/systeminfo.pro 2015-02-13 06:45:19 +0000 |
1450 | ++++ new/src/systeminfo/systeminfo.pro 2015-02-18 12:13:36 +0000 |
1451 | +@@ -11,7 +11,9 @@ |
1452 | + SOURCES += qdeviceinfo.cpp \ |
1453 | + qscreensaver.cpp \ |
1454 | + qbatteryinfo.cpp \ |
1455 | +- qnetworkinfo.cpp |
1456 | ++ qnetworkinfo.cpp \ |
1457 | ++ qinputinfo.cpp \ |
1458 | ++ linux/qinputdeviceinfo_linux.cpp |
1459 | + |
1460 | + win32: !simulator: { |
1461 | + # Wbemidl.h violates C/C++ strict strings |
1462 | +@@ -116,9 +118,13 @@ |
1463 | + SOURCES += linux/qbatteryinfo_linux.cpp |
1464 | + } |
1465 | + |
1466 | ++CONFIG += link_pkgconfig |
1467 | ++PKGCONFIG += libudev libevdev |
1468 | ++LIBS += -ludev -levdev |
1469 | ++ |
1470 | + config_udev { |
1471 | + CONFIG += link_pkgconfig |
1472 | +- PKGCONFIG += udev |
1473 | ++ PKGCONFIG += libudev |
1474 | + LIBS += -ludev |
1475 | + PRIVATE_HEADERS += linux/qudevwrapper_p.h |
1476 | + SOURCES += linux/qudevwrapper.cpp |
1477 | +@@ -225,7 +231,9 @@ |
1478 | + |
1479 | + QMAKE_DOCS = $$PWD/../../doc/config/systeminfo/qtsysteminfo.qdocconf |
1480 | + |
1481 | +-HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS |
1482 | ++HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS \ |
1483 | ++ qinputinfo.h \ |
1484 | ++ linux/qinputdeviceinfo_linux_p.h |
1485 | + load(qt_module) |
1486 | + |
1487 | + # This must be done after loading qt_module.prf |
1488 | +@@ -242,3 +250,6 @@ |
1489 | + } |
1490 | + } |
1491 | + |
1492 | ++OTHER_FILES += \ |
1493 | ++ notes.txt |
1494 | ++ |
1495 | + |
1496 | +=== modified file 'tests/auto/systeminfo/systeminfo.pro' |
1497 | +--- old/tests/auto/systeminfo/systeminfo.pro 2015-02-13 06:45:19 +0000 |
1498 | ++++ new/tests/auto/systeminfo/systeminfo.pro 2015-02-18 12:13:36 +0000 |
1499 | +@@ -3,4 +3,5 @@ |
1500 | + SUBDIRS = \ |
1501 | + qdeviceinfo \ |
1502 | + qscreensaver \ |
1503 | +- qbatteryinfo |
1504 | ++ qbatteryinfo \ |
1505 | ++# qinputdeviceinfo |
1506 | + |
1507 | |
1508 | === modified file 'debian/patches/series' |
1509 | --- debian/patches/series 2015-02-13 06:45:19 +0000 |
1510 | +++ debian/patches/series 2015-02-18 17:03:28 +0000 |
1511 | @@ -1,2 +1,4 @@ |
1512 | build_with_udisk.patch |
1513 | skip_failing_tests.patch |
1514 | +inputinfo.patch |
1515 | + |
1516 | |
1517 | === modified file 'debian/qtsystems5-dev.install' |
1518 | --- debian/qtsystems5-dev.install 2015-02-13 06:45:19 +0000 |
1519 | +++ debian/qtsystems5-dev.install 2015-02-18 17:03:28 +0000 |
1520 | @@ -39,6 +39,9 @@ |
1521 | usr/include/*/qt5/QtSystemInfo/qscreensaver.h |
1522 | usr/include/*/qt5/QtSystemInfo/qsysteminfoglobal.h |
1523 | usr/include/*/qt5/QtSystemInfo/qtsysteminfoversion.h |
1524 | +usr/include/*/qt5/QtSystemInfo/QInputDeviceInfo |
1525 | +usr/include/*/qt5/QtSystemInfo/QInputDevice |
1526 | +usr/include/*/qt5/QtSystemInfo/qinputinfo.h |
1527 | usr/lib/*/cmake/* |
1528 | usr/lib/*/libQt5PublishSubscribe.prl |
1529 | usr/lib/*/libQt5PublishSubscribe.so |
1530 | |
1531 | === modified file 'debian/qtsystems5-examples.install' |
1532 | --- debian/qtsystems5-examples.install 2015-02-13 06:45:19 +0000 |
1533 | +++ debian/qtsystems5-examples.install 2015-02-18 17:03:28 +0000 |
1534 | @@ -2,3 +2,5 @@ |
1535 | usr/lib/*/qt5/examples/sysinfo/qml-battery/qml-battery.qml |
1536 | usr/lib/*/qt5/examples/systeminfo/qml-deviceinfo/qml-deviceinfo |
1537 | usr/lib/*/qt5/examples/systeminfo/qml-deviceinfo/qml-deviceinfo.qml |
1538 | +usr/lib/*/qt5/examples/sysinfo/qml-inputinfo/qml-inputinfo |
1539 | +usr/lib/*/qt5/examples/sysinfo/qml-inputinfo/qml-inputinfo.qml |
1540 | |
1541 | === modified file 'debian/qtsystems5-private-dev.install' |
1542 | --- debian/qtsystems5-private-dev.install 2015-02-13 06:45:19 +0000 |
1543 | +++ debian/qtsystems5-private-dev.install 2015-02-18 17:03:28 +0000 |
1544 | @@ -54,3 +54,5 @@ |
1545 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qsysteminfoglobal_p.h |
1546 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qudevwrapper_p.h |
1547 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qwmihelper_win_p.h |
1548 | +usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qinputdeviceinfo_linux_p.h |
1549 | + |
1550 | |
1551 | === modified file 'debian/rules' |
1552 | --- debian/rules 2015-02-13 06:45:19 +0000 |
1553 | +++ debian/rules 2015-02-18 17:03:28 +0000 |
1554 | @@ -30,5 +30,5 @@ |
1555 | dh_install --fail-missing |
1556 | |
1557 | override_dh_auto_test: |
1558 | - export LD_LIBRARY_PATH=$(CURDIR)/lib |
1559 | - cd tests/auto/ && ( test -e Makefile || qmake auto.pro -o Makefile ) && make -f Makefile check |
1560 | + [ ! -d $(CURDIR)/home ] && mkdir $(CURDIR)/home |
1561 | + cd tests/auto/ && ( test -e Makefile || qmake auto.pro -o Makefile ) && env LD_LIBRARY_PATH=$(CURDIR)/lib HOME=$(CURDIR)/home make -f Makefile check |
I think we are going to move to a new upstream snapshot (it was requested by seb128 and kenvandine), I have already committed that to lp:~kubuntu-packagers/kubuntu-packaging/qtsystems-opensource-src.
Also, we can't remove qstorageinfo right now because it was added to qtbase only in 5.4 which we don't have yet (and ubuntu- system- settings uses that class).