|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "qsysteminfo.h" |
|
43 |
|
44 #ifdef Q_OS_LINUX |
|
45 #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) |
|
46 #include "qsysteminfo_maemo_p.h" |
|
47 #else |
|
48 #include "qsysteminfo_linux_p.h" |
|
49 #endif //Q_WS_MAEMO_5 & Q_WS_MAEMO_6 |
|
50 #endif //Q_OS_LINUX |
|
51 |
|
52 #ifdef Q_OS_WIN |
|
53 #include "qsysteminfo_win_p.h" |
|
54 #endif |
|
55 #ifdef Q_OS_MAC |
|
56 #include "qsysteminfo_mac_p.h" |
|
57 #endif |
|
58 #ifdef Q_OS_SYMBIAN |
|
59 #include "qsysteminfo_s60_p.h" |
|
60 #endif |
|
61 |
|
62 #include <QStringList> |
|
63 #include <QSize> |
|
64 #include <QFile> |
|
65 #include <QTextStream> |
|
66 #include <QLocale> |
|
67 #include <QLibraryInfo> |
|
68 #include <QApplication> |
|
69 #include <QDesktopWidget> |
|
70 #include <QDebug> |
|
71 |
|
72 |
|
73 #include <locale.h> |
|
74 |
|
75 QTM_BEGIN_NAMESPACE |
|
76 |
|
77 /*! |
|
78 \class QSystemInfo |
|
79 |
|
80 \ingroup systeminfo |
|
81 |
|
82 \brief The QSystemInfo class provides access to various general information from the system. |
|
83 |
|
84 In the future, parts of the QtSystemInfo API may be moved and renamed into an existing Qt class that provides similiar functionality. |
|
85 |
|
86 \table |
|
87 \header |
|
88 \o Class |
|
89 \row |
|
90 \o QSystemInfo::currentLanguage |
|
91 \row |
|
92 \o QSystemInfo::availableLanguages |
|
93 \row |
|
94 \o QSystemInfo::currentCountryCode |
|
95 \row |
|
96 \o QSystemDisplayInfo::displayBrightness |
|
97 \row |
|
98 \o QSystemDisplayInfo::colorDepth |
|
99 \row |
|
100 \o QSystemScreenSaver::screenSaverInhibited |
|
101 \row |
|
102 \o QSystemScreenSaver::setScreenSaverInhibit |
|
103 \endtable |
|
104 |
|
105 Platform notes |
|
106 Some functionality may or may not be supported on various platforms. Depending on if there |
|
107 is a reliable way to gather such information. |
|
108 */ |
|
109 |
|
110 /*! |
|
111 \enum QSystemInfo::Version |
|
112 This enum describes the version component. |
|
113 |
|
114 \value Os Operating system version / platform ID. |
|
115 \value QtCore Qt libs version. |
|
116 \value Firmware Version of (flashable) system as a whole. |
|
117 |
|
118 */ |
|
119 /*! |
|
120 \enum QSystemInfo::Feature |
|
121 This enum describes the features of the device or computer. |
|
122 |
|
123 \value BluetoothFeature Bluetooth feature available. |
|
124 \value CameraFeature Camera feature available. |
|
125 \value FmradioFeature FM Radio feature available. |
|
126 \value IrFeature Infrared feature available. |
|
127 \value LedFeature LED's feature available. |
|
128 \value MemcardFeature Memory card feature available. |
|
129 \value UsbFeature Universal System Bus (USB) feature available. |
|
130 \value VibFeature Vibration feature available. |
|
131 \value WlanFeature Wireless Local Area Network (WLAN) feature available. |
|
132 \value SimFeature Subscriber Identity Module (SIM) available. |
|
133 \value LocationFeature Global Positioning System (GPS) and/or other location feature available. |
|
134 \value VideoOutFeature Video out feature available. |
|
135 \value HapticsFeature Haptics feature available. |
|
136 */ |
|
137 |
|
138 /*! |
|
139 \class QSystemNetworkInfo |
|
140 |
|
141 \ingroup systeminfo |
|
142 |
|
143 \brief The QSystemNetworkInfo class provides access to network information from the system. |
|
144 |
|
145 */ |
|
146 /*! |
|
147 \enum QSystemNetworkInfo::NetworkStatus |
|
148 This enum describes the status of the network connection: |
|
149 |
|
150 \value UndefinedStatus There is no network device, or error. |
|
151 \value NoNetworkAvailable There is no network available. |
|
152 \value EmergencyOnly Emergency calls only. |
|
153 \value Searching Searching for or connecting with the network. |
|
154 \value Busy Network is busy. |
|
155 \value Connected Connected to newtwork. |
|
156 \value HomeNetwork On Home Network. |
|
157 \value Denied Network access denied. |
|
158 \value Roaming On Roaming network. |
|
159 |
|
160 */ |
|
161 /*! |
|
162 \enum QSystemNetworkInfo::NetworkMode |
|
163 This enum describes the type of network: |
|
164 |
|
165 \value UnknownMode Unknown network, or network error. |
|
166 \value GsmMode Global System for Mobile (GSM) network. |
|
167 \value CdmaMode Code division multiple access (CDMA) network. |
|
168 \value WcdmaMode Wideband Code Division Multiple Access (W-CDMA) network. |
|
169 \value WlanMode Wireless Local Area Network (WLAN) network. |
|
170 \value EthernetMode Wired Local Area network. |
|
171 \value BluetoothMode Bluetooth network. |
|
172 \value WimaxMode Wimax network. |
|
173 |
|
174 */ |
|
175 |
|
176 /*! |
|
177 \class QSystemDisplayInfo |
|
178 |
|
179 \ingroup systeminfo |
|
180 |
|
181 \brief The QSystemDisplayInfo class provides access to display information from the system. |
|
182 |
|
183 */ |
|
184 |
|
185 /*! |
|
186 \class QSystemStorageInfo |
|
187 |
|
188 \ingroup systeminfo |
|
189 |
|
190 \brief The QSystemStorageInfo class provides access to memory and disk information from the system. |
|
191 |
|
192 */ |
|
193 |
|
194 /*! |
|
195 \enum QSystemStorageInfo::DriveType |
|
196 This enum describes the type of drive or volume |
|
197 |
|
198 \value NoDrive Drive type undetermined. |
|
199 \value InternalDrive Is internal drive. |
|
200 \value RemovableDrive Is removable. |
|
201 \value RemoteDrive Is a network drive. |
|
202 \value CdromDrive Is a cd rom drive. |
|
203 */ |
|
204 |
|
205 |
|
206 /*! |
|
207 \class QSystemDeviceInfo |
|
208 |
|
209 \ingroup systeminfo |
|
210 |
|
211 \brief The QSystemDeviceInfo class provides access to device |
|
212 information from the system. |
|
213 |
|
214 */ |
|
215 /*! |
|
216 \fn void QSystemDeviceInfo::batteryLevelChanged(int level) |
|
217 |
|
218 This signal is emitted when battery level has changed. |
|
219 \a level is the new level. |
|
220 */ |
|
221 |
|
222 /*! |
|
223 \fn void QSystemDeviceInfo::batteryStatusChanged(QSystemDeviceInfo::BatteryStatus status) |
|
224 |
|
225 This signal is emitted when battery status has changed. |
|
226 \a status is the new status. |
|
227 */ |
|
228 |
|
229 /*! |
|
230 \fn void QSystemDeviceInfo::powerStateChanged(QSystemDeviceInfo::PowerState state) |
|
231 |
|
232 This signal is emitted when the power state has changed, such as when a phone gets plugged qint32o the wall. |
|
233 \a state is the new power state. |
|
234 */ |
|
235 |
|
236 /*! |
|
237 \fn void QSystemDeviceInfo::currentProfileChanged(QSystemDeviceInfo::Profile profile) |
|
238 |
|
239 This signal is emitted whenever the network profile changes, specified by \a profile. |
|
240 */ |
|
241 |
|
242 |
|
243 /*! |
|
244 \enum QSystemDeviceInfo::BatteryStatus |
|
245 This enum describes the status of the main battery. |
|
246 |
|
247 \value NoBatteryLevel Battery level undetermined. |
|
248 \value BatteryCritical Battery level is critical 3% or less. |
|
249 \value BatteryVeryLow Battery level is very low, 10% or less. |
|
250 \value BatteryLow Battery level is low 40% or less. |
|
251 \value BatteryNormal Battery level is above 40%. |
|
252 |
|
253 */ |
|
254 /*! |
|
255 \enum QSystemDeviceInfo::PowerState |
|
256 This enum describes the power state: |
|
257 |
|
258 \value UnknownPower Power error. |
|
259 \value BatteryPower On battery power. |
|
260 \value WallPower On wall power. |
|
261 \value WallPowerChargingBattery On wall power and charging main battery. |
|
262 |
|
263 */ |
|
264 /*! |
|
265 \enum QSystemDeviceInfo::Profile |
|
266 This enum describes the current operating profile of the device or computer. |
|
267 |
|
268 \value UnknownProfile Profile unknown or error. |
|
269 \value SilentProfile Silent profile. |
|
270 \value NormalProfile Normal profile. |
|
271 \value LoudProfile Loud profile. |
|
272 \value VibProfile Vibrate profile. |
|
273 \value OfflineProfile Offline profile. |
|
274 \value PowersaveProfile Powersave profile. |
|
275 \value CustomProfile Custom profile. |
|
276 |
|
277 */ |
|
278 |
|
279 /*! |
|
280 \enum QSystemDeviceInfo::SimStatus |
|
281 This enum describes the status is the sim card or cards. |
|
282 |
|
283 \value SimNotAvailable SIM is not available on this device. |
|
284 \value SingleSimAvailable One SIM card is available on this. |
|
285 \value DualSimAvailable Two SIM cards are available on this device. |
|
286 \value SimLocked Device has SIM lock enabled. |
|
287 */ |
|
288 |
|
289 /*! |
|
290 \enum QSystemDeviceInfo::InputMethod |
|
291 This enum describes the device method of user input. |
|
292 |
|
293 \value Keys Device has key/buttons. |
|
294 \value Keypad Device has keypad (1,2,3, etc). |
|
295 \value Keyboard Device has qwerty keyboard. |
|
296 \value SingleTouch Device has single touch screen. |
|
297 \value MultiTouch Device has muti touch screen. |
|
298 \value Mouse Device has a mouse. |
|
299 */ |
|
300 |
|
301 /*! |
|
302 \class QSystemScreenSaver |
|
303 |
|
304 \ingroup systeminfo |
|
305 |
|
306 \brief The QSystemScreenSaver class provides access to screen saver and blanking. |
|
307 |
|
308 */ |
|
309 |
|
310 /*! |
|
311 \fn void QSystemInfo::currentLanguageChanged(const QString &lang) |
|
312 |
|
313 This signal is emitted whenever the current language changes, specified by \a lang, |
|
314 which is in 2 letter, ISO 639-1 specification form. |
|
315 */ |
|
316 |
|
317 /*! |
|
318 \fn void QSystemNetworkInfo::networkStatusChanged(QSystemNetworkInfo::NetworkMode mode, QSystemNetworkInfo::NetworkStatus status) |
|
319 |
|
320 This signal is emitted whenever the network status of \a mode changes, specified by \a status. |
|
321 */ |
|
322 |
|
323 /*! |
|
324 \fn void QSystemNetworkInfo::networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode mode,int strength) |
|
325 |
|
326 This signal is emitted whenever the network \a mode signal strength changes, specified by \a strength. |
|
327 */ |
|
328 |
|
329 /*! |
|
330 \fn void QSystemNetworkInfo::currentMobileCountryCodeChanged(const QString &mcc) |
|
331 |
|
332 This signal is emitted whenever the Mobile Country Code changes, specified by \a mcc. |
|
333 */ |
|
334 |
|
335 /*! |
|
336 \fn void QSystemNetworkInfo::currentMobileNetworkCodeChanged(const QString &mnc) |
|
337 |
|
338 This signal is emitted whenever the network Mobile Network Code changes, specified by \a mnc. |
|
339 */ |
|
340 |
|
341 /*! |
|
342 \fn void QSystemNetworkInfo::networkNameChanged(QSystemNetworkInfo::NetworkMode mode,const QString & netName) |
|
343 |
|
344 This signal is emitted whenever the network \a mode name changes, specified by \a netName. |
|
345 |
|
346 */ |
|
347 |
|
348 /*! |
|
349 \fn void QSystemNetworkInfo::networkModeChanged(QSystemNetworkInfo::NetworkMode mode) |
|
350 |
|
351 This signal is emitted whenever the network mode changes, specified by \a mode. |
|
352 */ |
|
353 |
|
354 /*! |
|
355 \fn void QSystemDeviceInfo::bluetoothStateChanged(bool on) |
|
356 |
|
357 This signal is emitted whenever bluetooth state changes, specified by \a on. |
|
358 */ |
|
359 |
|
360 Q_GLOBAL_STATIC(QSystemInfoPrivate, sysinfoPrivate) |
|
361 Q_GLOBAL_STATIC(QSystemNetworkInfoPrivate, netInfoPrivate) |
|
362 Q_GLOBAL_STATIC(QSystemDisplayInfoPrivate, displayInfoPrivate) |
|
363 Q_GLOBAL_STATIC(QSystemStorageInfoPrivate, storageInfoPrivate) |
|
364 Q_GLOBAL_STATIC(QSystemDeviceInfoPrivate, deviceInfoPrivate) |
|
365 Q_GLOBAL_STATIC(QSystemScreenSaverPrivate, screenSaverPrivate) |
|
366 |
|
367 /*! |
|
368 \fn QSystemInfo::QSystemInfo(QObject *parent) |
|
369 Constructs a QSystemInfo object with the given \a parent. |
|
370 */ |
|
371 |
|
372 QSystemInfo::QSystemInfo(QObject *parent) |
|
373 : QObject(parent), d(sysinfoPrivate()) |
|
374 { |
|
375 connect(d,SIGNAL(currentLanguageChanged(QString)), |
|
376 this,SIGNAL(currentLanguageChanged(QString))); |
|
377 } |
|
378 |
|
379 /*! |
|
380 Destroys the QSystemInfo object |
|
381 */ |
|
382 QSystemInfo::~QSystemInfo() |
|
383 { |
|
384 } |
|
385 |
|
386 /*! |
|
387 \property QSystemInfo::currentLanguage |
|
388 \brief The current Language |
|
389 Returns the current language in 2 letter ISO 639-1 format. |
|
390 */ |
|
391 QString QSystemInfo::currentLanguage() |
|
392 { |
|
393 return sysinfoPrivate()->currentLanguage(); |
|
394 } |
|
395 /*! |
|
396 \property QSystemInfo::availableLanguages |
|
397 \brief List of available languages. |
|
398 |
|
399 Returns a QStringList of available Qt language translations in 2 letter ISO 639-1 format. |
|
400 If the Qt translations cannot be found, returns the current system language. |
|
401 */ |
|
402 QStringList QSystemInfo::availableLanguages() |
|
403 { |
|
404 return sysinfoPrivate()->availableLanguages(); |
|
405 } |
|
406 |
|
407 /*! |
|
408 Returns the version of QSystemInfo::Version \a type, |
|
409 with optional platform dependent \a parameter as a string. |
|
410 |
|
411 Version will be returned in "major.minor.build" form. |
|
412 |
|
413 In case a particular version does not use the "build" part, it is set to 0. |
|
414 If a particular element is not available at all, an error "Not Installed" will be returned by |
|
415 the API. |
|
416 */ |
|
417 QString QSystemInfo::version(QSystemInfo::Version type, const QString ¶meter) |
|
418 { |
|
419 return sysinfoPrivate()->version(type, parameter); |
|
420 } |
|
421 |
|
422 /*! |
|
423 \property QSystemInfo::currentCountryCode |
|
424 \brief The current locale country code. |
|
425 |
|
426 Returns the 2 letter ISO 3166-1 for the current country code. |
|
427 */ |
|
428 QString QSystemInfo::currentCountryCode() |
|
429 { |
|
430 return sysinfoPrivate()->currentCountryCode(); |
|
431 } |
|
432 |
|
433 /*! |
|
434 Returns true if the QSystemInfo::Feature \a feature is supported, otherwise false. |
|
435 */ |
|
436 |
|
437 bool QSystemInfo::hasFeatureSupported(QSystemInfo::Feature feature) |
|
438 { |
|
439 return sysinfoPrivate()->hasFeatureSupported(feature); |
|
440 } |
|
441 |
|
442 /*! |
|
443 \fn QSystemNetworkInfo::QSystemNetworkInfo(QObject *parent) |
|
444 Constructs a QSystemNetworkInfo object with the given \a parent. |
|
445 */ |
|
446 |
|
447 QSystemNetworkInfo::QSystemNetworkInfo(QObject *parent) |
|
448 : QObject(parent), d(netInfoPrivate()) |
|
449 { |
|
450 connect(d,SIGNAL(currentMobileCountryCodeChanged(QString)), |
|
451 this,SIGNAL(currentMobileCountryCodeChanged(QString))); |
|
452 |
|
453 connect(d,SIGNAL(currentMobileNetworkCodeChanged(QString)), |
|
454 this,SIGNAL(currentMobileNetworkCodeChanged(QString))); |
|
455 |
|
456 connect(d,SIGNAL(networkModeChanged(QSystemNetworkInfo::NetworkMode)), |
|
457 this,SIGNAL(networkModeChanged(QSystemNetworkInfo::NetworkMode))); |
|
458 |
|
459 connect(d,SIGNAL(networkNameChanged(QSystemNetworkInfo::NetworkMode,QString)), |
|
460 this,SIGNAL(networkNameChanged(QSystemNetworkInfo::NetworkMode,QString))); |
|
461 |
|
462 connect(d,SIGNAL(networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode,int)), |
|
463 this,SIGNAL(networkSignalStrengthChanged(QSystemNetworkInfo::NetworkMode,int))); |
|
464 |
|
465 connect(d,SIGNAL(networkStatusChanged(QSystemNetworkInfo::NetworkMode,QSystemNetworkInfo::NetworkStatus)), |
|
466 this,SIGNAL(networkStatusChanged(QSystemNetworkInfo::NetworkMode,QSystemNetworkInfo::NetworkStatus))); |
|
467 } |
|
468 |
|
469 /*! |
|
470 Destroys the QSystemNetworkInfo object. |
|
471 */ |
|
472 QSystemNetworkInfo::~QSystemNetworkInfo() |
|
473 { |
|
474 } |
|
475 |
|
476 /*! |
|
477 Returns the status of the network \a mode. |
|
478 */ |
|
479 QSystemNetworkInfo::NetworkStatus QSystemNetworkInfo::networkStatus(QSystemNetworkInfo::NetworkMode mode) |
|
480 { |
|
481 qWarning() << __FUNCTION__; |
|
482 return netInfoPrivate()->networkStatus(mode); |
|
483 } |
|
484 |
|
485 /*! |
|
486 Returns the strength of the network signal, per network \a mode , 0 - 100 linear scaling, |
|
487 or -1 in the case of unknown network mode or error. |
|
488 |
|
489 In the case of QSystemNetworkInfo::EthMode, it will either be 100 for carrier active, or 0 for when |
|
490 there is no carrier or cable connected. |
|
491 */ |
|
492 int QSystemNetworkInfo::networkSignalStrength(QSystemNetworkInfo::NetworkMode mode) |
|
493 { |
|
494 return netInfoPrivate()->networkSignalStrength(mode); |
|
495 } |
|
496 |
|
497 /*! |
|
498 \property QSystemNetworkInfo::cellId |
|
499 \brief The devices Cell ID |
|
500 Returns the Cell ID of the connected tower or based station. |
|
501 */ |
|
502 int QSystemNetworkInfo::cellId() |
|
503 { |
|
504 return netInfoPrivate()->cellId(); |
|
505 } |
|
506 |
|
507 /*! |
|
508 \property QSystemNetworkInfo::locationAreaCode |
|
509 \brief The LAC. |
|
510 |
|
511 Returns the Location Area Code. In the case of none such as a Desktop, an empty string. |
|
512 */ |
|
513 int QSystemNetworkInfo::locationAreaCode() |
|
514 { |
|
515 return netInfoPrivate()->locationAreaCode(); |
|
516 } |
|
517 |
|
518 /*! |
|
519 \property QSystemNetworkInfo::currentMobileCountryCode |
|
520 \brief The current MCC. |
|
521 |
|
522 Returns the current Mobile Country Code. In the case of none such as a Desktop, an empty string. |
|
523 /*/ |
|
524 QString QSystemNetworkInfo::currentMobileCountryCode() |
|
525 { |
|
526 return netInfoPrivate()->currentMobileCountryCode(); |
|
527 } |
|
528 |
|
529 /*! |
|
530 \property QSystemNetworkInfo::currentMobileNetworkCode |
|
531 \brief The current MNC. |
|
532 |
|
533 Returns the current Mobile Network Code. In the case of none such as a Desktop, an empty string. |
|
534 */ |
|
535 QString QSystemNetworkInfo::currentMobileNetworkCode() |
|
536 { |
|
537 return netInfoPrivate()->currentMobileNetworkCode(); |
|
538 } |
|
539 |
|
540 /*! |
|
541 \property QSystemNetworkInfo::homeMobileCountryCode |
|
542 \brief The home MNC. |
|
543 |
|
544 Returns the home Mobile Network Code. In the case of none such as a Desktop, an empty string. |
|
545 */ |
|
546 QString QSystemNetworkInfo::homeMobileCountryCode() |
|
547 { |
|
548 return netInfoPrivate()->homeMobileCountryCode(); |
|
549 } |
|
550 |
|
551 /*! |
|
552 \property QSystemNetworkInfo::homeMobileNetworkCode |
|
553 \brief The home MCC. |
|
554 |
|
555 Returns the home Mobile Country Code. In the case of none such as a Desktop, an empty string. |
|
556 */ |
|
557 QString QSystemNetworkInfo::homeMobileNetworkCode() |
|
558 { |
|
559 return netInfoPrivate()->homeMobileNetworkCode(); |
|
560 } |
|
561 |
|
562 /*! |
|
563 Returns the name of the operator for the network \a mode. For wlan this returns the network's current SSID. |
|
564 In the case of no network such as a desktop, an empty string. |
|
565 */ |
|
566 QString QSystemNetworkInfo::networkName(QSystemNetworkInfo::NetworkMode mode) |
|
567 { |
|
568 return netInfoPrivate()->networkName(mode); |
|
569 } |
|
570 |
|
571 /*! |
|
572 Returns the MAC address for the interface servicing the network \a mode. |
|
573 */ |
|
574 QString QSystemNetworkInfo::macAddress(QSystemNetworkInfo::NetworkMode mode) |
|
575 { |
|
576 return netInfoPrivate()->macAddress(mode); |
|
577 } |
|
578 |
|
579 /*! |
|
580 Returns the first found QNetworkInterface for type \a mode. |
|
581 */ |
|
582 QNetworkInterface QSystemNetworkInfo::interfaceForMode(QSystemNetworkInfo::NetworkMode mode) |
|
583 { |
|
584 return netInfoPrivate()->interfaceForMode(mode); |
|
585 } |
|
586 |
|
587 // display |
|
588 /*! |
|
589 \fn QSystemDisplayInfo::QSystemDisplayInfo(QObject *parent) |
|
590 Constructs a QSystemDisplayInfo object with the given \a parent. |
|
591 */ |
|
592 |
|
593 QSystemDisplayInfo::QSystemDisplayInfo(QObject *parent) |
|
594 : QObject(parent) |
|
595 { |
|
596 } |
|
597 |
|
598 /*! |
|
599 Destroys the QSystemDisplayInfo object. |
|
600 */ |
|
601 QSystemDisplayInfo::~QSystemDisplayInfo() |
|
602 { |
|
603 } |
|
604 |
|
605 /*! |
|
606 Returns the display brightness of \a screen in %, 1 - 100 scale. |
|
607 |
|
608 Depending on platform, displayBrightness may not be available due to |
|
609 differing hardware, software or driver implementation. In which case this |
|
610 will return 0. |
|
611 |
|
612 */ |
|
613 int QSystemDisplayInfo::displayBrightness(int screen) |
|
614 { |
|
615 return displayInfoPrivate()->displayBrightness(screen); |
|
616 } |
|
617 |
|
618 /*! |
|
619 Returns the color depth of the screen \a screenNumber, in bits per pixel. |
|
620 */ |
|
621 int QSystemDisplayInfo::colorDepth(int screenNumber) |
|
622 { |
|
623 return displayInfoPrivate()->colorDepth(screenNumber); |
|
624 } |
|
625 |
|
626 /*! |
|
627 \fn QSystemStorageInfo::QSystemStorageInfo(QObject *parent) |
|
628 Constructs a QSystemStorageInfo object with the given \a parent. |
|
629 */ |
|
630 |
|
631 QSystemStorageInfo::QSystemStorageInfo(QObject *parent) |
|
632 : QObject(parent) |
|
633 { |
|
634 } |
|
635 |
|
636 /*! |
|
637 Destroys the QSystemStorageInfo object. |
|
638 */ |
|
639 QSystemStorageInfo::~QSystemStorageInfo() |
|
640 { |
|
641 } |
|
642 |
|
643 /*! |
|
644 Returns the amount of total space on the \a volumeDrive, |
|
645 in bytes. |
|
646 */ |
|
647 qlonglong QSystemStorageInfo::totalDiskSpace(const QString &volumeDrive) |
|
648 { |
|
649 return storageInfoPrivate()->totalDiskSpace(volumeDrive); |
|
650 } |
|
651 |
|
652 /*! |
|
653 Returns the amount of available free space on the \a volumeDrive, |
|
654 in bytes. |
|
655 */ |
|
656 qlonglong QSystemStorageInfo::availableDiskSpace(const QString &volumeDrive) |
|
657 { |
|
658 return storageInfoPrivate()->availableDiskSpace(volumeDrive); |
|
659 } |
|
660 |
|
661 /*! |
|
662 \property QSystemStorageInfo::logicalDrives |
|
663 \brief The logical drives. |
|
664 |
|
665 Returns a QStringList of volumes or partitions. |
|
666 */ |
|
667 QStringList QSystemStorageInfo::logicalDrives() |
|
668 { |
|
669 return storageInfoPrivate()->logicalDrives(); |
|
670 } |
|
671 |
|
672 /*! |
|
673 Returns the type of volume \a driveVolume |
|
674 */ |
|
675 QSystemStorageInfo::DriveType QSystemStorageInfo::typeForDrive(const QString &driveVolume) |
|
676 { |
|
677 return storageInfoPrivate()->typeForDrive(driveVolume); |
|
678 } |
|
679 |
|
680 // device |
|
681 /*! |
|
682 \fn QSystemDeviceInfo::QSystemDeviceInfo(QObject *parent) |
|
683 Constructs a QSystemDeviceInfo with the given \a parent. |
|
684 */ |
|
685 |
|
686 QSystemDeviceInfo::QSystemDeviceInfo(QObject *parent) |
|
687 : QObject(parent), d(deviceInfoPrivate()) |
|
688 { |
|
689 connect(d,SIGNAL(batteryLevelChanged(int)), |
|
690 this,SIGNAL(batteryLevelChanged(int))); |
|
691 |
|
692 connect(d,SIGNAL(batteryStatusChanged(QSystemDeviceInfo::BatteryStatus)), |
|
693 this,SIGNAL(batteryStatusChanged(QSystemDeviceInfo::BatteryStatus))); |
|
694 |
|
695 connect(d,SIGNAL(bluetoothStateChanged(bool)), |
|
696 this,SIGNAL(bluetoothStateChanged(bool))); |
|
697 |
|
698 connect(d,SIGNAL(currentProfileChanged(QSystemDeviceInfo::Profile)), |
|
699 this,SIGNAL(currentProfileChanged(QSystemDeviceInfo::Profile))); |
|
700 |
|
701 connect(d,SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState)), |
|
702 this,SIGNAL(powerStateChanged(QSystemDeviceInfo::PowerState))); |
|
703 } |
|
704 |
|
705 /*! |
|
706 Destroys the QSystemDeviceInfo object. |
|
707 */ |
|
708 QSystemDeviceInfo::~QSystemDeviceInfo() |
|
709 { |
|
710 } |
|
711 |
|
712 |
|
713 /*! |
|
714 \property QSystemDeviceInfo::inputMethodType |
|
715 \brief The supported inputmethods. |
|
716 |
|
717 Returns the QSystemDeviceInfo::InputMethodFlags InputMethodType that the system uses. |
|
718 */ |
|
719 QSystemDeviceInfo::InputMethodFlags QSystemDeviceInfo::inputMethodType() |
|
720 { |
|
721 return deviceInfoPrivate()->inputMethodType(); |
|
722 } |
|
723 |
|
724 /*! |
|
725 \property QSystemDeviceInfo::imei |
|
726 \brief The IMEI. |
|
727 |
|
728 Returns the International Mobile Equipment Identity (IMEI), or a null QString in the case of none. |
|
729 */ |
|
730 QString QSystemDeviceInfo::imei() |
|
731 { |
|
732 return deviceInfoPrivate()->imei(); |
|
733 } |
|
734 |
|
735 /*! |
|
736 \property QSystemDeviceInfo::imsi |
|
737 \brief The IMSI. |
|
738 |
|
739 Returns the International Mobile Subscriber Identity (IMSI), or a null QString in the case of none. |
|
740 */ |
|
741 QString QSystemDeviceInfo::imsi() |
|
742 { |
|
743 return deviceInfoPrivate()->imsi(); |
|
744 } |
|
745 |
|
746 /*! |
|
747 \property QSystemDeviceInfo::manufacturer |
|
748 \brief The manufacture's name. |
|
749 |
|
750 Returns the name of the manufacturer of this device. In the case of desktops, the name of the vendor |
|
751 of the motherboard. |
|
752 */ |
|
753 QString QSystemDeviceInfo::manufacturer() |
|
754 { |
|
755 return deviceInfoPrivate()->manufacturer(); |
|
756 } |
|
757 |
|
758 /*! |
|
759 \property QSystemDeviceInfo::model |
|
760 \brief The model name. |
|
761 |
|
762 Returns the model information of the device. In the case of desktops where no |
|
763 model information is present, the CPU architect, such as i686, and machine type, such as Server, |
|
764 Desktop or Laptop. |
|
765 */ |
|
766 QString QSystemDeviceInfo::model() |
|
767 { |
|
768 return deviceInfoPrivate()->model(); |
|
769 } |
|
770 |
|
771 /*! |
|
772 \property QSystemDeviceInfo::productName |
|
773 \brief The product name. |
|
774 |
|
775 Returns the product name of the device. In the case where no product information is available, |
|
776 |
|
777 */ |
|
778 QString QSystemDeviceInfo::productName() |
|
779 { |
|
780 return deviceInfoPrivate()->productName(); |
|
781 } |
|
782 /*! |
|
783 \property QSystemDeviceInfo::batteryLevel |
|
784 \brief The battery level. |
|
785 |
|
786 Returns the battery charge level as percentage 1 - 100 scale. |
|
787 */ |
|
788 int QSystemDeviceInfo::batteryLevel() const |
|
789 { |
|
790 return deviceInfoPrivate()->batteryLevel(); |
|
791 } |
|
792 |
|
793 /*! |
|
794 \property QSystemDeviceInfo::batteryStatus |
|
795 \brief The battery status. |
|
796 |
|
797 Returns the battery charge status. |
|
798 */ |
|
799 QSystemDeviceInfo::BatteryStatus QSystemDeviceInfo::batteryStatus() |
|
800 { |
|
801 int level = batteryLevel(); |
|
802 if(level < 4) { |
|
803 return QSystemDeviceInfo::BatteryCritical; |
|
804 } else if(level < 11) { |
|
805 return QSystemDeviceInfo::BatteryVeryLow; |
|
806 } else if(level < 41) { |
|
807 return QSystemDeviceInfo::BatteryLow; |
|
808 } else if(level > 40) { |
|
809 return QSystemDeviceInfo::BatteryNormal; |
|
810 } |
|
811 |
|
812 return QSystemDeviceInfo::NoBatteryLevel; |
|
813 } |
|
814 |
|
815 /*! |
|
816 \property QSystemDeviceInfo::simStatus |
|
817 \brief the status of the sim card. |
|
818 Returns the QSystemDeviceInfo::simStatus status of SIM card. |
|
819 */ |
|
820 QSystemDeviceInfo::SimStatus QSystemDeviceInfo::simStatus() |
|
821 { |
|
822 return deviceInfoPrivate()->simStatus(); |
|
823 } |
|
824 /*! |
|
825 \property QSystemDeviceInfo::isDeviceLocked |
|
826 \brief Device lock. |
|
827 |
|
828 Returns true if the device is locked, otherwise false. |
|
829 */ |
|
830 bool QSystemDeviceInfo::isDeviceLocked() |
|
831 { |
|
832 return deviceInfoPrivate()->isDeviceLocked(); |
|
833 } |
|
834 |
|
835 /*! |
|
836 \property QSystemDeviceInfo::currentProfile |
|
837 \brief the device profile |
|
838 Gets the current QSystemDeviceInfo::currentProfile device profile. |
|
839 */ |
|
840 QSystemDeviceInfo::Profile QSystemDeviceInfo::currentProfile() |
|
841 { |
|
842 return deviceInfoPrivate()->currentProfile(); |
|
843 } |
|
844 |
|
845 /*! |
|
846 \property QSystemDeviceInfo::currentPowerState |
|
847 \brief the power state. |
|
848 |
|
849 Gets the current QSystemDeviceInfo::currentPowerState state. |
|
850 */ |
|
851 QSystemDeviceInfo::PowerState QSystemDeviceInfo::currentPowerState() |
|
852 { |
|
853 return deviceInfoPrivate()->currentPowerState(); |
|
854 } |
|
855 |
|
856 |
|
857 ///// |
|
858 /*! |
|
859 Constructs a QSystemScreenSaver object with the given \a parent. |
|
860 |
|
861 On platforms where there is no one default screensaver mechanism, such as Linux, this class |
|
862 may not be available. |
|
863 */ |
|
864 |
|
865 QSystemScreenSaver::QSystemScreenSaver(QObject *parent) |
|
866 : QObject(parent), d(screenSaverPrivate()) |
|
867 { |
|
868 screenSaverIsInhibited = screenSaverInhibited(); |
|
869 } |
|
870 |
|
871 /*! |
|
872 Destroys the QSystemScreenSaver object. |
|
873 */ |
|
874 QSystemScreenSaver::~QSystemScreenSaver() |
|
875 { |
|
876 qWarning() << Q_FUNC_INFO; |
|
877 delete d; |
|
878 } |
|
879 |
|
880 /*! |
|
881 Temporarily inhibits the screensaver. |
|
882 |
|
883 Will be reverted upon destruction of the QSystemScreenSaver object. |
|
884 Returns true on success, otherwise false. |
|
885 |
|
886 On platforms that support it, if screensaver is secure by policy, the policy will be honored |
|
887 and this will fail. |
|
888 */ |
|
889 bool QSystemScreenSaver::setScreenSaverInhibit() |
|
890 { |
|
891 return d->setScreenSaverInhibit(); |
|
892 } |
|
893 |
|
894 /*! |
|
895 \property QSystemScreenSaver::screenSaverInhibited |
|
896 \brief Screensaver inhibited. |
|
897 |
|
898 Returns true if the screensaver is inhibited, otherwise false. |
|
899 */ |
|
900 bool QSystemScreenSaver::screenSaverInhibited() |
|
901 { |
|
902 return d->screenSaverInhibited(); |
|
903 } |
|
904 |
|
905 |
|
906 #include "moc_qsysteminfo.cpp" |
|
907 |
|
908 QTM_END_NAMESPACE |