diff options
author | Olli Werwolff <qt-info@nokia.com> | 2011-04-26 14:38:24 +0200 |
---|---|---|
committer | Olli Werwolff <qt-info@nokia.com> | 2011-04-26 14:38:24 +0200 |
commit | 8ff2d677873c3dcce1cd471ecfbc4251765c4b25 (patch) | |
tree | 0dc4e4aa057d90b50977ed38c6c06e04c5f84743 | |
parent | f5e8d10f8a3e4c841985a3a28642a457c856ae80 (diff) | |
parent | 558c8ba1ca2978575c7f377167c5e0e641376c7c (diff) |
Merge remote branch 'public/1.1'
Conflicts:
src/main.cpp
src/ui/configurationwidget.cpp
src/ui/configurationwidget.h
-rw-r--r-- | doc/qt-html-templates.qdocconf | 2 | ||||
-rw-r--r-- | doc/simulator.qdoc | 48 | ||||
-rw-r--r-- | scripts/examples/camera.qs | 8 | ||||
-rw-r--r-- | scripts/examples/location.qs | 4 | ||||
-rw-r--r-- | scripts/examples/sensors.qs | 26 | ||||
-rw-r--r-- | scripts/examples/sysinfodevice.qs | 11 | ||||
-rw-r--r-- | scripts/examples/sysinfogeneric.qs | 16 | ||||
-rw-r--r-- | scripts/examples/sysinfonetwork.qs | 5 | ||||
-rw-r--r-- | scripts/examples/sysinfostorage.qs | 10 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/ui/cameraui.cpp | 7 | ||||
-rw-r--r-- | src/ui/cameraui.h | 2 | ||||
-rw-r--r-- | src/ui/configurationwidget.cpp | 1 | ||||
-rw-r--r-- | src/ui/mainwindow.cpp | 4 | ||||
-rw-r--r-- | src/ui/sensorsui.cpp | 3 | ||||
-rw-r--r-- | src/ui/systeminfostorageui.cpp | 22 | ||||
-rw-r--r-- | src/ui/systeminfostorageui.h | 5 | ||||
-rw-r--r-- | src/ui/viewconfiguration.cpp | 3 |
18 files changed, 142 insertions, 37 deletions
diff --git a/doc/qt-html-templates.qdocconf b/doc/qt-html-templates.qdocconf index d988b62..da89465 100644 --- a/doc/qt-html-templates.qdocconf +++ b/doc/qt-html-templates.qdocconf @@ -123,7 +123,7 @@ HTML.footer = " <!-- /div -->\n" \ " </div> \n" \ " <div class=\"footer\">\n" \ " <p>\n" \ - " <acronym title=\"Copyright\">©</acronym> 2008-2010 Nokia Corporation and/or its\n" \ + " <acronym title=\"Copyright\">©</acronym> 2008-2011 Nokia Corporation and/or its\n" \ " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ " in Finland and/or other countries worldwide.</p>\n" \ " <p>\n" \ diff --git a/doc/simulator.qdoc b/doc/simulator.qdoc index 13ed21a..bc4bdda 100644 --- a/doc/simulator.qdoc +++ b/doc/simulator.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -64,7 +64,6 @@ \o \l{Quick Tour} \o \l{Simulating Device Use} \o \l{Simulating Networking} - \o \l{Using Bearer Management} \o \l{Simulating Location} \o \l{Simulating Storage Devices} \o \l{Importing Contacts} @@ -78,6 +77,8 @@ \o \l{Checking Application Layout} \o \l{Scripting} \o \l{Adding New Device Models} + \o \l{Declaring Qt Mobility APIs} + \o \l{Using Bearer Management} \o \l{Testing Applications Using the Qt Mobility Service Framework} \o \l{Known Issues} \endlist @@ -417,7 +418,7 @@ \contentspage index.html \previouspage simulator-generic.html \page simulator-networking.html - \nextpage simulator-bearermanagement.html + \nextpage simulator-location.html \title Simulating Networking @@ -456,7 +457,7 @@ /*! \contentspage index.html - \previouspage simulator-bearermanagement.html + \previouspage simulator-networking.html \page simulator-location.html \nextpage simulator-drives.html @@ -837,7 +838,7 @@ \contentspage index.html \previouspage simulator-scripting.html \page simulator-adding-models.html - \nextpage simulator-serviceframework.html + \nextpage simulator-declaring-qt-mobility-apis.html \title Adding New Device Models @@ -1082,7 +1083,7 @@ /*! \contentspage index.html - \previouspage simulator-adding-models.html + \previouspage simulator-bearermanagement.html \page simulator-serviceframework.html \nextpage simulator-known-issues.html @@ -1135,9 +1136,9 @@ /*! \contentspage index.html - \previouspage simulator-networking.html + \previouspage simulator-declaring-qt-mobility-apis.html \page simulator-bearermanagement.html - \nextpage simulator-location.html + \nextpage simulator-serviceframework.html \title Using Bearer Management @@ -1308,6 +1309,8 @@ document location, file size, image size, and description. Double-click images to preview them. + \note You cannot add your own test documents to the document gallery. + \image qt-simulator-document-gallery.png "Document Gallery" */ @@ -1336,3 +1339,32 @@ \image qt-simulator-camera-image.png "Image in Camera section" */ + + +/*! + \contentspage index.html + \previouspage simulator-adding-models.html + \page simulator-declaring-qt-mobility-apis.html + \nextpage simulator-bearermanagement.html + + \title Declaring Qt Mobility APIs + + To use the Qt Mobility APIs or develop applications for Symbian + devices, you must modify the application .pro file to declare the Qt + Mobility APIs that you use. + + Each Mobility API has its corresponding value that you have to add + as a value of MOBILITY to use the API. For a list of the APIs and the + corresponding values that you can assign to MOBILITY, see the + \l {http://doc.qt.nokia.com/qtmobility/quickstart.html}{Quickstart Example}. + + For example, to use the System Info API, you must declare it, as + illustrated by the following code snippet: + + \code + + CONFIG += mobility + MOBILITY = systeminfo + + \endcode + diff --git a/scripts/examples/camera.qs b/scripts/examples/camera.qs new file mode 100644 index 0000000..5ae6fa4 --- /dev/null +++ b/scripts/examples/camera.qs @@ -0,0 +1,8 @@ +// show some functionality of the 'camera' object + +var cams = camera.availableCameras() +for (var i = 0; i < cams.length; ++i) { + print("Camera: " + i + " has name " + cams[i] + " and image path " + camera.imagePath(cams[i])) +} + +camera.addCamera("My Cam", "This is a test camera", "no image") diff --git a/scripts/examples/location.qs b/scripts/examples/location.qs index 1ace32f..02d9e2e 100644 --- a/scripts/examples/location.qs +++ b/scripts/examples/location.qs @@ -1,9 +1,9 @@ -// This script just moves continuasly from the current location to another one +// This script changes the current location every few seconds // Interesting parts: // location.latitude // location.longitude // location.altitude -// (current not working) location.datetime +// Check the documentation for a full list. var i = 0; while (i < 10) diff --git a/scripts/examples/sensors.qs b/scripts/examples/sensors.qs new file mode 100644 index 0000000..b9a24ef --- /dev/null +++ b/scripts/examples/sensors.qs @@ -0,0 +1,26 @@ +// use all functionality of the sensors object + +sensors.ambientLightLevel = sensors.Dark +print(sensors.ambientLightLevel) + +sensors.accelerometerX = 1 +sensors.accelerometerY = 2 +sensors.accelerometerZ = 3 +print(sensors.accelerometerX + ' ' + sensors.accelerometerY + ' ' + sensors.accelerometerZ) + +sensors.magnetometerX = 1 +sensors.magnetometerY = 2 +sensors.magnetometerZ = 3 +sensors.magnetometerCalibrationLevel = 4 +print(sensors.magnetometerX + ' ' + sensors.magnetometerY + ' ' + sensors.magnetometerZ + ' ' + sensors.magnetometerCalibrationLevel) + +sensors.compassAzimuth = 42 +sensors.compassCalibrationLevel = 43 +print(sensors.compassAzimuth + ' ' + sensors.compassCalibrationLevel) + +sensors.proximitySensorClose = true +print(sensors.proximitySensorClose) + +sensors.useCurrentTimestamp = true +sensors.useCurrentTimestamp = false +sensors.timestamp = new Date diff --git a/scripts/examples/sysinfodevice.qs b/scripts/examples/sysinfodevice.qs deleted file mode 100644 index 7d8e331..0000000 --- a/scripts/examples/sysinfodevice.qs +++ /dev/null @@ -1,11 +0,0 @@ -// set some device data - -sysinfo.generic.batteryLevel = 11; -sysinfo.generic.currentPowerState = sysinfo.generic.WallPower; -sysinfo.generic.simStatus = sysinfo.generic.SimLocked; -sysinfo.generic.currentProfile = sysinfo.generic.LoudProfile; -sysinfo.generic.imsi = "543210987654321" -sysinfo.generic.imei = "54-321098-765432-1" -sysinfo.generic.deviceLocked = true; - - diff --git a/scripts/examples/sysinfogeneric.qs b/scripts/examples/sysinfogeneric.qs index 5cfccad..b635f8c 100644 --- a/scripts/examples/sysinfogeneric.qs +++ b/scripts/examples/sysinfogeneric.qs @@ -1,6 +1,20 @@ +// this script aims to use all of sysinfo.generic + sysinfo.generic.currentLanguage = "bork" sysinfo.generic.currentCountryCode = "Borkland" sysinfo.generic.addAvailableLanguage("talk") sysinfo.generic.setFeature(sysinfo.generic.BluetoothFeature, true) sysinfo.generic.setVersion(sysinfo.generic.QtCore, "4.7") -print(sysinfo.generic.version(sysinfo.generic.QtCore)) +sysinfo.generic.displayBrightness = 12 +sysinfo.generic.colorDepth = 24 +sysinfo.generic.currentProfile = sysinfo.generic.OfflineProfile +sysinfo.generic.currentPowerState = sysinfo.generic.BatteryPower +sysinfo.generic.simStatus = sysinfo.generic.SimNotAvailable +sysinfo.generic.inputMethod = sysinfo.generic.Keys | sysinfo.generic.Keyboard +sysinfo.generic.imsi = "543210987654321" +sysinfo.generic.imei = "54-321098-765432-1" +sysinfo.generic.manufacturer = "Custom" +sysinfo.generic.model = "MyModel" +sysinfo.generic.productName = "NewProduct" +sysinfo.generic.batteryLevel = 79 +sysinfo.generic.deviceLocked = true diff --git a/scripts/examples/sysinfonetwork.qs b/scripts/examples/sysinfonetwork.qs index 97693ef..91dc8cd 100644 --- a/scripts/examples/sysinfonetwork.qs +++ b/scripts/examples/sysinfonetwork.qs @@ -1,6 +1,11 @@ // set some network data sysinfo.network.currentMobileCountryCode = "fi"; +sysinfo.network.currentMobileNetworkCode = "abc" +sysinfo.network.homeMobileCountryCode = "de"; +sysinfo.network.homeMobileNetworkCode = "def" +sysinfo.network.locationAreaCode = 1234 +sysinfo.network.currentMode = sysinfo.network.GsmMode sysinfo.network.cellId = 1; sysinfo.network.setNetworkSignalStrength(sysinfo.network.GsmMode, 10); diff --git a/scripts/examples/sysinfostorage.qs b/scripts/examples/sysinfostorage.qs new file mode 100644 index 0000000..e05c8ee --- /dev/null +++ b/scripts/examples/sysinfostorage.qs @@ -0,0 +1,10 @@ +// show some functionality of sysinfo.storage + +var drives = sysinfo.storage.logicalDrives() +for (var i = 0; i < drives.length; ++i) { + print ("Drive: " + i + " is called " + drives[i] + " and has " + + sysinfo.storage.availableDiskSpace(drives[i]) + " bytes available") +} + +sysinfo.storage.addDrive("My drive", sysinfo.storage.CdromDrive, 1000, 250) +sysinfo.storage.setAvailableSpace("My drive", 500) diff --git a/src/main.cpp b/src/main.cpp index 3ce9aa0..261a4c4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -85,7 +85,7 @@ static void registerSimulator(const QString &location) settings->beginGroup(SIMULATOR_APP_QT_VERSIONS_KEY); QList<QString> supportedQtVersion; - supportedQtVersion << "4.7.2.1"; + supportedQtVersion << "4.7.4.0"; foreach(const QString &version, supportedQtVersion) { QList<QString> simulators; QVariant value = settings->value(version); diff --git a/src/ui/cameraui.cpp b/src/ui/cameraui.cpp index 55da83d..1aa127c 100644 --- a/src/ui/cameraui.cpp +++ b/src/ui/cameraui.cpp @@ -54,6 +54,7 @@ CameraUi::CameraUi(QWidget *parent) : ToolBoxPage(parent) { qRegisterMetaType<CameraUi::CameraData>("CameraUi::CameraData"); + qRegisterMetaType<CameraUi::CameraData::CameraDetails>("CameraUi::CameraData::CameraDetails"); mScriptInterface = new CameraScriptInterface(this); QStringList tags; @@ -150,7 +151,11 @@ void CameraUi::emitCameraDataChange() const void CameraUi::showCameraInfo() { bool editingEnabled = mCameras->count() != 0; - enableCameraControls(editingEnabled); + // workaround for calling this from another thread (scripts): + // always perform the setEnabled calls in the gui thread - + // setEnabled calls sendEvent! + QMetaObject::invokeMethod(this, "enableCameraControls", Qt::QueuedConnection, + Q_ARG(bool, editingEnabled)); if (!editingEnabled) return; diff --git a/src/ui/cameraui.h b/src/ui/cameraui.h index f05e0c1..38cf177 100644 --- a/src/ui/cameraui.h +++ b/src/ui/cameraui.h @@ -115,7 +115,7 @@ private slots: void removeCameraClicked(); private: - void enableCameraControls(bool enabled); + Q_INVOKABLE void enableCameraControls(bool enabled); friend class CameraScriptInterface; CameraScriptInterface *mScriptInterface; diff --git a/src/ui/configurationwidget.cpp b/src/ui/configurationwidget.cpp index 668fe44..f82519f 100644 --- a/src/ui/configurationwidget.cpp +++ b/src/ui/configurationwidget.cpp @@ -49,3 +49,4 @@ void ConfigurationWidget::closeEvent(QCloseEvent *event) event->ignore(); emit closeMainWindow(); } + diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 9a4475a..3e07a7e 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -89,9 +89,9 @@ const VersionStruct simulatorVersion(1, 1, 0, 1); // Increment this value if the scripts that come bundled with the Simulator -// have changed and the user should be asked whehter he wants to copy them +// have changed and the user should be asked whether he wants to copy them // to his user script directory. -const int scriptVersion = 0; +const int scriptVersion = 1; MainWindow::MainWindow(QWidget *parent) : QWidget(parent) diff --git a/src/ui/sensorsui.cpp b/src/ui/sensorsui.cpp index bfffef7..323a702 100644 --- a/src/ui/sensorsui.cpp +++ b/src/ui/sensorsui.cpp @@ -171,7 +171,8 @@ SensorsUi::SensorsUi(QWidget *parent) mAccelerometerControl = new AccelerometerControl(); mAccelerometerControl->setMinimumHeight(150); connect(mAccelerometerControl, SIGNAL(valueChanged(QVector3D)), this, SLOT(setAccelerometerValue(QVector3D))); - vlayout->addWidget(mAccelerometerControl); + if (mAccelerometerControl->isValid()) + vlayout->addWidget(mAccelerometerControl); QHBoxLayout *hlayout = new QHBoxLayout; vlayout->addLayout(hlayout); diff --git a/src/ui/systeminfostorageui.cpp b/src/ui/systeminfostorageui.cpp index 6b3b8e2..93a698d 100644 --- a/src/ui/systeminfostorageui.cpp +++ b/src/ui/systeminfostorageui.cpp @@ -53,8 +53,8 @@ void StorageSystemInfoUi::initializeStorage() tags << tr("drives") << tr("memory") << tr("storage"); systemInfoDrives = new QComboBox(); - QPushButton *systemInfoChangeDriveName = new QPushButton(tr("Change Name")); - QPushButton *systemInfoRemoveDrive = new QPushButton(tr("Remove")); + systemInfoChangeDriveName = new QPushButton(tr("Change Name")); + systemInfoRemoveDrive = new QPushButton(tr("Remove")); QPushButton *systemInfoAddDrive = new QPushButton(tr("Add")); QHBoxLayout *hLayout = new QHBoxLayout(); hLayout->addWidget(systemInfoChangeDriveName); @@ -154,9 +154,12 @@ void StorageSystemInfoUi::emitStorageDataChange() void StorageSystemInfoUi::showDriveInfo() { bool editingEnabled = systemInfoDrives->count() != 0; - systemInfoDriveType->setEnabled(editingEnabled); - systemInfoDriveAvailableSpace->setEnabled(editingEnabled); - systemInfoDriveTotalSpace->setEnabled(editingEnabled); + + // workaround for calling this from another thread (scripts): + // always perform the setEnabled calls in the gui thread - + // setEnabled calls sendEvent! + QMetaObject::invokeMethod(this, "enableDriveControls", Qt::QueuedConnection, + Q_ARG(bool, editingEnabled)); if (!editingEnabled) return; @@ -394,3 +397,12 @@ bool StorageSystemInfoScriptInterface::setAvailableSpace(const QString &name, qi } return true; } + +void StorageSystemInfoUi::enableDriveControls(bool enabled) +{ + systemInfoDriveType->setEnabled(enabled); + systemInfoDriveAvailableSpace->setEnabled(enabled); + systemInfoDriveTotalSpace->setEnabled(enabled); + systemInfoRemoveDrive->setEnabled(enabled); + systemInfoChangeDriveName->setEnabled(enabled); +} diff --git a/src/ui/systeminfostorageui.h b/src/ui/systeminfostorageui.h index 33702d2..de55ebe 100644 --- a/src/ui/systeminfostorageui.h +++ b/src/ui/systeminfostorageui.h @@ -41,6 +41,7 @@ class QLineEdit; class QComboBox; +class QPushButton; class StorageSystemInfoUi; @@ -127,13 +128,15 @@ private slots: private: void initializeStorage(); void initializeStorageOptions(); - + Q_INVOKABLE void enableDriveControls(bool enabled); private: QComboBox *systemInfoDrives; QComboBox *systemInfoDriveType; QLineEdit *systemInfoDriveTotalSpace; QLineEdit *systemInfoDriveAvailableSpace; + QPushButton *systemInfoRemoveDrive; + QPushButton *systemInfoChangeDriveName; StorageData mData; diff --git a/src/ui/viewconfiguration.cpp b/src/ui/viewconfiguration.cpp index 052452b..cbe133e 100644 --- a/src/ui/viewconfiguration.cpp +++ b/src/ui/viewconfiguration.cpp @@ -86,8 +86,7 @@ void ViewConfiguration::updateLine() lineWidth = qApp->desktop()->logicalDpiX() / 2.54 * 10 * mCurrentCorrectionFactor; else lineWidth = qApp->desktop()->logicalDpiX() * 4 * mCurrentCorrectionFactor; - mRulerWidget->setFixedWidth(lineWidth); - ui.scrollArea->setMinimumWidth(lineWidth); + ui.scrollArea->setFixedWidth(lineWidth); mRulerWidget->updateCorrectionFactor(ui.horizontalSlider->value() / 100.); } |