diff options
author | Kevin Wu Won <kevin.wuwon@nokia.com> | 2010-12-15 11:14:32 +1000 |
---|---|---|
committer | Kevin Wu Won <kevin.wuwon@nokia.com> | 2010-12-15 11:15:03 +1000 |
commit | 899c2a03c31e8b49349b39acb227ec0ebbdd4bfe (patch) | |
tree | 10d70144cf984f3f571cc4615248ce9073acdb6c | |
parent | 181bb0190f5e7bc9cf8753fd433149c852cd9588 (diff) | |
parent | b5ab3af6c51c99d258f038790fc9d6fbc187583d (diff) |
Merge branch 'master' of ../qtmobility
Conflicts:
plugins/contacts/symbian/plugin/symbian_defines.pri
29 files changed, 311 insertions, 98 deletions
diff --git a/doc/src/location.qdoc b/doc/src/location.qdoc index 059c83fe26..5bf651b12f 100644 --- a/doc/src/location.qdoc +++ b/doc/src/location.qdoc @@ -307,22 +307,30 @@ To implment your own plugin, you need to subclass QLandmarkManagerEngine and pro for the virtual functions, and then create a QLandmarkMangerEngineFactory subclass that will instantiate your particular engine implementation. -The following table shows names of the default managers for each platform. +The following table shows names of the default managers for each platform and where the landmarks are stored. \table \header \o Manager name \o Platform + \o Landmark storage \row \o com.nokia.qt.landmarks.engines.symbian \o S60 3.1,3.2,5.0, Symbian + \o Uses the S60 Platform Landmarks API to store data into the default/global landmark database. \row \o com.nokia.qt.landmarks.engines.sqlite \o Maemo5, Windows Xp/Vista,Linux, Mac OS X + \o Landmarks are stored in an SQLite database. \row \o com.nokia.qt.landmarks.engines.qsparql \o Harmattan + \o Landmarks are stored in Tracker using SPARQL queries. \endtable +These managers only store and retrieve landmark data locally. This landmark data is available to any application which accesses the manager +and is thus shared between all applications. At present there are no managers which retrieve landmark data from online +sources. + For convenience, this documentations refers to the manager corresponding to \c com.nokia.qt.landmarks.engines.symbian as the \i {symbian manager}, the manager corresponding to \c com.nokia.qt.landmarks.engines.sqlite as the \i{sqlite manager}, and the manager corresponding to \c com.nokia.qt.landmarks.engines.sparql as the \i {sparql manager}. (Please note that there are several known issues with the sparql manager that are outlined in diff --git a/plugins/contacts/symbian/plugin/symbian_defines.pri b/plugins/contacts/symbian/plugin/symbian_defines.pri index cb0da43f86..2dbd56a57b 100644 --- a/plugins/contacts/symbian/plugin/symbian_defines.pri +++ b/plugins/contacts/symbian/plugin/symbian_defines.pri @@ -1,8 +1,6 @@ -include(../../../../common.pri) - symbian: { - #contains(symbiancntmodelv2_enabled, yes) { - # message("S^3 PS3 or later platform") + exists($${EPOCROOT}epoc32/data/z/system/install/Symbianv4.0.sis) { + message("S^3 PS3 or later platform") DEFINES += SYMBIAN_BACKEND_USE_SQLITE # This will enable signals to be emitted sychronously with every diff --git a/plugins/contacts/symbian/symbian.pro b/plugins/contacts/symbian/symbian.pro index e754a5a3e6..5889e5f73f 100644 --- a/plugins/contacts/symbian/symbian.pro +++ b/plugins/contacts/symbian/symbian.pro @@ -3,19 +3,17 @@ CONFIG += ordered include(../../../common.pri) - ## quick platform check. -IS_SYMBIAN_4 = no -IS_SYMBIAN_3 = no -exists($${EPOCROOT}epoc32/data/z/system/install/Symbianv4.sis) { - IS_SYMBIAN_4 = yes - message(Building Symbian contacts plugin on S^4 or later platform) +IS_SYMBIAN_3_PS3 = no +exists($${EPOCROOT}epoc32/data/z/system/install/Symbianv4.0.sis) { + IS_SYMBIAN_3_PS3 = yes + message(Building Symbian contacts plugin on S^3 PS3 or later platform) } else { - message(Building Symbian contacts plugin on S^3 or older platform) + message(Building Symbian contacts plugin on S^3 PS2 or older platform) } -contains(IS_SYMBIAN_4, yes) { - message(Building Symbian^4 CNTMODEL library and plugin) +contains(IS_SYMBIAN_3_PS3, yes) { + message(Building Symbian^3 PS3 CNTMODEL library and plugin) SUBDIRS += contactsmodel plugin } else { SUBDIRS += plugin diff --git a/plugins/feedback/mmk/qfeedback.cpp b/plugins/feedback/mmk/qfeedback.cpp index 2b1f09b5e0..65676b6879 100644 --- a/plugins/feedback/mmk/qfeedback.cpp +++ b/plugins/feedback/mmk/qfeedback.cpp @@ -83,7 +83,7 @@ void QFeedbackMMK::setLoaded(QFeedbackFileEffect *effect, bool load) mEffects.insert(effect, fi); mEffectMap.insert(fi.soundEffect, effect); - connect(fi.soundEffect, SIGNAL(statusChanged()), this, SLOT(soundEffectLoaded())); + connect(fi.soundEffect, SIGNAL(statusChanged()), this, SLOT(soundEffectStatusChanged())); connect(fi.soundEffect, SIGNAL(playingChanged()), this, SLOT(soundEffectPlayingChanged())); fi.soundEffect->setSource(effect->source()); } @@ -155,15 +155,33 @@ QStringList QFeedbackMMK::supportedMimeTypes() return QSoundEffect::supportedMimeTypes(); } -void QFeedbackMMK::soundEffectLoaded() +void QFeedbackMMK::soundEffectStatusChanged() { QSoundEffect* se = qobject_cast<QSoundEffect*>(sender()); - if (se && se->status() == QSoundEffect::Error) { + if (se) { // Hmm, now look up the right sound effect QFeedbackFileEffect* fe = mEffectMap.value(se); + if (!fe) + return; - if (fe && fe->state() == QFeedbackEffect::Loading) { - reportLoadFinished(fe, false); + switch(se->status()) { + case QSoundEffect::Error: + if (fe->state() == QFeedbackEffect::Loading) { + reportLoadFinished(fe, false); + } else { + reportError(fe, QFeedbackEffect::UnknownError); + } + break; + + case QSoundEffect::Ready: + if (fe->state() == QFeedbackEffect::Loading) { + reportLoadFinished(fe, true); + } + break; + + default: + // Nothing to handle here? + break; } } } diff --git a/plugins/feedback/mmk/qfeedback.h b/plugins/feedback/mmk/qfeedback.h index 2b4c0dee47..eb060710b1 100644 --- a/plugins/feedback/mmk/qfeedback.h +++ b/plugins/feedback/mmk/qfeedback.h @@ -66,7 +66,7 @@ public: virtual int effectDuration(const QFeedbackFileEffect*); virtual QStringList supportedMimeTypes(); private Q_SLOTS: - void soundEffectLoaded(); + void soundEffectStatusChanged(); void soundEffectPlayingChanged(); private: diff --git a/plugins/geoservices/nokia/jsonparser.h b/plugins/geoservices/nokia/jsonparser.h index ffe9daa6d3..49fdff0e90 100644 --- a/plugins/geoservices/nokia/jsonparser.h +++ b/plugins/geoservices/nokia/jsonparser.h @@ -73,11 +73,17 @@ public: } char peek() const { - return data[pos].toLatin1(); + if (pos < data.size()) + return data[pos].toLatin1(); + else + return -1; } QChar peekQ() const { - return data[pos]; + if (pos < data.size()) + return data[pos]; + else + return QChar(short(-1)); } bool next() { @@ -119,6 +125,10 @@ public: case '.': ret = parseNumber(); break; + case -1: + // we went off the end of the string + // return an invalid QVariant + break; default: ret = parseUnknown(); break; diff --git a/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp b/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp index d3903bee34..6d328c5718 100644 --- a/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp +++ b/plugins/geoservices/nokia/qgeotiledmapdata_nokia.cpp @@ -91,6 +91,9 @@ void QGeoTiledMapDataNokia::copyrightReplyFinished(QNetworkReply * reply) JSONParser jp(reply->readAll()); QVariant root = jp.parse(); + if (!root.isValid()) + return; + copyrights.clear(); QVariantHash rootHash = root.toHash(); diff --git a/src/location/maps/qgeomappolylineobject.cpp b/src/location/maps/qgeomappolylineobject.cpp index 89e65b178b..143e77395f 100644 --- a/src/location/maps/qgeomappolylineobject.cpp +++ b/src/location/maps/qgeomappolylineobject.cpp @@ -121,7 +121,7 @@ QList<QGeoCoordinate> QGeoMapPolylineObject::path() const void QGeoMapPolylineObject::setPen(const QPen &pen) { QPen newPen = pen; -// newPen.setCosmetic(true); + newPen.setCosmetic(false); if (d_ptr->pen == newPen) return; @@ -158,7 +158,7 @@ QPen QGeoMapPolylineObject::pen() const QGeoMapPolylineObjectPrivate::QGeoMapPolylineObjectPrivate() { -// pen.setCosmetic(true); + pen.setCosmetic(false); } QGeoMapPolylineObjectPrivate::~QGeoMapPolylineObjectPrivate() {} diff --git a/src/location/maps/qgeomaprouteobject.cpp b/src/location/maps/qgeomaprouteobject.cpp index 3160304284..b8b7d76b15 100644 --- a/src/location/maps/qgeomaprouteobject.cpp +++ b/src/location/maps/qgeomaprouteobject.cpp @@ -125,7 +125,7 @@ void QGeoMapRouteObject::setRoute(const QGeoRoute &route) The pen is used to draw the route. - The pen will be treated as a cosmetic pen, which means that the width + The pen will be treated like a cosmetic pen, which means that the width of the pen will be independent of the zoom level of the map. */ QPen QGeoMapRouteObject::pen() const @@ -136,7 +136,7 @@ QPen QGeoMapRouteObject::pen() const void QGeoMapRouteObject::setPen(const QPen &pen) { QPen newPen = pen; -// newPen.setCosmetic(true); + newPen.setCosmetic(false); if (d_ptr->pen == newPen) return; @@ -206,7 +206,7 @@ void QGeoMapRouteObject::setDetailLevel(quint32 detailLevel) QGeoMapRouteObjectPrivate::QGeoMapRouteObjectPrivate() { detailLevel = DEFAULT_ROUTE_DETAIL_LEVEL; -// pen.setCosmetic(true); + pen.setCosmetic(false); } QGeoMapRouteObjectPrivate::~QGeoMapRouteObjectPrivate() {} diff --git a/src/location/qgeocoordinate.cpp b/src/location/qgeocoordinate.cpp index 3fae64e0e8..1b1f5e6ffd 100644 --- a/src/location/qgeocoordinate.cpp +++ b/src/location/qgeocoordinate.cpp @@ -49,6 +49,8 @@ #include <math.h> +#include <QDebug> + #ifndef M_PI #define M_PI 3.14159265358979323846 #endif @@ -355,10 +357,14 @@ qreal QGeoCoordinate::distanceTo(const QGeoCoordinate &other) const // Haversine formula double dlat = qgeocoordinate_degToRad(other.d->lat - d->lat); double dlon = qgeocoordinate_degToRad(other.d->lng - d->lng); - double y = sin(dlat / 2.0) * sin(dlat / 2.0) - + cos(qgeocoordinate_degToRad(d->lat)) - * cos(qgeocoordinate_degToRad(other.d->lat)) - * sin(dlon / 2.0) * sin(dlon / 2.0); + double haversine_dlat = sin(dlat / 2.0); + haversine_dlat *= haversine_dlat; + double haversine_dlon = sin(dlon / 2.0); + haversine_dlon *= haversine_dlon; + double y = haversine_dlat + + cos(qgeocoordinate_degToRad(d->lat)) + * cos(qgeocoordinate_degToRad(other.d->lat)) + * haversine_dlon; double x = 2 * asin(sqrt(y)); return qreal(x * qgeocoordinate_EARTH_MEAN_RADIUS * 1000); } @@ -393,6 +399,46 @@ qreal QGeoCoordinate::azimuthTo(const QGeoCoordinate &other) const return qreal((int(whole + 360) % 360) + fraction); } + +/*! + Returns the coordinate that is reached by traveling \a distance metres + from the current coordinate at \a azimuth (or bearing) along a great-circle. + There is an assumption that the Earth is spherical for the purpose of this + calculation. + + The altitude will have \a distanceUp added to it. + + Returns an invalid coordinate if this coordinate is invalid. +*/ +QGeoCoordinate QGeoCoordinate::atDistanceAndAzimuth(qreal distance, qreal azimuth, qreal distanceUp) const +{ + if (!isValid()) + return QGeoCoordinate(); + + double latRad = qgeocoordinate_degToRad(d->lat); + double lonRad = qgeocoordinate_degToRad(d->lng); + double cosLatRad = cos(latRad); + double sinLatRad = sin(latRad); + + double azimuthRad = qgeocoordinate_degToRad(azimuth); + + double ratio = (distance / (qgeocoordinate_EARTH_MEAN_RADIUS * 1000.0)); + double cosRatio = cos(ratio); + double sinRatio = sin(ratio); + + double resultLatRad = asin(sinLatRad * cosRatio + + cosLatRad * sinRatio * cos(azimuthRad)); + double resultLonRad = lonRad + + atan2(sin(azimuthRad) * sinRatio * cosLatRad, + cosRatio - sinLatRad * sin(resultLatRad)); + + double resultLat = qgeocoordinate_radToDeg(resultLatRad); + double resultLon = qgeocoordinate_radToDeg(resultLonRad); + + double resultAlt = d->alt + distanceUp; + return QGeoCoordinate(resultLat, resultLon, resultAlt); +} + /*! Returns this coordinate as a string in the specified \a format. diff --git a/src/location/qgeocoordinate.h b/src/location/qgeocoordinate.h index 9a4902a0b8..c5aa8c8718 100644 --- a/src/location/qgeocoordinate.h +++ b/src/location/qgeocoordinate.h @@ -101,6 +101,8 @@ public: qreal distanceTo(const QGeoCoordinate &other) const; qreal azimuthTo(const QGeoCoordinate &other) const; + QGeoCoordinate atDistanceAndAzimuth(qreal distance, qreal azimuth, qreal distanceUp = 0.0) const; + QString toString(CoordinateFormat format = DegreesMinutesSecondsWithHemisphere) const; private: diff --git a/tests/auto/geoservicesgeomap/geoservicesgeomap.pro b/tests/auto/geoservicesgeomap/geoservicesgeomap.pro index 9eb4372e21..d172ef0321 100644 --- a/tests/auto/geoservicesgeomap/geoservicesgeomap.pro +++ b/tests/auto/geoservicesgeomap/geoservicesgeomap.pro @@ -18,9 +18,4 @@ MOBILITY = location symbian { INCLUDEPATH += $${EPOCROOT}epoc32/include/osextensions TARGET.CAPABILITY = ALL -TCB - LIBS += -lqtgeoservices_staticgeomapplugin.lib -} else { - LIBS += -L../../../build/tests/bin/plugins/geoservices - LIBS += -l$$mobilityDeployFilename(qtgeoservices_staticgeomapplugin) - TESTDLLS = $$mobilityDeployFilename(qtgeoservices_staticgeomapplugin) } diff --git a/tests/auto/geoservicesgeomap/tst_geoservicesgeomapplugin.cpp b/tests/auto/geoservicesgeomap/tst_geoservicesgeomapplugin.cpp index 482a02554d..445cd1ea81 100644 --- a/tests/auto/geoservicesgeomap/tst_geoservicesgeomapplugin.cpp +++ b/tests/auto/geoservicesgeomap/tst_geoservicesgeomapplugin.cpp @@ -51,8 +51,6 @@ #include <QPainter> #include <QStyleOptionGraphicsItem> -Q_IMPORT_PLUGIN( qtgeoservices_staticgeomapplugin) - QTM_USE_NAMESPACE Q_DECLARE_METATYPE(QGeoCoordinate) diff --git a/tests/auto/geoservicesgeomapplugin/geoservicesgeomapplugin.pro b/tests/auto/geoservicesgeomapplugin/geoservicesgeomapplugin.pro index 51520e383c..b34ea37ca2 100644 --- a/tests/auto/geoservicesgeomapplugin/geoservicesgeomapplugin.pro +++ b/tests/auto/geoservicesgeomapplugin/geoservicesgeomapplugin.pro @@ -1,6 +1,6 @@ TEMPLATE = lib -CONFIG += plugin static testplugin -TARGET = $$qtLibraryTarget(qtgeoservices_staticgeomapplugin) +CONFIG += plugin testplugin +TARGET = $$qtLibraryTarget(qtgeoservices_geomapplugin) PLUGIN_TYPE=geoservices include(../../../common.pri) diff --git a/tests/auto/geoservicesgeotiledmap/geoservicesgeotiledmap.pro b/tests/auto/geoservicesgeotiledmap/geoservicesgeotiledmap.pro index 9bc24e9eb3..70e72e63f4 100644 --- a/tests/auto/geoservicesgeotiledmap/geoservicesgeotiledmap.pro +++ b/tests/auto/geoservicesgeotiledmap/geoservicesgeotiledmap.pro @@ -20,9 +20,4 @@ MOBILITY = location symbian { INCLUDEPATH += $${EPOCROOT}epoc32/include/osextensions TARGET.CAPABILITY = ALL -TCB - LIBS += -lqtgeoservices_statictiledgeomapplugin.lib -} else { - LIBS += -L../../../build/tests/bin/plugins/geoservices - LIBS += -l$$mobilityDeployFilename(qtgeoservices_statictiledgeomapplugin) - TESTDLLS = $$mobilityDeployFilename(qtgeoservices_statictiledgeomapplugin) } diff --git a/tests/auto/geoservicesgeotiledmap/tst_geoservicesgeotiledmapplugin.cpp b/tests/auto/geoservicesgeotiledmap/tst_geoservicesgeotiledmapplugin.cpp index 992c6109b1..c93b05f52e 100644 --- a/tests/auto/geoservicesgeotiledmap/tst_geoservicesgeotiledmapplugin.cpp +++ b/tests/auto/geoservicesgeotiledmap/tst_geoservicesgeotiledmapplugin.cpp @@ -53,8 +53,6 @@ #include <QGraphicsView> #include <QStyleOptionGraphicsItem> -Q_IMPORT_PLUGIN( qtgeoservices_statictiledgeomapplugin) - QTM_USE_NAMESPACE Q_DECLARE_METATYPE(QGeoCoordinate) diff --git a/tests/auto/geoservicesgeotiledmapplugin/geoservicesgeotiledmapplugin.pro b/tests/auto/geoservicesgeotiledmapplugin/geoservicesgeotiledmapplugin.pro index 557894e674..5e2ab58ca4 100644 --- a/tests/auto/geoservicesgeotiledmapplugin/geoservicesgeotiledmapplugin.pro +++ b/tests/auto/geoservicesgeotiledmapplugin/geoservicesgeotiledmapplugin.pro @@ -1,6 +1,6 @@ TEMPLATE = lib -CONFIG += plugin static testplugin -TARGET = $$qtLibraryTarget(qtgeoservices_statictiledgeomapplugin) +CONFIG += plugin testplugin +TARGET = $$qtLibraryTarget(qtgeoservices_tiledgeomapplugin) PLUGIN_TYPE=geoservices include(../../../common.pri) diff --git a/tests/auto/location.pro b/tests/auto/location.pro index 5810d6a6f8..ff35a1a472 100644 --- a/tests/auto/location.pro +++ b/tests/auto/location.pro @@ -39,14 +39,17 @@ SUBDIRS += qgeocoordinate \ qgeosearchreply \ qgeosearchmanagerplugins \ qgeosearchmanager \ - qgeoserviceproviderplugins \ - qgeoserviceprovider \ geoservicesgeomapplugin \ geoservicesgeomap \ geoservicesgeotiledmapplugin \ geoservicesgeotiledmap +!symbian{ +SUBDIRS += qgeoserviceproviderplugins \ + qgeoserviceprovider +} + #IGNORED_UNTIL_INTEGRATED_PROPERLY += \ # qdeclarativeapitests diff --git a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp b/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp index 3633d00db9..cc3b8e1247 100644 --- a/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp +++ b/tests/auto/qgeocoordinate/tst_qgeocoordinate.cpp @@ -510,6 +510,94 @@ private slots: << NORTH_POLE << SOUTH_POLE << qreal(180.0); } +/* + void atDistance() + { + QFETCH(QGeoCoordinate, origin); + QFETCH(qreal, distanceNorth); + QFETCH(qreal, distanceEast); + QFETCH(QGeoCoordinate, result); + + QCOMPARE(result, origin.atDistance(distanceNorth, distanceEast)); + } + + void atDistance_data() + { + QTest::addColumn<QGeoCoordinate>("origin"); + QTest::addColumn<qreal>("distanceNorth"); + QTest::addColumn<qreal>("distanceEast"); + QTest::addColumn<QGeoCoordinate>("result"); + + QTest::newRow("invalid coord") + << QGeoCoordinate() + << qreal(1000.0) + << qreal(1000.0) + << QGeoCoordinate(); + + qWarning() << BRISBANE.toString() + << " " + << MELBOURNE.toString(); + + QTest::newRow("brisbane -> melbourne") + << BRISBANE + << qreal(-1150000.0) + << qreal(-795700.0) + << MELBOURNE; + + + QTest::newRow("london -> new york") + << LONDON + << qreal(0.0) + << qreal(0.0) + << NEW_YORK; + + QTest::newRow("north pole -> south pole") + << NORTH_POLE + << qreal(0.0) + << qreal(0.0) + << SOUTH_POLE; + } +*/ + + void atDistanceAndAzimuth() + { + QFETCH(QGeoCoordinate, origin); + QFETCH(qreal, distance); + QFETCH(qreal, azimuth); + QFETCH(QGeoCoordinate, result); + + QCOMPARE(result, origin.atDistanceAndAzimuth(distance, azimuth)); + } + + void atDistanceAndAzimuth_data() + { + QTest::addColumn<QGeoCoordinate>("origin"); + QTest::addColumn<qreal>("distance"); + QTest::addColumn<qreal>("azimuth"); + QTest::addColumn<QGeoCoordinate>("result"); + + QTest::newRow("invalid coord") + << QGeoCoordinate() + << qreal(1000.0) + << qreal(10.0) + << QGeoCoordinate(); + QTest::newRow("brisbane -> melbourne") + << BRISBANE + << qreal(1374820.1618767744) + << qreal(211.1717286649) + << MELBOURNE; + QTest::newRow("london -> new york") + << LONDON + << qreal(5570538.4987236429) + << qreal(288.3388804508) + << NEW_YORK; + QTest::newRow("north pole -> south pole") + << NORTH_POLE + << qreal(20015109.4154876769) + << qreal(180.0) + << SOUTH_POLE; + } + void degreesToString() { QFETCH(QGeoCoordinate, coord); diff --git a/tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro b/tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro index 6a86465a5c..49c6526c18 100644 --- a/tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro +++ b/tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro @@ -19,10 +19,4 @@ MOBILITY = location symbian { INCLUDEPATH += $${EPOCROOT}epoc32/include/osextensions TARGET.CAPABILITY = ALL -TCB - - LIBS += -lqtgeoservices_staticroutingplugin -} else { - LIBS += -L../../../build/tests/bin/plugins/geoservices - LIBS += -l$$mobilityDeployFilename(qtgeoservices_staticroutingplugin) - TESTDLLS = $$mobilityDeployFilename(qtgeoservices_staticroutingplugin) } diff --git a/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.h b/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.h index a01a64258a..e70f08b5e5 100644 --- a/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.h +++ b/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.h @@ -53,8 +53,6 @@ #include <qgeocoordinate.h> #include <qgeoroute.h> -Q_IMPORT_PLUGIN(qtgeoservices_staticroutingplugin) - QTM_USE_NAMESPACE class tst_QGeoRoutingManager: public QObject diff --git a/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro b/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro index a8d8cdc813..3a499c45fa 100644 --- a/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro +++ b/tests/auto/qgeoroutingmanagerplugins/qgeoroutingmanagerplugins.pro @@ -1,6 +1,6 @@ TEMPLATE = lib -CONFIG += plugin static testplugin -TARGET = $$qtLibraryTarget(qtgeoservices_staticroutingplugin) +CONFIG += plugin testplugin +TARGET = $$qtLibraryTarget(qtgeoservices_routingplugin) PLUGIN_TYPE=geoservices include(../../../common.pri) diff --git a/tests/auto/qgeosearchmanager/qgeosearchmanager.pro b/tests/auto/qgeosearchmanager/qgeosearchmanager.pro index da44442fda..236d390311 100644 --- a/tests/auto/qgeosearchmanager/qgeosearchmanager.pro +++ b/tests/auto/qgeosearchmanager/qgeosearchmanager.pro @@ -20,10 +20,4 @@ MOBILITY = location symbian { INCLUDEPATH += $${EPOCROOT}epoc32/include/osextensions TARGET.CAPABILITY = ALL -TCB - - LIBS += -lqtgeoservices_staticsearchplugin -} else { - LIBS += -L../../../build/tests/bin/plugins/geoservices - LIBS += -l$$mobilityDeployFilename(qtgeoservices_staticsearchplugin) - TESTDLLS = $$mobilityDeployFilename(qtgeoservices_staticsearchplugin) } diff --git a/tests/auto/qgeosearchmanager/tst_qgeosearchmanager.h b/tests/auto/qgeosearchmanager/tst_qgeosearchmanager.h index 29d6eb86fe..10f9eb7249 100644 --- a/tests/auto/qgeosearchmanager/tst_qgeosearchmanager.h +++ b/tests/auto/qgeosearchmanager/tst_qgeosearchmanager.h @@ -57,11 +57,8 @@ #include <qgeocoordinate.h> -Q_IMPORT_PLUGIN(qtgeoservices_staticsearchplugin) - QTM_USE_NAMESPACE - class SubLandmarkManager :public QLandmarkManager { Q_OBJECT @@ -101,6 +98,5 @@ Q_DECLARE_METATYPE( QGeoSearchReply*); Q_DECLARE_METATYPE( QGeoSearchReply::Error); Q_DECLARE_METATYPE( QGeoSearchManager::SearchType); - #endif diff --git a/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerplugins.pro b/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerplugins.pro index d6c9992757..1df1dde93b 100644 --- a/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerplugins.pro +++ b/tests/auto/qgeosearchmanagerplugins/qgeosearchmanagerplugins.pro @@ -1,6 +1,6 @@ TEMPLATE = lib -CONFIG += plugin static testplugin -TARGET = $$qtLibraryTarget(qtgeoservices_staticsearchplugin) +CONFIG += plugin testplugin +TARGET = $$qtLibraryTarget(qtgeoservices_searchplugin) PLUGIN_TYPE=geoservices include(../../../common.pri) diff --git a/tests/auto/qlandmarkmanager/tst_qlandmarkmanager.cpp b/tests/auto/qlandmarkmanager/tst_qlandmarkmanager.cpp index cd3a107e18..a64522cd09 100644 --- a/tests/auto/qlandmarkmanager/tst_qlandmarkmanager.cpp +++ b/tests/auto/qlandmarkmanager/tst_qlandmarkmanager.cpp @@ -1837,7 +1837,7 @@ void tst_QLandmarkManager::retrieveLandmark() { QCOMPARE(lms.at(0), lm2); QCOMPARE(lms.at(0).landmarkId().isValid(), true); } else { - qFatal("Unkown test row type"); + qFatal("Unknown test row type"); } //try retrieving a landmark with a category @@ -4094,7 +4094,7 @@ void tst_QLandmarkManager::filterLandmarksName() { //TODO: symbia matching landmarks with no name QVERIFY(doFetch(type,nameFilter, &lms, QLandmarkManager::NoError)); #if (defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_6)) - QCOMPARE(lms.count(), 11); //backend specifc behaviour of returning all results if + QCOMPARE(lms.count(), 11); //backend specific behaviour of returning all results if //empty name is used #else QCOMPARE(lms.count(),2); @@ -4364,7 +4364,7 @@ void tst_QLandmarkManager::filterLandmarksProximityOrder() qreal radius = QGeoCoordinate(20,20).distanceTo(QGeoCoordinate(20,50)); proximityFilter.setRadius(radius); - //TODO: Symbian proximity filter not maching landmarks which exactly lie on the edge of the radius + //TODO: Symbian proximity filter not matching landmarks which exactly lie on the edge of the radius QVERIFY(doFetch(type, proximityFilter,&lms,QLandmarkManager::NoError)); #ifdef Q_OS_SYMBIAN diff --git a/tests/locationex/mainwindow.cpp b/tests/locationex/mainwindow.cpp index d31054b560..8ad85fa458 100644 --- a/tests/locationex/mainwindow.cpp +++ b/tests/locationex/mainwindow.cpp @@ -7,6 +7,8 @@ #include <QGridLayout> #include <QPushButton> +#include <QTimer> +#include <QLabel> #include <cmath> @@ -17,21 +19,37 @@ MainWindow::MainWindow(QWidget *parent) setWindowTitle("MapBox test"); - resize(640, 480); - m_cleanButton = new QPushButton("Clean cache"); + m_cleanButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + m_panToggle = new QPushButton("auto-pan"); + m_panToggle->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + m_panToggle->setCheckable(true); + m_errorLabel = new QLabel("err"); + + m_controlLayout = new QHBoxLayout; + m_controlLayout->addWidget(m_cleanButton); + m_controlLayout->addWidget(m_panToggle); + m_controlLayout->addWidget(m_errorLabel); m_layout = new QGridLayout; setCentralWidget(new QWidget(this)); centralWidget()->setLayout(m_layout); - startTimer(10); + resize(640, 480); - eventTime.start(); + m_panTimer = new QTimer; + m_panTimer->setInterval(0); + connect(m_panTimer, SIGNAL(timeout()), this, SLOT(panTimerHandler())); + + QTimer * compareImagesTimer = new QTimer(this); + compareImagesTimer->setInterval(1000); + connect(compareImagesTimer, SIGNAL(timeout()), this, SLOT(compareImages())); + compareImagesTimer->start(); + + connect(m_panToggle, SIGNAL(toggled(bool)), this, SLOT(setAutoPanEnabled(bool))); } MainWindow::~MainWindow() { - } void MainWindow::addBox(MapBox * box) @@ -48,9 +66,9 @@ void MainWindow::resizeEvent(QResizeEvent * event) QLayoutItem *child; while ((child = m_layout->takeAt(0)) != 0) ; - int columns = floor(0.5+sqrt(static_cast<qreal>(m_boxes.size()))); + int columns = floor(0.5 + sqrt(static_cast<qreal>(m_boxes.size()))); - m_layout->addWidget(m_cleanButton, 0, 0, 1, columns); + m_layout->addLayout(m_controlLayout, 0, 0, 1, columns); int i = 0; for (int row = 1; i < m_boxes.size(); ++row) { @@ -70,22 +88,68 @@ void MainWindow::resizeEvent(QResizeEvent * event) void MainWindow::networkSessionOpened() { - for (int i = 0; i < 1; ++i) { + for (int i = 0; i < 2; ++i) { MapBox * box = MapBox::createOnlineMap(this); box->addRectangle(55.1977, 5.87586, 47.5395, 15.2802); - //box->addRoute(QGeoCoordinate(50, 5.87586), QGeoCoordinate(47.5395, 15.2802)); + box->addRoute(QGeoCoordinate(50, 5.87586), QGeoCoordinate(47.5395, 15.2802)); addBox(box); } } -void MainWindow::timerEvent(QTimerEvent * event) +void MainWindow::panTimerHandler() { const qreal speed = 0.5; - qreal currentMovement = speed * qMin(300, eventTime.elapsed()); + qreal currentMovement = speed * qMin(300, panTime.restart()); foreach(MapBox * box, m_boxes) { box->map()->pan(currentMovement, 0); } - eventTime.restart(); +} + +void MainWindow::compareImages() +{ + if (m_boxes.size() < 2) { + m_errorLabel->hide(); + return; + } + + QImage firstBoxImage = m_boxes.first()->grab().toImage(); + + QStringList results; + + foreach (MapBox * box, m_boxes) { + if (results.isEmpty()) { + results << "N/A"; + continue; + } + + QImage currentImage = box->grab().toImage(); + if (currentImage.size() != firstBoxImage.size()) { + results << "sizes differ"; + continue; + } + + int errorCount = MapBox::countErrors(currentImage, firstBoxImage); + qreal squareError = MapBox::squareError(currentImage, firstBoxImage); + + results << QString("sqerr=%1, errcnt=%2").arg(squareError).arg(errorCount); + } + + results.removeFirst(); + m_errorLabel->setText(results.join(" | ")); + m_errorLabel->show(); +} + +void MainWindow::setAutoPanEnabled(bool enabled) +{ + if (enabled != m_panTimer->isActive()) { + if (enabled) { + panTime.start(); + m_panTimer->start(); + } + else { + m_panTimer->stop(); + } + } } diff --git a/tests/locationex/mainwindow.h b/tests/locationex/mainwindow.h index 8db30cf205..1684381097 100644 --- a/tests/locationex/mainwindow.h +++ b/tests/locationex/mainwindow.h @@ -6,7 +6,9 @@ class MapBox; class QGridLayout; +class QLayout; class QPushButton; +class QLabel; class MainWindow : public QMainWindow { @@ -14,9 +16,13 @@ class MainWindow : public QMainWindow private: QList<MapBox *> m_boxes; QGridLayout * m_layout; + QLayout * m_controlLayout; void addBox(MapBox * box); - QTime eventTime; + QTime panTime; QPushButton * m_cleanButton; + QPushButton * m_panToggle; + QLabel * m_errorLabel; + QTimer * m_panTimer; public: MainWindow(QWidget *parent = 0); @@ -24,9 +30,11 @@ public: private slots: void networkSessionOpened(); + void compareImages(); + void setAutoPanEnabled(bool enabled); + void panTimerHandler(); protected: - void timerEvent(QTimerEvent * event); void resizeEvent(QResizeEvent * event); }; diff --git a/tests/locationex/mapbox.cpp b/tests/locationex/mapbox.cpp index 8b39777383..c2aa816e87 100644 --- a/tests/locationex/mapbox.cpp +++ b/tests/locationex/mapbox.cpp @@ -101,7 +101,6 @@ void MapBox::timerEvent(QTimerEvent * event) MapBox::~MapBox() { - m_scene->removeItem(m_mapWidget); // EVIL workaround! } void MapBox::setProvider(const QString & providerId) @@ -133,7 +132,7 @@ void MapBox::createProvider() void MapBox::createMapWidget() { - // delete m_mapWidget; // TODO: uncomment, since this is an EVIL workaround + delete m_mapWidget; m_mapWidget = new QGraphicsGeoMap(m_mapManager); @@ -294,7 +293,7 @@ void MapBox::routeFinished() QPen pen(QColor(0, 0, 255, 127)); // blue, semi-transparent pen.setWidth(7); - pen.setCosmetic(true); + //pen.setCosmetic(true); pen.setCapStyle(Qt::RoundCap); QGeoMapRouteObject *route = new QGeoMapRouteObject(reply->routes().at(0)); @@ -362,7 +361,7 @@ qreal MapBox::squareError(const QImage & otherImage) qreal MapBox::squareError(const QImage & image1, const QImage & image2) { - qreal delta; + qreal delta = 0.0; for (int y = 0; y < image1.height(); ++y) { for (int x = 0; x < image1.width(); ++x) { @@ -377,7 +376,7 @@ qreal MapBox::squareError(const QImage & image1, const QImage & image2) } } - return std::sqrt(delta); + return std::sqrt(delta / (image1.height()*image1.width())); } int MapBox::countErrors(MapBox * other) @@ -401,7 +400,7 @@ int MapBox::countErrors(const QImage & otherImage) int MapBox::countErrors(const QImage & image1, const QImage & image2) { - int errors; + int errors = 0; for (int y = 0; y < image1.height(); ++y) { for (int x = 0; x < image1.width(); ++x) { @@ -431,8 +430,8 @@ int MapBox::countErrors(const QImage & image1, const QImage & image2) more plattforms? - network traffic - from other sources than the session, for the desktop + - Windows: Network Monitor + http://blogs.technet.com/netmon/archive/2008/09/17/network-monitor-3-2-has-arrived.aspx - render mode - sw/hw, but that's pretty static, no? - - remove EVIL workarounds after the "crash on deleting QGraphicsGeoMap" bug is fixed */ |