|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU Lesser General Public License as published by |
|
7 * the Free Software Foundation, version 2.1 of the License. |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU Lesser General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Lesser General Public License |
|
15 * along with this program. If not, |
|
16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
17 * |
|
18 * Description: |
|
19 * |
|
20 */ |
|
21 |
|
22 #include "sysinfoexwindow.h" |
|
23 #include "xqsysinfo.h" |
|
24 #include "xqlistwidget.h" |
|
25 #ifndef KFeatureIdMmc //Workaround for RnD SDKs |
|
26 #include <featureinfo.h> |
|
27 #endif |
|
28 |
|
29 #include <QSignalMapper> |
|
30 #include <QMenu> |
|
31 #include <QMenuBar> |
|
32 |
|
33 SysInfoExWindow::SysInfoExWindow(QWidget* parent) |
|
34 : QMainWindow(parent) |
|
35 { |
|
36 setupUi(this); |
|
37 createMenus(); |
|
38 |
|
39 // Initializing sysinfo |
|
40 XQSysInfo* sysInfo = new XQSysInfo(this); |
|
41 |
|
42 // System Info |
|
43 modelLabel->setText("Model: "+sysInfo->model()); |
|
44 manufacturerLabel->setText("Manufacturer: " + sysInfo->manufacturer()); |
|
45 versionLabel->setText("Version: "+sysInfo->softwareVersion()); |
|
46 languageLabel->setText("Language: "+handleLanguage(sysInfo->currentLanguage())); |
|
47 imeiLabel->setText("Imei: "+sysInfo->imei()); |
|
48 imsiLabel->setText("Imsi: "+sysInfo->imsi()); |
|
49 |
|
50 // System Info 2 |
|
51 signalStrengthLabel->setText("Signal strenght: " + QString::number(sysInfo->signalStrength())); |
|
52 batteryLevelLabel->setText("Battery level: " + QString::number(sysInfo->batteryLevel())); |
|
53 diskSpaceLabel->setText("Free space (c:): " + QString::number(sysInfo->diskSpace(XQSysInfo::DriveC)/1048576,'f',1) + "MB"); |
|
54 |
|
55 if (sysInfo->isDiskSpaceCritical(XQSysInfo::DriveC)) |
|
56 { |
|
57 criticalDiskSpaceLabel = new QLabel("Disk space (c:): Critical"); |
|
58 } |
|
59 else |
|
60 { |
|
61 criticalDiskSpaceLabel = new QLabel("Disk space (c:): ok"); |
|
62 } |
|
63 |
|
64 // Feature Discover |
|
65 listWidget->addItem("MMC: "+boolToString(XQSysInfo::isSupported(KFeatureIdMmc))); |
|
66 listWidget->addItem("Camera: "+boolToString(XQSysInfo::isSupported(KFeatureIdCamera))); |
|
67 listWidget->addItem("Cover display: "+boolToString(XQSysInfo::isSupported(KFeatureIdCoverDisplay))); |
|
68 listWidget->addItem("Video recorder: "+boolToString(XQSysInfo::isSupported(KFeatureIdVideoRecorder))); |
|
69 listWidget->addItem("Flight mode: "+boolToString(XQSysInfo::isSupported(KFeatureIdFlightMode))); |
|
70 listWidget->addItem("Offline mode: "+boolToString(XQSysInfo::isSupported(KFeatureIdOfflineMode))); |
|
71 listWidget->addItem("OpenGL: "+boolToString(XQSysInfo::isSupported(KFeatureIdOpenGLES3DApi))); |
|
72 listWidget->addItem("IrDA: "+boolToString(XQSysInfo::isSupported(KFeatureIdIrda))); |
|
73 listWidget->addItem("Bluetooth: "+boolToString(XQSysInfo::isSupported(KFeatureIdBt))); |
|
74 listWidget->addItem("Qwerty: "+boolToString(XQSysInfo::isSupported(KFeatureIdQwertyInput))); |
|
75 listWidget->addItem("USB: "+boolToString(XQSysInfo::isSupported(KFeatureIdUsb))); |
|
76 listWidget->addItem("BT Fax Profile: "+boolToString(XQSysInfo::isSupported(KFeatureIdBtFaxProfile))); |
|
77 listWidget->addItem("BT Imaging Profile: "+boolToString(XQSysInfo::isSupported(KFeatureIdBtImagingProfile))); |
|
78 listWidget->addItem("Instant Messaging: "+boolToString(XQSysInfo::isSupported(KFeatureIdIm))); |
|
79 listWidget->addItem("Precense feature: "+boolToString(XQSysInfo::isSupported(KFeatureIdPresence))); |
|
80 listWidget->addItem("SVGT: "+boolToString(XQSysInfo::isSupported(KFeatureIdSvgt))); |
|
81 listWidget->addItem("Audio effects: "+boolToString(XQSysInfo::isSupported(KFeatureIdAudioEffectsApi))); |
|
82 listWidget->addItem("Equalizer: "+boolToString(XQSysInfo::isSupported(KFeatureIdEqualizer))); |
|
83 listWidget->addItem("GSM cellular stack: "+boolToString(XQSysInfo::isSupported(KFeatureIdProtocolGsm))); |
|
84 listWidget->addItem("WCDMA cellular stack: "+boolToString(XQSysInfo::isSupported(KFeatureIdProtocolWcdma))); |
|
85 listWidget->addItem("CDMA cellular stack: "+boolToString(XQSysInfo::isSupported(KFeatureIdProtocolCdma))); |
|
86 listWidget->addItem("Wlan: "+boolToString(XQSysInfo::isSupported(KFeatureIdProtocolWlan))); |
|
87 listWidget->addItem("Location: "+boolToString(XQSysInfo::isSupported(KFeatureIdLocationFrameworkCore))); |
|
88 listWidget->addItem("Landmarks: "+boolToString(XQSysInfo::isSupported(KFeatureIdLandmarks))); |
|
89 |
|
90 stackedWidget->setCurrentIndex(0); |
|
91 } |
|
92 |
|
93 SysInfoExWindow::~SysInfoExWindow() |
|
94 { |
|
95 } |
|
96 |
|
97 void SysInfoExWindow::createMenus() |
|
98 { |
|
99 m_systemInfoAction = new QAction(tr("System Info"), this); |
|
100 menuBar()->addAction(m_systemInfoAction); |
|
101 connect(m_systemInfoAction, SIGNAL(triggered()), this, SLOT(handleSystemInfoAction())); |
|
102 |
|
103 m_systemInfo2Action = new QAction(tr("System Info 2"), this); |
|
104 menuBar()->addAction(m_systemInfo2Action); |
|
105 connect(m_systemInfo2Action, SIGNAL(triggered()), this, SLOT(handleSystemInfo2Action())); |
|
106 |
|
107 m_featureDiscoverAction = new QAction(tr("Feature discover"), this); |
|
108 menuBar()->addAction(m_featureDiscoverAction); |
|
109 connect(m_featureDiscoverAction, SIGNAL(triggered()), this, SLOT(handleFeatureDiscoverAction())); |
|
110 |
|
111 m_exitAction = new QAction(tr("Exit"), this); |
|
112 menuBar()->addAction(m_exitAction); |
|
113 connect(m_exitAction, SIGNAL(triggered()), this, SLOT(close())); |
|
114 } |
|
115 |
|
116 void SysInfoExWindow::handleSystemInfoAction() |
|
117 { |
|
118 stackedWidget->setCurrentIndex(0); |
|
119 } |
|
120 |
|
121 void SysInfoExWindow::handleSystemInfo2Action() |
|
122 { |
|
123 stackedWidget->setCurrentIndex(1); |
|
124 } |
|
125 |
|
126 void SysInfoExWindow::handleFeatureDiscoverAction() |
|
127 { |
|
128 stackedWidget->setCurrentIndex(2); |
|
129 } |
|
130 |
|
131 QString SysInfoExWindow::boolToString(bool boolean) |
|
132 { |
|
133 if (boolean) |
|
134 { |
|
135 return "Supported"; |
|
136 } |
|
137 else |
|
138 { |
|
139 return "Not supported"; |
|
140 } |
|
141 } |
|
142 |
|
143 QString SysInfoExWindow::handleLanguage(XQSysInfo::Language language) |
|
144 { |
|
145 switch (language) |
|
146 { |
|
147 case XQSysInfo::LangEnglish: |
|
148 return "English"; |
|
149 case XQSysInfo::LangFinnish: |
|
150 return "Finnish"; |
|
151 case XQSysInfo::LangSwedish: |
|
152 return "Swedish"; |
|
153 case XQSysInfo::LangNorwegian: |
|
154 return "Norwegian"; |
|
155 case XQSysInfo::LangIcelandic: |
|
156 return "Icelandic"; |
|
157 case XQSysInfo::LangFrench: |
|
158 return "French"; |
|
159 case XQSysInfo::LangGerman: |
|
160 return "German"; |
|
161 case XQSysInfo::LangSpanish: |
|
162 return "Spanish"; |
|
163 case XQSysInfo::LangItalian: |
|
164 return "Italian"; |
|
165 case XQSysInfo::LangPortuguese: |
|
166 return "Portuguese"; |
|
167 default: |
|
168 return "Unknown"; |
|
169 } |
|
170 } |