1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Added the "always show map" option

This commit is contained in:
Martin Tůma 2017-12-03 14:18:41 +01:00
parent 0f10c7596b
commit 1ff2162811
4 changed files with 43 additions and 3 deletions

View File

@ -83,11 +83,11 @@ GUI::GUI()
_sliderPos = 0; _sliderPos = 0;
readSettings();
updateGraphTabs(); updateGraphTabs();
updateMapView(); updateMapView();
updateStatusBarInfo(); updateStatusBarInfo();
readSettings();
} }
GUI::~GUI() GUI::~GUI()
@ -876,6 +876,8 @@ void GUI::openOptions()
reloadFile(); reloadFile();
_options = options; _options = options;
updateMapView();
} }
void GUI::printFile() void GUI::printFile()
@ -1308,7 +1310,10 @@ void GUI::updateGraphTabs()
void GUI::updateMapView() void GUI::updateMapView()
{ {
_mapView->setHidden(!(_trackCount + _routeCount + _waypointCount)); if (_options.alwaysShowMap)
_mapView->setHidden(false);
else
_mapView->setHidden(!(_trackCount + _routeCount + _waypointCount));
} }
void GUI::setTimeType(TimeType type) void GUI::setTimeType(TimeType type)
@ -1631,6 +1636,8 @@ void GUI::writeSettings()
_options.separateGraphPage); _options.separateGraphPage);
if (_options.sliderColor != SLIDER_COLOR_DEFAULT) if (_options.sliderColor != SLIDER_COLOR_DEFAULT)
settings.setValue(SLIDER_COLOR_SETTING, _options.sliderColor); settings.setValue(SLIDER_COLOR_SETTING, _options.sliderColor);
if (_options.alwaysShowMap != ALWAYS_SHOW_MAP_DEFAULT)
settings.setValue(ALWAYS_SHOW_MAP_SETTING, _options.alwaysShowMap);
settings.endGroup(); settings.endGroup();
} }
@ -1846,6 +1853,8 @@ void GUI::readSettings()
SEPARATE_GRAPH_PAGE_DEFAULT).toBool(); SEPARATE_GRAPH_PAGE_DEFAULT).toBool();
_options.sliderColor = settings.value(SLIDER_COLOR_SETTING, _options.sliderColor = settings.value(SLIDER_COLOR_SETTING,
SLIDER_COLOR_DEFAULT).value<QColor>(); SLIDER_COLOR_DEFAULT).value<QColor>();
_options.alwaysShowMap = settings.value(ALWAYS_SHOW_MAP_SETTING,
ALWAYS_SHOW_MAP_DEFAULT).toBool();
_mapView->setPalette(_options.palette); _mapView->setPalette(_options.palette);
_mapView->setMapOpacity(_options.mapOpacity); _mapView->setMapOpacity(_options.mapOpacity);

View File

@ -35,6 +35,26 @@ static QFrame *line()
} }
#endif #endif
QWidget *OptionsDialog::createGeneralPage()
{
_alwaysShowMap = new QCheckBox(tr("Display map when no files are loaded"));
_alwaysShowMap->setChecked(_options->alwaysShowMap);
QFormLayout *showMapLayout = new QFormLayout();
showMapLayout->addWidget(_alwaysShowMap);
QWidget *generalTab = new QWidget();
QVBoxLayout *generalTabLayout = new QVBoxLayout();
generalTabLayout->addLayout(showMapLayout);
generalTabLayout->addStretch();
generalTab->setLayout(generalTabLayout);
QTabWidget *generalPage = new QTabWidget();
generalPage->addTab(generalTab, tr("General"));
return generalPage;
}
QWidget *OptionsDialog::createAppearancePage() QWidget *OptionsDialog::createAppearancePage()
{ {
// Paths // Paths
@ -426,6 +446,7 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
: QDialog(parent), _options(options) : QDialog(parent), _options(options)
{ {
QStackedWidget *pages = new QStackedWidget(); QStackedWidget *pages = new QStackedWidget();
pages->addWidget(createGeneralPage());
pages->addWidget(createAppearancePage()); pages->addWidget(createAppearancePage());
pages->addWidget(createDataPage()); pages->addWidget(createDataPage());
pages->addWidget(createPOIPage()); pages->addWidget(createPOIPage());
@ -434,6 +455,7 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
QListWidget *menu = new QListWidget(); QListWidget *menu = new QListWidget();
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE)); menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
new QListWidgetItem(QIcon(QPixmap(APP_ICON)), tr("General"), menu);
new QListWidgetItem(QIcon(QPixmap(APPEARANCE_ICON)), tr("Appearance"), new QListWidgetItem(QIcon(QPixmap(APPEARANCE_ICON)), tr("Appearance"),
menu); menu);
new QListWidgetItem(QIcon(QPixmap(DATA_ICON)), tr("Data"), menu); new QListWidgetItem(QIcon(QPixmap(DATA_ICON)), tr("Data"), menu);
@ -473,6 +495,8 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
void OptionsDialog::accept() void OptionsDialog::accept()
{ {
_options->alwaysShowMap = _alwaysShowMap->isChecked();
_options->palette.setColor(_baseColor->color()); _options->palette.setColor(_baseColor->color());
_options->palette.setShift(_colorOffset->value()); _options->palette.setShift(_colorOffset->value());
_options->mapOpacity = _mapOpacity->value(); _options->mapOpacity = _mapOpacity->value();

View File

@ -16,6 +16,8 @@ class QRadioButton;
class PercentSlider; class PercentSlider;
struct Options { struct Options {
// General
bool alwaysShowMap;
// Appearance // Appearance
Palette palette; Palette palette;
int trackWidth; int trackWidth;
@ -70,6 +72,7 @@ public slots:
void accept(); void accept();
private: private:
QWidget *createGeneralPage();
QWidget *createAppearancePage(); QWidget *createAppearancePage();
QWidget *createDataPage(); QWidget *createDataPage();
QWidget *createPOIPage(); QWidget *createPOIPage();
@ -78,6 +81,8 @@ private:
Options *_options; Options *_options;
// General
QCheckBox *_alwaysShowMap;
// Appearance // Appearance
ColorBox *_baseColor; ColorBox *_baseColor;
QDoubleSpinBox *_colorOffset; QDoubleSpinBox *_colorOffset;

View File

@ -146,5 +146,7 @@
#define SEPARATE_GRAPH_PAGE_DEFAULT false #define SEPARATE_GRAPH_PAGE_DEFAULT false
#define SLIDER_COLOR_SETTING "sliderColor" #define SLIDER_COLOR_SETTING "sliderColor"
#define SLIDER_COLOR_DEFAULT QColor(Qt::red) #define SLIDER_COLOR_DEFAULT QColor(Qt::red)
#define ALWAYS_SHOW_MAP_SETTING "alwaysShowMap"
#define ALWAYS_SHOW_MAP_DEFAULT true
#endif // SETTINGS_H #endif // SETTINGS_H