mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Properly use the default positioning plugin as the default option
This commit is contained in:
parent
973abedf3e
commit
d6d316676c
@ -263,6 +263,7 @@ SOURCES += src/main.cpp \
|
||||
src/GUI/motioninfoitem.cpp \
|
||||
src/GUI/navigationwidget.cpp \
|
||||
src/GUI/pluginparameters.cpp \
|
||||
src/GUI/settings.cpp \
|
||||
src/common/coordinates.cpp \
|
||||
src/common/rectc.cpp \
|
||||
src/common/range.cpp \
|
||||
|
@ -2641,8 +2641,8 @@ void GUI::writeSettings()
|
||||
settings.setValue(DEM_USERNAME_SETTING, _options.demUsername);
|
||||
if (_options.demPassword != DEM_PASSWORD_DEFAULT)
|
||||
settings.setValue(DEM_PASSWORD_SETTING, _options.demPassword);
|
||||
// the plugins order is random so always store the value
|
||||
settings.setValue(POSITION_PLUGIN_SETTING, _options.plugin);
|
||||
if (_options.plugin != POSITION_PLUGIN_DEFAULT)
|
||||
settings.setValue(POSITION_PLUGIN_SETTING, _options.plugin);
|
||||
index = 0;
|
||||
for (QMap<QString, QVariantMap>::const_iterator it
|
||||
= _options.pluginParams.constBegin();
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define MARKERINFOITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QFont>
|
||||
#include "format.h"
|
||||
|
||||
class Coordinates;
|
||||
|
22
src/GUI/settings.cpp
Normal file
22
src/GUI/settings.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include <QGeoPositionInfoSource>
|
||||
#include "settings.h"
|
||||
|
||||
static QString defaultPlugin()
|
||||
{
|
||||
QString source;
|
||||
|
||||
QGeoPositionInfoSource *ps = QGeoPositionInfoSource::createDefaultSource(0);
|
||||
if (!ps)
|
||||
return source;
|
||||
|
||||
source = ps->sourceName();
|
||||
delete ps;
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
const QString &Settings::positionPlugin()
|
||||
{
|
||||
static QString plugin(defaultPlugin());
|
||||
return plugin;
|
||||
}
|
@ -1,14 +1,21 @@
|
||||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QLocale>
|
||||
#include <QDir>
|
||||
#include <QPageLayout>
|
||||
#include <QPageSize>
|
||||
#include "common/config.h"
|
||||
#include "common/util.h"
|
||||
#include "data/graph.h"
|
||||
#include "format.h"
|
||||
#include "units.h"
|
||||
#include "timetype.h"
|
||||
#include "markerinfoitem.h"
|
||||
|
||||
|
||||
#define IMPERIAL_UNITS() \
|
||||
(QLocale::system().measurementSystem() == QLocale::ImperialSystem)
|
||||
#define POSITION_PLUGIN() \
|
||||
(QGeoPositionInfoSource::availableSources().isEmpty() \
|
||||
? "" : QGeoPositionInfoSource::availableSources().first())
|
||||
#define CURRENT_PATH(filename) \
|
||||
QDir::current().filePath(filename)
|
||||
|
||||
@ -214,7 +221,7 @@
|
||||
#define DEM_PASSWORD_SETTING "demPassword"
|
||||
#define DEM_PASSWORD_DEFAULT ""
|
||||
#define POSITION_PLUGIN_SETTING "positionPlugin"
|
||||
#define POSITION_PLUGIN_DEFAULT POSITION_PLUGIN()
|
||||
#define POSITION_PLUGIN_DEFAULT Settings::positionPlugin()
|
||||
#define POSITION_PLUGIN_PARAMS_PREFIX "pluginParameters"
|
||||
#define POSITION_PLUGIN_PARAMS_PLUGIN "plugin"
|
||||
#define POSITION_PLUGIN_PARAMS_PARAM "parameters"
|
||||
@ -255,10 +262,15 @@
|
||||
#define HIDPI_MAP_SETTING "HiDPIMap"
|
||||
#define HIDPI_MAP_DEFAULT true
|
||||
#define DATA_PATH_SETTING "dataPath"
|
||||
#define DATA_PATH_DEFAULT QString()
|
||||
#define DATA_PATH_DEFAULT ""
|
||||
#define MAPS_PATH_SETTING "mapsPath"
|
||||
#define MAPS_PATH_DEFAULT QString()
|
||||
#define MAPS_PATH_DEFAULT ""
|
||||
#define POI_PATH_SETTING "poiPath"
|
||||
#define POI_PATH_DEFAULT QString()
|
||||
#define POI_PATH_DEFAULT ""
|
||||
|
||||
namespace Settings
|
||||
{
|
||||
const QString &positionPlugin();
|
||||
}
|
||||
|
||||
#endif // SETTINGS_H
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
#include <cmath>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user