summaryrefslogtreecommitdiffstats
path: root/src/location/maps
diff options
context:
space:
mode:
authorjuhvu <qt-info@nokia.com>2011-10-20 11:24:34 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-20 07:08:21 +0200
commit0acb68f58dc276faea85c74311fee3920a99eac6 (patch)
tree43843899bad652d583eff61ec58438a4c6d5abfc /src/location/maps
parent8f765817b02e72356a0a4461b2889344fdc83dea (diff)
QML Map pinch and flick part 1/3
Autotest fw changes. First autotests and related fixes. Map initialization order changed to avoid blinking in hardcoded geocoordinate during app startup. Change-Id: Iaad879c135b6283957e0705b991474517f933485 Reviewed-by: David Laing <david.laing@nokia.com>
Diffstat (limited to 'src/location/maps')
-rw-r--r--src/location/maps/qgeomappingmanager.cpp23
-rw-r--r--src/location/maps/qgeomappingmanager.h2
-rw-r--r--src/location/maps/qgeomappingmanagerengine.cpp40
-rw-r--r--src/location/maps/qgeomappingmanagerengine.h2
-rw-r--r--src/location/maps/qgeomappingmanagerengine_p.h2
5 files changed, 66 insertions, 3 deletions
diff --git a/src/location/maps/qgeomappingmanager.cpp b/src/location/maps/qgeomappingmanager.cpp
index 6cc8a5fe..37a59c57 100644
--- a/src/location/maps/qgeomappingmanager.cpp
+++ b/src/location/maps/qgeomappingmanager.cpp
@@ -123,6 +123,11 @@ QGeoMappingManager::QGeoMappingManager(QGeoMappingManagerEngine *engine, QObject
SLOT(threadStarted()),
Qt::QueuedConnection);
+ connect(d_ptr->engine,
+ SIGNAL(initialized()),
+ this,
+ SIGNAL(initialized()));
+
d_ptr->engine->moveToThread(d_ptr->thread);
QTimer::singleShot(0, d_ptr->thread, SLOT(start()));
}
@@ -136,6 +141,13 @@ QGeoMappingManager::~QGeoMappingManager()
}
/*!
+ \fn void QGeoMappingManager::initialized()
+
+ This signal is emitted when the mapping manager has been initialized
+ and is ready to be used.
+*/
+
+/*!
Returns the name of the engine which implements the behaviour of this
mapping manager.
@@ -232,6 +244,17 @@ bool QGeoMappingManager::supportsBearing() const
}
/*!
+ Return whether the manager has been initialized
+ (will be done automatically but may take some time).
+
+*/
+bool QGeoMappingManager::isInitialized() const
+{
+ return d_ptr->engine->isInitialized();
+}
+
+
+/*!
Return whether tilting is supported by this manager.
*/
bool QGeoMappingManager::supportsTilting() const
diff --git a/src/location/maps/qgeomappingmanager.h b/src/location/maps/qgeomappingmanager.h
index deac7227..33d42426 100644
--- a/src/location/maps/qgeomappingmanager.h
+++ b/src/location/maps/qgeomappingmanager.h
@@ -94,6 +94,7 @@ public:
qreal maximumZoomLevel() const;
bool supportsBearing() const;
+ bool isInitialized() const;
bool supportsTilting() const;
qreal minimumTilt() const;
@@ -106,6 +107,7 @@ Q_SIGNALS:
void tileFinished(const TileSpec &spec, const QByteArray &bytes);
void tileError(const TileSpec &spec, const QString &errorString);
void queueFinished();
+ void initialized();
private:
QGeoMappingManager(QGeoMappingManagerEngine *engine, QObject *parent = 0);
diff --git a/src/location/maps/qgeomappingmanagerengine.cpp b/src/location/maps/qgeomappingmanagerengine.cpp
index b70cd5a8..242c2e02 100644
--- a/src/location/maps/qgeomappingmanagerengine.cpp
+++ b/src/location/maps/qgeomappingmanagerengine.cpp
@@ -79,6 +79,7 @@ QGeoMappingManagerEngine::QGeoMappingManagerEngine(const QMap<QString, QVariant>
d_ptr(new QGeoMappingManagerEnginePrivate())
{
d_ptr->parameters = parameters;
+ d_ptr->initialized = false;
}
/*!
@@ -103,8 +104,21 @@ QMap<QString, QVariant> QGeoMappingManagerEngine::parameters() const
return d->parameters;
}
+/*!
+ Initializes the engine. Subclasses of QGeoMappingManagerEngine may
+ implement this function to perform (potentially asynchronous) initialization.
+
+ Static/already known data (such as min/max zoom levels) is better to
+ initialize already earlier (e.g. in constructor).
+
+ Once subclasses are done with initialization, they should call this baseclass
+ implementation of init().
+*/
void QGeoMappingManagerEngine::init()
{
+ Q_D(QGeoMappingManagerEngine);
+ d->initialized = true;
+ emit initialized();
}
void QGeoMappingManagerEngine::threadStarted()
@@ -344,6 +358,17 @@ QSize QGeoMappingManagerEngine::tileSize() const
return d->tileSize;
}
+
+/*!
+ Return whether the engine has been initialized and is ready to be used.
+*/
+
+bool QGeoMappingManagerEngine::isInitialized() const
+{
+ Q_D(const QGeoMappingManagerEngine);
+ return d->initialized;
+}
+
/*!
Sets the minimum zoom level supported by this engine to \a minimumZoom.
@@ -360,6 +385,17 @@ void QGeoMappingManagerEngine::setMinimumZoomLevel(qreal minimumZoom)
}
/*!
+ \fn void QGeoMappingManagerEngine::initialized()
+
+ This signal is emitted when the mapping manager has been initialized
+ and is ready to be used.
+
+ Subclasses of QGeoMappingManagerEngine should call the
+ QGeoMappingManagerEngine init() when they have initialized themselves.
+*/
+
+
+/*!
Sets the maximum zoom level supported by this engine to \a maximumZoom.
Larger values of the zoom level correspond to more detailed views of the
@@ -503,8 +539,8 @@ QLocale QGeoMappingManagerEngine::locale() const
QGeoMappingManagerEnginePrivate::QGeoMappingManagerEnginePrivate()
: managerVersion(-1),
- minimumZoomLevel(1.0),
- maximumZoomLevel(20.0), // todo fixme, this needs to come from plugin
+ minimumZoomLevel(-2.0),
+ maximumZoomLevel(-2.0), // todo fixme, this needs to come from plugin
supportsBearing(false),
supportsTilting(false),
minimumTilt(0.0),
diff --git a/src/location/maps/qgeomappingmanagerengine.h b/src/location/maps/qgeomappingmanagerengine.h
index 9beb567b..d9df0017 100644
--- a/src/location/maps/qgeomappingmanagerengine.h
+++ b/src/location/maps/qgeomappingmanagerengine.h
@@ -97,6 +97,7 @@ public:
QLocale locale() const;
virtual void init();
+ bool isInitialized() const;
public Q_SLOTS:
void threadStarted();
@@ -110,6 +111,7 @@ Q_SIGNALS:
void tileFinished(const TileSpec &spec, const QByteArray &bytes);
void tileError(const TileSpec &spec, const QString &errorString);
void queueFinished();
+ void initialized();
protected:
QGeoMappingManagerEngine(QGeoMappingManagerEnginePrivate *dd, QObject *parent = 0);
diff --git a/src/location/maps/qgeomappingmanagerengine_p.h b/src/location/maps/qgeomappingmanagerengine_p.h
index e262cc2c..bbfed6f8 100644
--- a/src/location/maps/qgeomappingmanagerengine_p.h
+++ b/src/location/maps/qgeomappingmanagerengine_p.h
@@ -88,8 +88,8 @@ public:
qreal maximumTilt;
QLocale locale;
-
bool started_;
+ bool initialized;
QTimer *timer_;
QList<TileSpec> queue_;
QHash<QGeoTiledMapReply*, TileSpec> map_;