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

Fixed broken map show setting

Code cleanup
This commit is contained in:
Martin Tůma 2018-02-15 01:44:03 +01:00
parent 94ee5b6e67
commit 9fd5b1b80a

View File

@ -1147,7 +1147,7 @@ bool GUI::loadMap(const QString &fileName)
_mapMenu->insertAction(_mapsEnd, a); _mapMenu->insertAction(_mapsEnd, a);
_showMapAction->setEnabled(true); _showMapAction->setEnabled(true);
_clearMapCacheAction->setEnabled(true); _clearMapCacheAction->setEnabled(true);
_mapActions.last()->activate(QAction::Trigger); _mapActions.last()->trigger();
return true; return true;
} else { } else {
@ -1394,15 +1394,15 @@ void GUI::keyPressEvent(QKeyEvent *event)
case TOGGLE_GRAPH_TYPE_KEY: case TOGGLE_GRAPH_TYPE_KEY:
if (_timeGraphAction->isChecked()) if (_timeGraphAction->isChecked())
_distanceGraphAction->activate(QAction::Trigger); _distanceGraphAction->trigger();
else else
_timeGraphAction->activate(QAction::Trigger); _timeGraphAction->trigger();
break; break;
case TOGGLE_TIME_TYPE_KEY: case TOGGLE_TIME_TYPE_KEY:
if (_movingTimeAction->isChecked()) if (_movingTimeAction->isChecked())
_totalTimeAction->activate(QAction::Trigger); _totalTimeAction->trigger();
else else
_movingTimeAction->activate(QAction::Trigger); _movingTimeAction->trigger();
break; break;
case Qt::Key_Escape: case Qt::Key_Escape:
@ -1647,25 +1647,25 @@ void GUI::readSettings()
settings.beginGroup(SETTINGS_SETTINGS_GROUP); settings.beginGroup(SETTINGS_SETTINGS_GROUP);
if (settings.value(TIME_TYPE_SETTING, TIME_TYPE_DEFAULT).toInt() if (settings.value(TIME_TYPE_SETTING, TIME_TYPE_DEFAULT).toInt()
== Moving) == Moving)
_movingTimeAction->activate(QAction::Trigger); _movingTimeAction->trigger();
else else
_totalTimeAction->activate(QAction::Trigger); _totalTimeAction->trigger();
value = settings.value(UNITS_SETTING, UNITS_DEFAULT).toInt(); value = settings.value(UNITS_SETTING, UNITS_DEFAULT).toInt();
if (value == Imperial) if (value == Imperial)
_imperialUnitsAction->activate(QAction::Trigger); _imperialUnitsAction->trigger();
else if (value == Nautical) else if (value == Nautical)
_nauticalUnitsAction->activate(QAction::Trigger); _nauticalUnitsAction->trigger();
else else
_metricUnitsAction->activate(QAction::Trigger); _metricUnitsAction->trigger();
value = settings.value(COORDINATES_SETTING, COORDINATES_DEFAULT).toInt(); value = settings.value(COORDINATES_SETTING, COORDINATES_DEFAULT).toInt();
if (value == DMS) if (value == DMS)
_DMSAction->activate(QAction::Trigger); _DMSAction->trigger();
else if (value == DegreesMinutes) else if (value == DegreesMinutes)
_degreesMinutesAction->activate(QAction::Trigger); _degreesMinutesAction->trigger();
else else
_decimalDegreesAction->activate(QAction::Trigger); _decimalDegreesAction->trigger();
if (!settings.value(SHOW_TOOLBARS_SETTING, SHOW_TOOLBARS_DEFAULT).toBool()) if (!settings.value(SHOW_TOOLBARS_SETTING, SHOW_TOOLBARS_DEFAULT).toBool())
showToolbars(false); showToolbars(false);
@ -1676,6 +1676,8 @@ void GUI::readSettings()
settings.beginGroup(MAP_SETTINGS_GROUP); settings.beginGroup(MAP_SETTINGS_GROUP);
if (settings.value(SHOW_MAP_SETTING, SHOW_MAP_DEFAULT).toBool()) if (settings.value(SHOW_MAP_SETTING, SHOW_MAP_DEFAULT).toBool())
_showMapAction->setChecked(true); _showMapAction->setChecked(true);
else
_mapView->showMap(false);
if (_ml->maps().count()) { if (_ml->maps().count()) {
int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString()); int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString());
_mapActions.at(index)->trigger(); _mapActions.at(index)->trigger();