Merge lp:~mzanetti/ubuntu/vivid/qtsystems-opensource-src/inputinfo into lp:ubuntu/vivid/qtsystems-opensource-src
- Vivid (15.04)
- inputinfo
- Merge into vivid
Proposed by
kevin gunn
Status: | Superseded |
---|---|
Proposed branch: | lp:~mzanetti/ubuntu/vivid/qtsystems-opensource-src/inputinfo |
Merge into: | lp:ubuntu/vivid/qtsystems-opensource-src |
Diff against target: |
4548 lines (+4434/-19) 9 files modified
debian/control (+3/-0) debian/patches/inputinfo.patch (+1699/-0) debian/patches/remove-storageinfo-examples.patch (+342/-0) debian/patches/remove-storageinfo.patch (+2371/-0) debian/patches/series (+3/-0) debian/qtsystems5-dev.install (+3/-2) debian/qtsystems5-examples.install (+2/-4) debian/qtsystems5-private-dev.install (+1/-3) debian/rules (+10/-10) |
To merge this branch: | bzr merge lp:~mzanetti/ubuntu/vivid/qtsystems-opensource-src/inputinfo |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu branches | Pending | ||
Review via email: mp+248397@code.launchpad.net |
This proposal has been superseded by a proposal from 2015-02-03.
Commit message
Qt input info for mouse & keyboard detection
Description of the change
Qt input info for mouse & keyboard detection
To post a comment you must log in.
- 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 2014-10-28 07:06:50 +0000 |
3 | +++ debian/control 2015-02-03 15:58:39 +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.3.2~), |
10 | + libudev-dev, |
11 | + pkg-config, |
12 | pkg-kde-tools, |
13 | qtbase5-private-dev (>= 5.3.2~), |
14 | qtdeclarative5-private-dev (>= 5.3.2~), |
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-03 15:58:39 +0000 |
19 | @@ -0,0 +1,1699 @@ |
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-03 15:48:27 +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-03 15:48:27 +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() << "type" << device->type(); |
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-03 15:48:27 +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-03 15:48:27 +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-03 15:48:27 +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-03 15:48:27 +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-03 15:48:27 +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-03 15:48:27 +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-03 15:48:03 +0000 |
441 | ++++ new/examples/systeminfo/systeminfo.pro 2015-02-03 15:48:27 +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-03 15:48:03 +0000 |
456 | ++++ new/src/imports/systeminfo/plugins.qmltypes 2015-02-03 15:48:27 +0000 |
457 | +@@ -3,137 +3,11 @@ |
458 | + // This file describes the plugin-supplied types contained in the library. |
459 | + // It is used for QML tooling purposes only. |
460 | + // |
461 | +-// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtSystemInfo 5.0'. |
462 | ++// This file was auto-generated by: |
463 | ++// 'qmlplugindump -notrelocatable QtSystemInfo 5.0' |
464 | + |
465 | + Module { |
466 | + Component { |
467 | +- name: "QDeclarativeBatteryInfo" |
468 | +- prototype: "QObject" |
469 | +- exports: ["QtSystemInfo/BatteryInfo 5.0"] |
470 | +- exportMetaObjectRevisions: [0] |
471 | +- Enum { |
472 | +- name: "ChargerType" |
473 | +- values: { |
474 | +- "UnknownCharger": 0, |
475 | +- "WallCharger": 1, |
476 | +- "USBCharger": 2, |
477 | +- "VariableCurrentCharger": 3 |
478 | +- } |
479 | +- } |
480 | +- Enum { |
481 | +- name: "ChargingState" |
482 | +- values: { |
483 | +- "UnknownChargingState": 0, |
484 | +- "NotCharging": 1, |
485 | +- "Charging": 2, |
486 | +- "Discharging": 3, |
487 | +- "Full": 4 |
488 | +- } |
489 | +- } |
490 | +- Enum { |
491 | +- name: "EnergyUnit" |
492 | +- values: { |
493 | +- "UnitUnknown": 0, |
494 | +- "UnitmAh": 1, |
495 | +- "UnitmWh": 2 |
496 | +- } |
497 | +- } |
498 | +- Enum { |
499 | +- name: "BatteryStatus" |
500 | +- values: { |
501 | +- "BatteryStatusUnknown": 0, |
502 | +- "BatteryEmpty": 1, |
503 | +- "BatteryLow": 2, |
504 | +- "BatteryOk": 3, |
505 | +- "BatteryFull": 4 |
506 | +- } |
507 | +- } |
508 | +- Property { name: "monitorBatteryCount"; type: "bool" } |
509 | +- Property { name: "monitorChargerType"; type: "bool" } |
510 | +- Property { name: "monitorCurrentFlow"; type: "bool" } |
511 | +- Property { name: "monitorRemainingCapacity"; type: "bool" } |
512 | +- Property { name: "monitorRemainingChargingTime"; type: "bool" } |
513 | +- Property { name: "monitorVoltage"; type: "bool" } |
514 | +- Property { name: "monitorChargingState"; type: "bool" } |
515 | +- Property { name: "monitorBatteryStatus"; type: "bool" } |
516 | +- Property { name: "batteryCount"; type: "int"; isReadonly: true } |
517 | +- Property { name: "chargerType"; type: "ChargerType"; isReadonly: true } |
518 | +- Property { name: "energyUnit"; type: "EnergyUnit"; isReadonly: true } |
519 | +- Signal { |
520 | +- name: "batteryCountChanged" |
521 | +- Parameter { name: "count"; type: "int" } |
522 | +- } |
523 | +- Signal { |
524 | +- name: "chargerTypeChanged" |
525 | +- Parameter { name: "type"; type: "int" } |
526 | +- } |
527 | +- Signal { |
528 | +- name: "chargingStateChanged" |
529 | +- Parameter { name: "battery"; type: "int" } |
530 | +- Parameter { name: "state"; type: "int" } |
531 | +- } |
532 | +- Signal { |
533 | +- name: "currentFlowChanged" |
534 | +- Parameter { name: "battery"; type: "int" } |
535 | +- Parameter { name: "flow"; type: "int" } |
536 | +- } |
537 | +- Signal { |
538 | +- name: "remainingCapacityChanged" |
539 | +- Parameter { name: "battery"; type: "int" } |
540 | +- Parameter { name: "capacity"; type: "int" } |
541 | +- } |
542 | +- Signal { |
543 | +- name: "remainingChargingTimeChanged" |
544 | +- Parameter { name: "battery"; type: "int" } |
545 | +- Parameter { name: "seconds"; type: "int" } |
546 | +- } |
547 | +- Signal { |
548 | +- name: "voltageChanged" |
549 | +- Parameter { name: "battery"; type: "int" } |
550 | +- Parameter { name: "voltage"; type: "int" } |
551 | +- } |
552 | +- Signal { |
553 | +- name: "batteryStatusChanged" |
554 | +- Parameter { name: "battery"; type: "int" } |
555 | +- Parameter { name: "status"; type: "int" } |
556 | +- } |
557 | +- Method { |
558 | +- name: "currentFlow" |
559 | +- type: "int" |
560 | +- Parameter { name: "battery"; type: "int" } |
561 | +- } |
562 | +- Method { |
563 | +- name: "remainingCapacity" |
564 | +- type: "int" |
565 | +- Parameter { name: "battery"; type: "int" } |
566 | +- } |
567 | +- Method { |
568 | +- name: "remainingChargingTime" |
569 | +- type: "int" |
570 | +- Parameter { name: "battery"; type: "int" } |
571 | +- } |
572 | +- Method { |
573 | +- name: "voltage" |
574 | +- type: "int" |
575 | +- Parameter { name: "battery"; type: "int" } |
576 | +- } |
577 | +- Method { |
578 | +- name: "chargingState" |
579 | +- type: "int" |
580 | +- Parameter { name: "battery"; type: "int" } |
581 | +- } |
582 | +- Method { |
583 | +- name: "maximumCapacity" |
584 | +- type: "int" |
585 | +- Parameter { name: "battery"; type: "int" } |
586 | +- } |
587 | +- Method { |
588 | +- name: "batteryStatus" |
589 | +- type: "int" |
590 | +- Parameter { name: "battery"; type: "int" } |
591 | +- } |
592 | +- } |
593 | +- Component { |
594 | + name: "QDeclarativeDeviceInfo" |
595 | + prototype: "QObject" |
596 | + exports: ["QtSystemInfo/DeviceInfo 5.0"] |
597 | +@@ -219,87 +93,6 @@ |
598 | + } |
599 | + } |
600 | + Component { |
601 | +- name: "QDeclarativeDeviceProfile" |
602 | +- prototype: "QObject" |
603 | +- exports: ["QtSystemInfo/DeviceProfile 5.0"] |
604 | +- exportMetaObjectRevisions: [0] |
605 | +- Enum { |
606 | +- name: "ProfileType" |
607 | +- values: { |
608 | +- "UnknownProfile": 0, |
609 | +- "SilentProfile": 1, |
610 | +- "NormalProfile": 2, |
611 | +- "VibrationProfile": 3, |
612 | +- "BeepProfile": 4 |
613 | +- } |
614 | +- } |
615 | +- Property { name: "isVibrationActivated"; type: "bool"; isReadonly: true } |
616 | +- Property { name: "messageRingtoneVolume"; type: "int"; isReadonly: true } |
617 | +- Property { name: "voiceRingtoneVolume"; type: "int"; isReadonly: true } |
618 | +- Property { name: "currentProfileType"; type: "ProfileType"; isReadonly: true } |
619 | +- Signal { name: "vibrationActivatedChanged" } |
620 | +- } |
621 | +- Component { |
622 | +- name: "QDeclarativeDisplayInfo" |
623 | +- prototype: "QObject" |
624 | +- exports: ["QtSystemInfo/DisplayInfo 5.0"] |
625 | +- exportMetaObjectRevisions: [0] |
626 | +- Enum { |
627 | +- name: "BacklightState" |
628 | +- values: { |
629 | +- "BacklightUnknown": 0, |
630 | +- "BacklightOff": 1, |
631 | +- "BacklightDimmed": 2, |
632 | +- "BacklightOn": 3 |
633 | +- } |
634 | +- } |
635 | +- Signal { |
636 | +- name: "backlightStateChanged" |
637 | +- Parameter { name: "screen"; type: "int" } |
638 | +- Parameter { name: "state"; type: "int" } |
639 | +- } |
640 | +- Method { |
641 | +- name: "brightness" |
642 | +- type: "int" |
643 | +- Parameter { name: "screen"; type: "int" } |
644 | +- } |
645 | +- Method { |
646 | +- name: "contrast" |
647 | +- type: "int" |
648 | +- Parameter { name: "screen"; type: "int" } |
649 | +- } |
650 | +- Method { |
651 | +- name: "backlightState" |
652 | +- type: "int" |
653 | +- Parameter { name: "screen"; type: "int" } |
654 | +- } |
655 | +- Method { |
656 | +- name: "colorDepth" |
657 | +- type: "int" |
658 | +- Parameter { name: "screen"; type: "int" } |
659 | +- } |
660 | +- Method { |
661 | +- name: "dpiX" |
662 | +- type: "int" |
663 | +- Parameter { name: "screen"; type: "int" } |
664 | +- } |
665 | +- Method { |
666 | +- name: "dpiY" |
667 | +- type: "int" |
668 | +- Parameter { name: "screen"; type: "int" } |
669 | +- } |
670 | +- Method { |
671 | +- name: "physicalHeight" |
672 | +- type: "int" |
673 | +- Parameter { name: "screen"; type: "int" } |
674 | +- } |
675 | +- Method { |
676 | +- name: "physicalWidth" |
677 | +- type: "int" |
678 | +- Parameter { name: "screen"; type: "int" } |
679 | +- } |
680 | +- } |
681 | +- Component { |
682 | + name: "QDeclarativeNetworkInfo" |
683 | + prototype: "QObject" |
684 | + exports: ["QtSystemInfo/NetworkInfo 5.0"] |
685 | +@@ -472,6 +265,43 @@ |
686 | + } |
687 | + } |
688 | + Component { |
689 | ++ name: "QInputDevice" |
690 | ++ prototype: "QObject" |
691 | ++ exports: ["QtSystemInfo/InputInfo 5.0"] |
692 | ++ exportMetaObjectRevisions: [0] |
693 | ++ Enum { |
694 | ++ name: "InputType" |
695 | ++ values: { |
696 | ++ "Unknown": 0, |
697 | ++ "Button": 1, |
698 | ++ "Mouse": 2, |
699 | ++ "TouchPad": 3, |
700 | ++ "TouchScreen": 4, |
701 | ++ "Keyboard": 5, |
702 | ++ "Switch": 6 |
703 | ++ } |
704 | ++ } |
705 | ++ Property { name: "name"; type: "string"; isReadonly: true } |
706 | ++ Property { name: "devicePath"; type: "string"; isReadonly: true } |
707 | ++ Property { name: "buttons"; type: "QList<int>"; isReadonly: true } |
708 | ++ Property { name: "switches"; type: "QList<int>"; isReadonly: true } |
709 | ++ Property { name: "relativeAxis"; type: "QList<int>"; isReadonly: true } |
710 | ++ Property { name: "absoluteAxis"; type: "QList<int>"; isReadonly: true } |
711 | ++ Property { name: "type"; type: "QInputDevice::InputType"; isReadonly: true } |
712 | ++ } |
713 | ++ Component { |
714 | ++ name: "QInputDeviceInfo" |
715 | ++ prototype: "QObject" |
716 | ++ exports: ["QtSystemInfo/InputDeviceInfo 5.0"] |
717 | ++ exportMetaObjectRevisions: [0] |
718 | ++ Property { name: "deviceCount"; type: "int"; isReadonly: true } |
719 | ++ Signal { name: "deviceAdded" } |
720 | ++ Signal { name: "deviceRemoved" } |
721 | ++ Signal { name: "ready" } |
722 | ++ Method { name: "addedDevice" } |
723 | ++ Method { name: "deviceList"; type: "QList<QInputDevice*>" } |
724 | ++ } |
725 | ++ Component { |
726 | + name: "QScreenSaver" |
727 | + prototype: "QObject" |
728 | + exports: ["QtSystemInfo/ScreenSaver 5.0"] |
729 | + |
730 | +=== added file 'src/imports/systeminfo/qdeclarativeinputdeviceinfo.cpp' |
731 | +--- old/src/imports/systeminfo/qdeclarativeinputdeviceinfo.cpp 1970-01-01 00:00:00 +0000 |
732 | ++++ new/src/imports/systeminfo/qdeclarativeinputdeviceinfo.cpp 2015-02-03 15:48:27 +0000 |
733 | +@@ -0,0 +1,143 @@ |
734 | ++/**************************************************************************** |
735 | ++** |
736 | ++** Copyright (C) 2015 Jolla. |
737 | ++** Contact: http://www.qt-project.org/legal |
738 | ++** |
739 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
740 | ++** |
741 | ++** $QT_BEGIN_LICENSE:LGPL$ |
742 | ++** Commercial License Usage |
743 | ++** Licensees holding valid commercial Qt licenses may use this file in |
744 | ++** accordance with the commercial license agreement provided with the |
745 | ++** Software or, alternatively, in accordance with the terms contained in |
746 | ++** a written agreement between you and Digia. For licensing terms and |
747 | ++** conditions see http://qt.digia.com/licensing. For further information |
748 | ++** use the contact form at http://qt.digia.com/contact-us. |
749 | ++** |
750 | ++** GNU Lesser General Public License Usage |
751 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
752 | ++** General Public License version 2.1 as published by the Free Software |
753 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
754 | ++** packaging of this file. Please review the following information to |
755 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
756 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
757 | ++** |
758 | ++** In addition, as a special exception, Digia gives you certain additional |
759 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
760 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
761 | ++** |
762 | ++** GNU General Public License Usage |
763 | ++** Alternatively, this file may be used under the terms of the GNU |
764 | ++** General Public License version 3.0 as published by the Free Software |
765 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
766 | ++** packaging of this file. Please review the following information to |
767 | ++** ensure the GNU General Public License version 3.0 requirements will be |
768 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
769 | ++** |
770 | ++** |
771 | ++** $QT_END_LICENSE$ |
772 | ++** |
773 | ++****************************************************************************/ |
774 | ++#include "qdeclarativeinputdeviceinfo_p.h" |
775 | ++ |
776 | ++QDeclarativeInputDeviceInfo::QDeclarativeInputDeviceInfo(QObject *parent) : |
777 | ++ QAbstractListModel(parent), |
778 | ++ deviceInfo(new QInputDeviceInfo) |
779 | ++{ |
780 | ++ connect(deviceInfo,SIGNAL(ready()),this,SLOT(updateDeviceList())); |
781 | ++ connect(deviceInfo, &QInputDeviceInfo::deviceAdded,this,&QDeclarativeInputDeviceInfo::addedDevice); |
782 | ++ connect(deviceInfo, &QInputDeviceInfo::deviceRemoved,this,&QDeclarativeInputDeviceInfo::removedDevice); |
783 | ++} |
784 | ++ |
785 | ++QDeclarativeInputDeviceInfo::~QDeclarativeInputDeviceInfo() |
786 | ++{ |
787 | ++ delete deviceInfo; |
788 | ++} |
789 | ++ |
790 | ++QVariant QDeclarativeInputDeviceInfo::data(const QModelIndex &index, int role) const |
791 | ++{ |
792 | ++ switch (role) { |
793 | ++ case ServiceRole: |
794 | ++ return QVariant::fromValue(static_cast<QObject *>(inputDevices.value(index.row()))); |
795 | ++ } |
796 | ++ |
797 | ++ return QVariant(); |
798 | ++} |
799 | ++ |
800 | ++int QDeclarativeInputDeviceInfo::rowCount(const QModelIndex &parent) const |
801 | ++{ |
802 | ++ Q_UNUSED(parent); |
803 | ++ |
804 | ++ return inputDevices.count(); |
805 | ++} |
806 | ++ |
807 | ++int QDeclarativeInputDeviceInfo::indexOf(const QString &devicePath) const |
808 | ++{ |
809 | ++ int idx(-1); |
810 | ++ Q_FOREACH (QInputDevice *device, inputDevices) { |
811 | ++ idx++; |
812 | ++ if (device->devicePath() == devicePath) return idx; |
813 | ++ } |
814 | ++ |
815 | ++ return -1; |
816 | ++} |
817 | ++ |
818 | ++QInputDevice *QDeclarativeInputDeviceInfo::get(int index) const |
819 | ++{ |
820 | ++ if (index < 0 || index > inputDevices.count()) |
821 | ++ return 0; |
822 | ++ return inputDevices.value(index); |
823 | ++} |
824 | ++ |
825 | ++void QDeclarativeInputDeviceInfo::updateDeviceList() |
826 | ++{ |
827 | ++ QVector <QInputDevice *> newDevices = deviceInfo->deviceList(); |
828 | ++ |
829 | ++ int numNew = newDevices.count(); |
830 | ++ |
831 | ++ for (int i = 0; i < numNew; i++) { |
832 | ++ int j = inputDevices.indexOf(newDevices.value(i)); |
833 | ++ if (j == -1) { |
834 | ++ // not found -> remove from list |
835 | ++ beginInsertRows(QModelIndex(), i, i); |
836 | ++ inputDevices.insert(i, newDevices.value(i)); |
837 | ++ endInsertRows(); |
838 | ++ } else if (i != j) { |
839 | ++ // changed its position -> move it |
840 | ++ QInputDevice* device = inputDevices.value(j); |
841 | ++ beginMoveRows(QModelIndex(), j, j, QModelIndex(), i); |
842 | ++ inputDevices.remove(j); |
843 | ++ inputDevices.insert(i, device); |
844 | ++ endMoveRows(); |
845 | ++ } else { |
846 | ++ QModelIndex changedIndex(this->index(j, 0, QModelIndex())); |
847 | ++ Q_EMIT dataChanged(changedIndex, changedIndex); |
848 | ++ } |
849 | ++ } |
850 | ++ |
851 | ++ int numOld = inputDevices.count(); |
852 | ++ if (numOld > numNew) { |
853 | ++ beginRemoveRows(QModelIndex(), numNew, numOld - 1); |
854 | ++ inputDevices.remove(numNew, numOld - numNew); |
855 | ++ endRemoveRows(); |
856 | ++ } |
857 | ++} |
858 | ++ |
859 | ++void QDeclarativeInputDeviceInfo::addedDevice(const QString &devicePath) |
860 | ++{ |
861 | ++ updateDeviceList(); |
862 | ++ Q_EMIT newDevice(devicePath); |
863 | ++} |
864 | ++ |
865 | ++void QDeclarativeInputDeviceInfo::removedDevice(const QString &devicePath) |
866 | ++{ |
867 | ++ updateDeviceList(); |
868 | ++ Q_EMIT deviceRemoved(devicePath); |
869 | ++} |
870 | ++ |
871 | ++QHash<int, QByteArray> QDeclarativeInputDeviceInfo::roleNames() const |
872 | ++{ |
873 | ++ QHash<int, QByteArray> roles; |
874 | ++ roles.insert(ServiceRole, "service"); |
875 | ++ return roles; |
876 | ++} |
877 | + |
878 | +=== added file 'src/imports/systeminfo/qdeclarativeinputdeviceinfo_p.h' |
879 | +--- old/src/imports/systeminfo/qdeclarativeinputdeviceinfo_p.h 1970-01-01 00:00:00 +0000 |
880 | ++++ new/src/imports/systeminfo/qdeclarativeinputdeviceinfo_p.h 2015-02-03 15:48:27 +0000 |
881 | +@@ -0,0 +1,86 @@ |
882 | ++/**************************************************************************** |
883 | ++** |
884 | ++** Copyright (C) 2015 Jolla. |
885 | ++** Contact: http://www.qt-project.org/legal |
886 | ++** |
887 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
888 | ++** |
889 | ++** $QT_BEGIN_LICENSE:LGPL$ |
890 | ++** Commercial License Usage |
891 | ++** Licensees holding valid commercial Qt licenses may use this file in |
892 | ++** accordance with the commercial license agreement provided with the |
893 | ++** Software or, alternatively, in accordance with the terms contained in |
894 | ++** a written agreement between you and Digia. For licensing terms and |
895 | ++** conditions see http://qt.digia.com/licensing. For further information |
896 | ++** use the contact form at http://qt.digia.com/contact-us. |
897 | ++** |
898 | ++** GNU Lesser General Public License Usage |
899 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
900 | ++** General Public License version 2.1 as published by the Free Software |
901 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
902 | ++** packaging of this file. Please review the following information to |
903 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
904 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
905 | ++** |
906 | ++** In addition, as a special exception, Digia gives you certain additional |
907 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
908 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
909 | ++** |
910 | ++** GNU General Public License Usage |
911 | ++** Alternatively, this file may be used under the terms of the GNU |
912 | ++** General Public License version 3.0 as published by the Free Software |
913 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
914 | ++** packaging of this file. Please review the following information to |
915 | ++** ensure the GNU General Public License version 3.0 requirements will be |
916 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
917 | ++** |
918 | ++** |
919 | ++** $QT_END_LICENSE$ |
920 | ++** |
921 | ++****************************************************************************/ |
922 | ++ |
923 | ++#ifndef QDECLARATIVEINPUTDEVICEINFO_H |
924 | ++#define QDECLARATIVEINPUTDEVICEINFO_H |
925 | ++ |
926 | ++#include <QObject> |
927 | ++#include <QAbstractListModel> |
928 | ++#include "qinputinfo.h" |
929 | ++ |
930 | ++class QDeclarativeInputDeviceInfo : public QAbstractListModel |
931 | ++{ |
932 | ++ Q_OBJECT |
933 | ++ Q_DISABLE_COPY(QDeclarativeInputDeviceInfo) |
934 | ++ |
935 | ++public: |
936 | ++ enum ItemRoles { |
937 | ++ ServiceRole = Qt::UserRole + 1 |
938 | ++ }; |
939 | ++ |
940 | ++ explicit QDeclarativeInputDeviceInfo(QObject *parent = 0); |
941 | ++ virtual ~QDeclarativeInputDeviceInfo(); |
942 | ++ |
943 | ++ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
944 | ++ int rowCount(const QModelIndex &parent = QModelIndex()) const; |
945 | ++ |
946 | ++ QHash<int, QByteArray> roleNames() const; |
947 | ++ |
948 | ++ Q_INVOKABLE int indexOf(const QString &devicePath) const; |
949 | ++ |
950 | ++ Q_INVOKABLE QInputDevice *get(int index) const; |
951 | ++ |
952 | ++signals: |
953 | ++ void newDevice(const QString &devicePath); |
954 | ++ void deviceRemoved(const QString &devicePath); |
955 | ++ |
956 | ++public slots: |
957 | ++ void updateDeviceList(); |
958 | ++private: |
959 | ++ QInputDeviceInfo *deviceInfo; |
960 | ++ QVector<QInputDevice *> inputDevices; |
961 | ++private slots: |
962 | ++ void addedDevice(const QString &); |
963 | ++ void removedDevice(const QString &path); |
964 | ++ |
965 | ++}; |
966 | ++ |
967 | ++#endif // QDECLARATIVEINPUTDEVICEINFO_H |
968 | + |
969 | +=== modified file 'src/imports/systeminfo/qsysteminfo.cpp' |
970 | +--- old/src/imports/systeminfo/qsysteminfo.cpp 2015-02-03 15:48:03 +0000 |
971 | ++++ new/src/imports/systeminfo/qsysteminfo.cpp 2015-02-03 15:48:27 +0000 |
972 | +@@ -45,7 +45,10 @@ |
973 | + #include "qdeclarativebatteryinfo_p.h" |
974 | + #include "qdeclarativedeviceinfo_p.h" |
975 | + #include "qdeclarativenetworkinfo_p.h" |
976 | ++#include "qdeclarativeinputdeviceinfo_p.h" |
977 | ++ |
978 | + #include <qscreensaver.h> |
979 | ++#include "qinputinfo.h" |
980 | + |
981 | + QT_BEGIN_NAMESPACE |
982 | + |
983 | +@@ -65,6 +68,8 @@ |
984 | + qmlRegisterType<QDeclarativeDeviceInfo>(uri, major, minor, "DeviceInfo"); |
985 | + qmlRegisterType<QDeclarativeNetworkInfo>(uri, major, minor, "NetworkInfo"); |
986 | + qmlRegisterType<QScreenSaver>(uri, major, minor, "ScreenSaver"); |
987 | ++ qmlRegisterType<QDeclarativeInputDeviceInfo>(uri, major, minor, "InputDeviceInfo"); |
988 | ++ qmlRegisterType<QInputDevice>(uri, major, minor, "InputInfo"); |
989 | + } |
990 | + }; |
991 | + |
992 | + |
993 | +=== modified file 'src/imports/systeminfo/systeminfo.pro' |
994 | +--- old/src/imports/systeminfo/systeminfo.pro 2015-02-03 15:48:03 +0000 |
995 | ++++ new/src/imports/systeminfo/systeminfo.pro 2015-02-03 15:49:21 +0000 |
996 | +@@ -4,12 +4,14 @@ |
997 | + HEADERS += \ |
998 | + qdeclarativebatteryinfo_p.h \ |
999 | + qdeclarativedeviceinfo_p.h \ |
1000 | +- qdeclarativenetworkinfo_p.h |
1001 | ++ qdeclarativenetworkinfo_p.h \ |
1002 | ++ qdeclarativeinputdeviceinfo_p.h |
1003 | + |
1004 | + SOURCES += \ |
1005 | + qdeclarativebatteryinfo.cpp \ |
1006 | + qdeclarativedeviceinfo.cpp \ |
1007 | + qdeclarativenetworkinfo.cpp \ |
1008 | +- qsysteminfo.cpp |
1009 | ++ qsysteminfo.cpp \ |
1010 | ++ qdeclarativeinputdeviceinfo.cpp |
1011 | + |
1012 | + load(qml_plugin) |
1013 | + |
1014 | +=== added file 'src/systeminfo/linux/qinputdeviceinfo_linux.cpp' |
1015 | +--- old/src/systeminfo/linux/qinputdeviceinfo_linux.cpp 1970-01-01 00:00:00 +0000 |
1016 | ++++ new/src/systeminfo/linux/qinputdeviceinfo_linux.cpp 2015-02-03 15:48:27 +0000 |
1017 | +@@ -0,0 +1,239 @@ |
1018 | ++/**************************************************************************** |
1019 | ++** |
1020 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
1021 | ++** Contact: http://www.qt-project.org/legal |
1022 | ++** |
1023 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
1024 | ++** |
1025 | ++** $QT_BEGIN_LICENSE:LGPL$ |
1026 | ++** Commercial License Usage |
1027 | ++** Licensees holding valid commercial Qt licenses may use this file in |
1028 | ++** accordance with the commercial license agreement provided with the |
1029 | ++** Software or, alternatively, in accordance with the terms contained in |
1030 | ++** a written agreement between you and Digia. For licensing terms and |
1031 | ++** conditions see http://qt.digia.com/licensing. For further information |
1032 | ++** use the contact form at http://qt.digia.com/contact-us. |
1033 | ++** |
1034 | ++** GNU Lesser General Public License Usage |
1035 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
1036 | ++** General Public License version 2.1 as published by the Free Software |
1037 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
1038 | ++** packaging of this file. Please review the following information to |
1039 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
1040 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
1041 | ++** |
1042 | ++** In addition, as a special exception, Digia gives you certain additional |
1043 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
1044 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
1045 | ++** |
1046 | ++** GNU General Public License Usage |
1047 | ++** Alternatively, this file may be used under the terms of the GNU |
1048 | ++** General Public License version 3.0 as published by the Free Software |
1049 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
1050 | ++** packaging of this file. Please review the following information to |
1051 | ++** ensure the GNU General Public License version 3.0 requirements will be |
1052 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
1053 | ++** |
1054 | ++** |
1055 | ++** $QT_END_LICENSE$ |
1056 | ++** |
1057 | ++****************************************************************************/ |
1058 | ++ |
1059 | ++#include "qinputdeviceinfo_linux_p.h" |
1060 | ++ |
1061 | ++#include <libudev.h> |
1062 | ++#include <libevdev/libevdev.h> |
1063 | ++#include <fcntl.h> |
1064 | ++#include <QDebug> |
1065 | ++#include <QSocketNotifier> |
1066 | ++#include <QTimer> |
1067 | ++ |
1068 | ++QInputDeviceInfoPrivate::QInputDeviceInfoPrivate(QObject *parent) : |
1069 | ++ QObject(parent) |
1070 | ++ , udev(0) |
1071 | ++{ |
1072 | ++ QTimer::singleShot(250,this,SLOT(init())); |
1073 | ++} |
1074 | ++ |
1075 | ++void QInputDeviceInfoPrivate::init() |
1076 | ++{ |
1077 | ++ if (!udev) |
1078 | ++ udev = udev_new(); |
1079 | ++ |
1080 | ++ struct udev_list_entry *devices, *dev_list_entry; |
1081 | ++ struct udev_device *dev; |
1082 | ++ |
1083 | ++ QString subsystem = QStringLiteral("input"); |
1084 | ++ struct udev_enumerate *enumerate = 0; |
1085 | ++ |
1086 | ++ if (udev) { |
1087 | ++ |
1088 | ++ udevMonitor = udev_monitor_new_from_netlink(udev, "udev"); |
1089 | ++ udev_monitor_filter_add_match_subsystem_devtype(udevMonitor, subsystem.toLatin1(), NULL); |
1090 | ++ enumerate = udev_enumerate_new(udev); |
1091 | ++ udev_enumerate_add_match_subsystem(enumerate, subsystem.toLatin1()); |
1092 | ++ |
1093 | ++ |
1094 | ++ udev_monitor_enable_receiving(udevMonitor); |
1095 | ++ notifierFd = udev_monitor_get_fd(udevMonitor); |
1096 | ++ |
1097 | ++ notifier = new QSocketNotifier(notifierFd, QSocketNotifier::Read, this); |
1098 | ++ connect(notifier, SIGNAL(activated(int)), this, SLOT(onUDevChanges())); |
1099 | ++ |
1100 | ++ |
1101 | ++ udev_enumerate_scan_devices(enumerate); |
1102 | ++ devices = udev_enumerate_get_list_entry(enumerate); |
1103 | ++ |
1104 | ++ udev_list_entry_foreach(dev_list_entry, devices) { |
1105 | ++ const char *path; |
1106 | ++ path = udev_list_entry_get_name(dev_list_entry); |
1107 | ++ |
1108 | ++ dev = udev_device_new_from_syspath(udev, path); |
1109 | ++ |
1110 | ++ QString eventPath = QString::fromLatin1(udev_device_get_sysname(dev)); |
1111 | ++ |
1112 | ++ if (qstrcmp(udev_device_get_subsystem(dev), "input") == 0 ) { |
1113 | ++ |
1114 | ++ if (eventPath.contains(QStringLiteral("event"))) { |
1115 | ++ eventPath.prepend(QStringLiteral("/dev/input/")); |
1116 | ++ |
1117 | ++ QInputDevice *iDevice = addDevice(eventPath); |
1118 | ++ if (!iDevice) |
1119 | ++ continue; |
1120 | ++ iDevice->setType(getInputType(dev)); |
1121 | ++ |
1122 | ++ if (iDevice->switches().count() > 0 && iDevice->buttons().count() == 0) |
1123 | ++ iDevice->setType(QInputDeviceInfo::Switch); |
1124 | ++ |
1125 | ++ if (iDevice->buttons().count() > 0 && iDevice->type() == QInputDeviceInfo::Unknown) |
1126 | ++ iDevice->setType(QInputDeviceInfo::Button); |
1127 | ++ |
1128 | ++ deviceList.append(iDevice); |
1129 | ++ deviceMap.insert(eventPath,iDevice); |
1130 | ++ Q_EMIT newDevice(eventPath); |
1131 | ++ |
1132 | ++ } |
1133 | ++ } |
1134 | ++ } |
1135 | ++ udev_enumerate_unref(enumerate); |
1136 | ++ } |
1137 | ++ Q_EMIT ready(); |
1138 | ++} |
1139 | ++ |
1140 | ++QInputDeviceInfo::InputType QInputDeviceInfoPrivate::getInputType( struct udev_device *dev) |
1141 | ++{ |
1142 | ++ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 ) |
1143 | ++ return QInputDeviceInfo::Keyboard; |
1144 | ++ |
1145 | ++ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_MOUSE"), "1") == 0) |
1146 | ++ return QInputDeviceInfo::Mouse; |
1147 | ++ |
1148 | ++ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD"), "1") == 0) |
1149 | ++ return QInputDeviceInfo::TouchPad; |
1150 | ++ |
1151 | ++ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"), "1") == 0 |
1152 | ++ || qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TABLET"), "1") == 0) |
1153 | ++ return QInputDeviceInfo::TouchScreen; |
1154 | ++ |
1155 | ++return QInputDeviceInfo::Unknown; |
1156 | ++} |
1157 | ++ |
1158 | ++QInputDevice *QInputDeviceInfoPrivate::addDevice(const QString &path) |
1159 | ++{ |
1160 | ++ QInputDevice *inputDevice = new QInputDevice(this); |
1161 | ++ |
1162 | ++ struct libevdev *dev = NULL; |
1163 | ++ int fd; |
1164 | ++ int rc = 1; |
1165 | ++ fd = open(path.toLatin1(), O_RDONLY|O_NONBLOCK); |
1166 | ++ |
1167 | ++ if (fd == -1) { |
1168 | ++ qDebug() << "Failed to open"; |
1169 | ++ return inputDevice; |
1170 | ++ } |
1171 | ++ rc = libevdev_new_from_fd(fd, &dev); |
1172 | ++ if (rc < 0) { |
1173 | ++ qDebug() << "Failed to init libevdev ("<< strerror(-rc) << ")"; |
1174 | ++ return inputDevice; |
1175 | ++ } |
1176 | ++ |
1177 | ++ inputDevice->setName(QString::fromLatin1(libevdev_get_name(dev))); |
1178 | ++ inputDevice->setDevicePath(path); |
1179 | ++ for (int i = 0; i < EV_MAX; i++) { |
1180 | ++ if (i == EV_KEY || i == EV_SW || i == EV_REL |
1181 | ++ || i == EV_REL || i == EV_ABS) { |
1182 | ++ for (int j = 0; j < libevdev_event_type_get_max(i); j++) { |
1183 | ++ if (libevdev_has_event_code(dev, i, j)) { |
1184 | ++ switch (i) { |
1185 | ++ case EV_KEY: |
1186 | ++ inputDevice->addButton(j); |
1187 | ++ break; |
1188 | ++ case EV_SW: |
1189 | ++ inputDevice->addSwitch(j); |
1190 | ++ break; |
1191 | ++ case EV_REL: |
1192 | ++ inputDevice->addRelativeAxis(j); |
1193 | ++ break; |
1194 | ++ case EV_ABS: |
1195 | ++ inputDevice->addAbsoluteAxis(j); |
1196 | ++ break; |
1197 | ++ }; |
1198 | ++ } |
1199 | ++ } |
1200 | ++ } |
1201 | ++ } |
1202 | ++ return inputDevice; |
1203 | ++} |
1204 | ++ |
1205 | ++void QInputDeviceInfoPrivate::removeDevice(const QString &path) |
1206 | ++{ |
1207 | ++ for (int i = 0; i < deviceList.size(); ++i) { |
1208 | ++ if (deviceList.at(i)->devicePath() == path) { |
1209 | ++ delete deviceList.takeAt(i); |
1210 | ++ deviceMap.remove(path); |
1211 | ++ Q_EMIT deviceRemoved(path); |
1212 | ++ } |
1213 | ++ } |
1214 | ++} |
1215 | ++ |
1216 | ++void QInputDeviceInfoPrivate::onUDevChanges() |
1217 | ++{ |
1218 | ++ struct udev_device *dev = udev_monitor_receive_device(udevMonitor); |
1219 | ++ if (dev) { |
1220 | ++ if (qstrcmp(udev_device_get_subsystem(dev), "input") == 0 ) { |
1221 | ++ QString eventPath = QString::fromLatin1(udev_device_get_sysname(dev)); |
1222 | ++ |
1223 | ++ if (eventPath.contains(QStringLiteral("input"))) |
1224 | ++ return; |
1225 | ++ |
1226 | ++ QString action = QString::fromStdString(udev_device_get_action(dev)); |
1227 | ++ |
1228 | ++ if (!eventPath.contains(QStringLiteral("/dev/input/"))) |
1229 | ++ eventPath.prepend(QStringLiteral("/dev/input/")); |
1230 | ++ |
1231 | ++ if (action == QStringLiteral("add")) { |
1232 | ++ |
1233 | ++ QInputDevice *iDevice = addDevice(eventPath); |
1234 | ++ if (!iDevice) |
1235 | ++ return; |
1236 | ++ |
1237 | ++ iDevice->setType(getInputType(dev)); |
1238 | ++ udev_device_unref(dev); |
1239 | ++ |
1240 | ++ if (iDevice->switches().count() > 0 && iDevice->buttons().count() == 0) |
1241 | ++ iDevice->setType(QInputDeviceInfo::Switch); |
1242 | ++ |
1243 | ++ if (iDevice->buttons().count() > 0 && iDevice->type() == QInputDeviceInfo::Unknown) |
1244 | ++ iDevice->setType(QInputDeviceInfo::Button); |
1245 | ++ |
1246 | ++ deviceList.append(iDevice); |
1247 | ++ deviceMap.insert(eventPath,iDevice); |
1248 | ++ |
1249 | ++ Q_EMIT newDevice(eventPath); |
1250 | ++ |
1251 | ++ } else if (action == QStringLiteral("remove")) { |
1252 | ++ removeDevice(eventPath); |
1253 | ++ } |
1254 | ++ } |
1255 | ++ } |
1256 | ++} |
1257 | + |
1258 | +=== added file 'src/systeminfo/linux/qinputdeviceinfo_linux_p.h' |
1259 | +--- old/src/systeminfo/linux/qinputdeviceinfo_linux_p.h 1970-01-01 00:00:00 +0000 |
1260 | ++++ new/src/systeminfo/linux/qinputdeviceinfo_linux_p.h 2015-02-03 15:48:27 +0000 |
1261 | +@@ -0,0 +1,91 @@ |
1262 | ++/**************************************************************************** |
1263 | ++** |
1264 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
1265 | ++** Contact: http://www.qt-project.org/legal |
1266 | ++** |
1267 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
1268 | ++** |
1269 | ++** $QT_BEGIN_LICENSE:LGPL$ |
1270 | ++** Commercial License Usage |
1271 | ++** Licensees holding valid commercial Qt licenses may use this file in |
1272 | ++** accordance with the commercial license agreement provided with the |
1273 | ++** Software or, alternatively, in accordance with the terms contained in |
1274 | ++** a written agreement between you and Digia. For licensing terms and |
1275 | ++** conditions see http://qt.digia.com/licensing. For further information |
1276 | ++** use the contact form at http://qt.digia.com/contact-us. |
1277 | ++** |
1278 | ++** GNU Lesser General Public License Usage |
1279 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
1280 | ++** General Public License version 2.1 as published by the Free Software |
1281 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
1282 | ++** packaging of this file. Please review the following information to |
1283 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
1284 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
1285 | ++** |
1286 | ++** In addition, as a special exception, Digia gives you certain additional |
1287 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
1288 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
1289 | ++** |
1290 | ++** GNU General Public License Usage |
1291 | ++** Alternatively, this file may be used under the terms of the GNU |
1292 | ++** General Public License version 3.0 as published by the Free Software |
1293 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
1294 | ++** packaging of this file. Please review the following information to |
1295 | ++** ensure the GNU General Public License version 3.0 requirements will be |
1296 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
1297 | ++** |
1298 | ++** |
1299 | ++** $QT_END_LICENSE$ |
1300 | ++** |
1301 | ++****************************************************************************/ |
1302 | ++ |
1303 | ++#ifndef QINPUTDEVICEINFO_LINUX_P_H |
1304 | ++#define QINPUTDEVICEINFO_LINUX_P_H |
1305 | ++ |
1306 | ++#include <QObject> |
1307 | ++#include "qinputinfo.h" |
1308 | ++#include <libudev.h> |
1309 | ++ |
1310 | ++class QInputDevicePrivate : public QObject |
1311 | ++{ |
1312 | ++ Q_OBJECT |
1313 | ++public: |
1314 | ++ explicit QInputDevicePrivate(QObject *parent = 0); |
1315 | ++ |
1316 | ++ QString name; |
1317 | ++ QString devicePath; |
1318 | ++ QList <int> buttons; //keys |
1319 | ++ QList <int> switches; |
1320 | ++ QList <int> relativeAxis; |
1321 | ++ QList <int> absoluteAxis; |
1322 | ++ QInputDeviceInfo::InputType type; |
1323 | ++}; |
1324 | ++ |
1325 | ++class QInputDeviceInfoPrivate : public QObject |
1326 | ++{ |
1327 | ++ Q_OBJECT |
1328 | ++public: |
1329 | ++ explicit QInputDeviceInfoPrivate(QObject *parent = 0); |
1330 | ++ QVector <QInputDevice *> deviceList; |
1331 | ++ QMap <QString, QInputDevice *> deviceMap; |
1332 | ++ |
1333 | ++signals: |
1334 | ++ void newDevice(const QString &); |
1335 | ++ void deviceRemoved(const QString &); |
1336 | ++ void ready(); |
1337 | ++ |
1338 | ++private: |
1339 | ++ struct udev *udev; |
1340 | ++ QInputDevice *addDevice(const QString &path); |
1341 | ++ void removeDevice(const QString &path); |
1342 | ++ QSocketNotifier *notifier; |
1343 | ++ int notifierFd; |
1344 | ++ struct udev_monitor *udevMonitor; |
1345 | ++ QInputDeviceInfo::InputType getInputType( struct udev_device *); |
1346 | ++ |
1347 | ++private Q_SLOTS: |
1348 | ++ void onUDevChanges(); |
1349 | ++ void init(); |
1350 | ++}; |
1351 | ++ |
1352 | ++#endif // QINPUTDEVICEINFO_LINUX_P_H |
1353 | + |
1354 | +=== added file 'src/systeminfo/qinputinfo.cpp' |
1355 | +--- old/src/systeminfo/qinputinfo.cpp 1970-01-01 00:00:00 +0000 |
1356 | ++++ new/src/systeminfo/qinputinfo.cpp 2015-02-03 15:48:27 +0000 |
1357 | +@@ -0,0 +1,159 @@ |
1358 | ++/**************************************************************************** |
1359 | ++** |
1360 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
1361 | ++** Contact: http://www.qt-project.org/legal |
1362 | ++** |
1363 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
1364 | ++** |
1365 | ++** $QT_BEGIN_LICENSE:LGPL$ |
1366 | ++** Commercial License Usage |
1367 | ++** Licensees holding valid commercial Qt licenses may use this file in |
1368 | ++** accordance with the commercial license agreement provided with the |
1369 | ++** Software or, alternatively, in accordance with the terms contained in |
1370 | ++** a written agreement between you and Digia. For licensing terms and |
1371 | ++** conditions see http://qt.digia.com/licensing. For further information |
1372 | ++** use the contact form at http://qt.digia.com/contact-us. |
1373 | ++** |
1374 | ++** GNU Lesser General Public License Usage |
1375 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
1376 | ++** General Public License version 2.1 as published by the Free Software |
1377 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
1378 | ++** packaging of this file. Please review the following information to |
1379 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
1380 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
1381 | ++** |
1382 | ++** In addition, as a special exception, Digia gives you certain additional |
1383 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
1384 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
1385 | ++** |
1386 | ++** GNU General Public License Usage |
1387 | ++** Alternatively, this file may be used under the terms of the GNU |
1388 | ++** General Public License version 3.0 as published by the Free Software |
1389 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
1390 | ++** packaging of this file. Please review the following information to |
1391 | ++** ensure the GNU General Public License version 3.0 requirements will be |
1392 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
1393 | ++** |
1394 | ++** |
1395 | ++** $QT_END_LICENSE$ |
1396 | ++** |
1397 | ++****************************************************************************/ |
1398 | ++ |
1399 | ++#include "qinputinfo.h" |
1400 | ++ |
1401 | ++#if defined(Q_OS_LINUX) |
1402 | ++#include "linux/qinputdeviceinfo_linux_p.h" |
1403 | ++#endif |
1404 | ++ |
1405 | ++QT_BEGIN_NAMESPACE |
1406 | ++ |
1407 | ++ |
1408 | ++QInputDevicePrivate::QInputDevicePrivate(QObject *parent) : |
1409 | ++ QObject(parent), |
1410 | ++ type(QInputDeviceInfo::Unknown) |
1411 | ++{ |
1412 | ++} |
1413 | ++ |
1414 | ++QInputDevice::QInputDevice(QObject *parent) : |
1415 | ++ QObject(parent), |
1416 | ++ d_ptr(new QInputDevicePrivate(this)) |
1417 | ++{ |
1418 | ++} |
1419 | ++ |
1420 | ++QString QInputDevice::name() const |
1421 | ++{ |
1422 | ++ return d_ptr->name; |
1423 | ++} |
1424 | ++ |
1425 | ++void QInputDevice::setName(const QString &name) |
1426 | ++{ |
1427 | ++ d_ptr->name = name; |
1428 | ++} |
1429 | ++ |
1430 | ++QString QInputDevice::devicePath() const |
1431 | ++{ |
1432 | ++ return d_ptr->devicePath; |
1433 | ++} |
1434 | ++ |
1435 | ++void QInputDevice::setDevicePath(const QString &path) |
1436 | ++{ |
1437 | ++ d_ptr->devicePath = path; |
1438 | ++} |
1439 | ++ |
1440 | ++QList <int> QInputDevice::buttons() const |
1441 | ++{ |
1442 | ++ return d_ptr->buttons; |
1443 | ++} |
1444 | ++ |
1445 | ++void QInputDevice::addButton(int buttonCode) |
1446 | ++{ |
1447 | ++ d_ptr->buttons.append(buttonCode); |
1448 | ++} |
1449 | ++ |
1450 | ++QList <int> QInputDevice::switches() const |
1451 | ++{ |
1452 | ++ return d_ptr->switches; |
1453 | ++} |
1454 | ++ |
1455 | ++void QInputDevice::addSwitch(int switchCode) |
1456 | ++{ |
1457 | ++ d_ptr->switches.append(switchCode); |
1458 | ++} |
1459 | ++ |
1460 | ++QList <int> QInputDevice::relativeAxis() const |
1461 | ++{ |
1462 | ++ return d_ptr->relativeAxis; |
1463 | ++} |
1464 | ++ |
1465 | ++void QInputDevice::addRelativeAxis(int axisCode) |
1466 | ++{ |
1467 | ++ d_ptr->relativeAxis.append(axisCode); |
1468 | ++} |
1469 | ++ |
1470 | ++QList <int> QInputDevice::absoluteAxis() const |
1471 | ++{ |
1472 | ++ return d_ptr->absoluteAxis; |
1473 | ++} |
1474 | ++ |
1475 | ++void QInputDevice::addAbsoluteAxis(int axisCode) |
1476 | ++{ |
1477 | ++ d_ptr->absoluteAxis.append(axisCode); |
1478 | ++} |
1479 | ++ |
1480 | ++QInputDeviceInfo::InputType QInputDevice::type() |
1481 | ++{ |
1482 | ++ return d_ptr->type; |
1483 | ++} |
1484 | ++ |
1485 | ++void QInputDevice::setType(QInputDeviceInfo::InputType type) |
1486 | ++{ |
1487 | ++ d_ptr->type = type; |
1488 | ++} |
1489 | ++ |
1490 | ++ |
1491 | ++QInputDeviceInfo::QInputDeviceInfo(QObject *parent) : |
1492 | ++ QObject(parent), |
1493 | ++ d_ptr(new QInputDeviceInfoPrivate(this)) |
1494 | ++{ |
1495 | ++ connect(d_ptr, &QInputDeviceInfoPrivate::newDevice,this,&QInputDeviceInfo::addedDevice); |
1496 | ++ connect(d_ptr, &QInputDeviceInfoPrivate::deviceRemoved,this,&QInputDeviceInfo::deviceRemoved); |
1497 | ++ |
1498 | ++ connect(d_ptr,SIGNAL(ready()),this,SIGNAL(ready())); |
1499 | ++} |
1500 | ++ |
1501 | ++QVector <QInputDevice *> QInputDeviceInfo::deviceList() |
1502 | ++{ |
1503 | ++ return d_ptr->deviceList; |
1504 | ++} |
1505 | ++ |
1506 | ++QMap <QString, QInputDevice *> QInputDeviceInfo::deviceMap() |
1507 | ++{ |
1508 | ++ return d_ptr->deviceMap; |
1509 | ++} |
1510 | ++ |
1511 | ++void QInputDeviceInfo::addedDevice(const QString & devicePath) |
1512 | ++{ |
1513 | ++ Q_EMIT deviceAdded(devicePath); |
1514 | ++} |
1515 | ++ |
1516 | ++QT_END_NAMESPACE |
1517 | + |
1518 | +=== added file 'src/systeminfo/qinputinfo.h' |
1519 | +--- old/src/systeminfo/qinputinfo.h 1970-01-01 00:00:00 +0000 |
1520 | ++++ new/src/systeminfo/qinputinfo.h 2015-02-03 15:48:27 +0000 |
1521 | +@@ -0,0 +1,141 @@ |
1522 | ++/**************************************************************************** |
1523 | ++** |
1524 | ++** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies). |
1525 | ++** Contact: http://www.qt-project.org/legal |
1526 | ++** |
1527 | ++** This file is part of the QtSystems module of the Qt Toolkit. |
1528 | ++** |
1529 | ++** $QT_BEGIN_LICENSE:LGPL$ |
1530 | ++** Commercial License Usage |
1531 | ++** Licensees holding valid commercial Qt licenses may use this file in |
1532 | ++** accordance with the commercial license agreement provided with the |
1533 | ++** Software or, alternatively, in accordance with the terms contained in |
1534 | ++** a written agreement between you and Digia. For licensing terms and |
1535 | ++** conditions see http://qt.digia.com/licensing. For further information |
1536 | ++** use the contact form at http://qt.digia.com/contact-us. |
1537 | ++** |
1538 | ++** GNU Lesser General Public License Usage |
1539 | ++** Alternatively, this file may be used under the terms of the GNU Lesser |
1540 | ++** General Public License version 2.1 as published by the Free Software |
1541 | ++** Foundation and appearing in the file LICENSE.LGPL included in the |
1542 | ++** packaging of this file. Please review the following information to |
1543 | ++** ensure the GNU Lesser General Public License version 2.1 requirements |
1544 | ++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
1545 | ++** |
1546 | ++** In addition, as a special exception, Digia gives you certain additional |
1547 | ++** rights. These rights are described in the Digia Qt LGPL Exception |
1548 | ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
1549 | ++** |
1550 | ++** GNU General Public License Usage |
1551 | ++** Alternatively, this file may be used under the terms of the GNU |
1552 | ++** General Public License version 3.0 as published by the Free Software |
1553 | ++** Foundation and appearing in the file LICENSE.GPL included in the |
1554 | ++** packaging of this file. Please review the following information to |
1555 | ++** ensure the GNU General Public License version 3.0 requirements will be |
1556 | ++** met: http://www.gnu.org/copyleft/gpl.html. |
1557 | ++** |
1558 | ++** |
1559 | ++** $QT_END_LICENSE$ |
1560 | ++** |
1561 | ++****************************************************************************/ |
1562 | ++ |
1563 | ++#ifndef QINPUTINFO_H |
1564 | ++#define QINPUTINFO_H |
1565 | ++ |
1566 | ++#include <QtSystemInfo/qsysteminfoglobal.h> |
1567 | ++#include <QObject> |
1568 | ++#include <QVector> |
1569 | ++#include <QMap> |
1570 | ++#include <QSocketNotifier> |
1571 | ++#include <QDebug> |
1572 | ++ |
1573 | ++class QInputDeviceInfoPrivate; |
1574 | ++class QInputDevicePrivate; |
1575 | ++class QInputDevice; |
1576 | ++ |
1577 | ++class QInputDeviceInfoPrivate; |
1578 | ++class Q_SYSTEMINFO_EXPORT QInputDeviceInfo : public QObject |
1579 | ++{ |
1580 | ++ Q_OBJECT |
1581 | ++ Q_PROPERTY(int deviceCount READ deviceCount) |
1582 | ++public: |
1583 | ++ |
1584 | ++ enum InputType { |
1585 | ++ Unknown = 0, |
1586 | ++ Button, |
1587 | ++ Mouse, |
1588 | ++ TouchPad, |
1589 | ++ TouchScreen, |
1590 | ++ Keyboard, |
1591 | ++ Switch |
1592 | ++ }; |
1593 | ++ Q_ENUMS(InputType) |
1594 | ++ |
1595 | ++ explicit QInputDeviceInfo(QObject *parent = 0); |
1596 | ++ |
1597 | ++ Q_INVOKABLE QVector <QInputDevice *> deviceList(); |
1598 | ++ |
1599 | ++ Q_INVOKABLE QMap <QString, QInputDevice *> deviceMap(); |
1600 | ++ int deviceCount() { return deviceList().count(); } |
1601 | ++signals: |
1602 | ++ |
1603 | ++ void deviceAdded(const QString & devicePath); |
1604 | ++ void deviceRemoved(const QString & devicePath); |
1605 | ++ |
1606 | ++ void ready(); |
1607 | ++ |
1608 | ++public slots: |
1609 | ++ void addedDevice(const QString & devicePath); |
1610 | ++ |
1611 | ++private: |
1612 | ++ Q_DISABLE_COPY(QInputDeviceInfo) |
1613 | ++#if !defined(QT_SIMULATOR) |
1614 | ++ QInputDeviceInfoPrivate *const d_ptr; |
1615 | ++ Q_DECLARE_PRIVATE(QInputDeviceInfo) |
1616 | ++#endif |
1617 | ++}; |
1618 | ++ |
1619 | ++class Q_SYSTEMINFO_EXPORT QInputDevice : public QObject |
1620 | ++{ |
1621 | ++ friend class QInputDeviceInfoPrivate; |
1622 | ++ Q_OBJECT |
1623 | ++ Q_ENUMS(InputType) |
1624 | ++ Q_PROPERTY(QString name READ name NOTIFY nameChanged) |
1625 | ++ Q_PROPERTY(QString devicePath READ devicePath NOTIFY devicePathChanged) |
1626 | ++ Q_PROPERTY(QList <int> buttons READ buttons NOTIFY buttonsChanged) |
1627 | ++ Q_PROPERTY(QList <int> switches READ switches NOTIFY switchesChanged) |
1628 | ++ Q_PROPERTY(QList <int> relativeAxis READ relativeAxis NOTIFY relativeAxisChanged) |
1629 | ++ Q_PROPERTY(QList <int> absoluteAxis READ absoluteAxis NOTIFY absoluteAxisChanged) |
1630 | ++ Q_PROPERTY(QInputDeviceInfo::InputType type READ type NOTIFY typeChanged) |
1631 | ++ |
1632 | ++public: |
1633 | ++ explicit QInputDevice(QObject *parent = 0); |
1634 | ++ |
1635 | ++ QString name() const; |
1636 | ++ QString devicePath() const; |
1637 | ++ QList <int> buttons() const; //keys event code |
1638 | ++ QList <int> switches() const; |
1639 | ++ QList <int> relativeAxis() const; |
1640 | ++ QList <int> absoluteAxis() const; |
1641 | ++ |
1642 | ++ QInputDeviceInfo::InputType type(); |
1643 | ++signals: |
1644 | ++ void nameChanged(); |
1645 | ++ void devicePathChanged(); |
1646 | ++ void buttonsChanged(); |
1647 | ++ void switchesChanged(); |
1648 | ++ void relativeAxisChanged(); |
1649 | ++ void absoluteAxisChanged(); |
1650 | ++ void typeChanged(); |
1651 | ++private: |
1652 | ++ QInputDevicePrivate *d_ptr; |
1653 | ++ void setName(const QString &); |
1654 | ++ void setDevicePath(const QString &); |
1655 | ++ void addButton(int); |
1656 | ++ void addSwitch(int); |
1657 | ++ void addRelativeAxis(int); |
1658 | ++ void addAbsoluteAxis(int); |
1659 | ++ void setType(QInputDeviceInfo::InputType); |
1660 | ++}; |
1661 | ++ |
1662 | ++#endif // QINPUTINFO_H |
1663 | + |
1664 | +=== modified file 'src/systeminfo/systeminfo.pro' |
1665 | +--- old/src/systeminfo/systeminfo.pro 2015-02-03 15:48:03 +0000 |
1666 | ++++ new/src/systeminfo/systeminfo.pro 2015-02-03 15:48:27 +0000 |
1667 | +@@ -11,7 +11,9 @@ |
1668 | + SOURCES += qdeviceinfo.cpp \ |
1669 | + qscreensaver.cpp \ |
1670 | + qbatteryinfo.cpp \ |
1671 | +- qnetworkinfo.cpp |
1672 | ++ qnetworkinfo.cpp \ |
1673 | ++ qinputinfo.cpp \ |
1674 | ++ linux/qinputdeviceinfo_linux.cpp |
1675 | + |
1676 | + win32: !simulator: { |
1677 | + contains(CONFIG, release) { |
1678 | +@@ -110,6 +112,10 @@ |
1679 | + SOURCES += linux/qbatteryinfo_linux.cpp |
1680 | + } |
1681 | + |
1682 | ++CONFIG += link_pkgconfig |
1683 | ++PKGCONFIG += libudev libevdev |
1684 | ++LIBS += -ludev -levdev |
1685 | ++ |
1686 | + config_udev { |
1687 | + CONFIG += link_pkgconfig |
1688 | + PKGCONFIG += udev |
1689 | +@@ -219,7 +225,9 @@ |
1690 | + |
1691 | + QMAKE_DOCS = $$PWD/../../doc/config/systeminfo/qtsysteminfo.qdocconf |
1692 | + |
1693 | +-HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS |
1694 | ++HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS \ |
1695 | ++ qinputinfo.h \ |
1696 | ++ linux/qinputdeviceinfo_linux_p.h |
1697 | + load(qt_module) |
1698 | + |
1699 | + # This must be done after loading qt_module.prf |
1700 | +@@ -236,3 +244,6 @@ |
1701 | + } |
1702 | + } |
1703 | + |
1704 | ++OTHER_FILES += \ |
1705 | ++ notes.txt |
1706 | ++ |
1707 | + |
1708 | +=== modified file 'tests/auto/systeminfo/systeminfo.pro' |
1709 | +--- old/tests/auto/systeminfo/systeminfo.pro 2015-02-03 15:48:03 +0000 |
1710 | ++++ new/tests/auto/systeminfo/systeminfo.pro 2015-02-03 15:48:27 +0000 |
1711 | +@@ -3,4 +3,5 @@ |
1712 | + SUBDIRS = \ |
1713 | + qdeviceinfo \ |
1714 | + qscreensaver \ |
1715 | +- qbatteryinfo |
1716 | ++ qbatteryinfo \ |
1717 | ++# qinputdeviceinfo |
1718 | + |
1719 | |
1720 | === added file 'debian/patches/remove-storageinfo-examples.patch' |
1721 | --- debian/patches/remove-storageinfo-examples.patch 1970-01-01 00:00:00 +0000 |
1722 | +++ debian/patches/remove-storageinfo-examples.patch 2015-02-03 15:58:39 +0000 |
1723 | @@ -0,0 +1,342 @@ |
1724 | +=== removed directory 'examples/systeminfo/qml-storageinfo' |
1725 | +=== removed directory 'examples/systeminfo/qml-storageinfo/content' |
1726 | +=== removed file 'examples/systeminfo/qml-storageinfo/content/ProgressBar.qml' |
1727 | +--- old/examples/systeminfo/qml-storageinfo/content/ProgressBar.qml 2013-06-14 10:32:13 +0000 |
1728 | ++++ new/examples/systeminfo/qml-storageinfo/content/ProgressBar.qml 1970-01-01 00:00:00 +0000 |
1729 | +@@ -1,85 +0,0 @@ |
1730 | +-/**************************************************************************** |
1731 | +-** |
1732 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
1733 | +-** Contact: http://www.qt-project.org/legal |
1734 | +-** |
1735 | +-** This file is part of the examples of the Qt Toolkit. |
1736 | +-** |
1737 | +-** $QT_BEGIN_LICENSE:BSD$ |
1738 | +-** You may use this file under the terms of the BSD license as follows: |
1739 | +-** |
1740 | +-** "Redistribution and use in source and binary forms, with or without |
1741 | +-** modification, are permitted provided that the following conditions are |
1742 | +-** met: |
1743 | +-** * Redistributions of source code must retain the above copyright |
1744 | +-** notice, this list of conditions and the following disclaimer. |
1745 | +-** * Redistributions in binary form must reproduce the above copyright |
1746 | +-** notice, this list of conditions and the following disclaimer in |
1747 | +-** the documentation and/or other materials provided with the |
1748 | +-** distribution. |
1749 | +-** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names |
1750 | +-** of its contributors may be used to endorse or promote products derived |
1751 | +-** from this software without specific prior written permission. |
1752 | +-** |
1753 | +-** |
1754 | +-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
1755 | +-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
1756 | +-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
1757 | +-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
1758 | +-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
1759 | +-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
1760 | +-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
1761 | +-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
1762 | +-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
1763 | +-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
1764 | +-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." |
1765 | +-** |
1766 | +-** $QT_END_LICENSE$ |
1767 | +-** |
1768 | +-****************************************************************************/ |
1769 | +- |
1770 | +-import QtQuick 2.0 |
1771 | +- |
1772 | +-Item { |
1773 | +- id: progressbar |
1774 | +- |
1775 | +- property int minimum: 0 |
1776 | +- property int maximum: 100 |
1777 | +- property int value: 0 |
1778 | +- property int maxval: 0 |
1779 | +- property alias color: gradient1.color |
1780 | +- property alias secondColor: gradient2.color |
1781 | +- |
1782 | +- width: 30; height: 250 |
1783 | +- clip: true |
1784 | +- |
1785 | +- BorderImage { |
1786 | +- source: "background.png" |
1787 | +- width: parent.width; height: parent.height |
1788 | +- border { left: 4; top: 4; right: 4; bottom: 4 } |
1789 | +- } |
1790 | +- |
1791 | +- Rectangle { |
1792 | +- id: highlight |
1793 | +- |
1794 | +- property int widthDest: ((progressbar.height * (value - minimum)) / (maximum - minimum) ) |
1795 | +- |
1796 | +- height: highlight.widthDest |
1797 | +- Behavior on height { SmoothedAnimation { velocity: 1200 } } |
1798 | +- |
1799 | +- anchors { left: parent.left; right: parent.right; bottom: parent.bottom; leftMargin: 2; rightMargin: 2; bottomMargin: 2 } |
1800 | +-// anchors { left: parent.left; top: parent.top; bottom: parent.bottom; leftMargin: 3; topMargin: 3; bottomMargin: 3 } |
1801 | +- radius: 1 |
1802 | +- gradient: Gradient { |
1803 | +- GradientStop { id: gradient1; position: 0.0 } |
1804 | +- GradientStop { id: gradient2; position: 1.0 } |
1805 | +- } |
1806 | +- |
1807 | +- } |
1808 | +- Text { |
1809 | +- anchors { /*right: highlight.right; rightMargin: 6; */horizontalCenter: parent.horizontalCenter } |
1810 | +- color: "black" |
1811 | +- font.bold: true |
1812 | +- text: maxval + '%'//Math.floor((value - minimum) / (maximum - minimum) * 100) + '%' |
1813 | +- } |
1814 | +-} |
1815 | + |
1816 | +=== removed file 'examples/systeminfo/qml-storageinfo/content/background.png' |
1817 | +Binary files old/examples/systeminfo/qml-storageinfo/content/background.png 2013-06-14 10:32:13 +0000 and new/examples/systeminfo/qml-storageinfo/content/background.png 1970-01-01 00:00:00 +0000 differ |
1818 | +=== removed file 'examples/systeminfo/qml-storageinfo/main.cpp' |
1819 | +--- old/examples/systeminfo/qml-storageinfo/main.cpp 2013-06-14 10:32:13 +0000 |
1820 | ++++ new/examples/systeminfo/qml-storageinfo/main.cpp 1970-01-01 00:00:00 +0000 |
1821 | +@@ -1,43 +0,0 @@ |
1822 | +-/**************************************************************************** |
1823 | +-** |
1824 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
1825 | +-** Contact: http://www.qt-project.org/legal |
1826 | +-** |
1827 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
1828 | +-** |
1829 | +-** $QT_BEGIN_LICENSE:LGPL$ |
1830 | +-** Commercial License Usage |
1831 | +-** Licensees holding valid commercial Qt licenses may use this file in |
1832 | +-** accordance with the commercial license agreement provided with the |
1833 | +-** Software or, alternatively, in accordance with the terms contained in |
1834 | +-** a written agreement between you and Digia. For licensing terms and |
1835 | +-** conditions see http://qt.digia.com/licensing. For further information |
1836 | +-** use the contact form at http://qt.digia.com/contact-us. |
1837 | +-** |
1838 | +-** GNU Lesser General Public License Usage |
1839 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
1840 | +-** General Public License version 2.1 as published by the Free Software |
1841 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
1842 | +-** packaging of this file. Please review the following information to |
1843 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
1844 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
1845 | +-** |
1846 | +-** In addition, as a special exception, Digia gives you certain additional |
1847 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
1848 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
1849 | +-** |
1850 | +-** GNU General Public License Usage |
1851 | +-** Alternatively, this file may be used under the terms of the GNU |
1852 | +-** General Public License version 3.0 as published by the Free Software |
1853 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
1854 | +-** packaging of this file. Please review the following information to |
1855 | +-** ensure the GNU General Public License version 3.0 requirements will be |
1856 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
1857 | +-** |
1858 | +-** |
1859 | +-** $QT_END_LICENSE$ |
1860 | +-** |
1861 | +-****************************************************************************/ |
1862 | +- |
1863 | +-#include"../stub.h" |
1864 | +-SYSINFO_EXAMPLE_MAIN(qml-storage) |
1865 | + |
1866 | +=== removed file 'examples/systeminfo/qml-storageinfo/qml-storage.qml' |
1867 | +--- old/examples/systeminfo/qml-storageinfo/qml-storage.qml 2013-06-14 10:32:13 +0000 |
1868 | ++++ new/examples/systeminfo/qml-storageinfo/qml-storage.qml 1970-01-01 00:00:00 +0000 |
1869 | +@@ -1,111 +0,0 @@ |
1870 | +-/**************************************************************************** |
1871 | +-** |
1872 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
1873 | +-** Contact: http://www.qt-project.org/legal |
1874 | +-** |
1875 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
1876 | +-** |
1877 | +-** $QT_BEGIN_LICENSE:LGPL$ |
1878 | +-** Commercial License Usage |
1879 | +-** Licensees holding valid commercial Qt licenses may use this file in |
1880 | +-** accordance with the commercial license agreement provided with the |
1881 | +-** Software or, alternatively, in accordance with the terms contained in |
1882 | +-** a written agreement between you and Digia. For licensing terms and |
1883 | +-** conditions see http://qt.digia.com/licensing. For further information |
1884 | +-** use the contact form at http://qt.digia.com/contact-us. |
1885 | +-** |
1886 | +-** GNU Lesser General Public License Usage |
1887 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
1888 | +-** General Public License version 2.1 as published by the Free Software |
1889 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
1890 | +-** packaging of this file. Please review the following information to |
1891 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
1892 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
1893 | +-** |
1894 | +-** In addition, as a special exception, Digia gives you certain additional |
1895 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
1896 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
1897 | +-** |
1898 | +-** GNU General Public License Usage |
1899 | +-** Alternatively, this file may be used under the terms of the GNU |
1900 | +-** General Public License version 3.0 as published by the Free Software |
1901 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
1902 | +-** packaging of this file. Please review the following information to |
1903 | +-** ensure the GNU General Public License version 3.0 requirements will be |
1904 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
1905 | +-** |
1906 | +-** |
1907 | +-** $QT_END_LICENSE$ |
1908 | +-** |
1909 | +-****************************************************************************/ |
1910 | +- |
1911 | +-import QtQuick 2.0 |
1912 | +-import QtSystemInfo 5.0 |
1913 | +-import "content" |
1914 | +- |
1915 | +-Rectangle { |
1916 | +- width: 480; height: 854 |
1917 | +- color: "#343434" |
1918 | +- |
1919 | +- StorageInfo { |
1920 | +- id: storageinfo |
1921 | +- onLogicalDriveChanged: updateList; |
1922 | +- } |
1923 | +- |
1924 | +- function getTotalSizeText(name) { |
1925 | +- var totalSpace = storageinfo.totalDiskSpace(name); |
1926 | +- if (totalSpace / 1024 < 1024) |
1927 | +- return Math.round((totalSpace / 1024) * 100) / 100 + " kb avail."; |
1928 | +- else if (totalSpace/1024/1024 < 1024) |
1929 | +- return Math.round((totalSpace / 1024 / 1024) * 100) / 100 + " Mb avail."; |
1930 | +- else if (totalSpace/1024/1024/1024 < 1024) |
1931 | +- return Math.round((totalSpace / 1024 / 1024 / 1024) * 100) / 100 + " Gb avail."; |
1932 | +- return ""; |
1933 | +- } |
1934 | +- |
1935 | +- function getAvailableSizeText(name) { |
1936 | +- var dspace = storageinfo.availableDiskSpace(name); |
1937 | +- if (dspace /1024 < 1024) |
1938 | +- return Math.round((dspace / 1024) * 100) / 100 + " kb / "; |
1939 | +- else if (dspace/1024/1024 < 1024) |
1940 | +- return Math.round((dspace / 1024 / 1024) * 100) / 100 + " Mb / "; |
1941 | +- else if (dspace/1024/1024/1024 < 1024) |
1942 | +- return Math.round((dspace / 1024 / 1024 / 1024) * 100) / 100 + " Gb / "; |
1943 | +- return ""; |
1944 | +- } |
1945 | +- |
1946 | +- function getPercent(name) { |
1947 | +- return Math.round(100 - ((storageinfo.availableDiskSpace(name) / storageinfo.totalDiskSpace(name)) * 100)) |
1948 | +- } |
1949 | +- |
1950 | +- property alias storageList: storageinfo.allLogicalDrives; |
1951 | +- |
1952 | +- function updateList() { |
1953 | +- driveList:storageList: storageinfo.allLogicalDrives; |
1954 | +- } |
1955 | +- |
1956 | +- Component { |
1957 | +- id: listItem |
1958 | +- |
1959 | +- Row { |
1960 | +- id:row |
1961 | +- spacing: 10 |
1962 | +- ProgressBar { |
1963 | +- width: 120; height: 25 |
1964 | +- maxval: getPercent(name.text) |
1965 | +- value: getPercent(name.text) |
1966 | +- NumberAnimation on value { duration: 1500; from: 0; to: getPercent(name.text); loops: 1 } |
1967 | +- ColorAnimation on color { duration: 1500; from: "lightsteelblue"; to: "thistle"; loops:1} |
1968 | +- ColorAnimation on secondColor { duration: 1500; from: "steelblue"; to: "#CD96CD"; loops: 1 } |
1969 | +- } |
1970 | +- Text { id: name; text: modelData; color: "white";} |
1971 | +- Text { text: getAvailableSizeText(name.text) + getTotalSizeText(name.text); color: "white";} |
1972 | +- } |
1973 | +- } |
1974 | +- |
1975 | +- ListView { |
1976 | +- anchors.fill: parent |
1977 | +- model: storageList |
1978 | +- delegate: listItem |
1979 | +- } |
1980 | +-} |
1981 | + |
1982 | +=== removed file 'examples/systeminfo/qml-storageinfo/qml-storageinfo.pro' |
1983 | +--- old/examples/systeminfo/qml-storageinfo/qml-storageinfo.pro 2013-06-14 10:32:13 +0000 |
1984 | ++++ new/examples/systeminfo/qml-storageinfo/qml-storageinfo.pro 1970-01-01 00:00:00 +0000 |
1985 | +@@ -1,12 +0,0 @@ |
1986 | +-TEMPLATE = app |
1987 | +-TARGET = qml-storageinfo |
1988 | +-QT += quick |
1989 | +-SOURCES = main.cpp |
1990 | +- |
1991 | +-app.files = \ |
1992 | +- $$files(*.qml) \ |
1993 | +- content |
1994 | +- |
1995 | +-target.path = $$[QT_INSTALL_EXAMPLES]/sysinfo/qml-storageinfo |
1996 | +-app.path = $$[QT_INSTALL_EXAMPLES]/sysinfo/qml-storageinfo |
1997 | +-INSTALLS += target app |
1998 | + |
1999 | +=== modified file 'examples/systeminfo/systeminfo.pro' |
2000 | +--- old/examples/systeminfo/systeminfo.pro 2013-06-14 10:32:13 +0000 |
2001 | ++++ new/examples/systeminfo/systeminfo.pro 2015-02-03 09:54:15 +0000 |
2002 | +@@ -2,7 +2,6 @@ |
2003 | + |
2004 | + SUBDIRS += \ |
2005 | + qml-deviceinfo \ |
2006 | +- qml-storageinfo \ |
2007 | + qml-battery |
2008 | + |
2009 | + #qtHaveModule(widgets): SUBDIRS += \ |
2010 | + |
2011 | +=== modified file 'src/imports/systeminfo/plugins.qmltypes' |
2012 | +--- old/src/imports/systeminfo/plugins.qmltypes 2013-06-14 10:32:13 +0000 |
2013 | ++++ new/src/imports/systeminfo/plugins.qmltypes 2015-02-03 09:54:15 +0000 |
2014 | +@@ -472,50 +472,6 @@ |
2015 | + } |
2016 | + } |
2017 | + Component { |
2018 | +- name: "QDeclarativeStorageInfo" |
2019 | +- prototype: "QObject" |
2020 | +- exports: ["QtSystemInfo/StorageInfo 5.0"] |
2021 | +- exportMetaObjectRevisions: [0] |
2022 | +- Enum { |
2023 | +- name: "DriveType" |
2024 | +- values: { |
2025 | +- "UnknownDrive": 0, |
2026 | +- "InternalDrive": 1, |
2027 | +- "RemovableDrive": 2, |
2028 | +- "RemoteDrive": 3, |
2029 | +- "CdromDrive": 4, |
2030 | +- "RamDrive": 5 |
2031 | +- } |
2032 | +- } |
2033 | +- Property { name: "allLogicalDrives"; type: "QStringList"; isReadonly: true } |
2034 | +- Property { name: "monitorAllLogicalDrives"; type: "bool" } |
2035 | +- Signal { |
2036 | +- name: "logicalDriveChanged" |
2037 | +- Parameter { name: "drive"; type: "string" } |
2038 | +- Parameter { name: "added"; type: "bool" } |
2039 | +- } |
2040 | +- Method { |
2041 | +- name: "availableDiskSpace" |
2042 | +- type: "qlonglong" |
2043 | +- Parameter { name: "drive"; type: "string" } |
2044 | +- } |
2045 | +- Method { |
2046 | +- name: "totalDiskSpace" |
2047 | +- type: "qlonglong" |
2048 | +- Parameter { name: "drive"; type: "string" } |
2049 | +- } |
2050 | +- Method { |
2051 | +- name: "uriForDrive" |
2052 | +- type: "string" |
2053 | +- Parameter { name: "drive"; type: "string" } |
2054 | +- } |
2055 | +- Method { |
2056 | +- name: "driveType" |
2057 | +- type: "int" |
2058 | +- Parameter { name: "drive"; type: "string" } |
2059 | +- } |
2060 | +- } |
2061 | +- Component { |
2062 | + name: "QScreenSaver" |
2063 | + prototype: "QObject" |
2064 | + exports: ["QtSystemInfo/ScreenSaver 5.0"] |
2065 | + |
2066 | |
2067 | === added file 'debian/patches/remove-storageinfo.patch' |
2068 | --- debian/patches/remove-storageinfo.patch 1970-01-01 00:00:00 +0000 |
2069 | +++ debian/patches/remove-storageinfo.patch 2015-02-03 15:58:39 +0000 |
2070 | @@ -0,0 +1,2371 @@ |
2071 | +=== removed file 'src/imports/systeminfo/qdeclarativestorageinfo.cpp' |
2072 | +--- old/src/imports/systeminfo/qdeclarativestorageinfo.cpp 2013-06-14 10:32:13 +0000 |
2073 | ++++ new/src/imports/systeminfo/qdeclarativestorageinfo.cpp 1970-01-01 00:00:00 +0000 |
2074 | +@@ -1,157 +0,0 @@ |
2075 | +-/**************************************************************************** |
2076 | +-** |
2077 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
2078 | +-** Contact: http://www.qt-project.org/legal |
2079 | +-** |
2080 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
2081 | +-** |
2082 | +-** $QT_BEGIN_LICENSE:LGPL$ |
2083 | +-** Commercial License Usage |
2084 | +-** Licensees holding valid commercial Qt licenses may use this file in |
2085 | +-** accordance with the commercial license agreement provided with the |
2086 | +-** Software or, alternatively, in accordance with the terms contained in |
2087 | +-** a written agreement between you and Digia. For licensing terms and |
2088 | +-** conditions see http://qt.digia.com/licensing. For further information |
2089 | +-** use the contact form at http://qt.digia.com/contact-us. |
2090 | +-** |
2091 | +-** GNU Lesser General Public License Usage |
2092 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
2093 | +-** General Public License version 2.1 as published by the Free Software |
2094 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
2095 | +-** packaging of this file. Please review the following information to |
2096 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
2097 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
2098 | +-** |
2099 | +-** In addition, as a special exception, Digia gives you certain additional |
2100 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
2101 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
2102 | +-** |
2103 | +-** GNU General Public License Usage |
2104 | +-** Alternatively, this file may be used under the terms of the GNU |
2105 | +-** General Public License version 3.0 as published by the Free Software |
2106 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
2107 | +-** packaging of this file. Please review the following information to |
2108 | +-** ensure the GNU General Public License version 3.0 requirements will be |
2109 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
2110 | +-** |
2111 | +-** |
2112 | +-** $QT_END_LICENSE$ |
2113 | +-** |
2114 | +-****************************************************************************/ |
2115 | +- |
2116 | +-#include "qdeclarativestorageinfo_p.h" |
2117 | +- |
2118 | +-QT_BEGIN_NAMESPACE |
2119 | +- |
2120 | +-/*! |
2121 | +- \qmltype StorageInfo |
2122 | +- \instantiates QDeclarativeStorageInfo |
2123 | +- \inqmlmodule QtSystemInfo |
2124 | +- \ingroup qml-systeminfo |
2125 | +- \brief The StorageInfo element provides various information about the storage system. |
2126 | +-*/ |
2127 | +- |
2128 | +-/*! |
2129 | +- \internal |
2130 | +-*/ |
2131 | +-QDeclarativeStorageInfo::QDeclarativeStorageInfo(QObject *parent) |
2132 | +- : QObject(parent) |
2133 | +- , storageInfo(new QStorageInfo(this)) |
2134 | +- , isMonitorAllLogicalDrives(false) |
2135 | +-{ |
2136 | +-} |
2137 | +- |
2138 | +-/*! |
2139 | +- \internal |
2140 | +- */ |
2141 | +-QDeclarativeStorageInfo::~QDeclarativeStorageInfo() |
2142 | +-{ |
2143 | +-} |
2144 | +- |
2145 | +-/*! |
2146 | +- \qmlproperty bool StorageInfo::monitorAllLogicalDrives |
2147 | +- |
2148 | +- This property triggers the active monitoring of all available logical drives. |
2149 | +- */ |
2150 | +-bool QDeclarativeStorageInfo::monitorAllLogicalDrives() const |
2151 | +-{ |
2152 | +- return isMonitorAllLogicalDrives; |
2153 | +-} |
2154 | +- |
2155 | +-void QDeclarativeStorageInfo::setMonitorAllLogicalDrives(bool monitor) |
2156 | +-{ |
2157 | +- if (monitor != isMonitorAllLogicalDrives) { |
2158 | +- isMonitorAllLogicalDrives = monitor; |
2159 | +- if (monitor) { |
2160 | +- connect(storageInfo, SIGNAL(logicalDriveChanged(QString,bool)), |
2161 | +- this, SIGNAL(logicalDriveChanged(QString,bool))); |
2162 | +- } else { |
2163 | +- disconnect(storageInfo, SIGNAL(logicalDriveChanged(QString,bool)), |
2164 | +- this, SIGNAL(logicalDriveChanged(QString,bool))); |
2165 | +- } |
2166 | +- emit monitorAllLogicalDrivesChanged(); |
2167 | +- } |
2168 | +-} |
2169 | +- |
2170 | +-/*! |
2171 | +- \qmlproperty stringlist StorageInfo::allLogicalDrives |
2172 | +- |
2173 | +- This property holds a list of all the available logical drives. |
2174 | +-*/ |
2175 | +-QStringList QDeclarativeStorageInfo::allLogicalDrives() const |
2176 | +-{ |
2177 | +- return storageInfo->allLogicalDrives(); |
2178 | +-} |
2179 | +- |
2180 | +-/*! |
2181 | +- \qmlmethod qlonglong StorageInfo::availableDiskSpace(string drive) |
2182 | +- |
2183 | +- Returns the available free space on the \a drive, in bytes. -1 is returned if the drive doesn't |
2184 | +- exist, or the information is not available. |
2185 | +-*/ |
2186 | +-qlonglong QDeclarativeStorageInfo::availableDiskSpace(const QString &drive) const |
2187 | +-{ |
2188 | +- return storageInfo->availableDiskSpace(drive); |
2189 | +-} |
2190 | +- |
2191 | +-/*! |
2192 | +- \qmlmethod qlonglong StorageInfo::totalDiskSpace(string drive) |
2193 | +- |
2194 | +- Returns the total space of the \a drive, in bytes. -1 is returned if the drive doesn't exist, |
2195 | +- or the information is not available. |
2196 | +-*/ |
2197 | +-qlonglong QDeclarativeStorageInfo::totalDiskSpace(const QString &drive) const |
2198 | +-{ |
2199 | +- return storageInfo->totalDiskSpace(drive); |
2200 | +-} |
2201 | +- |
2202 | +-/*! |
2203 | +- \qmlmethod qlonglong StorageInfo::uriForDrive(string drive) |
2204 | +- |
2205 | +- Returns the URI, or unique identifier for the given \a drive. If the drive doesn't exist, or the |
2206 | +- information is not available, an empty string is returned. |
2207 | +-*/ |
2208 | +-QString QDeclarativeStorageInfo::uriForDrive(const QString &drive) const |
2209 | +-{ |
2210 | +- return storageInfo->uriForDrive(drive); |
2211 | +-} |
2212 | +- |
2213 | +-/*! |
2214 | +- \qmlmethod DriveType StorageInfo::driveType(string drive) |
2215 | +- |
2216 | +- Returns the type of the given \a drive. Possible values are: |
2217 | +- \list |
2218 | +- \li StorageInfo.UnknownDrive - Drive type unknown. |
2219 | +- \li StorageInfo.InternalDrive - Internal mass storage drive, e.g. hard drive. |
2220 | +- \li StorageInfo.RemovableDrive - Removable drive, e.g. memory card. |
2221 | +- \li StorageInfo.RemoteDrive - Network drive. |
2222 | +- \li StorageInfo.CdromDrive - CD-ROM. |
2223 | +- \li StorageInfo.RamDrive - Virtual drive made in RAM memory. |
2224 | +- \endlist |
2225 | +-*/ |
2226 | +-int QDeclarativeStorageInfo::driveType(const QString &drive) const |
2227 | +-{ |
2228 | +- return storageInfo->driveType(drive); |
2229 | +-} |
2230 | +- |
2231 | +-QT_END_NAMESPACE |
2232 | + |
2233 | +=== removed file 'src/imports/systeminfo/qdeclarativestorageinfo_p.h' |
2234 | +--- old/src/imports/systeminfo/qdeclarativestorageinfo_p.h 2013-06-14 10:32:13 +0000 |
2235 | ++++ new/src/imports/systeminfo/qdeclarativestorageinfo_p.h 1970-01-01 00:00:00 +0000 |
2236 | +@@ -1,104 +0,0 @@ |
2237 | +-/**************************************************************************** |
2238 | +-** |
2239 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
2240 | +-** Contact: http://www.qt-project.org/legal |
2241 | +-** |
2242 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
2243 | +-** |
2244 | +-** $QT_BEGIN_LICENSE:LGPL$ |
2245 | +-** Commercial License Usage |
2246 | +-** Licensees holding valid commercial Qt licenses may use this file in |
2247 | +-** accordance with the commercial license agreement provided with the |
2248 | +-** Software or, alternatively, in accordance with the terms contained in |
2249 | +-** a written agreement between you and Digia. For licensing terms and |
2250 | +-** conditions see http://qt.digia.com/licensing. For further information |
2251 | +-** use the contact form at http://qt.digia.com/contact-us. |
2252 | +-** |
2253 | +-** GNU Lesser General Public License Usage |
2254 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
2255 | +-** General Public License version 2.1 as published by the Free Software |
2256 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
2257 | +-** packaging of this file. Please review the following information to |
2258 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
2259 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
2260 | +-** |
2261 | +-** In addition, as a special exception, Digia gives you certain additional |
2262 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
2263 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
2264 | +-** |
2265 | +-** GNU General Public License Usage |
2266 | +-** Alternatively, this file may be used under the terms of the GNU |
2267 | +-** General Public License version 3.0 as published by the Free Software |
2268 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
2269 | +-** packaging of this file. Please review the following information to |
2270 | +-** ensure the GNU General Public License version 3.0 requirements will be |
2271 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
2272 | +-** |
2273 | +-** |
2274 | +-** $QT_END_LICENSE$ |
2275 | +-** |
2276 | +-****************************************************************************/ |
2277 | +- |
2278 | +-// |
2279 | +-// W A R N I N G |
2280 | +-// ------------- |
2281 | +-// |
2282 | +-// This file is not part of the Qt API. It exists purely as an |
2283 | +-// implementation detail. This header file may change from version to |
2284 | +-// version without notice, or even be removed. |
2285 | +-// |
2286 | +-// We mean it. |
2287 | +-// |
2288 | +- |
2289 | +-#ifndef QDECLARATIVESTORAGEINFO_P_H |
2290 | +-#define QDECLARATIVESTORAGEINFO_P_H |
2291 | +- |
2292 | +-#include <qstorageinfo.h> |
2293 | +- |
2294 | +-QT_BEGIN_NAMESPACE |
2295 | +- |
2296 | +-class QDeclarativeStorageInfo : public QObject |
2297 | +-{ |
2298 | +- Q_OBJECT |
2299 | +- |
2300 | +- Q_ENUMS(DriveType) |
2301 | +- |
2302 | +- Q_PROPERTY(QStringList allLogicalDrives READ allLogicalDrives NOTIFY logicalDriveChanged) |
2303 | +- Q_PROPERTY(bool monitorAllLogicalDrives READ monitorAllLogicalDrives WRITE setMonitorAllLogicalDrives NOTIFY monitorAllLogicalDrivesChanged) |
2304 | +- |
2305 | +-public: |
2306 | +- enum DriveType { |
2307 | +- UnknownDrive = QStorageInfo::UnknownDrive, |
2308 | +- InternalDrive = QStorageInfo::InternalDrive, |
2309 | +- RemovableDrive = QStorageInfo::RemovableDrive, |
2310 | +- RemoteDrive = QStorageInfo::RemoteDrive, |
2311 | +- CdromDrive = QStorageInfo::CdromDrive, |
2312 | +- RamDrive = QStorageInfo::RamDrive |
2313 | +- }; |
2314 | +- |
2315 | +- QDeclarativeStorageInfo(QObject *parent = 0); |
2316 | +- virtual ~QDeclarativeStorageInfo(); |
2317 | +- |
2318 | +- bool monitorAllLogicalDrives() const; |
2319 | +- void setMonitorAllLogicalDrives(bool monitor); |
2320 | +- QStringList allLogicalDrives() const; |
2321 | +- |
2322 | +- Q_INVOKABLE qlonglong availableDiskSpace(const QString &drive) const; |
2323 | +- Q_INVOKABLE qlonglong totalDiskSpace(const QString &drive) const; |
2324 | +- Q_INVOKABLE QString uriForDrive(const QString &drive) const; |
2325 | +- Q_INVOKABLE int driveType(const QString &drive) const; |
2326 | +- |
2327 | +-Q_SIGNALS: |
2328 | +- void monitorAllLogicalDrivesChanged(); |
2329 | +- |
2330 | +- void logicalDriveChanged(const QString &drive, bool added); |
2331 | +- |
2332 | +-private: |
2333 | +- QStorageInfo *storageInfo; |
2334 | +- |
2335 | +- bool isMonitorAllLogicalDrives; |
2336 | +-}; |
2337 | +- |
2338 | +-QT_END_NAMESPACE |
2339 | +- |
2340 | +-#endif // QDECLARATIVESTORAGEINFO_P_H |
2341 | + |
2342 | +=== modified file 'src/imports/systeminfo/qsysteminfo.cpp' |
2343 | +--- old/src/imports/systeminfo/qsysteminfo.cpp 2013-07-12 13:41:02 +0000 |
2344 | ++++ new/src/imports/systeminfo/qsysteminfo.cpp 2015-02-03 15:08:08 +0000 |
2345 | +@@ -46,7 +46,6 @@ |
2346 | + #include "qdeclarativedeviceinfo_p.h" |
2347 | + #include "qdeclarativenetworkinfo_p.h" |
2348 | + #include <qscreensaver.h> |
2349 | +-#include "qdeclarativestorageinfo_p.h" |
2350 | + |
2351 | + QT_BEGIN_NAMESPACE |
2352 | + |
2353 | +@@ -66,7 +65,6 @@ |
2354 | + qmlRegisterType<QDeclarativeDeviceInfo>(uri, major, minor, "DeviceInfo"); |
2355 | + qmlRegisterType<QDeclarativeNetworkInfo>(uri, major, minor, "NetworkInfo"); |
2356 | + qmlRegisterType<QScreenSaver>(uri, major, minor, "ScreenSaver"); |
2357 | +- qmlRegisterType<QDeclarativeStorageInfo>(uri, major, minor, "StorageInfo"); |
2358 | + } |
2359 | + }; |
2360 | + |
2361 | + |
2362 | +=== modified file 'src/imports/systeminfo/systeminfo.pro' |
2363 | +--- old/src/imports/systeminfo/systeminfo.pro 2013-07-12 13:41:02 +0000 |
2364 | ++++ new/src/imports/systeminfo/systeminfo.pro 2015-02-03 15:08:59 +0000 |
2365 | +@@ -4,14 +4,12 @@ |
2366 | + HEADERS += \ |
2367 | + qdeclarativebatteryinfo_p.h \ |
2368 | + qdeclarativedeviceinfo_p.h \ |
2369 | +- qdeclarativenetworkinfo_p.h \ |
2370 | +- qdeclarativestorageinfo_p.h |
2371 | ++ qdeclarativenetworkinfo_p.h |
2372 | + |
2373 | + SOURCES += \ |
2374 | + qdeclarativebatteryinfo.cpp \ |
2375 | + qdeclarativedeviceinfo.cpp \ |
2376 | + qdeclarativenetworkinfo.cpp \ |
2377 | +- qdeclarativestorageinfo.cpp \ |
2378 | + qsysteminfo.cpp |
2379 | + |
2380 | + load(qml_plugin) |
2381 | + |
2382 | +=== removed file 'src/systeminfo/linux/qstorageinfo_linux.cpp' |
2383 | +--- old/src/systeminfo/linux/qstorageinfo_linux.cpp 2013-06-14 10:32:13 +0000 |
2384 | ++++ new/src/systeminfo/linux/qstorageinfo_linux.cpp 1970-01-01 00:00:00 +0000 |
2385 | +@@ -1,410 +0,0 @@ |
2386 | +-/**************************************************************************** |
2387 | +-** |
2388 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
2389 | +-** Contact: http://www.qt-project.org/legal |
2390 | +-** |
2391 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
2392 | +-** |
2393 | +-** $QT_BEGIN_LICENSE:LGPL$ |
2394 | +-** Commercial License Usage |
2395 | +-** Licensees holding valid commercial Qt licenses may use this file in |
2396 | +-** accordance with the commercial license agreement provided with the |
2397 | +-** Software or, alternatively, in accordance with the terms contained in |
2398 | +-** a written agreement between you and Digia. For licensing terms and |
2399 | +-** conditions see http://qt.digia.com/licensing. For further information |
2400 | +-** use the contact form at http://qt.digia.com/contact-us. |
2401 | +-** |
2402 | +-** GNU Lesser General Public License Usage |
2403 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
2404 | +-** General Public License version 2.1 as published by the Free Software |
2405 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
2406 | +-** packaging of this file. Please review the following information to |
2407 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
2408 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
2409 | +-** |
2410 | +-** In addition, as a special exception, Digia gives you certain additional |
2411 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
2412 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
2413 | +-** |
2414 | +-** GNU General Public License Usage |
2415 | +-** Alternatively, this file may be used under the terms of the GNU |
2416 | +-** General Public License version 3.0 as published by the Free Software |
2417 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
2418 | +-** packaging of this file. Please review the following information to |
2419 | +-** ensure the GNU General Public License version 3.0 requirements will be |
2420 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
2421 | +-** |
2422 | +-** |
2423 | +-** $QT_END_LICENSE$ |
2424 | +-** |
2425 | +-****************************************************************************/ |
2426 | +- |
2427 | +-#include "qstorageinfo_linux_p.h" |
2428 | +- |
2429 | +-#include <QtCore/qfile.h> |
2430 | +-#include <QtCore/qdir.h> |
2431 | +-#include <QtCore/qmetaobject.h> |
2432 | +-#include <QtCore/qsocketnotifier.h> |
2433 | +- |
2434 | +-#include <errno.h> |
2435 | +-#include <mntent.h> |
2436 | +-#include <fcntl.h> |
2437 | +-#include <linux/fs.h> |
2438 | +-#include <sys/inotify.h> |
2439 | +-#include <sys/ioctl.h> |
2440 | +-#include <sys/stat.h> |
2441 | +-#include <sys/statfs.h> |
2442 | +-#include <unistd.h> |
2443 | +- |
2444 | +-#if !defined(QT_NO_UDEV) |
2445 | +-#include "qudevwrapper_p.h" |
2446 | +-#endif // QT_NO_UDEV |
2447 | +- |
2448 | +-#if !defined(QT_NO_UDISKS) |
2449 | +-#include <QtDBus/qdbusconnection.h> |
2450 | +-#include <QtDBus/qdbusinterface.h> |
2451 | +-#include <QtDBus/qdbusreply.h> |
2452 | +-#endif // QT_NO_UDISKS |
2453 | +- |
2454 | +-QT_BEGIN_NAMESPACE |
2455 | +- |
2456 | +-QStorageInfoPrivate::QStorageInfoPrivate(QStorageInfo *parent) |
2457 | +- : QObject(parent) |
2458 | +- , q_ptr(parent) |
2459 | +- , inotifyWatcher(-1) |
2460 | +- , inotifyFileDescriptor(-1) |
2461 | +- , notifier(0) |
2462 | +-#if !defined(QT_NO_UDEV) |
2463 | +- , udevWrapper(0) |
2464 | +- , needsUDevWatcher(-1) |
2465 | +-#endif // QT_NO_UDEV |
2466 | +-{ |
2467 | +-} |
2468 | +- |
2469 | +-QStorageInfoPrivate::~QStorageInfoPrivate() |
2470 | +-{ |
2471 | +- cleanupWatcher(); |
2472 | +-} |
2473 | +- |
2474 | +-qlonglong QStorageInfoPrivate::availableDiskSpace(const QString &drive) |
2475 | +-{ |
2476 | +- struct statfs statistics; |
2477 | +- if (statfs(drive.toLatin1(), &statistics) == 0) { |
2478 | +- qlonglong blockSize = statistics.f_bsize; |
2479 | +- qlonglong availBlocks = statistics.f_bavail; |
2480 | +- return availBlocks * blockSize; |
2481 | +- } |
2482 | +- |
2483 | +- return -1; |
2484 | +-} |
2485 | +- |
2486 | +-qlonglong QStorageInfoPrivate::totalDiskSpace(const QString &drive) |
2487 | +-{ |
2488 | +- struct statfs statistics; |
2489 | +- if (statfs(drive.toLatin1(), &statistics) == 0) { |
2490 | +- qlonglong blockSize = statistics.f_bsize; |
2491 | +- qlonglong totalBlocks = statistics.f_blocks; |
2492 | +- return totalBlocks * blockSize; |
2493 | +- } |
2494 | +- |
2495 | +- return -1; |
2496 | +-} |
2497 | +- |
2498 | +-QString QStorageInfoPrivate::uriForDrive(const QString &drive) |
2499 | +-{ |
2500 | +- QFileInfoList fileinfolist = QDir(QString(QStringLiteral("/dev/disk/by-uuid/"))).entryInfoList(QDir::AllEntries | QDir::NoDot | QDir::NoDotDot); |
2501 | +- if (!fileinfolist.isEmpty()) { |
2502 | +- FILE *fsDescription = setmntent(_PATH_MOUNTED, "r"); |
2503 | +- struct mntent entry; |
2504 | +- char buffer[512]; |
2505 | +- QString uri; |
2506 | +- while ((getmntent_r(fsDescription, &entry, buffer, sizeof(buffer))) != NULL) { |
2507 | +- if (drive != QString::fromLatin1(entry.mnt_dir)) |
2508 | +- continue; |
2509 | +- int idx = fileinfolist.indexOf(QString::fromLatin1(entry.mnt_fsname)); |
2510 | +- if (idx != -1) |
2511 | +- uri = fileinfolist[idx].fileName(); |
2512 | +- break; |
2513 | +- } |
2514 | +- endmntent(fsDescription); |
2515 | +- |
2516 | +- if (!uri.isEmpty()) |
2517 | +- return uri; |
2518 | +- } |
2519 | +- |
2520 | +-#if !defined(QT_NO_UDISKS) |
2521 | +- QDBusReply<QList<QDBusObjectPath> > reply = QDBusConnection::systemBus().call( |
2522 | +- QDBusMessage::createMethodCall(QString(QStringLiteral("org.freedesktop.UDisks")), |
2523 | +- QString(QStringLiteral("/org/freedesktop/UDisks")), |
2524 | +- QString(QStringLiteral("org.freedesktop.UDisks")), |
2525 | +- QString(QStringLiteral("EnumerateDevices")))); |
2526 | +- if (reply.isValid()) { |
2527 | +- QList<QDBusObjectPath> paths = reply.value(); |
2528 | +- foreach (const QDBusObjectPath &path, paths) { |
2529 | +- QDBusInterface interface(QString(QStringLiteral("org.freedesktop.UDisks")), path.path(), |
2530 | +- QString(QStringLiteral("org.freedesktop.DBus.Properties")), |
2531 | +- QDBusConnection::systemBus()); |
2532 | +- if (!interface.isValid()) |
2533 | +- continue; |
2534 | +- QDBusReply<QVariant> reply = interface.call(QString(QStringLiteral("Get")), |
2535 | +- QString(QStringLiteral("org.freedesktop.UDisks.Device")), |
2536 | +- QString(QStringLiteral("DeviceMountPaths"))); |
2537 | +- if (reply.isValid() && reply.value().toString() == drive) { |
2538 | +- reply = interface.call(QString(QStringLiteral("Get")), |
2539 | +- QString(QStringLiteral("org.freedesktop.UDisks.Device")), |
2540 | +- QString(QStringLiteral("IdUuid"))); |
2541 | +- if (reply.isValid()) |
2542 | +- return reply.value().toString(); |
2543 | +- } |
2544 | +- } |
2545 | +- } |
2546 | +-#endif // QT_NO_UDISKS |
2547 | +- |
2548 | +- return QString::null; |
2549 | +-} |
2550 | +- |
2551 | +-QStringList QStorageInfoPrivate::allLogicalDrives() |
2552 | +-{ |
2553 | +- // No need to update the list if someone is listening to the signal, as it will be updated in that case |
2554 | +-#if !defined(QT_NO_UDEV) |
2555 | +- if (inotifyWatcher == -1 && needsUDevWatcher != 2) |
2556 | +-#else |
2557 | +- if (inotifyWatcher == -1) |
2558 | +-#endif // QT_NO_UDEV |
2559 | +- updateLogicalDrives(); |
2560 | +- |
2561 | +- return logicalDrives; |
2562 | +-} |
2563 | +- |
2564 | +-QStorageInfo::DriveType QStorageInfoPrivate::driveType(const QString &drive) |
2565 | +-{ |
2566 | +- QStorageInfo::DriveType type = QStorageInfo::UnknownDrive; |
2567 | +- FILE *fsDescription = setmntent(_PATH_MOUNTED, "r"); |
2568 | +- struct mntent entry; |
2569 | +- char buffer[512]; |
2570 | +- while ((getmntent_r(fsDescription, &entry, buffer, sizeof(buffer))) != NULL) { |
2571 | +- if (drive != QString::fromLatin1(entry.mnt_dir)) |
2572 | +- continue; |
2573 | +- |
2574 | +- if (strcmp(entry.mnt_type, "binfmt_misc") == 0 |
2575 | +- || strcmp(entry.mnt_type, "debugfs") == 0 |
2576 | +- || strcmp(entry.mnt_type, "devpts") == 0 |
2577 | +- || strcmp(entry.mnt_type, "devtmpfs") == 0 |
2578 | +- || strcmp(entry.mnt_type, "fusectl") == 0 |
2579 | +- || strcmp(entry.mnt_type, "none") == 0 |
2580 | +- || strcmp(entry.mnt_type, "proc") == 0 |
2581 | +- || strcmp(entry.mnt_type, "ramfs") == 0 |
2582 | +- || strcmp(entry.mnt_type, "securityfs") == 0 |
2583 | +- || strcmp(entry.mnt_type, "sysfs") == 0 |
2584 | +- || strcmp(entry.mnt_type, "tmpfs") == 0) { |
2585 | +- type = QStorageInfo::RamDrive; |
2586 | +- break; |
2587 | +- } |
2588 | +- |
2589 | +- if (strcmp(entry.mnt_type, "cifs") == 0 |
2590 | +- || strcmp(entry.mnt_type, "ncpfs") == 0 |
2591 | +- || strcmp(entry.mnt_type, "nfs") == 0 |
2592 | +- || strcmp(entry.mnt_type, "nfs4") == 0 |
2593 | +- || strcmp(entry.mnt_type, "smbfs") == 0) { |
2594 | +- type = QStorageInfo::RemoteDrive; |
2595 | +- break; |
2596 | +- } |
2597 | +- |
2598 | +- if (strcmp(entry.mnt_type, "iso9660") == 0) { |
2599 | +- type = QStorageInfo::CdromDrive; |
2600 | +- break; |
2601 | +- } |
2602 | +- |
2603 | +- if (strcmp(entry.mnt_type, "rootfs") == 0) { |
2604 | +- type = QStorageInfo::InternalDrive; |
2605 | +- break; |
2606 | +- } |
2607 | +- |
2608 | +- // Now need to guess if it's InternalDrive or RemovableDrive |
2609 | +- QString fsName(QString::fromLatin1(entry.mnt_fsname)); |
2610 | +- if (fsName.contains(QString(QStringLiteral("mapper")))) { |
2611 | +- struct stat status; |
2612 | +- stat(entry.mnt_fsname, &status); |
2613 | +- fsName = QString(QStringLiteral("/sys/block/dm-%1/removable")).arg(status.st_rdev & 0377); |
2614 | +- } else { |
2615 | +- #if defined(QT_SIMULATOR) |
2616 | +- if (fsName.startsWith(QStringLiteral("/dev/loop"))) |
2617 | +- return QStorageInfo::RemovableDrive; |
2618 | +-#endif |
2619 | +- fsName = fsName.section(QString(QStringLiteral("/")), 2, 3); |
2620 | +- if (!fsName.isEmpty()) { |
2621 | +- if (fsName.length() > 3) { |
2622 | +- // only take the parent of the device |
2623 | +- if (fsName.at(fsName.size() -1).isDigit() && fsName.at(fsName.size() - 2) == QChar(QLatin1Char('p'))) |
2624 | +- fsName.chop(2); |
2625 | +- if (fsName.startsWith(QString(QStringLiteral("mmc")))) { |
2626 | +- // "removable" attribute is set only for removable media, and we may have internal mmc cards |
2627 | +- fsName = QString(QStringLiteral("/sys/block/")) + fsName + QString(QStringLiteral("/device/uevent")); |
2628 | +- QFile file(fsName); |
2629 | +- if (file.open(QIODevice::ReadOnly)) { |
2630 | +- QByteArray buf = file.readLine(); |
2631 | +- while (buf.size() > 0) { |
2632 | +- if (qstrncmp(buf.constData(), "MMC_TYPE=", 9) == 0) { |
2633 | +- if (qstrncmp(buf.constData() + 9, "MMC", 3) == 0) |
2634 | +- type = QStorageInfo::InternalDrive; |
2635 | +- else if (qstrncmp(buf.constData() + 9, "SD", 2) == 0) |
2636 | +- type = QStorageInfo::RemovableDrive; |
2637 | +- if (type != QStorageInfo::UnknownDrive) { |
2638 | +- endmntent(fsDescription); |
2639 | +- return type; |
2640 | +- } |
2641 | +- break; // fall back to check the "removable" attribute |
2642 | +- } |
2643 | +- buf = file.readLine(); |
2644 | +- } |
2645 | +- } |
2646 | +- } |
2647 | +- } |
2648 | +- fsName = QString(QStringLiteral("/sys/block/")) + fsName + QString(QStringLiteral("/removable")); |
2649 | +- } |
2650 | +- } |
2651 | +- QFile removable(fsName); |
2652 | +- char isRemovable; |
2653 | +- if (!removable.open(QIODevice::ReadOnly) || 1 != removable.read(&isRemovable, 1)) |
2654 | +- break; |
2655 | +- if (isRemovable == '0') |
2656 | +- type = QStorageInfo::InternalDrive; |
2657 | +- else |
2658 | +- type = QStorageInfo::RemovableDrive; |
2659 | +- break; |
2660 | +- } |
2661 | +- |
2662 | +- endmntent(fsDescription); |
2663 | +- return type; |
2664 | +-} |
2665 | +- |
2666 | +-void QStorageInfoPrivate::connectNotify(const QMetaMethod &signal) |
2667 | +-{ |
2668 | +- static const QMetaMethod logicalDriveChangedSignal = QMetaMethod::fromSignal(&QStorageInfoPrivate::logicalDriveChanged); |
2669 | +- if (signal == logicalDriveChangedSignal) |
2670 | +- setupWatcher(); |
2671 | +-} |
2672 | +- |
2673 | +-void QStorageInfoPrivate::disconnectNotify(const QMetaMethod &signal) |
2674 | +-{ |
2675 | +- static const QMetaMethod logicalDriveChangedSignal = QMetaMethod::fromSignal(&QStorageInfoPrivate::logicalDriveChanged); |
2676 | +- if (signal == logicalDriveChangedSignal) |
2677 | +- cleanupWatcher(); |
2678 | +-} |
2679 | +- |
2680 | +-void QStorageInfoPrivate::cleanupWatcher() |
2681 | +-{ |
2682 | +-#if !defined(QT_NO_UDEV) |
2683 | +- if (needsUDevWatcher == 2) { |
2684 | +- needsUDevWatcher = 1; |
2685 | +- if (udevWrapper) |
2686 | +- disconnect(udevWrapper, SIGNAL(driveChanged()), this, SLOT(onDriveChanged())); |
2687 | +- return; |
2688 | +- } |
2689 | +-#endif // QT_NO_UDEV |
2690 | +- |
2691 | +- if (notifier) { |
2692 | +- delete notifier; |
2693 | +- notifier = 0; |
2694 | +- } |
2695 | +- |
2696 | +- if (inotifyWatcher != -1) { |
2697 | +- inotify_rm_watch(inotifyFileDescriptor, inotifyWatcher); |
2698 | +- inotifyWatcher = -1; |
2699 | +- } |
2700 | +- |
2701 | +- if (inotifyFileDescriptor != -1) { |
2702 | +- close(inotifyFileDescriptor); |
2703 | +- inotifyFileDescriptor = -1; |
2704 | +- } |
2705 | +-} |
2706 | +- |
2707 | +-void QStorageInfoPrivate::setupWatcher() |
2708 | +-{ |
2709 | +- updateLogicalDrives(); |
2710 | +- |
2711 | +-#if !defined(QT_NO_UDEV) |
2712 | +- if (needsUDevWatcher == -1) |
2713 | +- needsUDevWatcher = QFileInfo(QStringLiteral("/etc/mtab")).isSymLink(); |
2714 | +- |
2715 | +- if (needsUDevWatcher == 1) { |
2716 | +- if (!udevWrapper) |
2717 | +- udevWrapper = new QUDevWrapper(this); |
2718 | +- connect(udevWrapper, SIGNAL(driveChanged()), this, SLOT(onDriveChanged())); |
2719 | +- needsUDevWatcher = 2; |
2720 | +- return; |
2721 | +- } |
2722 | +-#endif // QT_NO_UDEV |
2723 | +- |
2724 | +- if (inotifyFileDescriptor == -1 |
2725 | +- && (inotifyFileDescriptor = inotify_init()) == -1) { |
2726 | +- return; |
2727 | +- } |
2728 | +- |
2729 | +- if (inotifyWatcher == -1 |
2730 | +- && (inotifyWatcher = inotify_add_watch(inotifyFileDescriptor, _PATH_MOUNTED, IN_MODIFY)) == -1) { |
2731 | +- close(inotifyFileDescriptor); |
2732 | +- return; |
2733 | +- } |
2734 | +- |
2735 | +- if (notifier == 0) { |
2736 | +- notifier = new QSocketNotifier(inotifyFileDescriptor, QSocketNotifier::Read); |
2737 | +- connect(notifier, SIGNAL(activated(int)), this, SLOT(onInotifyActivated())); |
2738 | +- } |
2739 | +-} |
2740 | +- |
2741 | +-void QStorageInfoPrivate::updateLogicalDrives() |
2742 | +-{ |
2743 | +- FILE *fsDescription = setmntent(_PATH_MOUNTED, "r"); |
2744 | +- struct mntent entry; |
2745 | +- char buffer[512]; |
2746 | +- |
2747 | +- logicalDrives.clear(); |
2748 | +- while (getmntent_r(fsDescription, &entry, buffer, sizeof(buffer)) != NULL) |
2749 | +- logicalDrives << QString::fromLatin1(entry.mnt_dir); |
2750 | +- endmntent(fsDescription); |
2751 | +-} |
2752 | +- |
2753 | +-void QStorageInfoPrivate::onInotifyActivated() |
2754 | +-{ |
2755 | +- inotify_event event; |
2756 | +- if (read(inotifyFileDescriptor, (void *)&event, sizeof(event)) > 0 |
2757 | +- && event.wd == inotifyWatcher) { |
2758 | +- // Have to do this, otherwise I can't get further notification |
2759 | +- inotify_rm_watch(inotifyFileDescriptor, inotifyWatcher); |
2760 | +- inotifyWatcher = inotify_add_watch(inotifyFileDescriptor, _PATH_MOUNTED, IN_MODIFY); |
2761 | +- |
2762 | +- QStringList oldLogicalDrives = logicalDrives; |
2763 | +- updateLogicalDrives(); |
2764 | +- |
2765 | +- foreach (const QString &drive, oldLogicalDrives) { |
2766 | +- if (!logicalDrives.contains(drive)) |
2767 | +- emit logicalDriveChanged(drive, false); |
2768 | +- } |
2769 | +- |
2770 | +- foreach (const QString &drive, logicalDrives) { |
2771 | +- if (!oldLogicalDrives.contains(drive)) |
2772 | +- emit logicalDriveChanged(drive, true); |
2773 | +- } |
2774 | +- } |
2775 | +-} |
2776 | +- |
2777 | +-#if !defined(QT_NO_UDEV) |
2778 | +-void QStorageInfoPrivate::onDriveChanged() |
2779 | +-{ |
2780 | +- QStringList oldLogicalDrives = logicalDrives; |
2781 | +- updateLogicalDrives(); |
2782 | +- |
2783 | +- foreach (const QString &drive, oldLogicalDrives) { |
2784 | +- if (!logicalDrives.contains(drive)) |
2785 | +- emit logicalDriveChanged(drive, false); |
2786 | +- } |
2787 | +- |
2788 | +- foreach (const QString &drive, logicalDrives) { |
2789 | +- if (!oldLogicalDrives.contains(drive)) |
2790 | +- emit logicalDriveChanged(drive, true); |
2791 | +- } |
2792 | +-} |
2793 | +-#endif // QT_NO_UDEV |
2794 | +- |
2795 | +-QT_END_NAMESPACE |
2796 | + |
2797 | +=== removed file 'src/systeminfo/linux/qstorageinfo_linux_p.h' |
2798 | +--- old/src/systeminfo/linux/qstorageinfo_linux_p.h 2013-06-14 10:32:13 +0000 |
2799 | ++++ new/src/systeminfo/linux/qstorageinfo_linux_p.h 1970-01-01 00:00:00 +0000 |
2800 | +@@ -1,115 +0,0 @@ |
2801 | +-/**************************************************************************** |
2802 | +-** |
2803 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
2804 | +-** Contact: http://www.qt-project.org/legal |
2805 | +-** |
2806 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
2807 | +-** |
2808 | +-** $QT_BEGIN_LICENSE:LGPL$ |
2809 | +-** Commercial License Usage |
2810 | +-** Licensees holding valid commercial Qt licenses may use this file in |
2811 | +-** accordance with the commercial license agreement provided with the |
2812 | +-** Software or, alternatively, in accordance with the terms contained in |
2813 | +-** a written agreement between you and Digia. For licensing terms and |
2814 | +-** conditions see http://qt.digia.com/licensing. For further information |
2815 | +-** use the contact form at http://qt.digia.com/contact-us. |
2816 | +-** |
2817 | +-** GNU Lesser General Public License Usage |
2818 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
2819 | +-** General Public License version 2.1 as published by the Free Software |
2820 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
2821 | +-** packaging of this file. Please review the following information to |
2822 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
2823 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
2824 | +-** |
2825 | +-** In addition, as a special exception, Digia gives you certain additional |
2826 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
2827 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
2828 | +-** |
2829 | +-** GNU General Public License Usage |
2830 | +-** Alternatively, this file may be used under the terms of the GNU |
2831 | +-** General Public License version 3.0 as published by the Free Software |
2832 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
2833 | +-** packaging of this file. Please review the following information to |
2834 | +-** ensure the GNU General Public License version 3.0 requirements will be |
2835 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
2836 | +-** |
2837 | +-** |
2838 | +-** $QT_END_LICENSE$ |
2839 | +-** |
2840 | +-****************************************************************************/ |
2841 | +- |
2842 | +-// |
2843 | +-// W A R N I N G |
2844 | +-// ------------- |
2845 | +-// |
2846 | +-// This file is not part of the Qt API. It exists purely as an |
2847 | +-// implementation detail. This header file may change from version to |
2848 | +-// version without notice, or even be removed. |
2849 | +-// |
2850 | +-// We mean it. |
2851 | +-// |
2852 | +- |
2853 | +-#ifndef QSTORAGEINFO_LINUX_P_H |
2854 | +-#define QSTORAGEINFO_LINUX_P_H |
2855 | +- |
2856 | +-#include <qstorageinfo.h> |
2857 | +- |
2858 | +-QT_BEGIN_NAMESPACE |
2859 | +- |
2860 | +-#if !defined(QT_NO_UDEV) |
2861 | +-class QUDevWrapper; |
2862 | +-#endif // QT_NO_UDEV |
2863 | +- |
2864 | +-class QSocketNotifier; |
2865 | +- |
2866 | +-class QStorageInfoPrivate : public QObject |
2867 | +-{ |
2868 | +- Q_OBJECT |
2869 | +- |
2870 | +-public: |
2871 | +- QStorageInfoPrivate(QStorageInfo *parent); |
2872 | +- ~QStorageInfoPrivate(); |
2873 | +- |
2874 | +- qlonglong availableDiskSpace(const QString &drive); |
2875 | +- qlonglong totalDiskSpace(const QString &drive); |
2876 | +- QString uriForDrive(const QString &drive); |
2877 | +- QStringList allLogicalDrives(); |
2878 | +- QStorageInfo::DriveType driveType(const QString &drive); |
2879 | +- |
2880 | +-Q_SIGNALS: |
2881 | +- void logicalDriveChanged(const QString &drive, bool added); |
2882 | +- |
2883 | +-protected: |
2884 | +- void connectNotify(const QMetaMethod &signal); |
2885 | +- void disconnectNotify(const QMetaMethod &signal); |
2886 | +- |
2887 | +-private: |
2888 | +- QStorageInfo * const q_ptr; |
2889 | +- Q_DECLARE_PUBLIC(QStorageInfo) |
2890 | +- |
2891 | +- int inotifyWatcher; |
2892 | +- int inotifyFileDescriptor; |
2893 | +- QSocketNotifier *notifier; |
2894 | +- QStringList logicalDrives; |
2895 | +-#if !defined(QT_NO_UDEV) |
2896 | +- QUDevWrapper *udevWrapper; |
2897 | +- int needsUDevWatcher; // -1: unknown; 0: no need; |
2898 | +- // 1: needed, but not currently watching; |
2899 | +- // 2: needed and currently watching |
2900 | +-#endif // QT_NO_UDEV |
2901 | +- |
2902 | +- void cleanupWatcher(); |
2903 | +- void setupWatcher(); |
2904 | +- void updateLogicalDrives(); |
2905 | +- |
2906 | +-private Q_SLOTS: |
2907 | +- void onInotifyActivated(); |
2908 | +-#if !defined(QT_NO_UDEV) |
2909 | +- void onDriveChanged(); |
2910 | +-#endif // QT_NO_UDEV |
2911 | +-}; |
2912 | +- |
2913 | +-QT_END_NAMESPACE |
2914 | +- |
2915 | +-#endif // QSTORAGEINFO_LINUX_P_H |
2916 | + |
2917 | +=== removed file 'src/systeminfo/mac/qstorageinfo_mac.mm' |
2918 | +--- old/src/systeminfo/mac/qstorageinfo_mac.mm 2013-06-14 10:32:13 +0000 |
2919 | ++++ new/src/systeminfo/mac/qstorageinfo_mac.mm 1970-01-01 00:00:00 +0000 |
2920 | +@@ -1,423 +0,0 @@ |
2921 | +-/**************************************************************************** |
2922 | +-** |
2923 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
2924 | +-** Contact: http://www.qt-project.org/legal |
2925 | +-** |
2926 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
2927 | +-** |
2928 | +-** $QT_BEGIN_LICENSE:LGPL$ |
2929 | +-** Commercial License Usage |
2930 | +-** Licensees holding valid commercial Qt licenses may use this file in |
2931 | +-** accordance with the commercial license agreement provided with the |
2932 | +-** Software or, alternatively, in accordance with the terms contained in |
2933 | +-** a written agreement between you and Digia. For licensing terms and |
2934 | +-** conditions see http://qt.digia.com/licensing. For further information |
2935 | +-** use the contact form at http://qt.digia.com/contact-us. |
2936 | +-** |
2937 | +-** GNU Lesser General Public License Usage |
2938 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
2939 | +-** General Public License version 2.1 as published by the Free Software |
2940 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
2941 | +-** packaging of this file. Please review the following information to |
2942 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
2943 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
2944 | +-** |
2945 | +-** In addition, as a special exception, Digia gives you certain additional |
2946 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
2947 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
2948 | +-** |
2949 | +-** GNU General Public License Usage |
2950 | +-** Alternatively, this file may be used under the terms of the GNU |
2951 | +-** General Public License version 3.0 as published by the Free Software |
2952 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
2953 | +-** packaging of this file. Please review the following information to |
2954 | +-** ensure the GNU General Public License version 3.0 requirements will be |
2955 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
2956 | +-** |
2957 | +-** |
2958 | +-** $QT_END_LICENSE$ |
2959 | +-** |
2960 | +-****************************************************************************/ |
2961 | +- |
2962 | +-#include "qstorageinfo_mac_p.h" |
2963 | +- |
2964 | +-#include <QtCore/private/qcore_mac_p.h> |
2965 | +-#include <QtCore/qmetaobject.h> |
2966 | +-#include <QDebug> |
2967 | +- |
2968 | +-#include <CoreFoundation/CoreFoundation.h> |
2969 | +-#include <DiskArbitration/DiskArbitration.h> |
2970 | +-#include <ApplicationServices/ApplicationServices.h> |
2971 | +-#include <DiskArbitration/DASession.h> |
2972 | +-#include <IOKit/storage/IOMedia.h> |
2973 | +-#include <IOKit/storage/IOCDMedia.h> |
2974 | +-#include <IOKit/storage/IODVDMedia.h> |
2975 | +-#include <IOKit/storage/IOBlockStorageDevice.h> |
2976 | +-#include <Foundation/NSDictionary.h> |
2977 | +-#include <CoreFoundation/CFUUID.h> |
2978 | +- |
2979 | +-#include <sys/mount.h> |
2980 | +- |
2981 | +-DAApprovalSessionRef session = NULL; |
2982 | +- |
2983 | +-void mountCallback(DADiskRef disk, CFArrayRef /*keys*/, void *context) |
2984 | +-{ |
2985 | +- NSDictionary *batDoctionary; |
2986 | +- batDoctionary = (NSDictionary *)DADiskCopyDescription(disk); |
2987 | +- NSURL *volumePath = [[batDoctionary objectForKey:(NSString *)kDADiskDescriptionVolumePathKey] copy]; |
2988 | +- |
2989 | +- QString name = QCFString::toQString([volumePath path]); |
2990 | +- |
2991 | +- static_cast<QStorageInfoPrivate*>(context)->storageChanged(true, name); |
2992 | +-} |
2993 | +- |
2994 | +-void mountCallback2(DADiskRef diskRef, void *context) |
2995 | +-{ |
2996 | +- DADiskRef wholeDisk; |
2997 | +- wholeDisk = DADiskCopyWholeDisk(diskRef); |
2998 | +-// only deal with whole disks here.. i.e. cdroms |
2999 | +- if (wholeDisk) { |
3000 | +- io_service_t mediaService; |
3001 | +- |
3002 | +- mediaService = DADiskCopyIOMedia(wholeDisk); |
3003 | +- if (mediaService) { |
3004 | +- if (IOObjectConformsTo(mediaService, kIOCDMediaClass) || IOObjectConformsTo(mediaService, kIODVDMediaClass)) { |
3005 | +- |
3006 | +- NSDictionary *batDoctionary; |
3007 | +- batDoctionary = (NSDictionary *)DADiskCopyDescription(diskRef); |
3008 | +- NSURL *volumePath = [[batDoctionary objectForKey:(NSString *)kDADiskDescriptionVolumePathKey] copy]; |
3009 | +- |
3010 | +- QString name = QCFString::toQString([volumePath path]); |
3011 | +- |
3012 | +- static_cast<QStorageInfoPrivate*>(context)->storageChanged(true, name); |
3013 | +- CFRelease(batDoctionary); |
3014 | +- } |
3015 | +- } |
3016 | +- IOObjectRelease(mediaService); |
3017 | +- CFRelease(wholeDisk); |
3018 | +- } |
3019 | +-} |
3020 | +- |
3021 | +-void unmountCallback(DADiskRef disk, void *context) |
3022 | +-{ |
3023 | +- NSDictionary *batDoctionary; |
3024 | +- batDoctionary = (NSDictionary *)DADiskCopyDescription(disk); |
3025 | +- NSURL *volumePath = [[batDoctionary objectForKey:(NSString *)kDADiskDescriptionVolumePathKey] copy]; |
3026 | +- |
3027 | +- QString name = QCFString::toQString([volumePath path]); |
3028 | +- |
3029 | +- static_cast<QStorageInfoPrivate*>(context)->storageChanged(false,name); |
3030 | +-} |
3031 | +- |
3032 | +- |
3033 | +- |
3034 | +-QT_BEGIN_NAMESPACE |
3035 | +- |
3036 | +-QDASessionThread::QDASessionThread(QObject *parent) |
3037 | +- :QObject(parent), session(NULL) |
3038 | +-{ |
3039 | +- moveToThread(&t); |
3040 | +- t.start(); |
3041 | +- if (session == NULL) |
3042 | +- session = DASessionCreate(kCFAllocatorDefault); |
3043 | +-} |
3044 | +- |
3045 | +-QDASessionThread::~QDASessionThread() |
3046 | +-{ |
3047 | +-} |
3048 | +- |
3049 | +-void QDASessionThread::stop() |
3050 | +-{ |
3051 | +- QMutexLocker locker(&mutex); |
3052 | +- CFRunLoopStop(CFRunLoopGetCurrent()); |
3053 | +- keepRunning = false; |
3054 | +- t.quit(); |
3055 | +- t.wait(); |
3056 | +-} |
3057 | +- |
3058 | +-void QDASessionThread::doWork() |
3059 | +-{ |
3060 | +-#ifndef MAC_SDK_10_5 |
3061 | +- if (QThread::currentThread() != &t) { |
3062 | +- QMetaObject::invokeMethod(this, "doWork", |
3063 | +- Qt::QueuedConnection); |
3064 | +- } else { |
3065 | +- |
3066 | +- mutex.lock(); |
3067 | +- keepRunning = true; |
3068 | +- mutex.unlock(); |
3069 | +- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
3070 | +- |
3071 | +- DASessionScheduleWithRunLoop(session,CFRunLoopGetCurrent(),kCFRunLoopDefaultMode); |
3072 | +- |
3073 | +- SInt32 result; |
3074 | +- while (keepRunning && |
3075 | +- (result = CFRunLoopRunInMode(kCFRunLoopDefaultMode ,1, YES))) { |
3076 | +- } |
3077 | +- |
3078 | +- DASessionUnscheduleFromRunLoop(session, CFRunLoopGetCurrent(),kCFRunLoopDefaultMode); |
3079 | +- [pool release]; |
3080 | +- } |
3081 | +-#endif |
3082 | +-} |
3083 | +- |
3084 | +-QStorageInfoPrivate::QStorageInfoPrivate(QStorageInfo *parent) |
3085 | +- : QObject(parent) |
3086 | +- , q_ptr(parent), daSessionThread(0),sessionThreadStarted(0) |
3087 | +-{ |
3088 | +- updateVolumesMap(); |
3089 | +-} |
3090 | +- |
3091 | +-QStorageInfoPrivate::~QStorageInfoPrivate() |
3092 | +-{ |
3093 | +- if (sessionThreadStarted) { |
3094 | +- daSessionThread->stop(); |
3095 | +- delete daSessionThread; |
3096 | +- } |
3097 | +-} |
3098 | +- |
3099 | +-qlonglong QStorageInfoPrivate::availableDiskSpace(const QString &driveVolume) |
3100 | +-{ |
3101 | +- qint64 totalFreeBytes=0; |
3102 | +- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
3103 | +- NSDictionary *attr = [ [NSFileManager defaultManager] attributesOfFileSystemForPath:QCFString::toNSString(driveVolume) error:nil]; |
3104 | +- totalFreeBytes = [[attr objectForKey:NSFileSystemFreeSize] doubleValue]; |
3105 | +- [pool release]; |
3106 | +- |
3107 | +- return totalFreeBytes; |
3108 | +-} |
3109 | +- |
3110 | +-qlonglong QStorageInfoPrivate::totalDiskSpace(const QString &driveVolume) |
3111 | +-{ |
3112 | +- qint64 totalBytes=0; |
3113 | +- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
3114 | +- NSString *vol = QCFString::toNSString(driveVolume); |
3115 | +- NSDictionary *attr = [ [NSFileManager defaultManager] attributesOfFileSystemForPath:vol error:nil]; |
3116 | +- totalBytes = [[attr objectForKey:NSFileSystemSize] doubleValue]; |
3117 | +- [pool release]; |
3118 | +- |
3119 | +- return totalBytes; |
3120 | +-} |
3121 | +-QString QStorageInfoPrivate::uriForDrive(const QString &driveVolume) |
3122 | +-{ |
3123 | +- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
3124 | +- DADiskRef diskRef; |
3125 | +- DASessionRef sessionRef; |
3126 | +- CFDictionaryRef descriptionDictionary; |
3127 | +- |
3128 | +- sessionRef = DASessionCreate(NULL); |
3129 | +- if (sessionRef == NULL) { |
3130 | +- return QString(); |
3131 | +- } |
3132 | +- |
3133 | +- diskRef = DADiskCreateFromBSDName(NULL, sessionRef, mountEntriesMap.key(driveVolume).toLatin1()); |
3134 | +- if (diskRef == NULL) { |
3135 | +- CFRelease(sessionRef); |
3136 | +- return QString(); |
3137 | +- } |
3138 | +- |
3139 | +- descriptionDictionary = DADiskCopyDescription(diskRef); |
3140 | +- if (descriptionDictionary == NULL) { |
3141 | +- CFRelease(diskRef); |
3142 | +- CFRelease(sessionRef); |
3143 | +- return QString(); |
3144 | +- } |
3145 | +- |
3146 | +- CFUUIDRef uuid; |
3147 | +- uuid = (const __CFUUID *)CFDictionaryGetValue(descriptionDictionary, kDADiskDescriptionVolumeUUIDKey); |
3148 | +- |
3149 | +- CFRelease(diskRef); |
3150 | +- CFRelease(sessionRef); |
3151 | +- QString uri = QCFString::toQString(CFUUIDCreateString(kCFAllocatorDefault, uuid)); |
3152 | +- [pool release]; |
3153 | +- |
3154 | +- return uri; |
3155 | +-} |
3156 | +- |
3157 | +-QStringList QStorageInfoPrivate::allLogicalDrives() |
3158 | +-{ |
3159 | +- updateVolumesMap(); |
3160 | +- QStringList drivesList; |
3161 | +- QMapIterator<QString, QString> it(mountEntriesMap); |
3162 | +- while (it.hasNext()) { |
3163 | +- it.next(); |
3164 | +- drivesList << it.value(); |
3165 | +- } |
3166 | +- drivesList.sort(); |
3167 | +- return drivesList; |
3168 | +-} |
3169 | +- |
3170 | +-QStorageInfo::DriveType QStorageInfoPrivate::driveType(const QString &driveVolume) |
3171 | +-{ |
3172 | +- QStorageInfo::DriveType drivetype = QStorageInfo::UnknownDrive; |
3173 | +- |
3174 | +- DADiskRef diskRef; |
3175 | +- DASessionRef sessionRef; |
3176 | +- CFBooleanRef boolRef; |
3177 | +- CFBooleanRef boolRef2; |
3178 | +- CFDictionaryRef descriptionDictionary; |
3179 | +- |
3180 | +- sessionRef = DASessionCreate(NULL); |
3181 | +- if (sessionRef == NULL) { |
3182 | +- return QStorageInfo::UnknownDrive; |
3183 | +- } |
3184 | +- |
3185 | +- diskRef = DADiskCreateFromBSDName(NULL, sessionRef, mountEntriesMap.key(driveVolume).toLatin1()); |
3186 | +- if (diskRef == NULL) { |
3187 | +- CFRelease(sessionRef); |
3188 | +- return QStorageInfo::UnknownDrive; |
3189 | +- } |
3190 | +- |
3191 | +- descriptionDictionary = DADiskCopyDescription(diskRef); |
3192 | +- if (descriptionDictionary == NULL) { |
3193 | +- CFRelease(diskRef); |
3194 | +- CFRelease(sessionRef); |
3195 | +- return QStorageInfo::RemoteDrive; |
3196 | +- } |
3197 | +- |
3198 | +- boolRef = (CFBooleanRef) |
3199 | +- CFDictionaryGetValue(descriptionDictionary, kDADiskDescriptionMediaRemovableKey); |
3200 | +- if (boolRef) { |
3201 | +- if (CFBooleanGetValue(boolRef)) { |
3202 | +- drivetype = QStorageInfo::RemovableDrive; |
3203 | +- } else { |
3204 | +- drivetype = QStorageInfo::InternalDrive; |
3205 | +- } |
3206 | +- } |
3207 | +- boolRef2 = (CFBooleanRef) |
3208 | +- CFDictionaryGetValue(descriptionDictionary, kDADiskDescriptionVolumeNetworkKey); |
3209 | +- if (boolRef2) { |
3210 | +- if (CFBooleanGetValue(boolRef2)) { |
3211 | +- drivetype = QStorageInfo::RemoteDrive; |
3212 | +- } |
3213 | +- } |
3214 | +- |
3215 | +- DADiskRef wholeDisk; |
3216 | +- wholeDisk = DADiskCopyWholeDisk(diskRef); |
3217 | +- |
3218 | +- if (wholeDisk) { |
3219 | +- io_service_t mediaService; |
3220 | +- |
3221 | +- mediaService = DADiskCopyIOMedia(wholeDisk); |
3222 | +- if (mediaService) { |
3223 | +- if (IOObjectConformsTo(mediaService, kIOCDMediaClass)) { |
3224 | +- drivetype = QStorageInfo::CdromDrive; |
3225 | +- } |
3226 | +- if (IOObjectConformsTo(mediaService, kIODVDMediaClass)) { |
3227 | +- drivetype = QStorageInfo::CdromDrive; |
3228 | +- } |
3229 | +- IOObjectRelease(mediaService); |
3230 | +- } |
3231 | +- CFRelease(wholeDisk); |
3232 | +- } |
3233 | +- CFRelease(diskRef); |
3234 | +- CFRelease(descriptionDictionary); |
3235 | +- CFRelease(boolRef); |
3236 | +- CFRelease(boolRef2); |
3237 | +- CFRelease(sessionRef); |
3238 | +- |
3239 | +- return drivetype; |
3240 | +-} |
3241 | +- |
3242 | +-void QStorageInfoPrivate::connectNotify(const QMetaMethod &signal) |
3243 | +-{ |
3244 | +- static const QMetaMethod logicalDriveChangedSignal = QMetaMethod::fromSignal(&QStorageInfoPrivate::logicalDriveChanged); |
3245 | +- if (signal == logicalDriveChangedSignal) { |
3246 | +- /// |
3247 | +- sessionThread(); |
3248 | +- |
3249 | +- DARegisterDiskDescriptionChangedCallback(daSessionThread->session,kDADiskDescriptionMatchVolumeMountable, |
3250 | +- kDADiskDescriptionWatchVolumePath, mountCallback,this); |
3251 | +- DARegisterDiskAppearedCallback(daSessionThread->session,kDADiskDescriptionMatchVolumeMountable,mountCallback2,this); |
3252 | +- DARegisterDiskDisappearedCallback(daSessionThread->session,kDADiskDescriptionMatchVolumeMountable,unmountCallback,this); |
3253 | +- sessionThreadStarted = true; |
3254 | +- } |
3255 | +-} |
3256 | +- |
3257 | +-void QStorageInfoPrivate::disconnectNotify(const QMetaMethod &signal) |
3258 | +-{ |
3259 | +- static const QMetaMethod logicalDriveChangedSignal = QMetaMethod::fromSignal(&QStorageInfoPrivate::logicalDriveChanged); |
3260 | +- if (signal == logicalDriveChangedSignal) { |
3261 | +- } |
3262 | +-} |
3263 | +- |
3264 | +- |
3265 | +-void QStorageInfoPrivate::storageChanged( bool added, const QString &vol) |
3266 | +-{ |
3267 | +- if (!vol.isEmpty()) { |
3268 | +- QMapIterator<QString, QString> it(mountEntriesMap); |
3269 | +- QString foundKey; |
3270 | +- bool seen = false; |
3271 | +- while (it.hasNext()) { |
3272 | +- it.next(); |
3273 | +- if ( vol == it.value()) { |
3274 | +- seen = true; |
3275 | +- foundKey = it.key(); |
3276 | +- } |
3277 | +- } |
3278 | +- |
3279 | +- if (added && !seen) { |
3280 | +- Q_EMIT logicalDriveChanged(vol, added); |
3281 | +- updateVolumesMap(); |
3282 | +- } |
3283 | +- if (!added && seen) { |
3284 | +- mountEntriesMap.remove(foundKey); |
3285 | +- Q_EMIT logicalDriveChanged(vol, added); |
3286 | +- } |
3287 | +- |
3288 | +- |
3289 | +- } else { |
3290 | +- if (added) { |
3291 | +- |
3292 | +- } else { //removed |
3293 | +- // cdroms unmounting seem to not have a volume name with the notification here, so |
3294 | +- // we need to manually deal with it |
3295 | +- QMap <QString,QString> oldDrives = mountEntriesMap; |
3296 | +- updateVolumesMap(); |
3297 | +- QStringList newDrives = mountEntriesMap.keys(); |
3298 | +- QString foundDrive; |
3299 | +- |
3300 | +- QMapIterator<QString, QString> it(oldDrives); |
3301 | +- while (it.hasNext()) { |
3302 | +- it.next(); |
3303 | +- if (!newDrives.contains(it.key())) { |
3304 | +- Q_EMIT logicalDriveChanged(it.value(), added); |
3305 | +- } |
3306 | +- } |
3307 | +- } |
3308 | +- } |
3309 | +-} |
3310 | +- |
3311 | +-bool QStorageInfoPrivate::updateVolumesMap() |
3312 | +-{ |
3313 | +- struct statfs *buf = NULL; |
3314 | +- unsigned i, count = 0; |
3315 | +- |
3316 | +- mountEntriesMap.clear(); |
3317 | +- |
3318 | +- count = getmntinfo(&buf, 0); |
3319 | +- for (i=0; i<count; i++) { |
3320 | +- char *volName = buf[i].f_mntonname; |
3321 | +- |
3322 | +- if (buf[i].f_type != 19 |
3323 | +- && buf[i].f_type != 20 |
3324 | +- && !mountEntriesMap.contains(volName)) { |
3325 | +- mountEntriesMap.insert(buf[i].f_mntfromname,volName); |
3326 | +-// qDebug() << __FUNCTION__ << "insert" << buf[i].f_mntfromname<< volName; |
3327 | +- } |
3328 | +- } |
3329 | +- return true; |
3330 | +-} |
3331 | +- |
3332 | +-bool QStorageInfoPrivate::sessionThread() |
3333 | +-{ |
3334 | +- if (!sessionThreadStarted) { |
3335 | +- daSessionThread = new QDASessionThread(); |
3336 | +- sessionThreadStarted = true; |
3337 | +- } |
3338 | +- daSessionThread->doWork(); |
3339 | +- return true; |
3340 | +-} |
3341 | +- |
3342 | +-QT_END_NAMESPACE |
3343 | +- |
3344 | + |
3345 | +=== removed file 'src/systeminfo/mac/qstorageinfo_mac_p.h' |
3346 | +--- old/src/systeminfo/mac/qstorageinfo_mac_p.h 2013-06-14 10:32:13 +0000 |
3347 | ++++ new/src/systeminfo/mac/qstorageinfo_mac_p.h 1970-01-01 00:00:00 +0000 |
3348 | +@@ -1,134 +0,0 @@ |
3349 | +-/**************************************************************************** |
3350 | +-** |
3351 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
3352 | +-** Contact: http://www.qt-project.org/legal |
3353 | +-** |
3354 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
3355 | +-** |
3356 | +-** $QT_BEGIN_LICENSE:LGPL$ |
3357 | +-** Commercial License Usage |
3358 | +-** Licensees holding valid commercial Qt licenses may use this file in |
3359 | +-** accordance with the commercial license agreement provided with the |
3360 | +-** Software or, alternatively, in accordance with the terms contained in |
3361 | +-** a written agreement between you and Digia. For licensing terms and |
3362 | +-** conditions see http://qt.digia.com/licensing. For further information |
3363 | +-** use the contact form at http://qt.digia.com/contact-us. |
3364 | +-** |
3365 | +-** GNU Lesser General Public License Usage |
3366 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
3367 | +-** General Public License version 2.1 as published by the Free Software |
3368 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
3369 | +-** packaging of this file. Please review the following information to |
3370 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
3371 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
3372 | +-** |
3373 | +-** In addition, as a special exception, Digia gives you certain additional |
3374 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
3375 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
3376 | +-** |
3377 | +-** GNU General Public License Usage |
3378 | +-** Alternatively, this file may be used under the terms of the GNU |
3379 | +-** General Public License version 3.0 as published by the Free Software |
3380 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
3381 | +-** packaging of this file. Please review the following information to |
3382 | +-** ensure the GNU General Public License version 3.0 requirements will be |
3383 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
3384 | +-** |
3385 | +-** |
3386 | +-** $QT_END_LICENSE$ |
3387 | +-** |
3388 | +-****************************************************************************/ |
3389 | +- |
3390 | +-// |
3391 | +-// W A R N I N G |
3392 | +-// ------------- |
3393 | +-// |
3394 | +-// This file is not part of the Qt API. It exists purely as an |
3395 | +-// implementation detail. This header file may change from version to |
3396 | +-// version without notice, or even be removed. |
3397 | +-// |
3398 | +-// We mean it. |
3399 | +-// |
3400 | +- |
3401 | +-#ifndef QSTORAGEINFO_MAC_P_H |
3402 | +-#define QSTORAGEINFO_MAC_P_H |
3403 | +- |
3404 | +-#include <qstorageinfo.h> |
3405 | +-#include <QtCore/QTimer> |
3406 | +-#include <QtCore/QMap> |
3407 | +-#include <QtCore/QThread> |
3408 | +-#include <QtCore/QMutex> |
3409 | +- |
3410 | +-#include <SystemConfiguration/SystemConfiguration.h> |
3411 | +-#include <DiskArbitration/DiskArbitration.h> |
3412 | +- |
3413 | +-QT_BEGIN_NAMESPACE |
3414 | +- |
3415 | +-class QDASessionThread; |
3416 | +-class QStorageInfoPrivate : public QObject |
3417 | +-{ |
3418 | +- Q_OBJECT |
3419 | +- |
3420 | +-public: |
3421 | +- QStorageInfoPrivate(QStorageInfo *parent); |
3422 | +- ~QStorageInfoPrivate(); |
3423 | +- |
3424 | +- qlonglong availableDiskSpace(const QString &drive); |
3425 | +- qlonglong totalDiskSpace(const QString &drive); |
3426 | +- QString uriForDrive(const QString &drive); |
3427 | +- QStringList allLogicalDrives(); |
3428 | +- QStorageInfo::DriveType driveType(const QString &drive); |
3429 | +- |
3430 | +-public Q_SLOTS: |
3431 | +- void storageChanged( bool added,const QString &vol); |
3432 | +- |
3433 | +-Q_SIGNALS: |
3434 | +- void logicalDriveChanged(const QString &drive, bool added); |
3435 | +- |
3436 | +-protected: |
3437 | +- void connectNotify(const QMetaMethod &signal); |
3438 | +- void disconnectNotify(const QMetaMethod &signal); |
3439 | +- |
3440 | +-private: |
3441 | +- QStorageInfo * const q_ptr; |
3442 | +- Q_DECLARE_PUBLIC(QStorageInfo) |
3443 | +- |
3444 | +- QMap<QString, QString> mountEntriesMap; |
3445 | +- bool updateVolumesMap(); |
3446 | +- void mountEntries(); |
3447 | +- bool sessionThread(); |
3448 | +-// QMap<QString, QStorageInfo::StorageState> stateMap; |
3449 | +- QDASessionThread *daSessionThread; |
3450 | +- bool sessionThreadStarted; |
3451 | +- |
3452 | +-}; |
3453 | +- |
3454 | +- |
3455 | +-class QDASessionThread : public QObject |
3456 | +-{ |
3457 | +- Q_OBJECT |
3458 | +- |
3459 | +-public: |
3460 | +- QDASessionThread(QObject *parent = 0); |
3461 | +- ~QDASessionThread(); |
3462 | +- bool keepRunning; |
3463 | +- void stop(); |
3464 | +- DASessionRef session; |
3465 | +-public Q_SLOTS: |
3466 | +- void doWork(); |
3467 | +-Q_SIGNALS: |
3468 | +- void logicalDrivesChanged(bool added,const QString & vol); |
3469 | +- |
3470 | +-protected: |
3471 | +- QThread t; |
3472 | +- |
3473 | +-private: |
3474 | +- QMutex mutex; |
3475 | +- |
3476 | +-}; |
3477 | +- |
3478 | +- |
3479 | +- |
3480 | +-QT_END_NAMESPACE |
3481 | +- |
3482 | +-#endif // QSTORAGEINFO_MAC_P_H |
3483 | + |
3484 | +=== removed file 'src/systeminfo/qstorageinfo.cpp' |
3485 | +--- old/src/systeminfo/qstorageinfo.cpp 2013-06-14 10:32:13 +0000 |
3486 | ++++ new/src/systeminfo/qstorageinfo.cpp 1970-01-01 00:00:00 +0000 |
3487 | +@@ -1,192 +0,0 @@ |
3488 | +-/**************************************************************************** |
3489 | +-** |
3490 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
3491 | +-** Contact: http://www.qt-project.org/legal |
3492 | +-** |
3493 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
3494 | +-** |
3495 | +-** $QT_BEGIN_LICENSE:LGPL$ |
3496 | +-** Commercial License Usage |
3497 | +-** Licensees holding valid commercial Qt licenses may use this file in |
3498 | +-** accordance with the commercial license agreement provided with the |
3499 | +-** Software or, alternatively, in accordance with the terms contained in |
3500 | +-** a written agreement between you and Digia. For licensing terms and |
3501 | +-** conditions see http://qt.digia.com/licensing. For further information |
3502 | +-** use the contact form at http://qt.digia.com/contact-us. |
3503 | +-** |
3504 | +-** GNU Lesser General Public License Usage |
3505 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
3506 | +-** General Public License version 2.1 as published by the Free Software |
3507 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
3508 | +-** packaging of this file. Please review the following information to |
3509 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
3510 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
3511 | +-** |
3512 | +-** In addition, as a special exception, Digia gives you certain additional |
3513 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
3514 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
3515 | +-** |
3516 | +-** GNU General Public License Usage |
3517 | +-** Alternatively, this file may be used under the terms of the GNU |
3518 | +-** General Public License version 3.0 as published by the Free Software |
3519 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
3520 | +-** packaging of this file. Please review the following information to |
3521 | +-** ensure the GNU General Public License version 3.0 requirements will be |
3522 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
3523 | +-** |
3524 | +-** |
3525 | +-** $QT_END_LICENSE$ |
3526 | +-** |
3527 | +-****************************************************************************/ |
3528 | +- |
3529 | +-#include "qstorageinfo.h" |
3530 | +- |
3531 | +-#include <QtCore/qstringlist.h> |
3532 | +- |
3533 | +-#if defined(Q_OS_LINUX) |
3534 | +-# include "linux/qstorageinfo_linux_p.h" |
3535 | +-#elif defined(Q_OS_WIN) |
3536 | +-# include "windows/qstorageinfo_win_p.h" |
3537 | +-#elif defined(Q_OS_MAC) |
3538 | +-# include "mac/qstorageinfo_mac_p.h" |
3539 | +-#else |
3540 | +-QT_BEGIN_NAMESPACE |
3541 | +-class QStorageInfoPrivate |
3542 | +-{ |
3543 | +-public: |
3544 | +- QStorageInfoPrivate(QStorageInfo *) {} |
3545 | +- |
3546 | +- qlonglong availableDiskSpace(const QString &) { return -1; } |
3547 | +- qlonglong totalDiskSpace(const QString &) { return -1; } |
3548 | +- QString uriForDrive(const QString &) { return QString(); } |
3549 | +- QStringList allLogicalDrives() { return QStringList(); } |
3550 | +- QStorageInfo::DriveType driveType(const QString &) { return QStorageInfo::UnknownDrive; } |
3551 | +-}; |
3552 | +-QT_END_NAMESPACE |
3553 | +-#endif |
3554 | +- |
3555 | +-#include <QtCore/qmetaobject.h> |
3556 | +- |
3557 | +-QT_BEGIN_NAMESPACE |
3558 | +- |
3559 | +-/*! |
3560 | +- \class QStorageInfo |
3561 | +- \inmodule QtSystemInfo |
3562 | +- \ingroup systeminfo |
3563 | +- \brief The QStorageInfo class provides various disk storage information about the system. |
3564 | +-*/ |
3565 | +- |
3566 | +-/*! |
3567 | +- \enum QStorageInfo::DriveType |
3568 | +- This enum describes the type of drive or volume |
3569 | +- |
3570 | +- \value UnknownDrive Drive type unknown. |
3571 | +- \value InternalDrive Internal mass storage drive, e.g. hard drive. |
3572 | +- \value RemovableDrive Removable drive, e.g. memory card. |
3573 | +- \value RemoteDrive Network drive. |
3574 | +- \value CdromDrive CD-ROM. |
3575 | +- \value RamDrive Virtual drive made in RAM memory. |
3576 | +-*/ |
3577 | +- |
3578 | +-/*! |
3579 | +- \fn void QStorageInfo::logicalDriveChanged(const QString &drive, bool added) |
3580 | +- |
3581 | +- This signal gets emitted when a new \a drive storage has been \a added or removed. |
3582 | +-*/ |
3583 | +- |
3584 | +-/*! |
3585 | +- Constructs a QStorageInfo object with the given \a parent. |
3586 | +-*/ |
3587 | +-QStorageInfo::QStorageInfo(QObject *parent) |
3588 | +- : QObject(parent) |
3589 | +- , d_ptr(new QStorageInfoPrivate(this)) |
3590 | +-{ |
3591 | +-} |
3592 | +- |
3593 | +-/*! |
3594 | +- Destroys the object |
3595 | +-*/ |
3596 | +-QStorageInfo::~QStorageInfo() |
3597 | +-{ |
3598 | +-} |
3599 | +- |
3600 | +-/*! |
3601 | +- \property QStorageInfo::allLogicalDrives |
3602 | +- \brief The list of all drives. |
3603 | +- |
3604 | +- Returns a list of all logical drives or volumes, or an empty list if no drives are found or |
3605 | +- on error. |
3606 | +-*/ |
3607 | +-QStringList QStorageInfo::allLogicalDrives() |
3608 | +-{ |
3609 | +- return d_ptr->allLogicalDrives(); |
3610 | +-} |
3611 | +- |
3612 | +-/*! |
3613 | +- Returns the available free space on the \a drive, in bytes. -1 is returned if the drive doesn't |
3614 | +- exist, or the information is not available. |
3615 | +-*/ |
3616 | +-qlonglong QStorageInfo::availableDiskSpace(const QString &drive) const |
3617 | +-{ |
3618 | +- return d_ptr->availableDiskSpace(drive); |
3619 | +-} |
3620 | +- |
3621 | +-/*! |
3622 | +- Returns the total space of the \a drive, in bytes. -1 is returned if the drive doesn't exist, |
3623 | +- or the information is not available. |
3624 | +-*/ |
3625 | +-qlonglong QStorageInfo::totalDiskSpace(const QString &drive) const |
3626 | +-{ |
3627 | +- return d_ptr->totalDiskSpace(drive); |
3628 | +-} |
3629 | +- |
3630 | +-/*! |
3631 | +- Returns the URI, or unique identifier for the given \a drive. If the drive doesn't exist, or the |
3632 | +- information is not available, an empty string is returned. |
3633 | +-*/ |
3634 | +-QString QStorageInfo::uriForDrive(const QString &drive) const |
3635 | +-{ |
3636 | +- return d_ptr->uriForDrive(drive); |
3637 | +-} |
3638 | +- |
3639 | +-/*! |
3640 | +- Returns the type of the given \a drive. |
3641 | +-*/ |
3642 | +-QStorageInfo::DriveType QStorageInfo::driveType(const QString &drive) const |
3643 | +-{ |
3644 | +- return d_ptr->driveType(drive); |
3645 | +-} |
3646 | +- |
3647 | +-extern QMetaMethod proxyToSourceSignal(const QMetaMethod &, QObject *); |
3648 | +- |
3649 | +-/*! |
3650 | +- \internal |
3651 | +-*/ |
3652 | +-void QStorageInfo::connectNotify(const QMetaMethod &signal) |
3653 | +-{ |
3654 | +-#if defined(Q_OS_LINUX) || defined(Q_OS_WIN) |
3655 | +- QMetaMethod sourceSignal = proxyToSourceSignal(signal, d_ptr); |
3656 | +- connect(d_ptr, sourceSignal, this, signal, Qt::UniqueConnection); |
3657 | +-#else |
3658 | +- Q_UNUSED(signal) |
3659 | +-#endif |
3660 | +-} |
3661 | +- |
3662 | +-/*! |
3663 | +- \internal |
3664 | +-*/ |
3665 | +-void QStorageInfo::disconnectNotify(const QMetaMethod &signal) |
3666 | +-{ |
3667 | +-#if defined(Q_OS_LINUX) || defined(Q_OS_WIN) |
3668 | +- // We can only disconnect with the private implementation, when there is no receivers for the signal. |
3669 | +- if (isSignalConnected(signal)) |
3670 | +- return; |
3671 | +- |
3672 | +- QMetaMethod sourceSignal = proxyToSourceSignal(signal, d_ptr); |
3673 | +- disconnect(d_ptr, sourceSignal, this, signal); |
3674 | +-#else |
3675 | +- Q_UNUSED(signal) |
3676 | +-#endif |
3677 | +-} |
3678 | +- |
3679 | +-QT_END_NAMESPACE |
3680 | + |
3681 | +=== removed file 'src/systeminfo/qstorageinfo.h' |
3682 | +--- old/src/systeminfo/qstorageinfo.h 2013-07-12 13:41:02 +0000 |
3683 | ++++ new/src/systeminfo/qstorageinfo.h 1970-01-01 00:00:00 +0000 |
3684 | +@@ -1,94 +0,0 @@ |
3685 | +-/**************************************************************************** |
3686 | +-** |
3687 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
3688 | +-** Contact: http://www.qt-project.org/legal |
3689 | +-** |
3690 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
3691 | +-** |
3692 | +-** $QT_BEGIN_LICENSE:LGPL$ |
3693 | +-** Commercial License Usage |
3694 | +-** Licensees holding valid commercial Qt licenses may use this file in |
3695 | +-** accordance with the commercial license agreement provided with the |
3696 | +-** Software or, alternatively, in accordance with the terms contained in |
3697 | +-** a written agreement between you and Digia. For licensing terms and |
3698 | +-** conditions see http://qt.digia.com/licensing. For further information |
3699 | +-** use the contact form at http://qt.digia.com/contact-us. |
3700 | +-** |
3701 | +-** GNU Lesser General Public License Usage |
3702 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
3703 | +-** General Public License version 2.1 as published by the Free Software |
3704 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
3705 | +-** packaging of this file. Please review the following information to |
3706 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
3707 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
3708 | +-** |
3709 | +-** In addition, as a special exception, Digia gives you certain additional |
3710 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
3711 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
3712 | +-** |
3713 | +-** GNU General Public License Usage |
3714 | +-** Alternatively, this file may be used under the terms of the GNU |
3715 | +-** General Public License version 3.0 as published by the Free Software |
3716 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
3717 | +-** packaging of this file. Please review the following information to |
3718 | +-** ensure the GNU General Public License version 3.0 requirements will be |
3719 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
3720 | +-** |
3721 | +-** |
3722 | +-** $QT_END_LICENSE$ |
3723 | +-** |
3724 | +-****************************************************************************/ |
3725 | +- |
3726 | +-#ifndef QSTORAGEINFO_H |
3727 | +-#define QSTORAGEINFO_H |
3728 | +- |
3729 | +-#include <QtSystemInfo/qsysteminfoglobal.h> |
3730 | +-#include <QtCore/qobject.h> |
3731 | +-#include <QtCore/qstringlist.h> |
3732 | +- |
3733 | +-QT_BEGIN_NAMESPACE |
3734 | +- |
3735 | +-class QStorageInfoPrivate; |
3736 | +- |
3737 | +-class Q_SYSTEMINFO_EXPORT QStorageInfo : public QObject |
3738 | +-{ |
3739 | +- Q_OBJECT |
3740 | +- Q_ENUMS(DriveType) |
3741 | +- Q_PROPERTY(QStringList allLogicalDrives READ allLogicalDrives NOTIFY logicalDriveChanged) |
3742 | +- |
3743 | +-public: |
3744 | +- enum DriveType { |
3745 | +- UnknownDrive = 0, |
3746 | +- InternalDrive, |
3747 | +- RemovableDrive, |
3748 | +- RemoteDrive, |
3749 | +- CdromDrive, |
3750 | +- RamDrive |
3751 | +- }; |
3752 | +- |
3753 | +- QStorageInfo(QObject *parent = 0); |
3754 | +- virtual ~QStorageInfo(); |
3755 | +- |
3756 | +- QStringList allLogicalDrives(); |
3757 | +- |
3758 | +- Q_INVOKABLE qlonglong availableDiskSpace(const QString &drive) const; |
3759 | +- Q_INVOKABLE qlonglong totalDiskSpace(const QString &drive) const; |
3760 | +- Q_INVOKABLE QString uriForDrive(const QString &drive) const; |
3761 | +- Q_INVOKABLE QStorageInfo::DriveType driveType(const QString &drive) const; |
3762 | +- |
3763 | +-Q_SIGNALS: |
3764 | +- void logicalDriveChanged(const QString &drive, bool added); |
3765 | +- |
3766 | +-protected: |
3767 | +- void connectNotify(const QMetaMethod &signal); |
3768 | +- void disconnectNotify(const QMetaMethod &signal); |
3769 | +- |
3770 | +-private: |
3771 | +- Q_DISABLE_COPY(QStorageInfo) |
3772 | +- QStorageInfoPrivate * const d_ptr; |
3773 | +- Q_DECLARE_PRIVATE(QStorageInfo) |
3774 | +-}; |
3775 | +- |
3776 | +-QT_END_NAMESPACE |
3777 | +- |
3778 | +-#endif // QSTORAGEINFO_H |
3779 | + |
3780 | +=== modified file 'src/systeminfo/simulator/qsysteminfodata_simulator.cpp' |
3781 | +--- old/src/systeminfo/simulator/qsysteminfodata_simulator.cpp 2013-07-12 13:41:02 +0000 |
3782 | ++++ new/src/systeminfo/simulator/qsysteminfodata_simulator.cpp 2015-02-03 15:08:16 +0000 |
3783 | +@@ -54,8 +54,6 @@ |
3784 | + qRegisterMetaTypeStreamOperators<QNetworkInfoData::BluetoothInfo>("QNetworkInfoData::BluetoothInfo"); |
3785 | + qRegisterMetaTypeStreamOperators<QDeviceInfoData>("QDeviceInfoData"); |
3786 | + qRegisterMetaTypeStreamOperators<QBatteryInfoData>("QBatteryInfoData"); |
3787 | +- qRegisterMetaTypeStreamOperators<QStorageInfoData>("QStorageInfoData"); |
3788 | +- qRegisterMetaTypeStreamOperators<QStorageInfoData::DriveInfo>("QStorageInfoData::DriveInfo"); |
3789 | + qRegisterMetaTypeStreamOperators<QScreenSaverData>("QScreenSaverData"); |
3790 | + } |
3791 | + |
3792 | +@@ -258,38 +256,6 @@ |
3793 | + return in; |
3794 | + } |
3795 | + |
3796 | +-QDataStream &operator<<(QDataStream &out, const QStorageInfoData &s) |
3797 | +-{ |
3798 | +- out << s.drives; |
3799 | +- return out; |
3800 | +-} |
3801 | +- |
3802 | +-QDataStream &operator>>(QDataStream &in, QStorageInfoData &s) |
3803 | +-{ |
3804 | +- in >> s.drives; |
3805 | +- return in; |
3806 | +-} |
3807 | +- |
3808 | +-QDataStream &operator<<(QDataStream &out, const QStorageInfoData::DriveInfo &s) |
3809 | +-{ |
3810 | +- out << s.totalSpace << s.availableSpace; |
3811 | +- out << s.uri; |
3812 | +- out << static_cast<qint32>(s.type); |
3813 | +- |
3814 | +- return out; |
3815 | +-} |
3816 | +- |
3817 | +-QDataStream &operator>>(QDataStream &in, QStorageInfoData::DriveInfo &s) |
3818 | +-{ |
3819 | +- in >> s.totalSpace >> s.availableSpace; |
3820 | +- in >> s.uri; |
3821 | +- qint32 type; |
3822 | +- in >> type; |
3823 | +- s.type = static_cast<QStorageInfo::DriveType>(type); |
3824 | +- |
3825 | +- return in; |
3826 | +-} |
3827 | +- |
3828 | + QDataStream &operator<<(QDataStream &out, const QScreenSaverData &s) |
3829 | + { |
3830 | + out << s.screenSaverEnabled; |
3831 | + |
3832 | +=== modified file 'src/systeminfo/simulator/qsysteminfodata_simulator_p.h' |
3833 | +--- old/src/systeminfo/simulator/qsysteminfodata_simulator_p.h 2013-07-12 13:41:02 +0000 |
3834 | ++++ new/src/systeminfo/simulator/qsysteminfodata_simulator_p.h 2015-02-03 15:08:16 +0000 |
3835 | +@@ -57,7 +57,6 @@ |
3836 | + #include <qnetworkinfo.h> |
3837 | + #include <qdeviceinfo.h> |
3838 | + #include <qbatteryinfo.h> |
3839 | +-#include <qstorageinfo.h> |
3840 | + #include <qscreensaver.h> |
3841 | + |
3842 | + #include <QHash> |
3843 | +@@ -143,18 +142,6 @@ |
3844 | + QMap<QDeviceInfo::Version, QString> versionList; |
3845 | + }; |
3846 | + |
3847 | +-struct QStorageInfoData |
3848 | +-{ |
3849 | +- struct DriveInfo |
3850 | +- { |
3851 | +- qint64 totalSpace; |
3852 | +- qint64 availableSpace; |
3853 | +- QString uri; |
3854 | +- QStorageInfo::DriveType type; |
3855 | +- }; |
3856 | +- QHash<QString, DriveInfo> drives; |
3857 | +-}; |
3858 | +- |
3859 | + struct QScreenSaverData |
3860 | + { |
3861 | + bool screenSaverEnabled; |
3862 | +@@ -164,7 +151,6 @@ |
3863 | + Q_DECLARE_METATYPE(QNetworkInfoData) |
3864 | + Q_DECLARE_METATYPE(QDeviceInfoData) |
3865 | + Q_DECLARE_METATYPE(QBatteryInfoData) |
3866 | +-Q_DECLARE_METATYPE(QStorageInfoData) |
3867 | + Q_DECLARE_METATYPE(QScreenSaverData) |
3868 | + |
3869 | + void qt_registerSystemInfoTypes(); |
3870 | +@@ -189,10 +175,6 @@ |
3871 | + QDataStream &operator>>(QDataStream &in, QDeviceInfo::Version &s); |
3872 | + QDataStream &operator<<(QDataStream &out, const QBatteryInfoData &s); |
3873 | + QDataStream &operator>>(QDataStream &in, QBatteryInfoData &s); |
3874 | +-QDataStream &operator<<(QDataStream &out, const QStorageInfoData &s); |
3875 | +-QDataStream &operator>>(QDataStream &in, QStorageInfoData &s); |
3876 | +-QDataStream &operator<<(QDataStream &out, const QStorageInfoData::DriveInfo &s); |
3877 | +-QDataStream &operator>>(QDataStream &in, QStorageInfoData::DriveInfo &s); |
3878 | + QDataStream &operator<<(QDataStream &out, const QScreenSaverData &s); |
3879 | + QDataStream &operator>>(QDataStream &in, QScreenSaverData &s); |
3880 | + |
3881 | + |
3882 | +=== modified file 'src/systeminfo/systeminfo.pro' |
3883 | +--- old/src/systeminfo/systeminfo.pro 2013-08-09 10:39:01 +0000 |
3884 | ++++ new/src/systeminfo/systeminfo.pro 2015-02-03 15:08:16 +0000 |
3885 | +@@ -4,13 +4,11 @@ |
3886 | + QT = core network |
3887 | + PUBLIC_HEADERS = qsysteminfoglobal.h \ |
3888 | + qdeviceinfo.h \ |
3889 | +- qstorageinfo.h \ |
3890 | + qscreensaver.h \ |
3891 | + qbatteryinfo.h \ |
3892 | + qnetworkinfo.h |
3893 | + |
3894 | + SOURCES += qdeviceinfo.cpp \ |
3895 | +- qstorageinfo.cpp \ |
3896 | + qscreensaver.cpp \ |
3897 | + qbatteryinfo.cpp \ |
3898 | + qnetworkinfo.cpp |
3899 | +@@ -30,7 +28,6 @@ |
3900 | + |
3901 | + PRIVATE_HEADERS += windows/qscreensaver_win_p.h \ |
3902 | + windows/qdeviceinfo_win_p.h \ |
3903 | +- windows/qstorageinfo_win_p.h \ |
3904 | + windows/qbatteryinfo_win_p.h \ |
3905 | + windows/qnetworkinfo_win_p.h \ |
3906 | + windows/qwmihelper_win_p.h \ |
3907 | +@@ -38,7 +35,6 @@ |
3908 | + |
3909 | + SOURCES += windows/qscreensaver_win.cpp \ |
3910 | + windows/qdeviceinfo_win.cpp \ |
3911 | +- windows/qstorageinfo_win.cpp \ |
3912 | + windows/qbatteryinfo_win.cpp \ |
3913 | + windows/qnetworkinfo_win.cpp \ |
3914 | + windows/qwmihelper_win.cpp |
3915 | +@@ -60,12 +56,10 @@ |
3916 | + |
3917 | + linux-*: !simulator: { |
3918 | + PRIVATE_HEADERS += linux/qdeviceinfo_linux_p.h \ |
3919 | +- linux/qstorageinfo_linux_p.h \ |
3920 | + linux/qnetworkinfo_linux_p.h \ |
3921 | + linux/qscreensaver_linux_p.h |
3922 | + |
3923 | + SOURCES += linux/qdeviceinfo_linux.cpp \ |
3924 | +- linux/qstorageinfo_linux.cpp \ |
3925 | + linux/qnetworkinfo_linux.cpp \ |
3926 | + linux/qscreensaver_linux.cpp |
3927 | + |
3928 | +@@ -133,14 +127,12 @@ |
3929 | + OBJECTIVE_SOURCES += mac/qbatteryinfo_mac.mm \ |
3930 | + mac/qdeviceinfo_mac.mm \ |
3931 | + mac/qnetworkinfo_mac.mm \ |
3932 | +- mac/qscreensaver_mac.mm \ |
3933 | +- mac/qstorageinfo_mac.mm |
3934 | ++ mac/qscreensaver_mac.mm |
3935 | + |
3936 | + PRIVATE_HEADERS += mac/qbatteryinfo_mac_p.h \ |
3937 | + mac/qdeviceinfo_mac_p.h \ |
3938 | + mac/qnetworkinfo_mac_p.h \ |
3939 | +- mac/qscreensaver_mac_p.h \ |
3940 | +- mac/qstorageinfo_mac_p.h |
3941 | ++ mac/qscreensaver_mac_p.h |
3942 | + |
3943 | + LIBS += -framework SystemConfiguration \ |
3944 | + -framework Foundation \ |
3945 | +@@ -173,12 +165,10 @@ |
3946 | + |
3947 | + linux-*: { |
3948 | + PRIVATE_HEADERS += \ |
3949 | +- linux/qscreensaver_linux_p.h \ |
3950 | +- linux/qstorageinfo_linux_p.h |
3951 | ++ linux/qscreensaver_linux_p.h |
3952 | + |
3953 | + SOURCES += \ |
3954 | +- linux/qscreensaver_linux.cpp \ |
3955 | +- linux/qstorageinfo_linux.cpp |
3956 | ++ linux/qscreensaver_linux.cpp |
3957 | + |
3958 | + x11|config_x11 { |
3959 | + CONFIG += link_pkgconfig |
3960 | + |
3961 | +=== removed file 'src/systeminfo/windows/qstorageinfo_win.cpp' |
3962 | +--- old/src/systeminfo/windows/qstorageinfo_win.cpp 2013-06-14 10:32:13 +0000 |
3963 | ++++ new/src/systeminfo/windows/qstorageinfo_win.cpp 1970-01-01 00:00:00 +0000 |
3964 | +@@ -1,175 +0,0 @@ |
3965 | +-/**************************************************************************** |
3966 | +-** |
3967 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
3968 | +-** Contact: http://www.qt-project.org/legal |
3969 | +-** |
3970 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
3971 | +-** |
3972 | +-** $QT_BEGIN_LICENSE:LGPL$ |
3973 | +-** Commercial License Usage |
3974 | +-** Licensees holding valid commercial Qt licenses may use this file in |
3975 | +-** accordance with the commercial license agreement provided with the |
3976 | +-** Software or, alternatively, in accordance with the terms contained in |
3977 | +-** a written agreement between you and Digia. For licensing terms and |
3978 | +-** conditions see http://qt.digia.com/licensing. For further information |
3979 | +-** use the contact form at http://qt.digia.com/contact-us. |
3980 | +-** |
3981 | +-** GNU Lesser General Public License Usage |
3982 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
3983 | +-** General Public License version 2.1 as published by the Free Software |
3984 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
3985 | +-** packaging of this file. Please review the following information to |
3986 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
3987 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
3988 | +-** |
3989 | +-** In addition, as a special exception, Digia gives you certain additional |
3990 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
3991 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
3992 | +-** |
3993 | +-** GNU General Public License Usage |
3994 | +-** Alternatively, this file may be used under the terms of the GNU |
3995 | +-** General Public License version 3.0 as published by the Free Software |
3996 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
3997 | +-** packaging of this file. Please review the following information to |
3998 | +-** ensure the GNU General Public License version 3.0 requirements will be |
3999 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
4000 | +-** |
4001 | +-** |
4002 | +-** $QT_END_LICENSE$ |
4003 | +-** |
4004 | +-****************************************************************************/ |
4005 | +- |
4006 | +-#include "qstorageinfo_win_p.h" |
4007 | +- |
4008 | +-#if !defined( Q_CC_MINGW) |
4009 | +-#ifndef Q_OS_WINCE |
4010 | +-#include "qwmihelper_win_p.h" |
4011 | +-#endif |
4012 | +-#endif |
4013 | +- |
4014 | +-#include <QtCore/qdir.h> |
4015 | +-#include <QtCore/qmetaobject.h> |
4016 | +- |
4017 | +-#include <qt_windows.h> |
4018 | +- |
4019 | +-QT_BEGIN_NAMESPACE |
4020 | +- |
4021 | +-QStorageInfoPrivate::QStorageInfoPrivate(QStorageInfo *parent) |
4022 | +- : QObject(parent) |
4023 | +- , q_ptr(parent) |
4024 | +-{ |
4025 | +-#if !defined( Q_CC_MINGW) |
4026 | +-#if !defined( Q_OS_WINCE) |
4027 | +- WMIHelper *wHelper; |
4028 | +- wHelper = WMIHelper::instance(); |
4029 | +- wHelper->setWmiNamespace(QLatin1String("root/cimv2")); |
4030 | +- wHelper->setClassName(QLatin1String("Win32_VolumeChangeEvent")); |
4031 | +- QString aString = QLatin1String("SELECT * FROM __InstanceOperationEvent WITHIN 1 WHERE (TargetInstance ISA 'Win32_LogicalDisk') AND (TargetInstance.DriveType = 5 OR TargetInstance.DriveType = 2)"); |
4032 | +- |
4033 | +- wHelper->setupNotfication(QLatin1String("root/cimv2"),aString,QStringList()); |
4034 | +- |
4035 | +- connect(wHelper,SIGNAL(wminotificationArrived()),this,SLOT(notificationArrived())); |
4036 | +-#endif |
4037 | +-#endif |
4038 | +-} |
4039 | +- |
4040 | +-QStorageInfoPrivate::~QStorageInfoPrivate() |
4041 | +-{ |
4042 | +-} |
4043 | +- |
4044 | +-qlonglong QStorageInfoPrivate::availableDiskSpace(const QString &drive) |
4045 | +-{ |
4046 | +- qlonglong availableBytes(-1); |
4047 | +- if (!GetDiskFreeSpaceEx((WCHAR *)drive.utf16(), 0, 0, (PULARGE_INTEGER)&availableBytes)) |
4048 | +- availableBytes = -1; |
4049 | +- return availableBytes; |
4050 | +-} |
4051 | +- |
4052 | +-qlonglong QStorageInfoPrivate::totalDiskSpace(const QString &drive) |
4053 | +-{ |
4054 | +- qlonglong totalBytes(-1); |
4055 | +- if (!GetDiskFreeSpaceEx((WCHAR *)drive.utf16(), 0, (PULARGE_INTEGER)&totalBytes, 0)) |
4056 | +- totalBytes = -1; |
4057 | +- return totalBytes; |
4058 | +-} |
4059 | +- |
4060 | +-QString QStorageInfoPrivate::uriForDrive(const QString &drive) |
4061 | +-{ |
4062 | +- WCHAR uri[50]; |
4063 | +- if (GetVolumeNameForVolumeMountPoint((WCHAR *)drive.utf16(), uri, 50)) |
4064 | +- return QString::fromUtf16(reinterpret_cast<const unsigned short *>(uri)); |
4065 | +- return QString(); |
4066 | +-} |
4067 | +- |
4068 | +-QStringList QStorageInfoPrivate::allLogicalDrives() |
4069 | +-{ |
4070 | +- mountEntriesList.clear(); |
4071 | +- QFileInfoList drives = QDir::drives(); |
4072 | +- foreach (const QFileInfo &drive, drives) |
4073 | +- mountEntriesList << drive.absoluteFilePath(); |
4074 | +- return mountEntriesList; |
4075 | +-} |
4076 | +- |
4077 | +-QStorageInfo::DriveType QStorageInfoPrivate::driveType(const QString &drive) |
4078 | +-{ |
4079 | +- UINT type = GetDriveType((WCHAR *)drive.utf16()); |
4080 | +- switch (type) { |
4081 | +- case DRIVE_REMOVABLE: |
4082 | +- return QStorageInfo::RemovableDrive; |
4083 | +- case DRIVE_FIXED: |
4084 | +- return QStorageInfo::InternalDrive; |
4085 | +- case DRIVE_REMOTE: |
4086 | +- return QStorageInfo::RemoteDrive; |
4087 | +- case DRIVE_CDROM: |
4088 | +- return QStorageInfo::CdromDrive; |
4089 | +- case DRIVE_RAMDISK: |
4090 | +- return QStorageInfo::RamDrive; |
4091 | +- case DRIVE_UNKNOWN: |
4092 | +- case DRIVE_NO_ROOT_DIR: |
4093 | +- default: |
4094 | +- return QStorageInfo::UnknownDrive; |
4095 | +- }; |
4096 | +-} |
4097 | +- |
4098 | +-void QStorageInfoPrivate::connectNotify(const QMetaMethod &signal) |
4099 | +-{ |
4100 | +- static const QMetaMethod logicalDriveChangedSignal = QMetaMethod::fromSignal(&QStorageInfoPrivate::logicalDriveChanged); |
4101 | +- if (signal == logicalDriveChangedSignal) { |
4102 | +- } |
4103 | +-} |
4104 | +- |
4105 | +-void QStorageInfoPrivate::disconnectNotify(const QMetaMethod &signal) |
4106 | +-{ |
4107 | +- static const QMetaMethod logicalDriveChangedSignal = QMetaMethod::fromSignal(&QStorageInfoPrivate::logicalDriveChanged); |
4108 | +- if (signal == logicalDriveChangedSignal) { |
4109 | +- } |
4110 | +-} |
4111 | +- |
4112 | +-void QStorageInfoPrivate::notificationArrived() |
4113 | +-{ |
4114 | +- QStringList oldDrives; |
4115 | +- |
4116 | +- oldDrives = mountEntriesList; |
4117 | +- allLogicalDrives(); |
4118 | +- |
4119 | +- if (mountEntriesList.count() < oldDrives.count()) { |
4120 | +- QStringListIterator i(oldDrives); |
4121 | +- while (i.hasNext()) { |
4122 | +- QString key = i.next(); |
4123 | +- if (!mountEntriesList.contains(key)) { |
4124 | +- emit logicalDriveChanged(key, false); |
4125 | +- } |
4126 | +- } |
4127 | +- } else if (mountEntriesList.count() > oldDrives.count()) { |
4128 | +- QStringListIterator i(mountEntriesList); |
4129 | +- while (i.hasNext()) { |
4130 | +- QString key = i.next(); |
4131 | +- |
4132 | +- if (oldDrives.contains(key)) |
4133 | +- continue; |
4134 | +- emit logicalDriveChanged(key, true); |
4135 | +- } |
4136 | +- } |
4137 | +- } |
4138 | +- |
4139 | +-QT_END_NAMESPACE |
4140 | + |
4141 | +=== removed file 'src/systeminfo/windows/qstorageinfo_win_p.h' |
4142 | +--- old/src/systeminfo/windows/qstorageinfo_win_p.h 2013-06-14 10:32:13 +0000 |
4143 | ++++ new/src/systeminfo/windows/qstorageinfo_win_p.h 1970-01-01 00:00:00 +0000 |
4144 | +@@ -1,96 +0,0 @@ |
4145 | +-/**************************************************************************** |
4146 | +-** |
4147 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
4148 | +-** Contact: http://www.qt-project.org/legal |
4149 | +-** |
4150 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
4151 | +-** |
4152 | +-** $QT_BEGIN_LICENSE:LGPL$ |
4153 | +-** Commercial License Usage |
4154 | +-** Licensees holding valid commercial Qt licenses may use this file in |
4155 | +-** accordance with the commercial license agreement provided with the |
4156 | +-** Software or, alternatively, in accordance with the terms contained in |
4157 | +-** a written agreement between you and Digia. For licensing terms and |
4158 | +-** conditions see http://qt.digia.com/licensing. For further information |
4159 | +-** use the contact form at http://qt.digia.com/contact-us. |
4160 | +-** |
4161 | +-** GNU Lesser General Public License Usage |
4162 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
4163 | +-** General Public License version 2.1 as published by the Free Software |
4164 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
4165 | +-** packaging of this file. Please review the following information to |
4166 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
4167 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
4168 | +-** |
4169 | +-** In addition, as a special exception, Digia gives you certain additional |
4170 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
4171 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
4172 | +-** |
4173 | +-** GNU General Public License Usage |
4174 | +-** Alternatively, this file may be used under the terms of the GNU |
4175 | +-** General Public License version 3.0 as published by the Free Software |
4176 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
4177 | +-** packaging of this file. Please review the following information to |
4178 | +-** ensure the GNU General Public License version 3.0 requirements will be |
4179 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
4180 | +-** |
4181 | +-** |
4182 | +-** $QT_END_LICENSE$ |
4183 | +-** |
4184 | +-****************************************************************************/ |
4185 | +- |
4186 | +-// |
4187 | +-// W A R N I N G |
4188 | +-// ------------- |
4189 | +-// |
4190 | +-// This file is not part of the Qt API. It exists purely as an |
4191 | +-// implementation detail. This header file may change from version to |
4192 | +-// version without notice, or even be removed. |
4193 | +-// |
4194 | +-// We mean it. |
4195 | +-// |
4196 | +- |
4197 | +-#ifndef QSTORAGEINFO_WIN_P_H |
4198 | +-#define QSTORAGEINFO_WIN_P_H |
4199 | +- |
4200 | +-#include "qstorageinfo.h" |
4201 | +-#include "qwmihelper_win_p.h" |
4202 | +- |
4203 | +-QT_BEGIN_NAMESPACE |
4204 | +- |
4205 | +-class QSocketNotifier; |
4206 | +- |
4207 | +-class QStorageInfoPrivate : public QObject |
4208 | +-{ |
4209 | +- Q_OBJECT |
4210 | +- |
4211 | +-public: |
4212 | +- QStorageInfoPrivate(QStorageInfo *parent); |
4213 | +- ~QStorageInfoPrivate(); |
4214 | +- |
4215 | +- qlonglong availableDiskSpace(const QString &drive); |
4216 | +- qlonglong totalDiskSpace(const QString &drive); |
4217 | +- QString uriForDrive(const QString &drive); |
4218 | +- QStringList allLogicalDrives(); |
4219 | +- QStorageInfo::DriveType driveType(const QString &drive); |
4220 | +- |
4221 | +-Q_SIGNALS: |
4222 | +- void logicalDriveChanged(const QString &drive, bool added); |
4223 | +- |
4224 | +-protected: |
4225 | +- void connectNotify(const QMetaMethod &signal); |
4226 | +- void disconnectNotify(const QMetaMethod &signal); |
4227 | +- |
4228 | +-private: |
4229 | +- QStorageInfo * const q_ptr; |
4230 | +- Q_DECLARE_PUBLIC(QStorageInfo); |
4231 | +- |
4232 | +- QStringList mountEntriesList; |
4233 | +- |
4234 | +-private Q_SLOTS: |
4235 | +- void notificationArrived(); |
4236 | +-}; |
4237 | +- |
4238 | +-QT_END_NAMESPACE |
4239 | +- |
4240 | +-#endif // QSTORAGEINFO_WIN_P_H |
4241 | + |
4242 | +=== modified file 'tests/auto/cmake/test_modules/main.cpp' |
4243 | +--- old/tests/auto/cmake/test_modules/main.cpp 2013-07-12 13:41:02 +0000 |
4244 | ++++ new/tests/auto/cmake/test_modules/main.cpp 2015-02-03 15:08:16 +0000 |
4245 | +@@ -41,7 +41,6 @@ |
4246 | + |
4247 | + #include <QValueSpaceSubscriber> |
4248 | + #include <QServiceInterfaceDescriptor> |
4249 | +-#include <QStorageInfo> |
4250 | + |
4251 | + int main(int argc, char **argv) |
4252 | + { |
4253 | +@@ -49,7 +48,5 @@ |
4254 | + |
4255 | + QServiceInterfaceDescriptor serviceInterfaceDescriptor; |
4256 | + |
4257 | +- QStorageInfo storageInfo; |
4258 | +- |
4259 | + return 0; |
4260 | + } |
4261 | + |
4262 | +=== removed directory 'tests/auto/systeminfo/qstorageinfo' |
4263 | +=== removed file 'tests/auto/systeminfo/qstorageinfo/qstorageinfo.pro' |
4264 | +--- old/tests/auto/systeminfo/qstorageinfo/qstorageinfo.pro 2013-07-12 13:41:02 +0000 |
4265 | ++++ new/tests/auto/systeminfo/qstorageinfo/qstorageinfo.pro 1970-01-01 00:00:00 +0000 |
4266 | +@@ -1,5 +0,0 @@ |
4267 | +- |
4268 | +-QT += systeminfo testlib |
4269 | +- |
4270 | +-SOURCES += tst_qstorageinfo.cpp |
4271 | +-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 |
4272 | + |
4273 | +=== removed file 'tests/auto/systeminfo/qstorageinfo/tst_qstorageinfo.cpp' |
4274 | +--- old/tests/auto/systeminfo/qstorageinfo/tst_qstorageinfo.cpp 2013-06-14 10:32:13 +0000 |
4275 | ++++ new/tests/auto/systeminfo/qstorageinfo/tst_qstorageinfo.cpp 1970-01-01 00:00:00 +0000 |
4276 | +@@ -1,67 +0,0 @@ |
4277 | +-/**************************************************************************** |
4278 | +-** |
4279 | +-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). |
4280 | +-** Contact: http://www.qt-project.org/legal |
4281 | +-** |
4282 | +-** This file is part of the QtSystems module of the Qt Toolkit. |
4283 | +-** |
4284 | +-** $QT_BEGIN_LICENSE:LGPL$ |
4285 | +-** Commercial License Usage |
4286 | +-** Licensees holding valid commercial Qt licenses may use this file in |
4287 | +-** accordance with the commercial license agreement provided with the |
4288 | +-** Software or, alternatively, in accordance with the terms contained in |
4289 | +-** a written agreement between you and Digia. For licensing terms and |
4290 | +-** conditions see http://qt.digia.com/licensing. For further information |
4291 | +-** use the contact form at http://qt.digia.com/contact-us. |
4292 | +-** |
4293 | +-** GNU Lesser General Public License Usage |
4294 | +-** Alternatively, this file may be used under the terms of the GNU Lesser |
4295 | +-** General Public License version 2.1 as published by the Free Software |
4296 | +-** Foundation and appearing in the file LICENSE.LGPL included in the |
4297 | +-** packaging of this file. Please review the following information to |
4298 | +-** ensure the GNU Lesser General Public License version 2.1 requirements |
4299 | +-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
4300 | +-** |
4301 | +-** In addition, as a special exception, Digia gives you certain additional |
4302 | +-** rights. These rights are described in the Digia Qt LGPL Exception |
4303 | +-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
4304 | +-** |
4305 | +-** GNU General Public License Usage |
4306 | +-** Alternatively, this file may be used under the terms of the GNU |
4307 | +-** General Public License version 3.0 as published by the Free Software |
4308 | +-** Foundation and appearing in the file LICENSE.GPL included in the |
4309 | +-** packaging of this file. Please review the following information to |
4310 | +-** ensure the GNU General Public License version 3.0 requirements will be |
4311 | +-** met: http://www.gnu.org/copyleft/gpl.html. |
4312 | +-** |
4313 | +-** |
4314 | +-** $QT_END_LICENSE$ |
4315 | +-** |
4316 | +-****************************************************************************/ |
4317 | +- |
4318 | +-#include <QtTest/QtTest> |
4319 | +-#include "qstorageinfo.h" |
4320 | +- |
4321 | +-QT_USE_NAMESPACE |
4322 | +- |
4323 | +-class tst_QStorageInfo : public QObject |
4324 | +-{ |
4325 | +- Q_OBJECT |
4326 | +- |
4327 | +-private slots: |
4328 | +- void tst_diskSpace(); |
4329 | +-}; |
4330 | +- |
4331 | +-void tst_QStorageInfo::tst_diskSpace() |
4332 | +-{ |
4333 | +- QStorageInfo storageInfo; |
4334 | +- QStringList drives = storageInfo.allLogicalDrives(); |
4335 | +- foreach (const QString &drive, drives) { |
4336 | +- qlonglong available = storageInfo.availableDiskSpace(drive); |
4337 | +- qlonglong total = storageInfo.totalDiskSpace(drive); |
4338 | +- QVERIFY(available <= total); |
4339 | +- } |
4340 | +-} |
4341 | +- |
4342 | +-QTEST_MAIN(tst_QStorageInfo) |
4343 | +-#include "tst_qstorageinfo.moc" |
4344 | + |
4345 | +=== modified file 'tests/auto/systeminfo/systeminfo.pro' |
4346 | +--- old/tests/auto/systeminfo/systeminfo.pro 2013-07-12 13:41:02 +0000 |
4347 | ++++ new/tests/auto/systeminfo/systeminfo.pro 2015-02-03 15:08:16 +0000 |
4348 | +@@ -2,6 +2,5 @@ |
4349 | + |
4350 | + SUBDIRS = \ |
4351 | + qdeviceinfo \ |
4352 | +- qstorageinfo \ |
4353 | + qscreensaver \ |
4354 | + qbatteryinfo |
4355 | + |
4356 | +=== modified file 'tests/manual/sysinfo-tester/main.cpp' |
4357 | +--- old/tests/manual/sysinfo-tester/main.cpp 2013-07-12 13:41:02 +0000 |
4358 | ++++ new/tests/manual/sysinfo-tester/main.cpp 2015-02-03 15:08:16 +0000 |
4359 | +@@ -47,7 +47,6 @@ |
4360 | + #include "qbatteryinfo.h" |
4361 | + #include "qdeviceinfo.h" |
4362 | + #include "qnetworkinfo.h" |
4363 | +-#include "qstorageinfo.h" |
4364 | + //#include "qscreensaverinfo.h" |
4365 | + |
4366 | + |
4367 | +@@ -207,65 +206,6 @@ |
4368 | + } |
4369 | + |
4370 | + /* ------------------------------------------------------------------------- * |
4371 | +- * test_systemstorageinfo |
4372 | +- * ------------------------------------------------------------------------- */ |
4373 | +- |
4374 | +-static const char *human_size(qlonglong n) |
4375 | +-{ |
4376 | +- if (n == 0) return "0B"; |
4377 | +- |
4378 | +- static char buf[256]; |
4379 | +- char *pos = buf; |
4380 | +- char *end = buf + sizeof buf; |
4381 | +- |
4382 | +- int b = n & 1023; n >>= 10; |
4383 | +- int k = n & 1023; n >>= 10; |
4384 | +- int m = n & 1023; n >>= 10; |
4385 | +- int g = n & 1023; n >>= 10; |
4386 | +- |
4387 | +- *pos = 0; |
4388 | +-#if defined(Q_OS_WIN) |
4389 | +- if (g) _snprintf_s(pos, sizeof(pos), end-pos,"%s%dGB", *buf?" ":"", g), pos = strchr(pos,0); |
4390 | +- if (m) _snprintf_s(pos, sizeof(pos), end-pos,"%s%dMB", *buf?" ":"", m), pos = strchr(pos,0); |
4391 | +- if (k) _snprintf_s(pos, sizeof(pos), end-pos,"%s%dkB", *buf?" ":"", k), pos = strchr(pos,0); |
4392 | +- if (b) _snprintf_s(pos, sizeof(pos), end-pos,"%s%dB", *buf?" ":"", b), pos = strchr(pos,0); |
4393 | +-#else |
4394 | +- if (g) snprintf(pos, end-pos, "%s%dGB", *buf?" ":"", g), pos = strchr(pos,0); |
4395 | +- if (m) snprintf(pos, end-pos, "%s%dMB", *buf?" ":"", m), pos = strchr(pos,0); |
4396 | +- if (k) snprintf(pos, end-pos, "%s%dkB", *buf?" ":"", k), pos = strchr(pos,0); |
4397 | +- if (b) snprintf(pos, end-pos, "%s%dB", *buf?" ":"", b), pos = strchr(pos,0); |
4398 | +-#endif |
4399 | +- return buf; |
4400 | +-} |
4401 | +- |
4402 | +-static void test_storageinfo(void) |
4403 | +-{ |
4404 | +- QStorageInfo storageinfo; |
4405 | +- |
4406 | +- QStringList lst = storageinfo.allLogicalDrives(); |
4407 | +- |
4408 | +- qDebug() << "storageinfo.logicalDrives ->" << lst; |
4409 | +- |
4410 | +- for (int i = 0; i < lst.size(); ++i) { |
4411 | +- const QString &drv = lst.at(i); |
4412 | +- |
4413 | +- qDebug() << "Logical drive:" << drv; |
4414 | +- |
4415 | +- qlonglong avail = storageinfo.availableDiskSpace(drv); |
4416 | +- qDebug() << " storageinfo.availableDiskSpace() ->" << human_size(avail); |
4417 | +- |
4418 | +- qlonglong total = storageinfo.totalDiskSpace(drv); |
4419 | +- qDebug() << " storageinfo.totalDiskSpace() ->" << human_size(total); |
4420 | +- |
4421 | +- QStorageInfo::DriveType dtype = storageinfo.driveType(drv); |
4422 | +- qDebug() << " storageinfo.typeForDrive() ->" << dtype; |
4423 | +- |
4424 | +- QString duri = storageinfo.uriForDrive(drv); |
4425 | +- qDebug() << " storageinfo.uriForDrive() ->" << duri; |
4426 | +- } |
4427 | +-} |
4428 | +- |
4429 | +-/* ------------------------------------------------------------------------- * |
4430 | + * test_systemnetworkinfo |
4431 | + * ------------------------------------------------------------------------- */ |
4432 | + |
4433 | +@@ -357,7 +297,6 @@ |
4434 | + #define ADD(x) {#x, test_##x } |
4435 | + // ADD(systeminfo), |
4436 | + ADD(deviceinfo), |
4437 | +- ADD(storageinfo), |
4438 | + ADD(networkinfo), |
4439 | + // ADD(screensaver), |
4440 | + ADD(batteryinfo), |
4441 | + |
4442 | |
4443 | === modified file 'debian/patches/series' |
4444 | --- debian/patches/series 2014-07-15 09:21:57 +0000 |
4445 | +++ debian/patches/series 2015-02-03 15:58:39 +0000 |
4446 | @@ -3,3 +3,6 @@ |
4447 | wlan_detect.patch |
4448 | skip_failing_tests.patch |
4449 | fix_qserviceinterfacedescriptor_unit_test.patch |
4450 | +remove-storageinfo.patch |
4451 | +remove-storageinfo-examples.patch |
4452 | +inputinfo.patch |
4453 | |
4454 | === modified file 'debian/qtsystems5-dev.install' |
4455 | --- debian/qtsystems5-dev.install 2014-05-26 07:37:59 +0000 |
4456 | +++ debian/qtsystems5-dev.install 2015-02-03 15:58:39 +0000 |
4457 | @@ -31,16 +31,17 @@ |
4458 | usr/include/*/qt5/QtSystemInfo/QDeviceInfo |
4459 | usr/include/*/qt5/QtSystemInfo/QNetworkInfo |
4460 | usr/include/*/qt5/QtSystemInfo/QScreenSaver |
4461 | -usr/include/*/qt5/QtSystemInfo/QStorageInfo |
4462 | usr/include/*/qt5/QtSystemInfo/QtSystemInfo |
4463 | usr/include/*/qt5/QtSystemInfo/QtSystemInfoVersion |
4464 | usr/include/*/qt5/QtSystemInfo/qbatteryinfo.h |
4465 | usr/include/*/qt5/QtSystemInfo/qdeviceinfo.h |
4466 | usr/include/*/qt5/QtSystemInfo/qnetworkinfo.h |
4467 | usr/include/*/qt5/QtSystemInfo/qscreensaver.h |
4468 | -usr/include/*/qt5/QtSystemInfo/qstorageinfo.h |
4469 | usr/include/*/qt5/QtSystemInfo/qsysteminfoglobal.h |
4470 | usr/include/*/qt5/QtSystemInfo/qtsysteminfoversion.h |
4471 | +usr/include/*/qt5/QtSystemInfo/qinputinfo.h |
4472 | +usr/include/*/qt5/QtSystemInfo/QInputDevice |
4473 | +usr/include/*/qt5/QtSystemInfo/QInputDeviceInfo |
4474 | usr/lib/*/cmake/* |
4475 | usr/lib/*/libQt5PublishSubscribe.prl |
4476 | usr/lib/*/libQt5PublishSubscribe.so |
4477 | |
4478 | === modified file 'debian/qtsystems5-examples.install' |
4479 | --- debian/qtsystems5-examples.install 2013-07-12 13:41:02 +0000 |
4480 | +++ debian/qtsystems5-examples.install 2015-02-03 15:58:39 +0000 |
4481 | @@ -1,8 +1,6 @@ |
4482 | usr/lib/*/qt5/examples/sysinfo/qml-battery/qml-battery |
4483 | usr/lib/*/qt5/examples/sysinfo/qml-battery/qml-battery.qml |
4484 | -usr/lib/*/qt5/examples/sysinfo/qml-storageinfo/content/ProgressBar.qml |
4485 | -usr/lib/*/qt5/examples/sysinfo/qml-storageinfo/content/background.png |
4486 | -usr/lib/*/qt5/examples/sysinfo/qml-storageinfo/qml-storage.qml |
4487 | -usr/lib/*/qt5/examples/sysinfo/qml-storageinfo/qml-storageinfo |
4488 | usr/lib/*/qt5/examples/systeminfo/qml-deviceinfo/qml-deviceinfo |
4489 | usr/lib/*/qt5/examples/systeminfo/qml-deviceinfo/qml-deviceinfo.qml |
4490 | +usr/lib/*/qt5/examples/sysinfo/qml-inputinfo/qml-inputinfo |
4491 | +usr/lib/*/qt5/examples/sysinfo/qml-inputinfo/qml-inputinfo.qml |
4492 | |
4493 | === modified file 'debian/qtsystems5-private-dev.install' |
4494 | --- debian/qtsystems5-private-dev.install 2014-05-26 07:37:59 +0000 |
4495 | +++ debian/qtsystems5-private-dev.install 2015-02-03 15:58:39 +0000 |
4496 | @@ -38,6 +38,7 @@ |
4497 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qdeviceinfo_mac_p.h |
4498 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qdeviceinfo_win_p.h |
4499 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qdevicekitservice_linux_p.h |
4500 | +usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qinputdeviceinfo_linux_p.h |
4501 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qnetworkinfo_linux_p.h |
4502 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qnetworkinfo_mac_p.h |
4503 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qnetworkinfo_win_p.h |
4504 | @@ -45,9 +46,6 @@ |
4505 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qscreensaver_linux_p.h |
4506 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qscreensaver_mac_p.h |
4507 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qscreensaver_win_p.h |
4508 | -usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qstorageinfo_linux_p.h |
4509 | -usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qstorageinfo_mac_p.h |
4510 | -usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qstorageinfo_win_p.h |
4511 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qsystemalignedtimer_linux_p.h |
4512 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qsystemalignedtimer_stub_p.h |
4513 | usr/include/*/qt5/QtSystemInfo/*/QtSystemInfo/private/qsysteminfo_simulator_p.h |
4514 | |
4515 | === modified file 'debian/rules' |
4516 | --- debian/rules 2014-07-15 09:21:57 +0000 |
4517 | +++ debian/rules 2015-02-03 15:58:39 +0000 |
4518 | @@ -23,14 +23,14 @@ |
4519 | -exec sed -i -e 's/$(DEB_HOST_MULTIARCH)\/$(DEB_HOST_MULTIARCH)/$(DEB_HOST_MULTIARCH)/g' {} \; |
4520 | |
4521 | # Fix wrong permissions in examples. |
4522 | - find $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/examples/ -type f \( \ |
4523 | - -name '*.png' \ |
4524 | - -o -name '*.php' \ |
4525 | - -o -name '*.xsl' \ |
4526 | - -o -name '*.xml' \ |
4527 | - -o -name '*.js' \ |
4528 | - -o -name '*.jpg' \ |
4529 | - \) -print0 | xargs -0 chmod a-x |
4530 | + #find $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/qt5/examples/ -type f \( \ |
4531 | + #-name '*.png' \ |
4532 | + #-o -name '*.php' \ |
4533 | + #-o -name '*.xsl' \ |
4534 | + #-o -name '*.xml' \ |
4535 | + #-o -name '*.js' \ |
4536 | + #-o -name '*.jpg' \ |
4537 | + #\) -print0 | xargs -0 chmod a-x |
4538 | |
4539 | # Remove libtool-like files |
4540 | rm -f debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.la |
4541 | @@ -40,5 +40,5 @@ |
4542 | dh_install --fail-missing |
4543 | |
4544 | override_dh_auto_test: |
4545 | - export LD_LIBRARY_PATH=$(CURDIR)/lib |
4546 | - cd tests/auto/ && ( test -e Makefile || qmake auto.pro -o Makefile ) && make -f Makefile check |
4547 | + [ ! -d $(CURDIR)/home ] && mkdir $(CURDIR)/home |
4548 | + cd tests/auto/ && ( test -e Makefile || qmake auto.pro -o Makefile ) && env LD_LIBRARY_PATH=$(CURDIR)/lib HOME=$(CURDIR)/home make -f Makefile check |