diff options
author | Rainer Keller <rainer.keller@nokia.com> | 2011-02-23 17:07:32 +0000 |
---|---|---|
committer | Rainer Keller <rainer.keller@nokia.com> | 2011-02-23 17:07:32 +0000 |
commit | ca8ec7b2886db3bef3dcd2dc8fb8d91f900c7054 (patch) | |
tree | d09a39c21c30733e2d1d0bba33441d56f754a3f2 | |
parent | 0b30edad375b4532c07930c5b8e1bc197e972bf6 (diff) | |
parent | eaae74d5bd250a4837f28bf59976aaabf1ee2156 (diff) |
Merge remote-tracking branch 'origin/1.1'
Conflicts:
src/ui/accelerometercontrol.cpp
src/ui/accelerometercontrol.h
src/ui/locationui.cpp
src/ui/locationui.h
src/ui/mainwindow.cpp
src/ui/ui.qrc
-rw-r--r-- | doc/doc.pri | 4 | ||||
-rw-r--r-- | doc/images/qt-simulator-devices.png | bin | 512292 -> 108186 bytes | |||
-rw-r--r-- | doc/simulator.qdoc | 6 | ||||
-rw-r--r-- | models/maemoFremantle/N900_back.png | bin | 0 -> 1157713 bytes | |||
-rw-r--r-- | models/maemoFremantle/N900_left.png | bin | 0 -> 193023 bytes | |||
-rw-r--r-- | models/maemoFremantle/N900_top.png | bin | 0 -> 324504 bytes | |||
-rw-r--r-- | src/ui/accelerometercontrol.cpp | 37 | ||||
-rw-r--r-- | src/ui/accelerometercontrol.h | 3 | ||||
-rw-r--r-- | src/ui/locationui.cpp | 121 | ||||
-rw-r--r-- | src/ui/locationui.h | 63 | ||||
-rw-r--r-- | src/ui/viewconfiguration.cpp | 3 |
11 files changed, 39 insertions, 198 deletions
diff --git a/doc/doc.pri b/doc/doc.pri index 0c60264..e4524a1 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -4,10 +4,10 @@ QDOC_BIN = $$[QT_INSTALL_BINS]/qdoc3 win32:QDOC_BIN = $$replace(QDOC_BIN, "/", "\\") unix { - QDOC = SRCDIR=$$PWD OUTDIR=$$OUT_PWD/doc/html QT_MOBILITY_SOURCE_PATH=$$QT_MOBILITY_SOURCE_PATH $$QDOC_BIN + QDOC = SIMULATOR_DEPENDENCY_PATH=$$SIMULATOR_DEPENDENCY_PATH SRCDIR=$$PWD OUTDIR=$$OUT_PWD/doc/html QT_MOBILITY_SOURCE_PATH=$$QT_MOBILITY_SOURCE_PATH $$QDOC_BIN HELPGENERATOR = $$[QT_INSTALL_BINS]/qhelpgenerator } else { - QDOC = set SRCDIR=$$PWD&& set OUTDIR=$$OUT_PWD/doc/html&& set QT_MOBILITY_SOURCE_PATH=$$QT_MOBILITY_SOURCE_PATH&& $$QDOC_BIN + QDOC = set SIMULATOR_DEPENDENCY_PATH=$$SIMULATOR_DEPENDENCY_PATH && set SRCDIR=$$PWD&& set OUTDIR=$$OUT_PWD/doc/html&& set QT_MOBILITY_SOURCE_PATH=$$QT_MOBILITY_SOURCE_PATH&& $$QDOC_BIN # Always run qhelpgenerator inside its own cmd; this is a workaround for # an unusual bug which causes qhelpgenerator.exe to do nothing HELPGENERATOR = cmd /C $$replace($$list($$[QT_INSTALL_BINS]/qhelpgenerator.exe), "/", "\\") diff --git a/doc/images/qt-simulator-devices.png b/doc/images/qt-simulator-devices.png Binary files differindex e6f0864..e72b0df 100644 --- a/doc/images/qt-simulator-devices.png +++ b/doc/images/qt-simulator-devices.png diff --git a/doc/simulator.qdoc b/doc/simulator.qdoc index f064381..13ed21a 100644 --- a/doc/simulator.qdoc +++ b/doc/simulator.qdoc @@ -47,6 +47,12 @@ change the information that the device has about its configuration and environment. + Qt Simulator does not support any device specific APIs by design. Therefore, + applications that run well on Qt Simulator also run on any device that hosts the + Qt and Qt Mobility libraries. However, this means that you cannot use + Qt Simulator to test applications that use device specific libraries, such as + Symbian C++ APIs. + \image qt-simulator.png "Qt Simulator" \note Please report bugs and suggestions to the diff --git a/models/maemoFremantle/N900_back.png b/models/maemoFremantle/N900_back.png Binary files differnew file mode 100644 index 0000000..dc74ee1 --- /dev/null +++ b/models/maemoFremantle/N900_back.png diff --git a/models/maemoFremantle/N900_left.png b/models/maemoFremantle/N900_left.png Binary files differnew file mode 100644 index 0000000..3f6379b --- /dev/null +++ b/models/maemoFremantle/N900_left.png diff --git a/models/maemoFremantle/N900_top.png b/models/maemoFremantle/N900_top.png Binary files differnew file mode 100644 index 0000000..11365d9 --- /dev/null +++ b/models/maemoFremantle/N900_top.png diff --git a/src/ui/accelerometercontrol.cpp b/src/ui/accelerometercontrol.cpp index 03ed36a..d4656f6 100644 --- a/src/ui/accelerometercontrol.cpp +++ b/src/ui/accelerometercontrol.cpp @@ -40,28 +40,33 @@ #include <QtGui/QMatrix4x4> #include <QtGui/QMouseEvent> +static QVector3D accelerometerX(-1, 0, 0); +static QVector3D accelerometerY(0, 1, 0); +static QVector3D accelerometerZ(0, 0, -1); +static QVector3D unrotatedGravity(0, 1, 0); + AccelerometerControl::AccelerometerControl(QWidget *parent) - : QGLWidget(parent) + : QGLWidget(parent), mGravity(9.8) { } -void AccelerometerControl::setValue(const QVector3D &value) +void AccelerometerControl::setValue(const QVector3D &newValue) { - QVector3D up(0, 1, 0); - QVector3D target = value.normalized(); + mGravity = newValue.length(); + QVector3D target = newValue.normalized(); + + if ((newValue - value()).lengthSquared() < 0.0001) + return; - qreal dot = QVector3D::dotProduct(up, target); + qreal dot = QVector3D::dotProduct(accelerometerY, target); if (dot > 0.999) { mRotation = QQuaternion(); - mUpValue = value; } else if(dot < -0.999) { mRotation = QQuaternion::fromAxisAndAngle(0, 0, 1, 180); - mUpValue = -value; } else { // we want the quaternion that transforms target into up - QVector3D cross = QVector3D::crossProduct(target, up); + QVector3D cross = QVector3D::crossProduct(target, accelerometerY); mRotation = QQuaternion::fromAxisAndAngle(cross, qAcos(dot) * 180 / M_PI); - mUpValue = mRotation.rotatedVector(value); } updateGL(); @@ -263,8 +268,7 @@ void AccelerometerControl::mouseMoveEvent(QMouseEvent *event) } mOldMousePosition = event->pos(); - QVector3D newValue = mRotation.conjugate().rotatedVector(mUpValue); - emit valueChanged(newValue); + emit valueChanged(value()); updateGL(); } @@ -293,3 +297,14 @@ void AccelerometerControl::setDeviceOrientation(bool portrait) } updateGL(); } + +QVector3D AccelerometerControl::value() const +{ + QVector3D newValue; + newValue.setX(QVector3D::dotProduct(mRotation.conjugate().rotatedVector(accelerometerX), unrotatedGravity)); + newValue.setY(QVector3D::dotProduct(mRotation.conjugate().rotatedVector(accelerometerY), unrotatedGravity)); + newValue.setZ(QVector3D::dotProduct(mRotation.conjugate().rotatedVector(accelerometerZ), unrotatedGravity)); + newValue *= mGravity; + + return newValue; +} diff --git a/src/ui/accelerometercontrol.h b/src/ui/accelerometercontrol.h index 52c051f..81993fb 100644 --- a/src/ui/accelerometercontrol.h +++ b/src/ui/accelerometercontrol.h @@ -46,6 +46,7 @@ public: void setDeviceOrientation(bool portrait); + QVector3D value() const; signals: void valueChanged(const QVector3D &value); @@ -66,7 +67,7 @@ private: private: QPoint mOldMousePosition; QQuaternion mRotation; - QVector3D mUpValue; + qreal mGravity; bool mDefaultPortrait; GLuint mFrontTexture; diff --git a/src/ui/locationui.cpp b/src/ui/locationui.cpp deleted file mode 100644 index 5355a7c..0000000 --- a/src/ui/locationui.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Simulator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#include "locationui.h" - -#include "optionsitem.h" -#include "configurationwidget.h" -#include "location.h" - -#include <location/qlocationdata_simulator_p.h> - -#include <QtGui/QLineEdit> -#include <QtGui/QDoubleValidator> -#include <QtGui/QPushButton> -#include <QtGui/QBoxLayout> -#include <QtGui/QDateTimeEdit> - -LocationUi::LocationUi(ConfigurationWidget *w, Location *location) - : QObject(w) - , mLocation(location) - , mLatitudeEdit(0) - , mLongitudeEdit(0) - , mAltitudeEdit(0) - , mTimeEdit(0) -{ - QStringList tags; - QList<OptionsItem *> optionsList; - - mLatitudeEdit = new QLineEdit("52.5056819"); - mLatitudeEdit->setValidator(new QDoubleValidator(-90, 90, 10, this)); - OptionsItem *item = new OptionsItem(tr("Latitude"), mLatitudeEdit); - connect(mLatitudeEdit, SIGNAL(editingFinished()), SLOT(triggerLocationInfoChange())); - item->setTags(tags); - optionsList << item; - - mLongitudeEdit = new QLineEdit("13.3232027"); - mLatitudeEdit->setValidator(new QDoubleValidator(-180, 180, 10, this)); - item = new OptionsItem(tr("Longitude"), mLongitudeEdit); - connect(mLongitudeEdit, SIGNAL(editingFinished()), SLOT(triggerLocationInfoChange())); - item->setTags(tags); - optionsList << item; - - mAltitudeEdit = new QLineEdit("13.3232027"); - mAltitudeEdit->setValidator(new QDoubleValidator(-15000, 15000, 10, this)); - item = new OptionsItem(tr("Altitude"), mAltitudeEdit); - connect(mAltitudeEdit, SIGNAL(editingFinished()), SLOT(triggerLocationInfoChange())); - item->setTags(tags); - optionsList << item; - - mTimeEdit = new QDateTimeEdit(); - QPushButton *locationTimeButton = new QPushButton(tr("Now")); - QHBoxLayout *hLayout = new QHBoxLayout(); - hLayout->setContentsMargins(0, 0, 0, 0); - QVBoxLayout *vLayout = new QVBoxLayout(); - vLayout->addWidget(mTimeEdit); - vLayout->addWidget(locationTimeButton); - hLayout->addLayout(vLayout); - QWidget *tmp = new QWidget(); - tmp->setLayout(hLayout); - connect(mTimeEdit, SIGNAL(dateTimeChanged(const QDateTime &)), SLOT(triggerLocationInfoChange())); - connect(locationTimeButton, SIGNAL(clicked()), this, SLOT(updateLocationTime())); - item = new OptionsItem(tr("Timestamp"), tmp); - item->setTags(tags); - optionsList << item; - connect(mLocation, SIGNAL(locationChanged(QGeoPositionInfoData)), this, SLOT(locationSetData())); - - w->addToolBoxPage(tr("Location"), optionsList); -} - -void LocationUi::triggerLocationInfoChange() -{ - mLocation->setLatitude(mLatitudeEdit->text().toDouble()); - mLocation->setLongitude(mLongitudeEdit->text().toDouble()); - mLocation->setAltitude(mAltitudeEdit->text().toDouble()); - mLocation->setDateTime(mTimeEdit->dateTime()); - mLocation->publish(); -} - -void LocationUi::updateLocationTime() -{ - mTimeEdit->setDateTime(QDateTime::currentDateTime()); -} - -void LocationUi::locationSetData() -{ - mLatitudeEdit->setText(QString::number(mLocation->latitude(), 'f', 8)); - mLongitudeEdit->setText(QString::number(mLocation->longitude(), 'f', 8)); - mAltitudeEdit->setText(QString::number(mLocation->altitude(), 'f', 8)); - mTimeEdit->setDateTime(mLocation->dateTime()); -} - diff --git a/src/ui/locationui.h b/src/ui/locationui.h deleted file mode 100644 index 8e33acf..0000000 --- a/src/ui/locationui.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** -** -** This file is part of Qt Simulator -** -** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** No Commercial Usage -** -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -**************************************************************************/ - -#ifndef LOCATIONUI_H -#define LOCATIONUI_H - -#include <QtCore/QObject> - -class ConfigurationWidget; -class Location; -class QLineEdit; -class QDateTimeEdit; - -class LocationUi : public QObject -{ - Q_OBJECT -public: - LocationUi(ConfigurationWidget* w, Location *location); - -private slots: - void updateLocationTime(); - void locationSetData(); - void triggerLocationInfoChange(); - -private: - Location *mLocation; - QLineEdit *mLatitudeEdit; - QLineEdit *mLongitudeEdit; - QLineEdit *mAltitudeEdit; - QDateTimeEdit *mTimeEdit; -}; - -#endif // LOCATIONUI_H diff --git a/src/ui/viewconfiguration.cpp b/src/ui/viewconfiguration.cpp index 71a32cb..052452b 100644 --- a/src/ui/viewconfiguration.cpp +++ b/src/ui/viewconfiguration.cpp @@ -70,7 +70,10 @@ ViewConfiguration::~ViewConfiguration() void ViewConfiguration::updateValues(qreal factor) { + ui.horizontalSlider->blockSignals(true); ui.horizontalSlider->setValue(factor * 100); + ui.horizontalSlider->blockSignals(false); + updateLine(); QLocale locale; ui.correctionFactorEdit->setText(locale.toString(factor)); |