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

Better graph tabs handling

This commit is contained in:
2016-03-23 09:38:22 +01:00
parent 58bed99d14
commit a2eaacc017
3 changed files with 111 additions and 95 deletions

View File

@ -80,6 +80,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
_lastGraph = static_cast<GraphView*>(_trackGraphs->currentWidget());
_lastSliderPos = _lastGraph->sliderPosition();
updateGraphTabs();
resize(600, 800);
}
@ -346,6 +347,7 @@ void GUI::createToolBars()
void GUI::createTrackView()
{
_track = new TrackView(this);
_track->setEnabled(false);
if (_showMapAction->isChecked())
_track->setMap(_currentMap);
@ -472,6 +474,7 @@ bool GUI::openFile(const QString &fileName)
_fileActionGroup->setEnabled(true);
_navigationActionGroup->setEnabled(true);
updateNavigationActions();
updateGraphTabs();
return true;
} else {
updateNavigationActions();
@ -497,6 +500,7 @@ bool GUI::loadFile(const QString &fileName)
}
_trackCount += gpx.trackCount();
_track->setEnabled(true);
return true;
} else {
@ -660,8 +664,10 @@ void GUI::closeFile()
_files.clear();
_track->setEnabled(false);
_fileActionGroup->setEnabled(false);
updateStatusBarInfo();
updateGraphTabs();
}
void GUI::showPOI(bool checked)
@ -768,6 +774,15 @@ void GUI::updateNavigationActions()
}
}
void GUI::updateGraphTabs()
{
GraphView *gv;
for (int i = 0; i < _trackGraphs->count(); i++) {
gv = static_cast<GraphView*>(_trackGraphs->widget(i));
_trackGraphs->setTabEnabled(i, gv->count());
}
}
void GUI::setMetricUnits()
{
_track->setUnits(Metric);

View File

@ -76,6 +76,7 @@ private:
void saveFile(const QString &fileName);
void updateStatusBarInfo();
void updateNavigationActions();
void updateGraphTabs();
void keyPressEvent(QKeyEvent * event);