void tst_QSystemInfo::tst_currentLanguage() { QSystemInfo si; QVERIFY(!si.currentLanguage().isEmpty()); QCOMPARE(si.currentLanguage().length(), 2); QVERIFY(si.currentLanguage() == si.currentLanguage().toLower()); }
void tst_QSystemInfo::tst_availableLanguages() { QSystemInfo si; QVERIFY(!si.availableLanguages().isEmpty()); QStringList available = si.availableLanguages(); foreach(QString lang, available) { QCOMPARE(lang.length(), 2); QVERIFY(lang == lang.toLower()); }
QTM_USE_NAMESPACE //(2) int main(int argc, char *argv[]) { QApplication app(argc, argv); QSystemInfo s; QLabel *label = new QLabel(QObject::tr("hello ").append(s.currentCountryCode())); label->show(); label->resize(100,30); return app.exec(); }
/********************************************** * void DeviceInfoProvider::getSystemInfo *********************************************/ void DeviceInfoProvider::getSystemInfo() { QSystemInfo *si = new QSystemInfo(this); QSystemDeviceInfo *di = new QSystemDeviceInfo(this); m_deviceVersion = si->version(QSystemInfo::Firmware).isEmpty() ? m_deviceVersion : si->version(QSystemInfo::Firmware); m_serialNo = di->imei().isEmpty() ? m_serialNo : di->imei(); m_manufacturer = di->manufacturer().isEmpty() ? m_manufacturer : di->manufacturer(); m_model = di->model().isEmpty() ? m_model : di->model(); delete si; delete di; }
QString JSSupporter::get_locale() { #ifdef USE_SYSTEMINFO QSystemInfo i; QString c = i.currentCountryCode(); #else QString c = "et"; #endif qDebug() << "JSSupporter::get_locale() " << c; return c; }
static void test_systeminfo(void) { QSystemInfo info; X(info.currentLanguage()); X(info.availableLanguages()); X(info.currentCountryCode()); X(info.version(QSystemInfo::Os)); X(info.version(QSystemInfo::QtCore)); X(info.version(QSystemInfo::Firmware)); X(info.version(QSystemInfo::QtMobility)); X(info.hasFeatureSupported(QSystemInfo::BluetoothFeature)); X(info.hasFeatureSupported(QSystemInfo::CameraFeature)); X(info.hasFeatureSupported(QSystemInfo::FmradioFeature)); X(info.hasFeatureSupported(QSystemInfo::IrFeature)); X(info.hasFeatureSupported(QSystemInfo::LedFeature)); X(info.hasFeatureSupported(QSystemInfo::MemcardFeature)); X(info.hasFeatureSupported(QSystemInfo::UsbFeature)); X(info.hasFeatureSupported(QSystemInfo::VibFeature)); X(info.hasFeatureSupported(QSystemInfo::WlanFeature)); X(info.hasFeatureSupported(QSystemInfo::SimFeature)); X(info.hasFeatureSupported(QSystemInfo::LocationFeature)); X(info.hasFeatureSupported(QSystemInfo::VideoOutFeature)); X(info.hasFeatureSupported(QSystemInfo::HapticsFeature)); X(info.hasFeatureSupported(QSystemInfo::FmTransmitterFeature)); }