diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-11-29 16:03:31 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-11-29 16:03:31 +0100 |
commit | 0a6191c01b6a855cb871286ac48c45d01b34310a (patch) | |
tree | b89f2182025809a2b425df1a5256388b151eeddb | |
parent | e376d9bb3a94d28c30c67baa7bc385baaf65a035 (diff) | |
parent | be13521707249d4d89085e6e850944056ab923f7 (diff) | |
download | qtlocation-0a6191c01b6a855cb871286ac48c45d01b34310a.tar.gz |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
.qmake.conf
Change-Id: I3c90652f618afcf6a5f26232558843b8e26d8164
7 files changed, 64 insertions, 26 deletions
diff --git a/.qmake.conf b/.qmake.conf index 16328b7d..efd0e68f 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,3 +1,4 @@ load(qt_build_config) +CONFIG += qt_example_installs MODULE_VERSION = 5.3.0 diff --git a/examples/positioning/flickr/flickr.pro b/examples/positioning/flickr/flickr.pro index 9014935d..1d7cce50 100644 --- a/examples/positioning/flickr/flickr.pro +++ b/examples/positioning/flickr/flickr.pro @@ -7,10 +7,9 @@ SOURCES += qmllocationflickr.cpp RESOURCES += \ flickr.qrc -OTHER_FILES += flickr.qml +OTHER_FILES += flickr.qml \ + flickrcommon/* \ + flickrmobile/* -target.path = $$[QT_INSTALL_EXAMPLES]/qtpositioning/flickr -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.qml flickrcommon flickrmobile -sources.path = $$[QT_INSTALL_EXAMPLES]/qtpositioning/flickr - -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/positioning/flickr +INSTALLS += target diff --git a/examples/positioning/logfilepositionsource/logfilepositionsource.pro b/examples/positioning/logfilepositionsource/logfilepositionsource.pro index bd00a169..59c0d86b 100644 --- a/examples/positioning/logfilepositionsource/logfilepositionsource.pro +++ b/examples/positioning/logfilepositionsource/logfilepositionsource.pro @@ -9,8 +9,7 @@ SOURCES = logfilepositionsource.cpp \ clientapplication.cpp \ main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtpositioning/logfilepositionsource -sources.files = $$SOURCES $$HEADERS *.pro simplelog.txt -sources.path = $$[QT_INSTALL_EXAMPLES]/qtpositioning/logfilepositionsource +EXAMPLE_FILES = simplelog.txt -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/positioning/logfilepositionsource +INSTALLS += target diff --git a/examples/positioning/weatherinfo/components/BigForecastIcon.qml b/examples/positioning/weatherinfo/components/BigForecastIcon.qml index 6583d6d3..16e99bf8 100644 --- a/examples/positioning/weatherinfo/components/BigForecastIcon.qml +++ b/examples/positioning/weatherinfo/components/BigForecastIcon.qml @@ -70,7 +70,10 @@ Item { Text { text: current.bottomText - font.pointSize: 28 + font.pointSize: 23 + wrapMode: Text.WordWrap + width: parent.width + horizontalAlignment: Text.AlignRight anchors { bottom: current.bottom right: current.right diff --git a/examples/positioning/weatherinfo/weatherinfo.pro b/examples/positioning/weatherinfo/weatherinfo.pro index 1470b8a0..e2b2102d 100644 --- a/examples/positioning/weatherinfo/weatherinfo.pro +++ b/examples/positioning/weatherinfo/weatherinfo.pro @@ -9,14 +9,13 @@ SOURCES += main.cpp \ OTHER_FILES += weatherinfo.qml \ components/WeatherIcon.qml \ components/ForecastIcon.qml \ - components/BigForecastIcon.qml + components/BigForecastIcon.qml \ + icons/* + RESOURCES += weatherinfo.qrc HEADERS += appmodel.h -#install -target.path = $$[QT_INSTALL_EXAMPLES]/qtpositioning/weatherinfo -sources.files = $$SOURCES $HEADERS $$RESOURCES $$FORMS *.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtpositioning/weatherinfo -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/positioning/weatherinfo +INSTALLS += target diff --git a/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.cpp b/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.cpp index 6dcedeec..ffa976a8 100644 --- a/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.cpp +++ b/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.cpp @@ -155,10 +155,10 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, QList<QGeoSatelli QGeoSatelliteInfoSourceGeoclueMaster::QGeoSatelliteInfoSourceGeoclueMaster(QObject *parent) : QGeoSatelliteInfoSource(parent), QGeoclueMaster(this), m_sat(0), m_error(NoError), - m_satellitesChangedConnected(false) + m_satellitesChangedConnected(false), m_running(false) { m_requestTimer.setSingleShot(true); - connect(&m_requestTimer, SIGNAL(timeout()), this, SIGNAL(requestTimeout())); + connect(&m_requestTimer, SIGNAL(timeout()), this, SLOT(requestUpdateTimeout())); } QGeoSatelliteInfoSourceGeoclueMaster::~QGeoSatelliteInfoSourceGeoclueMaster() @@ -170,7 +170,7 @@ bool QGeoSatelliteInfoSourceGeoclueMaster::init() { g_type_init(); - return configureSatelliteSource(); + return true; } int QGeoSatelliteInfoSourceGeoclueMaster::minimumUpdateInterval() const @@ -185,6 +185,16 @@ QGeoSatelliteInfoSource::Error QGeoSatelliteInfoSourceGeoclueMaster::error() con void QGeoSatelliteInfoSourceGeoclueMaster::startUpdates() { + if (m_running) + return; + + m_running = true; + + // Start Geoclue provider. + if (!hasMasterClient()) + configureSatelliteSource(); + + // m_sat is likely to be invalid until Geoclue master selects a position provider. if (!m_sat) return; @@ -193,13 +203,24 @@ void QGeoSatelliteInfoSourceGeoclueMaster::startUpdates() void QGeoSatelliteInfoSourceGeoclueMaster::stopUpdates() { - if (!m_sat) + if (!m_running) + return; + + if (m_sat) g_signal_handlers_disconnect_by_func(G_OBJECT(m_sat), gpointer(satellite_changed), this); + + m_running = false; + + // Only stop positioning if single update not requested. + if (!m_requestTimer.isActive()) { + cleanupSatelliteSource(); + releaseMasterClient(); + } } void QGeoSatelliteInfoSourceGeoclueMaster::requestUpdate(int timeout) { - if ((timeout < minimumUpdateInterval() && timeout != 0) || !m_sat) { + if (timeout < minimumUpdateInterval() && timeout != 0) { emit requestTimeout(); return; } @@ -207,8 +228,13 @@ void QGeoSatelliteInfoSourceGeoclueMaster::requestUpdate(int timeout) if (m_requestTimer.isActive()) return; + if (!hasMasterClient()) + configureSatelliteSource(); + m_requestTimer.start(qMax(timeout, minimumUpdateInterval())); - geoclue_satellite_get_satellite_async(m_sat, satellite_callback, this); + + if (m_sat) + geoclue_satellite_get_satellite_async(m_sat, satellite_callback, this); } void QGeoSatelliteInfoSourceGeoclueMaster::satelliteChanged(int timestamp, int satellitesUsed, @@ -252,6 +278,18 @@ void QGeoSatelliteInfoSourceGeoclueMaster::requestUpdateFinished(int timestamp, satelliteChanged(timestamp, satellitesUsed, satellitesVisible, usedPrn, satInfos); } +void QGeoSatelliteInfoSourceGeoclueMaster::requestUpdateTimeout() +{ + // If we end up here, there has not been a valid satellite info update. + emit requestTimeout(); + + // Only stop satellite info if regular updates not active. + if (!m_running) { + cleanupSatelliteSource(); + releaseMasterClient(); + } +} + void QGeoSatelliteInfoSourceGeoclueMaster::positionProviderChanged(const QByteArray &service, const QByteArray &path) { if (m_sat) @@ -326,9 +364,6 @@ void QGeoSatelliteInfoSourceGeoclueMaster::satellitesChanged(const QDBusMessage bool QGeoSatelliteInfoSourceGeoclueMaster::configureSatelliteSource() { - cleanupSatelliteSource(); - releaseMasterClient(); - return createMasterClient(GEOCLUE_ACCURACY_LEVEL_DETAILED, GEOCLUE_RESOURCE_GPS); } diff --git a/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.h b/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.h index 52cbb316..a770ee5f 100644 --- a/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.h +++ b/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.h @@ -78,6 +78,7 @@ public: const QList<int> &usedPrn, const QList<QGeoSatelliteInfo> &satInfos); private slots: + void requestUpdateTimeout(); void positionProviderChanged(const QByteArray &service, const QByteArray &path); void satellitesChanged(const QDBusMessage &message); @@ -91,6 +92,7 @@ private: QList<QGeoSatelliteInfo> m_inUse; Error m_error; bool m_satellitesChangedConnected; + bool m_running; }; QT_END_NAMESPACE |