1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 13:41:16 +01:00
GPXSee/src/GUI/optionsdialog.cpp

932 lines
33 KiB
C++
Raw Normal View History

2016-12-06 01:48:26 +01:00
#include <QVBoxLayout>
#include <QFormLayout>
#include <QDialogButtonBox>
#include <QListWidget>
#include <QListWidgetItem>
#include <QStackedWidget>
#include <QTabWidget>
#include <QSpinBox>
#include <QGroupBox>
#include <QCheckBox>
#include <QComboBox>
#include <QRadioButton>
2017-05-23 12:50:46 +02:00
#include <QLabel>
2016-12-06 01:48:26 +01:00
#include <QSysInfo>
#include <QButtonGroup>
2021-12-04 15:05:30 +01:00
#include <QGeoPositionInfoSource>
2016-12-06 01:48:26 +01:00
#include "icons.h"
#include "infolabel.h"
2016-12-06 01:48:26 +01:00
#include "colorbox.h"
#include "stylecombobox.h"
#include "oddspinbox.h"
#include "percentslider.h"
#include "projectioncombobox.h"
#include "dirselectwidget.h"
#include "authenticationwidget.h"
2021-12-04 15:05:30 +01:00
#include "pluginparameters.h"
2016-12-06 01:48:26 +01:00
#include "optionsdialog.h"
2016-12-06 01:48:26 +01:00
#define MENU_MARGIN 20
2016-12-07 21:38:36 +01:00
#define MENU_ICON_SIZE 32
2016-12-06 01:48:26 +01:00
#ifdef Q_OS_MAC
static QFrame *line()
{
QFrame *l = new QFrame();
l->setFrameShape(QFrame::HLine);
l->setFrameShadow(QFrame::Sunken);
return l;
}
2019-05-30 19:36:24 +02:00
#endif // Q_OS_MAC
2019-11-13 08:27:54 +01:00
void OptionsDialog::automaticPauseDetectionSet(bool set)
{
_pauseInterval->setEnabled(!set);
_pauseSpeed->setEnabled(!set);
}
2021-06-17 21:58:25 +02:00
QWidget *OptionsDialog::createMapPage()
{
_outputProjection = new ProjectionComboBox();
_outputProjection->setCurrentIndex(_outputProjection->findData(
_options.outputProjection));
_inputProjection = new ProjectionComboBox();
_inputProjection->setCurrentIndex(_inputProjection->findData(
_options.inputProjection));
InfoLabel *inInfo = new InfoLabel(tr("Select the proper projection of maps"
2021-06-29 23:11:56 +02:00
" without a projection definition (JNX, KMZ and world file maps)."));
InfoLabel *outInfo = new InfoLabel(tr("Select the desired projection of"
" vector maps (IMG and Mapsforge maps). The projection must be valid for"
2021-06-17 21:58:25 +02:00
" the whole map area."));
2017-12-03 14:18:41 +01:00
_hidpi = new QRadioButton(tr("High-resolution"));
_lodpi = new QRadioButton(tr("Standard"));
2020-09-27 00:34:38 +02:00
if (_options.hidpiMap)
_hidpi->setChecked(true);
else
_lodpi->setChecked(true);
InfoLabel *lhi = new InfoLabel(tr("Non-HiDPI maps are loaded as HiDPI maps. "
"The map is sharp but map objects are small/hard to read."));
InfoLabel *llo = new InfoLabel(tr("Non-HiDPI maps are loaded such as they are. "
"Map objects have the expected size but the map is blurry."));
2020-12-27 00:14:28 +01:00
QVBoxLayout *inLayout = new QVBoxLayout();
inLayout->addWidget(_inputProjection);
inLayout->addWidget(inInfo);
QVBoxLayout *outLayout = new QVBoxLayout();
outLayout->addWidget(_outputProjection);
outLayout->addWidget(outInfo);
#ifndef Q_OS_MAC
QGroupBox *inBox = new QGroupBox(tr("Input"));
inBox->setLayout(inLayout);
QGroupBox *outBox = new QGroupBox(tr("Output"));
outBox->setLayout(outLayout);
#endif // Q_OS_MAC
QWidget *projectionTab = new QWidget();
QVBoxLayout *projectionTabLayout = new QVBoxLayout();
2020-12-27 00:14:28 +01:00
#ifdef Q_OS_MAC
2020-12-27 00:15:41 +01:00
projectionTabLayout->addWidget(new QLabel(tr("Input:")));
projectionTabLayout->addLayout(inLayout);
projectionTabLayout->addWidget(line());
projectionTabLayout->addWidget(new QLabel(tr("Output:")));
projectionTabLayout->addLayout(outLayout);
2020-12-27 00:14:28 +01:00
#else // Q_OS_MAC
projectionTabLayout->addWidget(inBox);
projectionTabLayout->addWidget(outBox);
#endif // Q_OS_MAC
projectionTabLayout->addStretch();
projectionTab->setLayout(projectionTabLayout);
2017-12-03 14:18:41 +01:00
QVBoxLayout *hidpiTabLayout = new QVBoxLayout();
hidpiTabLayout->addWidget(_lodpi);
hidpiTabLayout->addWidget(llo);
hidpiTabLayout->addSpacing(10);
hidpiTabLayout->addWidget(_hidpi);
hidpiTabLayout->addWidget(lhi);
hidpiTabLayout->addStretch();
QWidget *hidpiTab = new QWidget();
hidpiTab->setLayout(hidpiTabLayout);
QTabWidget *mapPage = new QTabWidget();
mapPage->addTab(projectionTab, tr("Projection"));
mapPage->addTab(hidpiTab, tr("HiDPI display mode"));
return mapPage;
2017-12-03 14:18:41 +01:00
}
2016-12-06 01:48:26 +01:00
QWidget *OptionsDialog::createAppearancePage()
{
2019-01-31 01:46:53 +01:00
// Tracks
2016-12-06 01:48:26 +01:00
_trackWidth = new QSpinBox();
2020-09-27 00:34:38 +02:00
_trackWidth->setValue(_options.trackWidth);
2016-12-06 01:48:26 +01:00
_trackWidth->setMinimum(1);
_trackStyle = new StyleComboBox();
2020-09-27 00:34:38 +02:00
_trackStyle->setValue(_options.trackStyle);
2019-01-31 01:46:53 +01:00
// Routes
2016-12-06 01:48:26 +01:00
_routeWidth = new QSpinBox();
2020-09-27 00:34:38 +02:00
_routeWidth->setValue(_options.routeWidth);
2016-12-06 01:48:26 +01:00
_routeWidth->setMinimum(1);
_routeStyle = new StyleComboBox();
2020-09-27 00:34:38 +02:00
_routeStyle->setValue(_options.routeStyle);
// Areas
_areaWidth = new QSpinBox();
2020-09-27 00:34:38 +02:00
_areaWidth->setValue(_options.areaWidth);
_areaStyle = new StyleComboBox();
2020-09-27 00:34:38 +02:00
_areaStyle->setValue(_options.areaStyle);
_areaOpacity = new PercentSlider();
2020-09-27 00:34:38 +02:00
_areaOpacity->setValue(_options.areaOpacity);
2021-08-31 18:25:30 +02:00
// Palette & antialiasing
_baseColor = new ColorBox();
_baseColor->setColor(_options.palette.color());
_colorOffset = new PercentSlider();
_colorOffset->setValue(_options.palette.shift() * 100);
_pathAA = new QCheckBox(tr("Use anti-aliasing"));
_pathAA->setChecked(_options.pathAntiAliasing);
#ifdef Q_OS_MAC
2021-08-31 18:25:30 +02:00
QWidget *pathTab = new QWidget();
QFormLayout *pathTabLayout = new QFormLayout();
pathTabLayout->addRow(tr("Track width:"), _trackWidth);
pathTabLayout->addRow(tr("Track style:"), _trackStyle);
pathTabLayout->addRow(line());
pathTabLayout->addRow(tr("Route width:"), _routeWidth);
pathTabLayout->addRow(tr("Route style:"), _routeStyle);
pathTabLayout->addRow(line());
pathTabLayout->addRow(tr("Area border width:"), _areaWidth);
pathTabLayout->addRow(tr("Area border style:"), _areaStyle);
pathTabLayout->addRow(tr("Area fill opacity:"), _areaOpacity);
pathTabLayout->addRow(line());
pathTabLayout->addRow(tr("Base color:"), _baseColor);
pathTabLayout->addRow(tr("Palette shift:"), _colorOffset);
pathTabLayout->addRow(line());
pathTabLayout->addWidget(_pathAA);
pathTab->setLayout(pathTabLayout);
#else // Q_OS_MAC
2021-08-31 18:25:30 +02:00
QFormLayout *trackLayout = new QFormLayout();
trackLayout->addRow(tr("Width:"), _trackWidth);
trackLayout->addRow(tr("Style:"), _trackStyle);
QGroupBox *trackBox = new QGroupBox(tr("Tracks"));
trackBox->setLayout(trackLayout);
QFormLayout *routeLayout = new QFormLayout();
routeLayout->addRow(tr("Width:"), _routeWidth);
routeLayout->addRow(tr("Style:"), _routeStyle);
QGroupBox *routeBox = new QGroupBox(tr("Routes"));
routeBox->setLayout(routeLayout);
QFormLayout *areaLayout = new QFormLayout();
areaLayout->addRow(tr("Width:"), _areaWidth);
areaLayout->addRow(tr("Style:"), _areaStyle);
areaLayout->addRow(tr("Fill opacity:"), _areaOpacity);
QGroupBox *areaBox = new QGroupBox(tr("Areas"));
areaBox->setLayout(areaLayout);
2019-01-31 01:46:53 +01:00
QFormLayout *paletteLayout = new QFormLayout();
paletteLayout->addRow(tr("Base color:"), _baseColor);
paletteLayout->addRow(tr("Palette shift:"), _colorOffset);
2016-12-07 21:38:36 +01:00
QFormLayout *pathAALayout = new QFormLayout();
pathAALayout->addWidget(_pathAA);
2016-12-06 01:48:26 +01:00
QWidget *pathTab = new QWidget();
QVBoxLayout *pathTabLayout = new QVBoxLayout();
pathTabLayout->addWidget(trackBox);
pathTabLayout->addWidget(routeBox);
pathTabLayout->addWidget(areaBox);
2019-01-31 01:46:53 +01:00
pathTabLayout->addLayout(paletteLayout);
2016-12-07 21:38:36 +01:00
pathTabLayout->addLayout(pathAALayout);
2017-05-22 17:04:37 +02:00
pathTabLayout->addStretch();
2016-12-06 01:48:26 +01:00
pathTab->setLayout(pathTabLayout);
2021-08-31 18:25:30 +02:00
#endif // Q_OS_MAC
// Waypoints
_waypointSize = new QSpinBox();
2017-09-15 00:07:09 +02:00
_waypointSize->setMinimum(1);
2020-09-27 00:34:38 +02:00
_waypointSize->setValue(_options.waypointSize);
_waypointColor = new ColorBox();
2020-09-27 00:34:38 +02:00
_waypointColor->setColor(_options.waypointColor);
2021-08-31 18:25:30 +02:00
// POI
_poiSize = new QSpinBox();
2017-09-15 00:07:09 +02:00
_poiSize->setMinimum(1);
2020-09-27 00:34:38 +02:00
_poiSize->setValue(_options.poiSize);
_poiColor = new ColorBox();
2020-09-27 00:34:38 +02:00
_poiColor->setColor(_options.poiColor);
2021-08-31 18:25:30 +02:00
2017-09-15 00:07:09 +02:00
#ifdef Q_OS_MAC
2021-08-31 18:25:30 +02:00
QWidget *pointTab = new QWidget();
QFormLayout *pointTabLayout = new QFormLayout();
pointTabLayout->addRow(tr("Waypoint color:"), _waypointColor);
pointTabLayout->addRow(tr("Waypoint size:"), _waypointSize);
pointTabLayout->addRow(line());
pointTabLayout->addRow(tr("POI color:"), _poiColor);
pointTabLayout->addRow(tr("POI size:"), _poiSize);
pointTab->setLayout(pointTabLayout);
2017-09-15 00:07:09 +02:00
#else // Q_OS_MAC
2021-08-31 18:25:30 +02:00
QFormLayout *waypointLayout = new QFormLayout();
waypointLayout->addRow(tr("Color:"), _waypointColor);
waypointLayout->addRow(tr("Size:"), _waypointSize);
QGroupBox *waypointBox = new QGroupBox(tr("Waypoints"));
waypointBox->setLayout(waypointLayout);
QFormLayout *poiLayout = new QFormLayout();
2017-09-15 00:07:09 +02:00
poiLayout->addRow(tr("Color:"), _poiColor);
poiLayout->addRow(tr("Size:"), _poiSize);
QGroupBox *poiBox = new QGroupBox(tr("POIs"));
poiBox->setLayout(poiLayout);
QWidget *pointTab = new QWidget();
QVBoxLayout *pointTabLayout = new QVBoxLayout();
pointTabLayout->addWidget(waypointBox);
pointTabLayout->addWidget(poiBox);
pointTabLayout->addStretch();
pointTab->setLayout(pointTabLayout);
2021-08-31 18:25:30 +02:00
#endif // Q_OS_MAC
// Graphs
2017-12-03 00:36:52 +01:00
_sliderColor = new ColorBox();
2020-09-27 00:34:38 +02:00
_sliderColor->setColor(_options.sliderColor);
2016-12-06 01:48:26 +01:00
_graphWidth = new QSpinBox();
2020-09-27 00:34:38 +02:00
_graphWidth->setValue(_options.graphWidth);
2016-12-06 01:48:26 +01:00
_graphWidth->setMinimum(1);
2021-08-31 18:25:30 +02:00
_graphAA = new QCheckBox(tr("Use anti-aliasing"));
_graphAA->setChecked(_options.graphAntiAliasing);
2017-12-03 00:36:52 +01:00
2021-08-31 18:25:30 +02:00
#ifdef Q_OS_MAC
QWidget *graphTab = new QWidget();
QFormLayout *graphTabLayout = new QFormLayout();
graphTabLayout->addRow(tr("Line width:"), _graphWidth);
graphTabLayout->addRow(tr("Slider color:"), _sliderColor);
graphTabLayout->addWidget(_graphAA);
graphTab->setLayout(graphTabLayout);
#else // Q_OS_MAC
2016-12-06 01:48:26 +01:00
QFormLayout *graphLayout = new QFormLayout();
graphLayout->addRow(tr("Line width:"), _graphWidth);
2017-12-03 00:36:52 +01:00
graphLayout->addRow(tr("Slider color:"), _sliderColor);
2016-12-07 21:38:36 +01:00
QFormLayout *graphAALayout = new QFormLayout();
graphAALayout->addWidget(_graphAA);
2016-12-06 01:48:26 +01:00
QWidget *graphTab = new QWidget();
QVBoxLayout *graphTabLayout = new QVBoxLayout();
graphTabLayout->addLayout(graphLayout);
2016-12-07 21:38:36 +01:00
graphTabLayout->addLayout(graphAALayout);
2016-12-06 01:48:26 +01:00
graphTabLayout->addStretch();
graphTab->setLayout(graphTabLayout);
2021-08-31 18:25:30 +02:00
#endif // Q_OS_MAC
// Map
_mapOpacity = new PercentSlider();
2020-09-27 00:34:38 +02:00
_mapOpacity->setValue(_options.mapOpacity);
2017-09-15 00:07:09 +02:00
_backgroundColor = new ColorBox();
2020-09-27 00:34:38 +02:00
_backgroundColor->setColor(_options.backgroundColor);
_backgroundColor->enableAlphaChannel(false);
2021-12-04 15:05:30 +01:00
_crosshairColor = new ColorBox();
_crosshairColor->setColor(_options.crosshairColor);
_infoColor = new ColorBox();
_infoColor->setColor(_options.infoColor);
_infoBackground = new QCheckBox(tr("Info background"));
_infoBackground->setChecked(_options.infoBackground);
QFormLayout *mapLayout = new QFormLayout();
2017-09-15 00:07:09 +02:00
mapLayout->addRow(tr("Background color:"), _backgroundColor);
mapLayout->addRow(tr("Map opacity:"), _mapOpacity);
2021-12-04 15:05:30 +01:00
mapLayout->addRow(tr("Crosshair color:"), _crosshairColor);
mapLayout->addRow(tr("Info color:"), _infoColor);
mapLayout->addWidget(_infoBackground);
QWidget *mapTab = new QWidget();
QVBoxLayout *mapTabLayout = new QVBoxLayout();
mapTabLayout->addLayout(mapLayout);
mapTabLayout->addStretch();
mapTab->setLayout(mapTabLayout);
2016-12-06 01:48:26 +01:00
QTabWidget *appearancePage = new QTabWidget();
appearancePage->addTab(pathTab, tr("Paths"));
appearancePage->addTab(pointTab, tr("Points"));
2016-12-06 01:48:26 +01:00
appearancePage->addTab(graphTab, tr("Graphs"));
appearancePage->addTab(mapTab, tr("Map"));
2016-12-06 01:48:26 +01:00
return appearancePage;
}
2017-05-22 14:54:22 +02:00
QWidget *OptionsDialog::createDataPage()
{
QString filterToolTip = tr("Moving average window size");
_elevationFilter = new OddSpinBox();
2020-09-27 00:34:38 +02:00
_elevationFilter->setValue(_options.elevationFilter);
2017-05-22 14:54:22 +02:00
_elevationFilter->setToolTip(filterToolTip);
_speedFilter = new OddSpinBox();
2020-09-27 00:34:38 +02:00
_speedFilter->setValue(_options.speedFilter);
2017-05-22 14:54:22 +02:00
_speedFilter->setToolTip(filterToolTip);
_heartRateFilter = new OddSpinBox();
2020-09-27 00:34:38 +02:00
_heartRateFilter->setValue(_options.heartRateFilter);
2017-05-22 14:54:22 +02:00
_heartRateFilter->setToolTip(filterToolTip);
_cadenceFilter = new OddSpinBox();
2020-09-27 00:34:38 +02:00
_cadenceFilter->setValue(_options.cadenceFilter);
2017-05-22 14:54:22 +02:00
_cadenceFilter->setToolTip(filterToolTip);
_powerFilter = new OddSpinBox();
2020-09-27 00:34:38 +02:00
_powerFilter->setValue(_options.powerFilter);
2017-05-22 14:54:22 +02:00
_powerFilter->setToolTip(filterToolTip);
2021-08-31 18:25:30 +02:00
_outlierEliminate = new QCheckBox(tr("Eliminate GPS outliers"));
_outlierEliminate->setChecked(_options.outlierEliminate);
#ifdef Q_OS_MAC
QWidget *filterTab = new QWidget();
QFormLayout *filterTabLayout = new QFormLayout();
filterTabLayout->addWidget(new QLabel(tr("Smoothing")));
filterTabLayout->addRow(tr("Elevation:"), _elevationFilter);
filterTabLayout->addRow(tr("Speed:"), _speedFilter);
filterTabLayout->addRow(tr("Heart rate:"), _heartRateFilter);
filterTabLayout->addRow(tr("Cadence:"), _cadenceFilter);
filterTabLayout->addRow(tr("Power:"), _powerFilter);
filterTabLayout->addWidget(new QWidget());
filterTabLayout->addWidget(_outlierEliminate);
filterTab->setLayout(filterTabLayout);
#else // Q_OS_MAC
2017-05-22 17:04:37 +02:00
QFormLayout *smoothLayout = new QFormLayout();
smoothLayout->addRow(tr("Elevation:"), _elevationFilter);
smoothLayout->addRow(tr("Speed:"), _speedFilter);
smoothLayout->addRow(tr("Heart rate:"), _heartRateFilter);
smoothLayout->addRow(tr("Cadence:"), _cadenceFilter);
smoothLayout->addRow(tr("Power:"), _powerFilter);
2021-08-31 18:25:30 +02:00
QWidget *filterTab = new QWidget();
QVBoxLayout *filterTabLayout = new QVBoxLayout();
2017-05-22 17:04:37 +02:00
QGroupBox *smoothBox = new QGroupBox(tr("Smoothing"));
smoothBox->setLayout(smoothLayout);
2017-05-22 14:54:22 +02:00
QFormLayout *outlierLayout = new QFormLayout();
outlierLayout->addWidget(_outlierEliminate);
2017-05-22 17:04:37 +02:00
filterTabLayout->addWidget(smoothBox);
filterTabLayout->addLayout(outlierLayout);
2017-05-22 14:54:22 +02:00
filterTabLayout->addStretch();
filterTab->setLayout(filterTabLayout);
2021-08-31 18:25:30 +02:00
#endif // Q_OS_MAC
2017-05-22 17:04:37 +02:00
2019-11-13 08:27:54 +01:00
_automaticPause = new QRadioButton(tr("Automatic"));
2019-11-13 09:13:05 +01:00
_manualPause = new QRadioButton(tr("Custom"));
2020-09-27 00:34:38 +02:00
if (_options.automaticPause)
2019-11-13 08:27:54 +01:00
_automaticPause->setChecked(true);
else
_manualPause->setChecked(true);
2017-05-22 14:54:22 +02:00
_pauseSpeed = new QDoubleSpinBox();
_pauseSpeed->setDecimals(1);
_pauseSpeed->setSingleStep(0.1);
_pauseSpeed->setMinimum(0.1);
2019-11-13 08:27:54 +01:00
_pauseSpeed->setEnabled(_manualPause->isChecked());
2020-09-27 00:34:38 +02:00
if (_units == Imperial) {
_pauseSpeed->setValue(_options.pauseSpeed * MS2MIH);
2017-05-22 14:54:22 +02:00
_pauseSpeed->setSuffix(UNIT_SPACE + tr("mi/h"));
2020-09-27 00:34:38 +02:00
} else if (_units == Nautical) {
_pauseSpeed->setValue(_options.pauseSpeed * MS2KN);
2018-02-11 23:51:57 +01:00
_pauseSpeed->setSuffix(UNIT_SPACE + tr("kn"));
2017-05-22 14:54:22 +02:00
} else {
2020-09-27 00:34:38 +02:00
_pauseSpeed->setValue(_options.pauseSpeed * MS2KMH);
2017-05-22 14:54:22 +02:00
_pauseSpeed->setSuffix(UNIT_SPACE + tr("km/h"));
}
_pauseInterval = new QSpinBox();
_pauseInterval->setMinimum(1);
_pauseInterval->setSuffix(UNIT_SPACE + tr("s"));
2020-09-27 00:34:38 +02:00
_pauseInterval->setValue(_options.pauseInterval);
2019-11-13 08:27:54 +01:00
_pauseInterval->setEnabled(_manualPause->isChecked());
2021-04-28 00:01:07 +02:00
connect(_automaticPause, &QRadioButton::toggled, this,
&OptionsDialog::automaticPauseDetectionSet);
2019-11-13 08:27:54 +01:00
_computedSpeed = new QRadioButton(tr("Computed from distance/time"));
_reportedSpeed = new QRadioButton(tr("Recorded by device"));
2020-09-27 00:34:38 +02:00
if (_options.useReportedSpeed)
_reportedSpeed->setChecked(true);
2018-06-21 20:54:24 +02:00
else
_computedSpeed->setChecked(true);
_showSecondarySpeed = new QCheckBox(tr("Show secondary speed"));
2020-09-27 00:34:38 +02:00
_showSecondarySpeed->setChecked(_options.showSecondarySpeed);
_dataGPSElevation = new QRadioButton(tr("GPS data"));
_dataDEMElevation = new QRadioButton(tr("DEM data"));
2020-09-27 00:34:38 +02:00
if (_options.dataUseDEM)
_dataDEMElevation->setChecked(true);
else
_dataGPSElevation->setChecked(true);
_showSecondaryElevation = new QCheckBox(tr("Show secondary elevation"));
2020-09-27 00:34:38 +02:00
_showSecondaryElevation->setChecked(_options.showSecondaryElevation);
2020-05-20 21:00:36 +02:00
_utcZone = new QRadioButton(tr("UTC"));
_systemZone = new QRadioButton(tr("System"));
_customZone = new QRadioButton(tr("Custom"));
2020-09-27 00:34:38 +02:00
if (_options.timeZone.type() == TimeZoneInfo::UTC)
2020-05-20 21:00:36 +02:00
_utcZone->setChecked(true);
2020-09-27 00:34:38 +02:00
else if (_options.timeZone.type() == TimeZoneInfo::System)
2020-05-20 21:00:36 +02:00
_systemZone->setChecked(true);
else
_customZone->setChecked(true);
_timeZone = new QComboBox();
_timeZone->setEnabled(_customZone->isChecked());
QList<QByteArray> zones = QTimeZone::availableTimeZoneIds();
for (int i = 0; i < zones.size(); i++)
_timeZone->addItem(zones.at(i));
2020-09-27 00:34:38 +02:00
_timeZone->setCurrentText(_options.timeZone.customZone().id());
2021-04-28 00:01:07 +02:00
connect(_customZone, &QRadioButton::toggled, _timeZone,
&QComboBox::setEnabled);
2020-05-20 21:00:36 +02:00
QHBoxLayout *customZoneLayout = new QHBoxLayout();
customZoneLayout->addSpacing(20);
customZoneLayout->addWidget(_timeZone);
2020-09-20 22:18:35 +02:00
_useSegments = new QCheckBox(tr("Use segments"));
2020-09-27 00:34:38 +02:00
_useSegments->setChecked(_options.useSegments);
2020-09-20 22:18:35 +02:00
#ifdef Q_OS_MAC
2021-08-31 18:25:30 +02:00
QWidget *sourceTab = new QWidget();
QFormLayout *sourceTabLayout = new QFormLayout();
QButtonGroup *speedGroup = new QButtonGroup(this);
speedGroup->addButton(_computedSpeed);
speedGroup->addButton(_reportedSpeed);
QVBoxLayout *speedOptions = new QVBoxLayout();
speedOptions->addWidget(_computedSpeed);
speedOptions->addWidget(_reportedSpeed);
speedOptions->addWidget(_showSecondarySpeed);
QButtonGroup *elevationGroup = new QButtonGroup(this);
elevationGroup->addButton(_dataGPSElevation);
elevationGroup->addButton(_dataDEMElevation);
QVBoxLayout *elevationOptions = new QVBoxLayout();
2019-01-22 23:21:01 +01:00
elevationOptions->addWidget(_dataGPSElevation);
elevationOptions->addWidget(_dataDEMElevation);
elevationOptions->addWidget(_showSecondaryElevation);
2020-05-20 23:45:06 +02:00
QButtonGroup *timeZoneGroup = new QButtonGroup(this);
2020-05-20 21:00:36 +02:00
timeZoneGroup->addButton(_utcZone);
timeZoneGroup->addButton(_systemZone);
timeZoneGroup->addButton(_customZone);
QVBoxLayout *zoneOptions = new QVBoxLayout();
zoneOptions->addWidget(_utcZone);
zoneOptions->addWidget(_systemZone);
zoneOptions->addWidget(_customZone);
zoneOptions->addItem(customZoneLayout);
2021-08-31 18:25:30 +02:00
sourceTabLayout->addRow(tr("Speed:"), speedOptions);
sourceTabLayout->addRow(tr("Elevation:"), elevationOptions);
sourceTabLayout->addRow(tr("Time zone:"), zoneOptions);
sourceTabLayout->addRow(line());
sourceTabLayout->addWidget(_useSegments);
sourceTab->setLayout(sourceTabLayout);
#else // Q_OS_MAC
2021-08-31 18:25:30 +02:00
QWidget *sourceTab = new QWidget();
QVBoxLayout *sourceTabLayout = new QVBoxLayout();
QFormLayout *speedLayout = new QFormLayout();
QFormLayout *elevationLayout = new QFormLayout();
2020-05-20 21:00:36 +02:00
QFormLayout *timeZoneLayout = new QFormLayout();
2020-09-20 22:18:35 +02:00
QFormLayout *segmentsLayout = new QFormLayout();
speedLayout->addWidget(_computedSpeed);
speedLayout->addWidget(_reportedSpeed);
speedLayout->addWidget(_showSecondarySpeed);
QGroupBox *speedBox = new QGroupBox(tr("Speed"));
speedBox->setLayout(speedLayout);
elevationLayout->addWidget(_dataGPSElevation);
elevationLayout->addWidget(_dataDEMElevation);
elevationLayout->addWidget(_showSecondaryElevation);
QGroupBox *elevationBox = new QGroupBox(tr("Elevation"));
elevationBox->setLayout(elevationLayout);
2020-05-20 21:00:36 +02:00
timeZoneLayout->addWidget(_utcZone);
timeZoneLayout->addWidget(_systemZone);
timeZoneLayout->addWidget(_customZone);
timeZoneLayout->addItem(customZoneLayout);
QGroupBox *timeZoneBox = new QGroupBox(tr("Time zone"));
timeZoneBox->setLayout(timeZoneLayout);
2020-09-20 22:18:35 +02:00
segmentsLayout->addWidget(_useSegments);
sourceTabLayout->addWidget(speedBox);
sourceTabLayout->addWidget(elevationBox);
2020-05-20 21:00:36 +02:00
sourceTabLayout->addWidget(timeZoneBox);
2020-09-20 22:18:35 +02:00
sourceTabLayout->addLayout(segmentsLayout);
sourceTabLayout->addStretch();
sourceTab->setLayout(sourceTabLayout);
2021-08-31 18:25:30 +02:00
#endif // Q_OS_MAC
QHBoxLayout *pauseTypeLayout = new QHBoxLayout();
#ifdef Q_OS_MAC
pauseTypeLayout->addStretch();
#endif
pauseTypeLayout->addWidget(_automaticPause);
pauseTypeLayout->addWidget(_manualPause);
pauseTypeLayout->addStretch();
QFormLayout *pauseValuesLayout = new QFormLayout();
pauseValuesLayout->addRow(tr("Minimal speed:"), _pauseSpeed);
pauseValuesLayout->addRow(tr("Minimal duration:"), _pauseInterval);
QVBoxLayout *pauseLayout = new QVBoxLayout();
pauseLayout->addLayout(pauseTypeLayout);
pauseLayout->addLayout(pauseValuesLayout);
QWidget *pauseTab = new QWidget();
pauseTab->setLayout(pauseLayout);
2018-06-21 20:54:24 +02:00
QTabWidget *dataPage = new QTabWidget();
dataPage->addTab(sourceTab, tr("Sources"));
2021-08-31 18:25:30 +02:00
dataPage->addTab(filterTab, tr("Filtering"));
dataPage->addTab(pauseTab, tr("Pause detection"));
2017-05-22 14:54:22 +02:00
return dataPage;
2017-05-22 14:54:22 +02:00
}
2016-12-06 01:48:26 +01:00
QWidget *OptionsDialog::createPOIPage()
{
_poiRadius = new QDoubleSpinBox();
_poiRadius->setSingleStep(1);
_poiRadius->setDecimals(1);
2020-09-27 00:34:38 +02:00
if (_units == Imperial) {
_poiRadius->setValue(_options.poiRadius / MIINM);
2016-12-07 21:38:36 +01:00
_poiRadius->setSuffix(UNIT_SPACE + tr("mi"));
2020-09-27 00:34:38 +02:00
} else if (_units == Nautical) {
_poiRadius->setValue(_options.poiRadius / NMIINM);
2018-02-11 23:51:57 +01:00
_poiRadius->setSuffix(UNIT_SPACE + tr("nmi"));
2016-12-07 21:38:36 +01:00
} else {
2020-09-27 00:34:38 +02:00
_poiRadius->setValue(_options.poiRadius / KMINM);
2016-12-07 21:38:36 +01:00
_poiRadius->setSuffix(UNIT_SPACE + tr("km"));
}
2016-12-06 01:48:26 +01:00
QFormLayout *poiLayout = new QFormLayout();
poiLayout->addRow(tr("Radius:"), _poiRadius);
2016-12-06 01:48:26 +01:00
QWidget *poiTab = new QWidget();
poiTab->setLayout(poiLayout);
QTabWidget *poiPage = new QTabWidget();
poiPage->addTab(poiTab, tr("POI"));
return poiPage;
}
QWidget *OptionsDialog::createDEMPage()
{
_demURL = new QLineEdit();
2021-08-31 18:25:30 +02:00
_demURL->setMinimumWidth(300);
_demURL->setText(_options.demURL);
_demAuth = new AuthenticationWidget();
_demAuth->setUsername(_options.demUsername);
_demAuth->setPassword(_options.demPassword);
_demAuth->setEnabled(_options.demAuthorization);
QCheckBox *useAuth = new QCheckBox(tr("Use HTTP authentication"));
useAuth->setChecked(_demAuth->isEnabled());
connect(useAuth, &QRadioButton::toggled, _demAuth,
&AuthenticationWidget::setEnabled);
2021-08-31 18:25:30 +02:00
InfoLabel *info = new InfoLabel(
tr("Use $lat and $lon for NYY/SYY and EXXX/WXXX in the URL."));
2021-09-01 13:08:34 +02:00
info->setMinimumWidth(_demURL->minimumWidth());
2021-08-31 18:25:30 +02:00
#ifdef Q_OS_MAC
QFormLayout *sourceLayout = new QFormLayout();
sourceLayout->addRow(tr("URL:"), _demURL);
sourceLayout->addWidget(info);
sourceLayout->addWidget(new QWidget());
sourceLayout->addWidget(useAuth);
sourceLayout->addWidget(_demAuth);
sourceLayout->setAlignment(_demAuth, Qt::AlignLeft);
QWidget *sourceTab = new QWidget();
sourceTab->setLayout(sourceLayout);
#else // Q_OS_MAC
2021-08-31 22:55:32 +02:00
QVBoxLayout *urlValueLayout = new QVBoxLayout();
urlValueLayout->addWidget(_demURL);
urlValueLayout->addWidget(info);
QFormLayout *urlLayout = new QFormLayout();
2021-08-31 22:55:32 +02:00
urlLayout->addRow(tr("URL:"), urlValueLayout);
QVBoxLayout *sourceLayout = new QVBoxLayout();
sourceLayout->addLayout(urlLayout);
sourceLayout->addSpacing(10);
sourceLayout->addWidget(useAuth);
sourceLayout->addWidget(_demAuth);
sourceLayout->addStretch();
QWidget *sourceTab = new QWidget();
sourceTab->setLayout(sourceLayout);
2021-08-31 18:25:30 +02:00
#endif // Q_OS_MAC
QTabWidget *demPage = new QTabWidget();
demPage->addTab(sourceTab, tr("Source"));
return demPage;
}
2021-12-04 15:05:30 +01:00
QWidget *OptionsDialog::createPositionPage()
{
QStringList plugins(QGeoPositionInfoSource::availableSources());
_positionPlugin = new QComboBox();
_positionPlugin->addItems(plugins);
_positionPlugin->setCurrentIndex(_positionPlugin->findText(_options.plugin));
2021-12-05 18:14:31 +01:00
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
2021-12-04 15:05:30 +01:00
_pluginParameters = new PluginParameters(_positionPlugin->currentText(),
_options.pluginParams);
connect(_positionPlugin, &QComboBox::currentTextChanged, _pluginParameters,
&PluginParameters::setPlugin);
2021-12-05 18:14:31 +01:00
#endif // QT 5.14
2021-12-04 15:05:30 +01:00
QFormLayout *pluginLayout = new QFormLayout();
pluginLayout->addRow(tr("Plugin:"), _positionPlugin);
QVBoxLayout *sourceLayout = new QVBoxLayout();
sourceLayout->addLayout(pluginLayout);
2021-12-05 18:14:31 +01:00
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
2021-12-04 15:05:30 +01:00
sourceLayout->addWidget(_pluginParameters);
2021-12-05 18:14:31 +01:00
#endif // QT 5.14
2021-12-04 15:05:30 +01:00
sourceLayout->addStretch();
QWidget *sourceTab = new QWidget();
sourceTab->setLayout(sourceLayout);
QTabWidget *positionPage = new QTabWidget();
positionPage->addTab(sourceTab, tr("Source"));
return positionPage;
}
QWidget *OptionsDialog::createExportPage()
{
_wysiwyg = new QRadioButton(tr("WYSIWYG"));
2017-08-30 13:56:23 +02:00
_hires = new QRadioButton(tr("High-Resolution"));
2020-09-27 00:34:38 +02:00
if (_options.hiresPrint)
_hires->setChecked(true);
else
_wysiwyg->setChecked(true);
InfoLabel *lw = new InfoLabel(tr("The printed area is approximately the "
"display area. The map zoom level does not change."));
InfoLabel *lh = new InfoLabel(tr("The zoom level will be changed so that"
2017-08-30 13:56:23 +02:00
" the whole content (tracks/waypoints) fits to the printed area and"
" the map resolution is as close as possible to the print resolution."));
QVBoxLayout *modeTabLayout = new QVBoxLayout();
modeTabLayout->addWidget(_wysiwyg);
modeTabLayout->addWidget(lw);
modeTabLayout->addSpacing(10);
modeTabLayout->addWidget(_hires);
modeTabLayout->addWidget(lh);
modeTabLayout->addStretch();
QWidget *modeTab = new QWidget();
modeTab->setLayout(modeTabLayout);
_name = new QCheckBox(tr("Name"));
2020-09-27 00:34:38 +02:00
_name->setChecked(_options.printName);
_date = new QCheckBox(tr("Date"));
2020-09-27 00:34:38 +02:00
_date->setChecked(_options.printDate);
_distance = new QCheckBox(tr("Distance"));
2020-09-27 00:34:38 +02:00
_distance->setChecked(_options.printDistance);
_time = new QCheckBox(tr("Time"));
2020-09-27 00:34:38 +02:00
_time->setChecked(_options.printTime);
_movingTime = new QCheckBox(tr("Moving time"));
2020-09-27 00:34:38 +02:00
_movingTime->setChecked(_options.printMovingTime);
_itemCount = new QCheckBox(tr("Item count (>1)"));
2020-09-27 00:34:38 +02:00
_itemCount->setChecked(_options.printItemCount);
QFormLayout *headerTabLayout = new QFormLayout();
headerTabLayout->addWidget(_name);
headerTabLayout->addWidget(_date);
headerTabLayout->addWidget(_distance);
headerTabLayout->addWidget(_time);
headerTabLayout->addWidget(_movingTime);
headerTabLayout->addItem(new QSpacerItem(10, 10));
headerTabLayout->addWidget(_itemCount);
QWidget *headerTab = new QWidget();
headerTab->setLayout(headerTabLayout);
_separateGraphPage = new QCheckBox(tr("Separate graph page"));
2020-09-27 00:34:38 +02:00
_separateGraphPage->setChecked(_options.separateGraphPage);
QFormLayout *graphTabLayout = new QFormLayout();
graphTabLayout->addWidget(_separateGraphPage);
QWidget *graphTab = new QWidget();
graphTab->setLayout(graphTabLayout);
QTabWidget *exportPage = new QTabWidget();
exportPage->addTab(modeTab, tr("Print mode"));
exportPage->addTab(headerTab, tr("Header"));
exportPage->addTab(graphTab, tr("Graphs"));
return exportPage;
}
2016-12-06 01:48:26 +01:00
QWidget *OptionsDialog::createSystemPage()
{
_useOpenGL = new QCheckBox(tr("Use OpenGL"));
2020-09-27 00:34:38 +02:00
_useOpenGL->setChecked(_options.useOpenGL);
2018-07-23 23:53:58 +02:00
_enableHTTP2 = new QCheckBox(tr("Enable HTTP/2"));
2020-09-27 00:34:38 +02:00
_enableHTTP2->setChecked(_options.enableHTTP2);
2016-12-06 01:48:26 +01:00
_pixmapCache = new QSpinBox();
_pixmapCache->setMinimum(16);
_pixmapCache->setMaximum(1024);
_pixmapCache->setSuffix(UNIT_SPACE + tr("MB"));
2020-09-27 00:34:38 +02:00
_pixmapCache->setValue(_options.pixmapCache);
_connectionTimeout = new QSpinBox();
_connectionTimeout->setMinimum(30);
_connectionTimeout->setMaximum(120);
_connectionTimeout->setSuffix(UNIT_SPACE + tr("s"));
2020-09-27 00:34:38 +02:00
_connectionTimeout->setValue(_options.connectionTimeout);
2021-08-31 18:25:30 +02:00
#ifdef Q_OS_MAC
QWidget *systemTab = new QWidget();
QFormLayout *systemTabLayout = new QFormLayout();
systemTabLayout->addRow(tr("Image cache size:"), _pixmapCache);
systemTabLayout->addRow(tr("Connection timeout:"), _connectionTimeout);
systemTabLayout->addWidget(_enableHTTP2);
systemTabLayout->addWidget(_useOpenGL);
systemTab->setLayout(systemTabLayout);
#else // Q_OS_MAC
QFormLayout *formLayout = new QFormLayout();
formLayout->addRow(tr("Image cache size:"), _pixmapCache);
formLayout->addRow(tr("Connection timeout:"), _connectionTimeout);
QFormLayout *checkboxLayout = new QFormLayout();
2018-07-23 23:53:58 +02:00
checkboxLayout->addWidget(_enableHTTP2);
checkboxLayout->addWidget(_useOpenGL);
2016-12-06 01:48:26 +01:00
QWidget *systemTab = new QWidget();
QVBoxLayout *systemTabLayout = new QVBoxLayout();
systemTabLayout->addLayout(formLayout);
systemTabLayout->addLayout(checkboxLayout);
systemTabLayout->addStretch();
systemTab->setLayout(systemTabLayout);
2021-08-31 18:25:30 +02:00
#endif // Q_OS_MAC
2016-12-06 01:48:26 +01:00
_dataPath = new DirSelectWidget();
_dataPath->setDir(_options.dataPath);
_mapsPath = new DirSelectWidget();
_mapsPath->setDir(_options.mapsPath);
_poiPath = new DirSelectWidget();
_poiPath->setDir(_options.poiPath);
InfoLabel *info = new InfoLabel(tr("Select the initial paths of the file"
" open dialogues. Leave the field empty for the system default."));
QFormLayout *pathsFormLayout = new QFormLayout();
pathsFormLayout->addRow(tr("Data:"), _dataPath);
pathsFormLayout->addRow(tr("Maps:"), _mapsPath);
pathsFormLayout->addRow(tr("POI:"), _poiPath);
QWidget *pathsTab = new QWidget();
QVBoxLayout *pathsTabLayout = new QVBoxLayout();
pathsTabLayout->addLayout(pathsFormLayout);
pathsTabLayout->addWidget(info);
pathsTabLayout->addStretch();
pathsTab->setLayout(pathsTabLayout);
2016-12-06 01:48:26 +01:00
QTabWidget *systemPage = new QTabWidget();
systemPage->addTab(systemTab, tr("System"));
systemPage->addTab(pathsTab, tr("Initial paths"));
2016-12-06 01:48:26 +01:00
return systemPage;
}
2020-09-27 00:34:38 +02:00
OptionsDialog::OptionsDialog(Options &options, Units units, QWidget *parent)
: QDialog(parent), _options(options), _units(units)
2016-12-06 01:48:26 +01:00
{
QStackedWidget *pages = new QStackedWidget();
pages->addWidget(createAppearancePage());
pages->addWidget(createMapPage());
2017-05-22 14:54:22 +02:00
pages->addWidget(createDataPage());
2016-12-06 01:48:26 +01:00
pages->addWidget(createPOIPage());
pages->addWidget(createDEMPage());
2021-12-04 15:05:30 +01:00
pages->addWidget(createPositionPage());
pages->addWidget(createExportPage());
2016-12-06 01:48:26 +01:00
pages->addWidget(createSystemPage());
QListWidget *menu = new QListWidget();
2016-12-07 21:38:36 +01:00
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
2018-08-18 21:06:36 +02:00
new QListWidgetItem(QIcon(APPEARANCE_ICON), tr("Appearance"),
2016-12-06 01:48:26 +01:00
menu);
new QListWidgetItem(QIcon(MAPS_ICON), tr("Maps"), menu);
2018-08-18 21:06:36 +02:00
new QListWidgetItem(QIcon(DATA_ICON), tr("Data"), menu);
new QListWidgetItem(QIcon(POI_ICON), tr("POI"), menu);
new QListWidgetItem(QIcon(DEM_ICON), tr("DEM"), menu);
2021-12-04 15:05:30 +01:00
new QListWidgetItem(QIcon(POSITION_ICON), tr("Position"), menu);
2018-08-18 21:06:36 +02:00
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), tr("Print & Export"),
menu);
2018-08-18 21:06:36 +02:00
new QListWidgetItem(QIcon(SYSTEM_ICON), tr("System"), menu);
2016-12-06 01:48:26 +01:00
QHBoxLayout *contentLayout = new QHBoxLayout();
contentLayout->addWidget(menu);
contentLayout->addWidget(pages);
menu->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
menu->setMaximumWidth(menu->sizeHintForColumn(0) + 2 * menu->frameWidth()
+ MENU_MARGIN);
pages->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
pages->setMinimumWidth(2 * menu->size().width());
2021-04-28 00:01:07 +02:00
connect(menu, &QListWidget::currentRowChanged, pages,
&QStackedWidget::setCurrentIndex);
2016-12-06 01:48:26 +01:00
menu->item(0)->setSelected(true);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel);
2021-04-28 00:01:07 +02:00
connect(buttonBox, &QDialogButtonBox::accepted, this,
&OptionsDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this,
&OptionsDialog::reject);
2016-12-06 01:48:26 +01:00
QVBoxLayout *layout = new QVBoxLayout;
layout->addLayout(contentLayout);
layout->addWidget(buttonBox);
#ifdef Q_OS_MAC
layout->setSizeConstraint(QLayout::SetFixedSize);
#endif // Q_OS_MAC
2016-12-06 01:48:26 +01:00
setLayout(layout);
setWindowTitle(tr("Options"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
void OptionsDialog::accept()
{
2020-09-27 00:34:38 +02:00
_options.palette.setColor(_baseColor->color());
_options.palette.setShift(_colorOffset->value() / 100.0);
_options.mapOpacity = _mapOpacity->value();
_options.backgroundColor = _backgroundColor->color();
2021-12-04 15:05:30 +01:00
_options.crosshairColor = _crosshairColor->color();
_options.infoColor = _infoColor->color();
_options.infoBackground = _infoBackground->isChecked();
2020-09-27 00:34:38 +02:00
_options.trackWidth = _trackWidth->value();
_options.trackStyle = (Qt::PenStyle) _trackStyle->itemData(
2016-12-06 01:48:26 +01:00
_trackStyle->currentIndex()).toInt();
2020-09-27 00:34:38 +02:00
_options.routeWidth = _routeWidth->value();
_options.routeStyle = (Qt::PenStyle) _routeStyle->itemData(
2016-12-06 01:48:26 +01:00
_routeStyle->currentIndex()).toInt();
2020-09-27 00:34:38 +02:00
_options.pathAntiAliasing = _pathAA->isChecked();
_options.areaWidth = _areaWidth->value();
_options.areaStyle = (Qt::PenStyle) _areaStyle->itemData(
2019-01-31 01:46:53 +01:00
_areaStyle->currentIndex()).toInt();
2020-09-27 00:34:38 +02:00
_options.areaOpacity = _areaOpacity->value();
_options.waypointSize = _waypointSize->value();
_options.waypointColor = _waypointColor->color();
_options.poiSize = _poiSize->value();
_options.poiColor = _poiColor->color();
_options.graphWidth = _graphWidth->value();
_options.sliderColor = _sliderColor->color();
_options.graphAntiAliasing = _graphAA->isChecked();
_options.outputProjection = _outputProjection->itemData(
_outputProjection->currentIndex()).toInt();
_options.inputProjection = _inputProjection->itemData(
_inputProjection->currentIndex()).toInt();
2020-09-27 00:34:38 +02:00
_options.hidpiMap = _hidpi->isChecked();
2020-09-27 00:34:38 +02:00
_options.elevationFilter = _elevationFilter->value();
_options.speedFilter = _speedFilter->value();
_options.heartRateFilter = _heartRateFilter->value();
_options.cadenceFilter = _cadenceFilter->value();
_options.powerFilter = _powerFilter->value();
_options.outlierEliminate = _outlierEliminate->isChecked();
_options.automaticPause = _automaticPause->isChecked();
qreal pauseSpeed = (_units == Imperial)
? _pauseSpeed->value() / MS2MIH : (_units == Nautical)
2018-02-11 23:51:57 +01:00
? _pauseSpeed->value() / MS2KN : _pauseSpeed->value() / MS2KMH;
2020-09-27 00:34:38 +02:00
if (qAbs(pauseSpeed - _options.pauseSpeed) > 0.01)
_options.pauseSpeed = pauseSpeed;
_options.pauseInterval = _pauseInterval->value();
_options.useReportedSpeed = _reportedSpeed->isChecked();
_options.dataUseDEM = _dataDEMElevation->isChecked();
_options.showSecondaryElevation = _showSecondaryElevation->isChecked();
_options.showSecondarySpeed = _showSecondarySpeed->isChecked();
_options.timeZone.setType(_utcZone->isChecked()
2020-05-20 21:00:36 +02:00
? TimeZoneInfo::UTC : _systemZone->isChecked()
? TimeZoneInfo::System : TimeZoneInfo::Custom);
2020-09-27 00:34:38 +02:00
_options.timeZone.setCustomZone(QTimeZone(_timeZone->currentText()
2020-05-20 21:00:36 +02:00
.toLatin1()));
2020-09-27 00:34:38 +02:00
_options.useSegments = _useSegments->isChecked();
2017-05-22 14:54:22 +02:00
2020-09-27 00:34:38 +02:00
qreal poiRadius = (_units == Imperial)
? _poiRadius->value() * MIINM : (_units == Nautical)
2018-02-11 23:51:57 +01:00
? _poiRadius->value() * NMIINM : _poiRadius->value() * KMINM;
2020-09-27 00:34:38 +02:00
if (qAbs(poiRadius - _options.poiRadius) > 0.01)
_options.poiRadius = poiRadius;
2016-12-06 01:48:26 +01:00
_options.demURL = _demURL->text();
_options.demAuthorization = _demAuth->isEnabled();
_options.demUsername = _demAuth->username();
_options.demPassword = _demAuth->password();
2021-12-04 15:05:30 +01:00
_options.plugin = _positionPlugin->currentText();
2021-12-05 18:14:31 +01:00
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
2021-12-04 15:05:30 +01:00
_options.pluginParams = _pluginParameters->parameters();
2021-12-05 18:14:31 +01:00
#endif // QT 5.14
2021-12-04 15:05:30 +01:00
2020-09-27 00:34:38 +02:00
_options.useOpenGL = _useOpenGL->isChecked();
_options.enableHTTP2 = _enableHTTP2->isChecked();
_options.pixmapCache = _pixmapCache->value();
_options.connectionTimeout = _connectionTimeout->value();
_options.dataPath = _dataPath->dir();
_options.mapsPath = _mapsPath->dir();
_options.poiPath = _poiPath->dir();
2020-09-27 00:34:38 +02:00
_options.hiresPrint = _hires->isChecked();
_options.printName = _name->isChecked();
_options.printDate = _date->isChecked();
_options.printDistance = _distance->isChecked();
_options.printTime = _time->isChecked();
_options.printMovingTime = _movingTime->isChecked();
_options.printItemCount = _itemCount->isChecked();
_options.separateGraphPage = _separateGraphPage->isChecked();
2016-12-06 01:48:26 +01:00
QDialog::accept();
}