From bda24d90917db9ae9dc892dfc06f35a358136203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 28 Mar 2018 02:01:27 +0200 Subject: [PATCH] Use $HOME as the default open directory (on all platforms) --- src/GUI/gui.cpp | 16 +++++++++++++--- src/GUI/gui.h | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/GUI/gui.cpp b/src/GUI/gui.cpp index 09908dcf..6228de6b 100644 --- a/src/GUI/gui.cpp +++ b/src/GUI/gui.cpp @@ -82,6 +82,10 @@ GUI::GUI() _sliderPos = 0; + _dataDir = QDir::homePath(); + _mapDir = QDir::homePath(); + _poiDir = QDir::homePath(); + readSettings(); updateGraphTabs(); @@ -660,11 +664,13 @@ void GUI::paths() void GUI::openFile() { QStringList files = QFileDialog::getOpenFileNames(this, tr("Open file"), - QString(), Data::formats()); + _dataDir, Data::formats()); QStringList list = files; for (QStringList::Iterator it = list.begin(); it != list.end(); it++) openFile(*it); + if (!list.isEmpty()) + _dataDir = QFileInfo(list.first()).path(); } bool GUI::openFile(const QString &fileName) @@ -749,11 +755,13 @@ bool GUI::loadFile(const QString &fileName) void GUI::openPOIFile() { QStringList files = QFileDialog::getOpenFileNames(this, tr("Open POI file"), - QString(), Data::formats()); + _poiDir, Data::formats()); QStringList list = files; for (QStringList::Iterator it = list.begin(); it != list.end(); it++) openPOIFile(*it); + if (!list.isEmpty()) + _poiDir = QFileInfo(list.first()).path(); } bool GUI::openPOIFile(const QString &fileName) @@ -1125,11 +1133,13 @@ void GUI::showGraphSliderInfo(bool show) void GUI::loadMap() { QStringList files = QFileDialog::getOpenFileNames(this, tr("Open map file"), - QString(), MapList::formats()); + _mapDir, MapList::formats()); QStringList list = files; for (QStringList::Iterator it = list.begin(); it != list.end(); it++) loadMap(*it); + if (!list.isEmpty()) + _mapDir = QFileInfo(list.first()).path(); } bool GUI::loadMap(const QString &fileName) diff --git a/src/GUI/gui.h b/src/GUI/gui.h index 26fe5339..a7fb699e 100644 --- a/src/GUI/gui.h +++ b/src/GUI/gui.h @@ -224,6 +224,8 @@ private: Export _export; Options _options; + + QString _dataDir, _mapDir, _poiDir; }; #endif // GUI_H