From 1928b579abe554bea1bb56520c96f5e41f09fc8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 25 Mar 2016 11:27:42 +0100 Subject: [PATCH] Replace global data sources with user data sources rather than merging them --- src/gui.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/gui.cpp b/src/gui.cpp index c8a1e25e..dc27640a 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -96,17 +96,23 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent) void GUI::loadMaps() { - _maps = MapList::load(this, USER_MAP_FILE); - _maps += MapList::load(this, GLOBAL_MAP_FILE); + if (QFile::exists(USER_MAP_FILE)) + _maps = MapList::load(this, USER_MAP_FILE); + else + _maps = MapList::load(this, GLOBAL_MAP_FILE); } void GUI::loadPOIs() { + QFileInfoList list; QDir userDir(USER_POI_DIR); QDir globalDir(GLOBAL_POI_DIR); - QFileInfoList list = userDir.entryInfoList(QStringList(), QDir::Files) - + globalDir.entryInfoList(QStringList(), QDir::Files); + if (userDir.exists()) + list = userDir.entryInfoList(QStringList(), QDir::Files); + else + list = globalDir.entryInfoList(QStringList(), QDir::Files); + for (int i = 0; i < list.size(); ++i) _poi.loadFile(list.at(i).absoluteFilePath()); }