1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-27 03:29:16 +02:00

Added support for show/hide the graphs and the toolbars

This commit is contained in:
2015-11-24 00:24:26 +01:00
parent a9b3d2595e
commit f93b54aab0
3 changed files with 97 additions and 43 deletions

View File

@ -158,17 +158,29 @@ void GUI::createActions()
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)),
tr("Show POIs"), this);
_showPOIAction->setCheckable(true);
connect(_showPOIAction, SIGNAL(triggered()), this, SLOT(showPOI()));
connect(_showPOIAction, SIGNAL(triggered(bool)), this, SLOT(showPOI(bool)));
// Map actions
_showMapAction = new QAction(QIcon(QPixmap(SHOW_MAP_ICON)), tr("Show map"),
this);
_showMapAction->setCheckable(true);
connect(_showMapAction, SIGNAL(triggered()), this, SLOT(showMap()));
connect(_showMapAction, SIGNAL(triggered(bool)), this, SLOT(showMap(bool)));
if (_maps.empty())
_showMapAction->setEnabled(false);
else
createMapActions();
// Settings actions
_showGraphsAction = new QAction(tr("Show graphs"), this);
_showGraphsAction->setCheckable(true);
_showGraphsAction->setChecked(true);
connect(_showGraphsAction, SIGNAL(triggered(bool)), this,
SLOT(showGraphs(bool)));
_showToolbarsAction = new QAction(tr("Show toolbars"), this);
_showToolbarsAction->setCheckable(true);
_showToolbarsAction->setChecked(true);
connect(_showToolbarsAction, SIGNAL(triggered(bool)), this,
SLOT(showToolbars(bool)));
}
void GUI::createMenus()
@ -196,6 +208,10 @@ void GUI::createMenus()
_poiMenu->addAction(_openPOIAction);
_poiMenu->addAction(_showPOIAction);
_settingsMenu = menuBar()->addMenu(tr("Settings"));
_settingsMenu->addAction(_showToolbarsAction);
_settingsMenu->addAction(_showGraphsAction);
_helpMenu = menuBar()->addMenu(tr("Help"));
_helpMenu->addAction(_keysAction);
_helpMenu->addSeparator();
@ -445,22 +461,40 @@ void GUI::closeFile()
updateStatusBarInfo();
}
void GUI::showPOI()
void GUI::showPOI(bool checked)
{
if (_showPOIAction->isChecked())
if (checked)
_track->loadPOI(_poi);
else
_track->clearPOI();
}
void GUI::showMap()
void GUI::showMap(bool checked)
{
if (_showMapAction->isChecked())
if (checked)
_track->setMap(_currentMap);
else
_track->setMap(0);
}
void GUI::showGraphs(bool checked)
{
_trackGraphs->setHidden(!checked);
}
void GUI::showToolbars(bool checked)
{
if (checked) {
addToolBar(_fileToolBar);
addToolBar(_showToolBar);
_fileToolBar->show();
_showToolBar->show();
} else {
removeToolBar(_fileToolBar);
removeToolBar(_showToolBar);
}
}
void GUI::updateStatusBarInfo()
{
int files = _files.size();

View File

@ -36,8 +36,10 @@ private slots:
void closeFile();
void reloadFile();
void openPOIFile();
void showPOI();
void showMap();
void showPOI(bool checked);
void showMap(bool checked);
void showGraphs(bool checked);
void showToolbars(bool checked);
void mapChanged(int);
void graphChanged(int);
@ -63,6 +65,7 @@ private:
QMenu *_helpMenu;
QMenu *_poiMenu;
QMenu *_mapMenu;
QMenu *_settingsMenu;
QToolBar *_fileToolBar;
QToolBar *_showToolBar;
@ -81,6 +84,8 @@ private:
QAction *_openPOIAction;
QAction *_showPOIAction;
QAction *_showMapAction;
QAction *_showGraphsAction;
QAction *_showToolbarsAction;
QList<QAction*> _mapActions;
QLabel *_fileNameLabel;