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

Replace global data sources with user data sources rather than merging them

This commit is contained in:
Martin Tůma 2016-03-25 11:27:42 +01:00
parent 501431207f
commit 1928b579ab

View File

@ -96,17 +96,23 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
void GUI::loadMaps() void GUI::loadMaps()
{ {
_maps = MapList::load(this, USER_MAP_FILE); if (QFile::exists(USER_MAP_FILE))
_maps += MapList::load(this, GLOBAL_MAP_FILE); _maps = MapList::load(this, USER_MAP_FILE);
else
_maps = MapList::load(this, GLOBAL_MAP_FILE);
} }
void GUI::loadPOIs() void GUI::loadPOIs()
{ {
QFileInfoList list;
QDir userDir(USER_POI_DIR); QDir userDir(USER_POI_DIR);
QDir globalDir(GLOBAL_POI_DIR); QDir globalDir(GLOBAL_POI_DIR);
QFileInfoList list = userDir.entryInfoList(QStringList(), QDir::Files) if (userDir.exists())
+ globalDir.entryInfoList(QStringList(), QDir::Files); list = userDir.entryInfoList(QStringList(), QDir::Files);
else
list = globalDir.entryInfoList(QStringList(), QDir::Files);
for (int i = 0; i < list.size(); ++i) for (int i = 0; i < list.size(); ++i)
_poi.loadFile(list.at(i).absoluteFilePath()); _poi.loadFile(list.at(i).absoluteFilePath());
} }