1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Use $HOME as the default open directory (on all platforms)

This commit is contained in:
Martin Tůma 2018-03-28 02:01:27 +02:00
parent 820e614921
commit bda24d9091
2 changed files with 15 additions and 3 deletions

View File

@ -82,6 +82,10 @@ GUI::GUI()
_sliderPos = 0; _sliderPos = 0;
_dataDir = QDir::homePath();
_mapDir = QDir::homePath();
_poiDir = QDir::homePath();
readSettings(); readSettings();
updateGraphTabs(); updateGraphTabs();
@ -660,11 +664,13 @@ void GUI::paths()
void GUI::openFile() void GUI::openFile()
{ {
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open file"), QStringList files = QFileDialog::getOpenFileNames(this, tr("Open file"),
QString(), Data::formats()); _dataDir, Data::formats());
QStringList list = files; QStringList list = files;
for (QStringList::Iterator it = list.begin(); it != list.end(); it++) for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
openFile(*it); openFile(*it);
if (!list.isEmpty())
_dataDir = QFileInfo(list.first()).path();
} }
bool GUI::openFile(const QString &fileName) bool GUI::openFile(const QString &fileName)
@ -749,11 +755,13 @@ bool GUI::loadFile(const QString &fileName)
void GUI::openPOIFile() void GUI::openPOIFile()
{ {
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open POI file"), QStringList files = QFileDialog::getOpenFileNames(this, tr("Open POI file"),
QString(), Data::formats()); _poiDir, Data::formats());
QStringList list = files; QStringList list = files;
for (QStringList::Iterator it = list.begin(); it != list.end(); it++) for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
openPOIFile(*it); openPOIFile(*it);
if (!list.isEmpty())
_poiDir = QFileInfo(list.first()).path();
} }
bool GUI::openPOIFile(const QString &fileName) bool GUI::openPOIFile(const QString &fileName)
@ -1125,11 +1133,13 @@ void GUI::showGraphSliderInfo(bool show)
void GUI::loadMap() void GUI::loadMap()
{ {
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open map file"), QStringList files = QFileDialog::getOpenFileNames(this, tr("Open map file"),
QString(), MapList::formats()); _mapDir, MapList::formats());
QStringList list = files; QStringList list = files;
for (QStringList::Iterator it = list.begin(); it != list.end(); it++) for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
loadMap(*it); loadMap(*it);
if (!list.isEmpty())
_mapDir = QFileInfo(list.first()).path();
} }
bool GUI::loadMap(const QString &fileName) bool GUI::loadMap(const QString &fileName)

View File

@ -224,6 +224,8 @@ private:
Export _export; Export _export;
Options _options; Options _options;
QString _dataDir, _mapDir, _poiDir;
}; };
#endif // GUI_H #endif // GUI_H