3 #include <QDialogButtonBox>
5 #include <QListWidgetItem>
6 #include <QStackedWidget>
12 #include <QRadioButton>
17 #include "stylecombobox.h"
18 #include "oddspinbox.h"
19 #include "percentslider.h"
20 #include "optionsdialog.h"
23 #define MENU_MARGIN 20
24 #define MENU_ICON_SIZE 32
29 QFrame
*l
= new QFrame();
30 l
->setFrameShape(QFrame::HLine
);
31 l
->setFrameShadow(QFrame::Sunken
);
37 QWidget
*OptionsDialog::createMapPage()
39 _alwaysShowMap
= new QCheckBox(tr("Always show the map"));
40 _alwaysShowMap
->setChecked(_options
->alwaysShowMap
);
41 _alwaysShowMap
->setToolTip("<p>" +
42 tr("Show the map even when no files are loaded.") + "</p>");
45 _hidpi
= new QRadioButton(tr("High-resolution"));
46 _lodpi
= new QRadioButton(tr("Standard"));
47 if (_options
->hidpiMap
)
48 _hidpi
->setChecked(true);
50 _lodpi
->setChecked(true);
51 QLabel
*lhi
= new QLabel(tr("Non-HiDPI maps are loaded as HiDPI maps. "
52 "The map is sharp but map objects are small/hard to read."));
53 QLabel
*llo
= new QLabel(tr("Non-HiDPI maps are loaded such as they are. "
54 "Map objects have the expected size but the map is blurry."));
55 QFont f
= lhi
->font();
56 f
.setPointSize(f
.pointSize() - 1);
57 lhi
->setWordWrap(true);
58 llo
->setWordWrap(true);
61 #endif // ENABLE_HIDPI
63 QFormLayout
*showMapLayout
= new QFormLayout();
64 showMapLayout
->addWidget(_alwaysShowMap
);
66 QWidget
*mapTab
= new QWidget();
67 QVBoxLayout
*mapTabLayout
= new QVBoxLayout();
68 mapTabLayout
->addLayout(showMapLayout
);
69 mapTabLayout
->addStretch();
70 mapTab
->setLayout(mapTabLayout
);
73 QVBoxLayout
*hidpiTabLayout
= new QVBoxLayout();
74 hidpiTabLayout
->addWidget(_lodpi
);
75 hidpiTabLayout
->addWidget(llo
);
76 hidpiTabLayout
->addSpacing(10);
77 hidpiTabLayout
->addWidget(_hidpi
);
78 hidpiTabLayout
->addWidget(lhi
);
79 hidpiTabLayout
->addStretch();
81 QWidget
*hidpiTab
= new QWidget();
82 hidpiTab
->setLayout(hidpiTabLayout
);
83 #endif // ENABLE_HIDPI
85 QTabWidget
*mapPage
= new QTabWidget();
86 mapPage
->addTab(mapTab
, tr("General"));
88 mapPage
->addTab(hidpiTab
, tr("HiDPI display mode"));
89 #endif // ENABLE_HIDPI
94 QWidget
*OptionsDialog::createAppearancePage()
97 _baseColor
= new ColorBox();
98 _baseColor
->setColor(_options
->palette
.color());
99 _colorOffset
= new QDoubleSpinBox();
100 _colorOffset
->setMinimum(0);
101 _colorOffset
->setMaximum(1.0);
102 _colorOffset
->setSingleStep(0.01);
103 _colorOffset
->setValue(_options
->palette
.shift());
104 QFormLayout
*paletteLayout
= new QFormLayout();
105 paletteLayout
->addRow(tr("Base color:"), _baseColor
);
106 paletteLayout
->addRow(tr("Palette shift:"), _colorOffset
);
108 QGroupBox
*colorBox
= new QGroupBox(tr("Colors"));
109 colorBox
->setLayout(paletteLayout
);
112 _trackWidth
= new QSpinBox();
113 _trackWidth
->setValue(_options
->trackWidth
);
114 _trackWidth
->setMinimum(1);
115 _trackStyle
= new StyleComboBox();
116 _trackStyle
->setValue(_options
->trackStyle
);
117 QFormLayout
*trackLayout
= new QFormLayout();
119 trackLayout
->addRow(tr("Track width:"), _trackWidth
);
120 trackLayout
->addRow(tr("Track style:"), _trackStyle
);
122 trackLayout
->addRow(tr("Width:"), _trackWidth
);
123 trackLayout
->addRow(tr("Style:"), _trackStyle
);
124 QGroupBox
*trackBox
= new QGroupBox(tr("Tracks"));
125 trackBox
->setLayout(trackLayout
);
128 _routeWidth
= new QSpinBox();
129 _routeWidth
->setValue(_options
->routeWidth
);
130 _routeWidth
->setMinimum(1);
131 _routeStyle
= new StyleComboBox();
132 _routeStyle
->setValue(_options
->routeStyle
);
133 QFormLayout
*routeLayout
= new QFormLayout();
135 routeLayout
->addRow(tr("Route width:"), _routeWidth
);
136 routeLayout
->addRow(tr("Route style:"), _routeStyle
);
138 routeLayout
->addRow(tr("Width:"), _routeWidth
);
139 routeLayout
->addRow(tr("Style:"), _routeStyle
);
140 QGroupBox
*routeBox
= new QGroupBox(tr("Routes"));
141 routeBox
->setLayout(routeLayout
);
144 _pathAA
= new QCheckBox(tr("Use anti-aliasing"));
145 _pathAA
->setChecked(_options
->pathAntiAliasing
);
146 QFormLayout
*pathAALayout
= new QFormLayout();
147 pathAALayout
->addWidget(_pathAA
);
149 QWidget
*pathTab
= new QWidget();
150 QVBoxLayout
*pathTabLayout
= new QVBoxLayout();
152 pathTabLayout
->addLayout(paletteLayout
);
153 pathTabLayout
->addWidget(line());
154 pathTabLayout
->addLayout(trackLayout
);
155 pathTabLayout
->addWidget(line());
156 pathTabLayout
->addLayout(routeLayout
);
157 pathTabLayout
->addWidget(line());
159 pathTabLayout
->addWidget(colorBox
);
160 pathTabLayout
->addWidget(trackBox
);
161 pathTabLayout
->addWidget(routeBox
);
163 pathTabLayout
->addLayout(pathAALayout
);
164 pathTabLayout
->addStretch();
165 pathTab
->setLayout(pathTabLayout
);
169 _waypointSize
= new QSpinBox();
170 _waypointSize
->setMinimum(1);
171 _waypointSize
->setValue(_options
->waypointSize
);
172 _waypointColor
= new ColorBox();
173 _waypointColor
->setColor(_options
->waypointColor
);
174 QFormLayout
*waypointLayout
= new QFormLayout();
176 waypointLayout
->addRow(tr("Waypoint color:"), _waypointColor
);
177 waypointLayout
->addRow(tr("Waypoint size:"), _waypointSize
);
179 waypointLayout
->addRow(tr("Color:"), _waypointColor
);
180 waypointLayout
->addRow(tr("Size:"), _waypointSize
);
181 QGroupBox
*waypointBox
= new QGroupBox(tr("Waypoints"));
182 waypointBox
->setLayout(waypointLayout
);
185 _poiSize
= new QSpinBox();
186 _poiSize
->setMinimum(1);
187 _poiSize
->setValue(_options
->poiSize
);
188 _poiColor
= new ColorBox();
189 _poiColor
->setColor(_options
->poiColor
);
190 QFormLayout
*poiLayout
= new QFormLayout();
192 poiLayout
->addRow(tr("POI color:"), _poiColor
);
193 poiLayout
->addRow(tr("POI size:"), _poiSize
);
195 poiLayout
->addRow(tr("Color:"), _poiColor
);
196 poiLayout
->addRow(tr("Size:"), _poiSize
);
197 QGroupBox
*poiBox
= new QGroupBox(tr("POIs"));
198 poiBox
->setLayout(poiLayout
);
201 QWidget
*pointTab
= new QWidget();
202 QVBoxLayout
*pointTabLayout
= new QVBoxLayout();
204 pointTabLayout
->addLayout(waypointLayout
);
205 pointTabLayout
->addWidget(line());
206 pointTabLayout
->addLayout(poiLayout
);
208 pointTabLayout
->addWidget(waypointBox
);
209 pointTabLayout
->addWidget(poiBox
);
211 pointTabLayout
->addStretch();
212 pointTab
->setLayout(pointTabLayout
);
216 _sliderColor
= new ColorBox();
217 _sliderColor
->setColor(_options
->sliderColor
);
218 _graphWidth
= new QSpinBox();
219 _graphWidth
->setValue(_options
->graphWidth
);
220 _graphWidth
->setMinimum(1);
222 QFormLayout
*graphLayout
= new QFormLayout();
223 graphLayout
->addRow(tr("Line width:"), _graphWidth
);
224 graphLayout
->addRow(tr("Slider color:"), _sliderColor
);
226 _graphAA
= new QCheckBox(tr("Use anti-aliasing"));
227 _graphAA
->setChecked(_options
->graphAntiAliasing
);
228 QFormLayout
*graphAALayout
= new QFormLayout();
229 graphAALayout
->addWidget(_graphAA
);
231 QWidget
*graphTab
= new QWidget();
232 QVBoxLayout
*graphTabLayout
= new QVBoxLayout();
233 graphTabLayout
->addLayout(graphLayout
);
234 graphTabLayout
->addLayout(graphAALayout
);
235 graphTabLayout
->addStretch();
236 graphTab
->setLayout(graphTabLayout
);
240 _mapOpacity
= new PercentSlider();
241 _mapOpacity
->setValue(_options
->mapOpacity
);
242 _backgroundColor
= new ColorBox();
243 _backgroundColor
->setColor(_options
->backgroundColor
);
244 _backgroundColor
->enableAlphaChannel(false);
245 QFormLayout
*mapLayout
= new QFormLayout();
246 mapLayout
->addRow(tr("Background color:"), _backgroundColor
);
247 mapLayout
->addRow(tr("Map opacity:"), _mapOpacity
);
249 QWidget
*mapTab
= new QWidget();
250 QVBoxLayout
*mapTabLayout
= new QVBoxLayout();
251 mapTabLayout
->addLayout(mapLayout
);
252 mapTabLayout
->addStretch();
253 mapTab
->setLayout(mapTabLayout
);
256 QTabWidget
*appearancePage
= new QTabWidget();
257 appearancePage
->addTab(pathTab
, tr("Paths"));
258 appearancePage
->addTab(pointTab
, tr("Points"));
259 appearancePage
->addTab(graphTab
, tr("Graphs"));
260 appearancePage
->addTab(mapTab
, tr("Map"));
262 return appearancePage
;
265 QWidget
*OptionsDialog::createDataPage()
267 QString filterToolTip
= tr("Moving average window size");
269 _elevationFilter
= new OddSpinBox();
270 _elevationFilter
->setValue(_options
->elevationFilter
);
271 _elevationFilter
->setToolTip(filterToolTip
);
272 _speedFilter
= new OddSpinBox();
273 _speedFilter
->setValue(_options
->speedFilter
);
274 _speedFilter
->setToolTip(filterToolTip
);
275 _heartRateFilter
= new OddSpinBox();
276 _heartRateFilter
->setValue(_options
->heartRateFilter
);
277 _heartRateFilter
->setToolTip(filterToolTip
);
278 _cadenceFilter
= new OddSpinBox();
279 _cadenceFilter
->setValue(_options
->cadenceFilter
);
280 _cadenceFilter
->setToolTip(filterToolTip
);
281 _powerFilter
= new OddSpinBox();
282 _powerFilter
->setValue(_options
->powerFilter
);
283 _powerFilter
->setToolTip(filterToolTip
);
285 QFormLayout
*smoothLayout
= new QFormLayout();
286 smoothLayout
->addRow(tr("Elevation:"), _elevationFilter
);
287 smoothLayout
->addRow(tr("Speed:"), _speedFilter
);
288 smoothLayout
->addRow(tr("Heart rate:"), _heartRateFilter
);
289 smoothLayout
->addRow(tr("Cadence:"), _cadenceFilter
);
290 smoothLayout
->addRow(tr("Power:"), _powerFilter
);
292 QGroupBox
*smoothBox
= new QGroupBox(tr("Smoothing"));
293 smoothBox
->setLayout(smoothLayout
);
296 _outlierEliminate
= new QCheckBox(tr("Eliminate GPS outliers"));
297 _outlierEliminate
->setChecked(_options
->outlierEliminate
);
299 QFormLayout
*outlierLayout
= new QFormLayout();
300 outlierLayout
->addWidget(_outlierEliminate
);
302 QGroupBox
*outlierBox
= new QGroupBox(tr("Outlier elimination"));
303 outlierBox
->setLayout(outlierLayout
);
306 QWidget
*filterTab
= new QWidget();
307 QVBoxLayout
*filterTabLayout
= new QVBoxLayout();
309 filterTabLayout
->addWidget(new QLabel(tr("Smoothing:")));
310 filterTabLayout
->addLayout(smoothLayout
);
311 filterTabLayout
->addWidget(line());
312 filterTabLayout
->addLayout(outlierLayout
);
314 filterTabLayout
->addWidget(smoothBox
);
315 filterTabLayout
->addWidget(outlierBox
);
317 filterTabLayout
->addStretch();
318 filterTab
->setLayout(filterTabLayout
);
321 _pauseSpeed
= new QDoubleSpinBox();
322 _pauseSpeed
->setDecimals(1);
323 _pauseSpeed
->setSingleStep(0.1);
324 _pauseSpeed
->setMinimum(0.1);
325 if (_options
->units
== Imperial
) {
326 _pauseSpeed
->setValue(_options
->pauseSpeed
* MS2MIH
);
327 _pauseSpeed
->setSuffix(UNIT_SPACE
+ tr("mi/h"));
328 } else if (_options
->units
== Nautical
) {
329 _pauseSpeed
->setValue(_options
->pauseSpeed
* MS2KN
);
330 _pauseSpeed
->setSuffix(UNIT_SPACE
+ tr("kn"));
332 _pauseSpeed
->setValue(_options
->pauseSpeed
* MS2KMH
);
333 _pauseSpeed
->setSuffix(UNIT_SPACE
+ tr("km/h"));
335 _pauseInterval
= new QSpinBox();
336 _pauseInterval
->setMinimum(1);
337 _pauseInterval
->setSuffix(UNIT_SPACE
+ tr("s"));
338 _pauseInterval
->setValue(_options
->pauseInterval
);
340 QFormLayout
*pauseLayout
= new QFormLayout();
341 pauseLayout
->addRow(tr("Minimal speed:"), _pauseSpeed
);
342 pauseLayout
->addRow(tr("Minimal duration:"), _pauseInterval
);
344 QWidget
*pauseTab
= new QWidget();
345 pauseTab
->setLayout(pauseLayout
);
348 _computedSpeed
= new QRadioButton(tr("Computed from distance/time"));
349 _reportedSpeed
= new QRadioButton(tr("Recorded by device"));
350 if (_options
->useReportedSpeed
)
351 _reportedSpeed
->setChecked(true);
353 _computedSpeed
->setChecked(true);
355 _dataGPSElevation
= new QRadioButton(tr("GPS data"));
356 _dataDEMElevation
= new QRadioButton(tr("DEM data"));
357 if (_options
->dataUseDEM
)
358 _dataDEMElevation
->setChecked(true);
360 _dataGPSElevation
->setChecked(true);
363 QWidget
*sourceTab
= new QWidget();
364 QVBoxLayout
*sourceTabLayout
= new QVBoxLayout();
367 QVBoxLayout
*speedOptions
= new QVBoxLayout();
368 speedOptions
->addWidget(_computedSpeed
);
369 speedOptions
->addWidget(_reportedSpeed
);
371 QVBoxLayout
*elevationOptions
= new QVBoxLayout();
372 elevationOptions
->addWidget(_dataGPSElevation
);
373 elevationOptions
->addWidget(_dataDEMElevation
);
375 QFormLayout
*formLayout
= new QFormLayout();
376 formLayout
->addRow(tr("Speed:"), speedOptions
);
377 formLayout
->addRow(tr("Elevation:"), elevationOptions
);
379 sourceTabLayout
->addLayout(formLayout
);
381 QFormLayout
*speedLayout
= new QFormLayout();
382 QFormLayout
*elevationLayout
= new QFormLayout();
384 speedLayout
->addWidget(_computedSpeed
);
385 speedLayout
->addWidget(_reportedSpeed
);
387 QGroupBox
*speedBox
= new QGroupBox(tr("Speed"));
388 speedBox
->setLayout(speedLayout
);
390 elevationLayout
->addWidget(_dataGPSElevation
);
391 elevationLayout
->addWidget(_dataDEMElevation
);
393 QGroupBox
*elevationBox
= new QGroupBox(tr("Elevation"));
394 elevationBox
->setLayout(elevationLayout
);
396 sourceTabLayout
->addWidget(speedBox
);
397 sourceTabLayout
->addWidget(elevationBox
);
399 sourceTabLayout
->addStretch();
400 sourceTab
->setLayout(sourceTabLayout
);
403 QTabWidget
*filterPage
= new QTabWidget();
404 filterPage
->addTab(filterTab
, tr("Filtering"));
405 filterPage
->addTab(sourceTab
, tr("Sources"));
406 filterPage
->addTab(pauseTab
, tr("Pause detection"));
411 QWidget
*OptionsDialog::createPOIPage()
413 _poiGPSElevation
= new QRadioButton(tr("GPS data"));
414 _poiDEMElevation
= new QRadioButton(tr("DEM data"));
415 if (_options
->poiUseDEM
)
416 _poiDEMElevation
->setChecked(true);
418 _poiGPSElevation
->setChecked(true);
420 _poiRadius
= new QDoubleSpinBox();
421 _poiRadius
->setSingleStep(1);
422 _poiRadius
->setDecimals(1);
423 if (_options
->units
== Imperial
) {
424 _poiRadius
->setValue(_options
->poiRadius
/ MIINM
);
425 _poiRadius
->setSuffix(UNIT_SPACE
+ tr("mi"));
426 } else if (_options
->units
== Nautical
) {
427 _poiRadius
->setValue(_options
->poiRadius
/ NMIINM
);
428 _poiRadius
->setSuffix(UNIT_SPACE
+ tr("nmi"));
430 _poiRadius
->setValue(_options
->poiRadius
/ KMINM
);
431 _poiRadius
->setSuffix(UNIT_SPACE
+ tr("km"));
434 QVBoxLayout
*elevationLayout
= new QVBoxLayout();
435 elevationLayout
->addWidget(_poiGPSElevation
);
436 elevationLayout
->addWidget(_poiDEMElevation
);
438 QFormLayout
*poiLayout
= new QFormLayout();
439 poiLayout
->addRow(tr("Radius:"), _poiRadius
);
440 poiLayout
->addRow(tr("Elevation:"), elevationLayout
);
442 QWidget
*poiTab
= new QWidget();
443 poiTab
->setLayout(poiLayout
);
445 QTabWidget
*poiPage
= new QTabWidget();
446 poiPage
->addTab(poiTab
, tr("POI"));
451 QWidget
*OptionsDialog::createExportPage()
453 _wysiwyg
= new QRadioButton(tr("WYSIWYG"));
454 _hires
= new QRadioButton(tr("High-Resolution"));
455 if (_options
->hiresPrint
)
456 _hires
->setChecked(true);
458 _wysiwyg
->setChecked(true);
459 QLabel
*lw
= new QLabel(tr("The printed area is approximately the display"
460 " area. The map zoom level does not change."));
461 QLabel
*lh
= new QLabel(tr("The zoom level will be changed so that"
462 " the whole content (tracks/waypoints) fits to the printed area and"
463 " the map resolution is as close as possible to the print resolution."));
464 QFont f
= lw
->font();
465 f
.setPointSize(f
.pointSize() - 1);
466 lw
->setWordWrap(true);
467 lh
->setWordWrap(true);
471 QVBoxLayout
*modeTabLayout
= new QVBoxLayout();
472 modeTabLayout
->addWidget(_wysiwyg
);
473 modeTabLayout
->addWidget(lw
);
474 modeTabLayout
->addSpacing(10);
475 modeTabLayout
->addWidget(_hires
);
476 modeTabLayout
->addWidget(lh
);
477 modeTabLayout
->addStretch();
479 QWidget
*modeTab
= new QWidget();
480 modeTab
->setLayout(modeTabLayout
);
483 _name
= new QCheckBox(tr("Name"));
484 _name
->setChecked(_options
->printName
);
485 _date
= new QCheckBox(tr("Date"));
486 _date
->setChecked(_options
->printDate
);
487 _distance
= new QCheckBox(tr("Distance"));
488 _distance
->setChecked(_options
->printDistance
);
489 _time
= new QCheckBox(tr("Time"));
490 _time
->setChecked(_options
->printTime
);
491 _movingTime
= new QCheckBox(tr("Moving time"));
492 _movingTime
->setChecked(_options
->printMovingTime
);
493 _itemCount
= new QCheckBox(tr("Item count (>1)"));
494 _itemCount
->setChecked(_options
->printItemCount
);
496 QFormLayout
*headerTabLayout
= new QFormLayout();
497 headerTabLayout
->addWidget(_name
);
498 headerTabLayout
->addWidget(_date
);
499 headerTabLayout
->addWidget(_distance
);
500 headerTabLayout
->addWidget(_time
);
501 headerTabLayout
->addWidget(_movingTime
);
502 headerTabLayout
->addItem(new QSpacerItem(10, 10));
503 headerTabLayout
->addWidget(_itemCount
);
504 QWidget
*headerTab
= new QWidget();
505 headerTab
->setLayout(headerTabLayout
);
508 _separateGraphPage
= new QCheckBox(tr("Separate graph page"));
509 _separateGraphPage
->setChecked(_options
->separateGraphPage
);
511 QFormLayout
*graphTabLayout
= new QFormLayout();
512 graphTabLayout
->addWidget(_separateGraphPage
);
513 QWidget
*graphTab
= new QWidget();
514 graphTab
->setLayout(graphTabLayout
);
517 QTabWidget
*exportPage
= new QTabWidget();
518 exportPage
->addTab(modeTab
, tr("Print mode"));
519 exportPage
->addTab(headerTab
, tr("Header"));
520 exportPage
->addTab(graphTab
, tr("Graphs"));
525 QWidget
*OptionsDialog::createSystemPage()
527 _useOpenGL
= new QCheckBox(tr("Use OpenGL"));
528 _useOpenGL
->setChecked(_options
->useOpenGL
);
530 _enableHTTP2
= new QCheckBox(tr("Enable HTTP/2"));
531 _enableHTTP2
->setChecked(_options
->enableHTTP2
);
532 #endif // ENABLE_HTTP2
534 _pixmapCache
= new QSpinBox();
535 _pixmapCache
->setMinimum(16);
536 _pixmapCache
->setMaximum(1024);
537 _pixmapCache
->setSuffix(UNIT_SPACE
+ tr("MB"));
538 _pixmapCache
->setValue(_options
->pixmapCache
);
540 _connectionTimeout
= new QSpinBox();
541 _connectionTimeout
->setMinimum(30);
542 _connectionTimeout
->setMaximum(120);
543 _connectionTimeout
->setSuffix(UNIT_SPACE
+ tr("s"));
544 _connectionTimeout
->setValue(_options
->connectionTimeout
);
546 QFormLayout
*formLayout
= new QFormLayout();
547 formLayout
->addRow(tr("Image cache size:"), _pixmapCache
);
548 formLayout
->addRow(tr("Connection timeout:"), _connectionTimeout
);
550 QFormLayout
*checkboxLayout
= new QFormLayout();
552 checkboxLayout
->addWidget(_enableHTTP2
);
553 #endif // ENABLE_HTTP2
554 checkboxLayout
->addWidget(_useOpenGL
);
556 QWidget
*systemTab
= new QWidget();
557 QVBoxLayout
*systemTabLayout
= new QVBoxLayout();
558 systemTabLayout
->addLayout(formLayout
);
559 systemTabLayout
->addLayout(checkboxLayout
);
560 systemTabLayout
->addStretch();
561 systemTab
->setLayout(systemTabLayout
);
563 QTabWidget
*systemPage
= new QTabWidget();
564 systemPage
->addTab(systemTab
, tr("System"));
569 OptionsDialog::OptionsDialog(Options
*options
, QWidget
*parent
)
570 : QDialog(parent
), _options(options
)
572 QStackedWidget
*pages
= new QStackedWidget();
573 pages
->addWidget(createAppearancePage());
574 pages
->addWidget(createMapPage());
575 pages
->addWidget(createDataPage());
576 pages
->addWidget(createPOIPage());
577 pages
->addWidget(createExportPage());
578 pages
->addWidget(createSystemPage());
580 QListWidget
*menu
= new QListWidget();
581 menu
->setIconSize(QSize(MENU_ICON_SIZE
, MENU_ICON_SIZE
));
582 new QListWidgetItem(QIcon(APPEARANCE_ICON
), tr("Appearance"),
584 new QListWidgetItem(QIcon(MAPS_ICON
), tr("Maps"), menu
);
585 new QListWidgetItem(QIcon(DATA_ICON
), tr("Data"), menu
);
586 new QListWidgetItem(QIcon(POI_ICON
), tr("POI"), menu
);
587 new QListWidgetItem(QIcon(PRINT_EXPORT_ICON
), tr("Print & Export"),
589 new QListWidgetItem(QIcon(SYSTEM_ICON
), tr("System"), menu
);
591 QHBoxLayout
*contentLayout
= new QHBoxLayout();
592 contentLayout
->addWidget(menu
);
593 contentLayout
->addWidget(pages
);
595 menu
->setSizePolicy(QSizePolicy::Minimum
, QSizePolicy::Preferred
);
596 menu
->setMaximumWidth(menu
->sizeHintForColumn(0) + 2 * menu
->frameWidth()
598 pages
->setSizePolicy(QSizePolicy::MinimumExpanding
, QSizePolicy::Preferred
);
599 pages
->setMinimumWidth(2 * menu
->size().width());
601 connect(menu
, SIGNAL(currentRowChanged(int)), pages
,
602 SLOT(setCurrentIndex(int)));
603 menu
->item(0)->setSelected(true);
606 QDialogButtonBox
*buttonBox
= new QDialogButtonBox(QDialogButtonBox::Ok
607 | QDialogButtonBox::Cancel
);
608 connect(buttonBox
, SIGNAL(accepted()), this, SLOT(accept()));
609 connect(buttonBox
, SIGNAL(rejected()), this, SLOT(reject()));
611 QVBoxLayout
*layout
= new QVBoxLayout
;
612 layout
->addLayout(contentLayout
);
613 layout
->addWidget(buttonBox
);
616 setWindowTitle(tr("Options"));
617 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint
);
620 void OptionsDialog::accept()
622 _options
->palette
.setColor(_baseColor
->color());
623 _options
->palette
.setShift(_colorOffset
->value());
624 _options
->mapOpacity
= _mapOpacity
->value();
625 _options
->backgroundColor
= _backgroundColor
->color();
626 _options
->trackWidth
= _trackWidth
->value();
627 _options
->trackStyle
= (Qt::PenStyle
) _trackStyle
->itemData(
628 _trackStyle
->currentIndex()).toInt();
629 _options
->routeWidth
= _routeWidth
->value();
630 _options
->routeStyle
= (Qt::PenStyle
) _routeStyle
->itemData(
631 _routeStyle
->currentIndex()).toInt();
632 _options
->pathAntiAliasing
= _pathAA
->isChecked();
633 _options
->waypointSize
= _waypointSize
->value();
634 _options
->waypointColor
= _waypointColor
->color();
635 _options
->poiSize
= _poiSize
->value();
636 _options
->poiColor
= _poiColor
->color();
637 _options
->graphWidth
= _graphWidth
->value();
638 _options
->sliderColor
= _sliderColor
->color();
639 _options
->graphAntiAliasing
= _graphAA
->isChecked();
641 _options
->alwaysShowMap
= _alwaysShowMap
->isChecked();
643 _options
->hidpiMap
= _hidpi
->isChecked();
644 #endif // ENABLE_HIDPI
646 _options
->elevationFilter
= _elevationFilter
->value();
647 _options
->speedFilter
= _speedFilter
->value();
648 _options
->heartRateFilter
= _heartRateFilter
->value();
649 _options
->cadenceFilter
= _cadenceFilter
->value();
650 _options
->powerFilter
= _powerFilter
->value();
651 _options
->outlierEliminate
= _outlierEliminate
->isChecked();
652 qreal pauseSpeed
= (_options
->units
== Imperial
)
653 ? _pauseSpeed
->value() / MS2MIH
: (_options
->units
== Nautical
)
654 ? _pauseSpeed
->value() / MS2KN
: _pauseSpeed
->value() / MS2KMH
;
655 if (qAbs(pauseSpeed
- _options
->pauseSpeed
) > 0.01)
656 _options
->pauseSpeed
= pauseSpeed
;
657 _options
->pauseInterval
= _pauseInterval
->value();
658 _options
->useReportedSpeed
= _reportedSpeed
->isChecked();
659 _options
->dataUseDEM
= _dataDEMElevation
->isChecked();
661 qreal poiRadius
= (_options
->units
== Imperial
)
662 ? _poiRadius
->value() * MIINM
: (_options
->units
== Nautical
)
663 ? _poiRadius
->value() * NMIINM
: _poiRadius
->value() * KMINM
;
664 if (qAbs(poiRadius
- _options
->poiRadius
) > 0.01)
665 _options
->poiRadius
= poiRadius
;
666 _options
->poiUseDEM
= _poiDEMElevation
->isChecked();
668 _options
->useOpenGL
= _useOpenGL
->isChecked();
670 _options
->enableHTTP2
= _enableHTTP2
->isChecked();
671 #endif // ENABLE_HTTP2
672 _options
->pixmapCache
= _pixmapCache
->value();
673 _options
->connectionTimeout
= _connectionTimeout
->value();
675 _options
->hiresPrint
= _hires
->isChecked();
676 _options
->printName
= _name
->isChecked();
677 _options
->printDate
= _date
->isChecked();
678 _options
->printDistance
= _distance
->isChecked();
679 _options
->printTime
= _time
->isChecked();
680 _options
->printMovingTime
= _movingTime
->isChecked();
681 _options
->printItemCount
= _itemCount
->isChecked();
682 _options
->separateGraphPage
= _separateGraphPage
->isChecked();