Skip to content

Commit

Permalink
Clean up the splitter/graph tabs logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tumic0 committed Sep 21, 2024
1 parent 762e374 commit b01dcc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/GUI/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1171,8 +1171,7 @@ void GUI::loadData(const Data &data)

for (int i = 0; i < _tabs.count(); i++)
graphs.append(_tabs.at(i)->loadData(data, _map));
if (updateGraphTabs())
_splitter->refresh();
updateGraphTabs();
paths = _mapView->loadData(data);

GraphTab *gt = static_cast<GraphTab*>(_graphTabWidget->currentWidget());
Expand Down Expand Up @@ -1620,7 +1619,7 @@ void GUI::closeAll()

void GUI::showGraphs(bool show)
{
_graphTabWidget->setHidden(!show);
_graphTabWidget->setVisible(show);
}

#ifdef Q_OS_ANDROID
Expand Down Expand Up @@ -2220,11 +2219,10 @@ void GUI::updateNavigationActions()
#endif // Q_OS_ANDROID
}

bool GUI::updateGraphTabs()
void GUI::updateGraphTabs()
{
int index;
GraphTab *tab;
bool hidden = _graphTabWidget->isHidden();

for (int i = 0; i < _tabs.size(); i++) {
tab = _tabs.at(i);
Expand All @@ -2242,14 +2240,12 @@ bool GUI::updateGraphTabs()
((_showTracksAction->isChecked() && _trackCount)
|| (_showRoutesAction->isChecked() && _routeCount))) {
if (_showGraphsAction->isChecked())
_graphTabWidget->setHidden(false);
_graphTabWidget->show();
_showGraphsAction->setEnabled(true);
} else {
_graphTabWidget->setHidden(true);
_graphTabWidget->hide();
_showGraphsAction->setEnabled(false);
}

return (hidden != _graphTabWidget->isHidden());
}

void GUI::updateDataDEMDownloadAction()
Expand Down
2 changes: 1 addition & 1 deletion src/GUI/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private slots:
QMenu *menu, const QList<QAction*> &existingActions, int &showError);
void updateStatusBarInfo();
void updateWindowTitle();
bool updateGraphTabs();
void updateGraphTabs();
void updateDataDEMDownloadAction();
void updateMapDEMDownloadAction();
#ifndef Q_OS_ANDROID
Expand Down

0 comments on commit b01dcc4

Please sign in to comment.