mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Prefer GPS positioning sources if available
This commit is contained in:
parent
3117127a3e
commit
d0e0ea32ab
@ -1059,13 +1059,7 @@ void GUI::openOptions()
|
|||||||
if (options.plugin != _options.plugin
|
if (options.plugin != _options.plugin
|
||||||
|| options.pluginParams.value(options.plugin)
|
|| options.pluginParams.value(options.plugin)
|
||||||
!= _options.pluginParams.value(_options.plugin)) {
|
!= _options.pluginParams.value(_options.plugin)) {
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
QGeoPositionInfoSource *source = positionSource(options);
|
||||||
QGeoPositionInfoSource *source = QGeoPositionInfoSource::createSource(
|
|
||||||
options.plugin, this);
|
|
||||||
#else // QT 5.14
|
|
||||||
QGeoPositionInfoSource *source = QGeoPositionInfoSource::createSource(
|
|
||||||
options.plugin, options.pluginParams.value(options.plugin), this);
|
|
||||||
#endif // QT 5.14
|
|
||||||
_showPositionAction->setEnabled(source != 0);
|
_showPositionAction->setEnabled(source != 0);
|
||||||
_mapView->setPositionSource(source);
|
_mapView->setPositionSource(source);
|
||||||
delete _positionSource;
|
delete _positionSource;
|
||||||
@ -2149,6 +2143,23 @@ void GUI::dropEvent(QDropEvent *event)
|
|||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QGeoPositionInfoSource *GUI::positionSource(const Options &options)
|
||||||
|
{
|
||||||
|
QGeoPositionInfoSource *source;
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||||
|
source = QGeoPositionInfoSource::createSource(options.plugin, this);
|
||||||
|
#else // QT 5.14
|
||||||
|
source = QGeoPositionInfoSource::createSource(options.plugin,
|
||||||
|
options.pluginParams.value(options.plugin), this);
|
||||||
|
#endif // QT 5.14
|
||||||
|
if (source)
|
||||||
|
source->setPreferredPositioningMethods(
|
||||||
|
QGeoPositionInfoSource::SatellitePositioningMethods);
|
||||||
|
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
void GUI::writeSettings()
|
void GUI::writeSettings()
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
@ -2794,13 +2805,7 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs)
|
|||||||
.toString();
|
.toString();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
_positionSource = positionSource(_options);
|
||||||
_positionSource = QGeoPositionInfoSource::createSource(_options.plugin,
|
|
||||||
this);
|
|
||||||
#else // QT 5.14
|
|
||||||
_positionSource = QGeoPositionInfoSource::createSource(_options.plugin,
|
|
||||||
_options.pluginParams.value(_options.plugin), this);
|
|
||||||
#endif // QT 5.14
|
|
||||||
_showPositionAction->setEnabled(_positionSource != 0);
|
_showPositionAction->setEnabled(_positionSource != 0);
|
||||||
|
|
||||||
settings.beginGroup(POSITION_SETTINGS_GROUP);
|
settings.beginGroup(POSITION_SETTINGS_GROUP);
|
||||||
|
@ -158,6 +158,7 @@ private:
|
|||||||
qreal time() const;
|
qreal time() const;
|
||||||
qreal movingTime() const;
|
qreal movingTime() const;
|
||||||
QAction *mapAction(const QString &name);
|
QAction *mapAction(const QString &name);
|
||||||
|
QGeoPositionInfoSource *positionSource(const Options &options);
|
||||||
void readSettings(QString &activeMap, QStringList &disabledPOIs);
|
void readSettings(QString &activeMap, QStringList &disabledPOIs);
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user