1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-02-07 12:05:14 +01:00

Improved error handling

This commit is contained in:
Martin Tůma 2016-10-28 19:29:42 +02:00
parent 5693375a3f
commit 6a25ad6379
2 changed files with 17 additions and 11 deletions

View File

@ -81,7 +81,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
_sliderPos = 0; _sliderPos = 0;
updateGraphTabs(); updateGraphTabs();
updateTrackView(); updatePathView();
updateStatusBarInfo(); updateStatusBarInfo();
readSettings(); readSettings();
@ -622,18 +622,18 @@ bool GUI::openFile(const QString &fileName)
_browser->setCurrent(fileName); _browser->setCurrent(fileName);
_fileActionGroup->setEnabled(true); _fileActionGroup->setEnabled(true);
_navigationActionGroup->setEnabled(true); _navigationActionGroup->setEnabled(true);
updateNavigationActions();
updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs();
updatePathView();
} else { } else {
if (_files.isEmpty()) if (_files.isEmpty())
_fileActionGroup->setEnabled(false); _fileActionGroup->setEnabled(false);
ret = false; ret = false;
} }
updateNavigationActions();
updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs();
updateTrackView();
return ret; return ret;
} }
@ -668,6 +668,12 @@ bool GUI::loadFile(const QString &fileName)
return true; return true;
} else { } else {
updateNavigationActions();
updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs();
updatePathView();
QString error = fileName + QString("\n\n") QString error = fileName + QString("\n\n")
+ tr("Error loading data file:\n%1").arg(data.errorString()) + tr("Error loading data file:\n%1").arg(data.errorString())
+ QString("\n"); + QString("\n");
@ -842,7 +848,7 @@ void GUI::reloadFile()
updateStatusBarInfo(); updateStatusBarInfo();
updateWindowTitle(); updateWindowTitle();
updateGraphTabs(); updateGraphTabs();
updateTrackView(); updatePathView();
if (_files.isEmpty()) if (_files.isEmpty())
_fileActionGroup->setEnabled(false); _fileActionGroup->setEnabled(false);
else else
@ -876,7 +882,7 @@ void GUI::closeAll()
updateStatusBarInfo(); updateStatusBarInfo();
updateWindowTitle(); updateWindowTitle();
updateGraphTabs(); updateGraphTabs();
updateTrackView(); updatePathView();
} }
void GUI::showMap(bool show) void GUI::showMap(bool show)
@ -1093,7 +1099,7 @@ void GUI::updateGraphTabs()
} }
} }
void GUI::updateTrackView() void GUI::updatePathView()
{ {
_pathView->setHidden(!(_pathView->trackCount() + _pathView->routeCount() _pathView->setHidden(!(_pathView->trackCount() + _pathView->routeCount()
+ _pathView->waypointCount())); + _pathView->waypointCount()));

View File

@ -98,7 +98,7 @@ private:
void updateWindowTitle(); void updateWindowTitle();
void updateNavigationActions(); void updateNavigationActions();
void updateGraphTabs(); void updateGraphTabs();
void updateTrackView(); void updatePathView();
void setUnits(Units units); void setUnits(Units units);
void setGraphType(GraphType type); void setGraphType(GraphType type);