×
Namespaces

Variants
Actions
(Difference between revisions)

Working with QSystemInfo - System Information API - Part 2

From Nokia Developer Wiki
Jump to: navigation, search
kiran10182 (Talk | contribs)
(Created page with 'Category:DraftCategory:Qt for Symbian {{UnderConstruction}} {{Tip| Read this article before moving forward: Setting up environment for Qt Mobility API}} == Overview…')
 
kiran10182 (Talk | contribs)
m (Implementing QSystemInfo API)
Line 39: Line 39:
  
 
== Implementing QSystemInfo API ==
 
== Implementing QSystemInfo API ==
* QSystemInfo API is a part of the QtMobility namespace. So declare the QtMobiliyt namespace as shown below:
+
* QSystemInfo API is a part of the QtMobility namespace. So declare the QtMobility namespace as shown below:
 
<code cpp>
 
<code cpp>
 
using namespace QtMobility;
 
using namespace QtMobility;
Line 146: Line 146:
 
}
 
}
 
</code>
 
</code>
 
  
 
== Output ==
 
== Output ==

Revision as of 21:50, 8 March 2010

Underconstruction.pngUnder Construction: This article is under construction and it may have outstanding issues. If you have any comments please use the comments tab.

Tip.pngTip: Read this article before moving forward: Setting up environment for Qt Mobility API

Contents

Overview

This is a part 2 of the QSystemInfo API which is a part of the System Information API from Qt Mobility project.

What is covered in QSystemInfo API Part 2

  • It is a part of the System Information API.
  • This article covers information about
    • Available features of the device
    • Version information of the OS
    • Current firmware information of the device


Capabilities required

  • ReadDeviceData


UI design (.ui file)

SystemFeatureInfo UI.png


Project configuration file (.Pro file)

  • Add the Qt Mobility project configuration option in the .Pro file as shown below
CONFIG += mobility
MOBILITY += systeminfo
  • Add Qt-specific configuration options in .pro file as shown below
QT += network


Implementing QSystemInfo API

  • QSystemInfo API is a part of the QtMobility namespace. So declare the QtMobility namespace as shown below:
using namespace QtMobility;

Header file

#ifndef SYSTEMFEATUREINFO_H
#define SYSTEMFEATUREINFO_H
 
#include <QtGui/QWidget>
#include "ui_SystemFeatureInfo.h"
#include <qsysteminfo.h>
 
using namespace QtMobility;
class SystemFeatureInfo : public QWidget
{
Q_OBJECT
 
public:
SystemFeatureInfo(QWidget *parent = 0);
~SystemFeatureInfo();
 
public slots:
void checkFeatureAvailability(int aIndex);
void listFirmwareInformation();
void resetAllFields();
 
private:
Ui::SystemFeatureInfo ui;
QSystemInfo* sysInfo;
};
 
#endif // SYSTEMFEATUREINFO_H


Source file

#include "SystemFeatureInfo.h"
 
SystemFeatureInfo::SystemFeatureInfo(QWidget *parent)
: QWidget(parent), sysInfo(NULL)
{
ui.setupUi(this);
sysInfo = new QSystemInfo();
 
QObject::connect(ui.featureComboBox,
SIGNAL(currentIndexChanged(int)),
this,
SLOT(checkFeatureAvailability(int)));
QObject::connect(ui.listVersionInfoButton,
SIGNAL(clicked()),
this,
SLOT(listFirmwareInformation()));
QObject::connect(ui.resetButton,
SIGNAL(clicked()),
this,
SLOT(resetAllFields()));
}
 
SystemFeatureInfo::~SystemFeatureInfo()
{
delete sysInfo;
sysInfo = NULL;
}
 
void SystemFeatureInfo::checkFeatureAvailability(int aIndex)
{
ASSERT(aIndex >=0 && aIndex <=13);
 
if(! aIndex)
{
ui.label->clear();
return;
}
 
bool val = sysInfo->hasFeatureSupported((QSystemInfo::Feature)(aIndex-1));
if(val)
{
ui.label->setText("Available");
}
else
{
ui.label->setText("Not available");
}
}
 
void SystemFeatureInfo::listFirmwareInformation()
{
if(sysInfo)
{
QString os = sysInfo->version(QSystemInfo::Os);
ui.OSlabel->setText(sysInfo->version(QSystemInfo::Os));
ui.qtLabel->setText(sysInfo->version(QSystemInfo::QtCore));
ui.firmwareLabel->setText(sysInfo->version(QSystemInfo::Firmware));
}
}
void SystemFeatureInfo::resetAllFields()
{
ui.featureComboBox->setCurrentIndex(0);
ui.label->clear();
ui.OSlabel->clear();
ui.qtLabel->clear();
ui.firmwareLabel->clear();
}

Output

SystemFeatureInfo device.jpg


Useful functions

Keywords

Headers

  • #include <qsysteminfo.h>


Classes

  • QSystemInfo


Example Application


Related articles


Reference links

107 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×