Files:
The System Information example uses a tabbed dialog, with each tab representing a particular type of data: versions, network and so on.
To access the information, the example creates objects belonging to the System Information classes
Access to details of the currently active phone profile |
|
Service for applications to synchronize their activity |
|
Access to battery and power information from the system |
|
Access to device information from the system |
|
Access to display information from the system |
|
Access to various general information from the system |
|
Access to various networking status and signals |
|
Access to screen saver and blanking |
|
Access to disk storage information from the system |
Here are some examples that show how the example application reads the device information.
The current language
systemInfo = new QSystemInfo(this); curLanguageLineEdit->setText( systemInfo->currentLanguage());
Device information, starting with the battery level
bi = new QSystemBatteryInfo(this); ... chargerTypeChanged(bi->chargerType()); currentBatStat = bi->batteryStatus();
The battery status is an enum, QSystemBatteryInfo::BatteryStatus, that indicates various battery levels and their significance, e.g., QSystemBatteryInfo::BatteryVeryLow.
The manufacturer id and the product name
manufacturerLabel->setText(di->manufacturer()); ... productLabel->setText(di->productName());
Other information is stored as bitwise flags. The following code shows the input methods being determined using flags.
QSystemDeviceInfo::InputMethodFlags methods = di->inputMethodType(); QStringList inputs; if ((methods & QSystemDeviceInfo::Keys)=QSystemDeviceInfo::Keypad){ inputs << "Keys"; } if ((methods & QSystemDeviceInfo::Keypad)=QSystemDeviceInfo::Keypad) { inputs << "Keypad"; }
Various capabilities of the device can be found by testing for features. In the example a Feature combo box, on the General tab, has a hard coded list of features. When a listed feature is selected the getFeature() function is called with the index which is handled by applying a test to the corresponding feature.
QSystemInfo::Feature feature; switch(index) { ... case 1: feature = QSystemInfo::BluetoothFeature; ... QSystemInfo si; featuresLineEdit->setText((si.hasFeatureSupported(feature) ? "true":"false" ));
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.