1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Fixed build with Qt < 5.14

This commit is contained in:
Martin Tůma 2021-12-05 18:14:31 +01:00
parent 2d43768f81
commit f5523b68a9
3 changed files with 19 additions and 0 deletions

View File

@ -1059,8 +1059,13 @@ void GUI::openOptions()
if (options.plugin != _options.plugin
|| options.pluginParams.value(options.plugin)
!= _options.pluginParams.value(_options.plugin)) {
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
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);
_mapView->setPositionSource(source);
delete _positionSource;
@ -2789,8 +2794,13 @@ void GUI::readSettings(QString &activeMap, QStringList &disabledPOIs)
.toString();
settings.endGroup();
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
_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);
settings.beginGroup(POSITION_SETTINGS_GROUP);

View File

@ -611,17 +611,21 @@ QWidget *OptionsDialog::createPositionPage()
_positionPlugin = new QComboBox();
_positionPlugin->addItems(plugins);
_positionPlugin->setCurrentIndex(_positionPlugin->findText(_options.plugin));
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
_pluginParameters = new PluginParameters(_positionPlugin->currentText(),
_options.pluginParams);
connect(_positionPlugin, &QComboBox::currentTextChanged, _pluginParameters,
&PluginParameters::setPlugin);
#endif // QT 5.14
QFormLayout *pluginLayout = new QFormLayout();
pluginLayout->addRow(tr("Plugin:"), _positionPlugin);
QVBoxLayout *sourceLayout = new QVBoxLayout();
sourceLayout->addLayout(pluginLayout);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
sourceLayout->addWidget(_pluginParameters);
#endif // QT 5.14
sourceLayout->addStretch();
QWidget *sourceTab = new QWidget();
@ -902,7 +906,9 @@ void OptionsDialog::accept()
_options.demPassword = _demAuth->password();
_options.plugin = _positionPlugin->currentText();
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
_options.pluginParams = _pluginParameters->parameters();
#endif // QT 5.14
_options.useOpenGL = _useOpenGL->isChecked();
_options.enableHTTP2 = _enableHTTP2->isChecked();

View File

@ -1,6 +1,7 @@
#ifndef OPTIONSDIALOG_H
#define OPTIONSDIALOG_H
#include <QtGlobal>
#include <QDialog>
#include "palette.h"
#include "units.h"
@ -176,7 +177,9 @@ private:
AuthenticationWidget *_demAuth;
// Position
QComboBox *_positionPlugin;
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
PluginParameters *_pluginParameters;
#endif // QT 5.14
// System
QSpinBox *_pixmapCache;
QSpinBox *_connectionTimeout;