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

Fixed error reporting

This commit is contained in:
Martin Tůma 2018-02-10 09:57:21 +01:00
parent 8d3fcc7a17
commit 9675e19b94
2 changed files with 17 additions and 13 deletions

View File

@ -78,16 +78,7 @@ bool MapList::loadFile(const QString &path, bool *atlas, bool dir)
} }
} }
bool MapList::loadFile(const QString &path) bool MapList::loadDirR(const QString &path)
{
bool atlas;
_errorString.clear();
return loadFile(path, &atlas, false);
}
bool MapList::loadDir(const QString &path)
{ {
QDir md(path); QDir md(path);
md.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); md.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
@ -95,14 +86,12 @@ bool MapList::loadDir(const QString &path)
QFileInfoList ml = md.entryInfoList(); QFileInfoList ml = md.entryInfoList();
bool atlas, ret = true; bool atlas, ret = true;
_errorString.clear();
for (int i = 0; i < ml.size(); i++) { for (int i = 0; i < ml.size(); i++) {
const QFileInfo &fi = ml.at(i); const QFileInfo &fi = ml.at(i);
QString suffix = fi.suffix().toLower(); QString suffix = fi.suffix().toLower();
if (fi.isDir() && fi.fileName() != "set") { if (fi.isDir() && fi.fileName() != "set") {
if (!loadDir(fi.absoluteFilePath())) if (!loadDirR(fi.absoluteFilePath()))
ret = false; ret = false;
} else if (filter().contains("*." + suffix)) { } else if (filter().contains("*." + suffix)) {
if (!loadFile(fi.absoluteFilePath(), &atlas, true)) if (!loadFile(fi.absoluteFilePath(), &atlas, true))
@ -115,6 +104,20 @@ bool MapList::loadDir(const QString &path)
return ret; return ret;
} }
bool MapList::loadFile(const QString &path)
{
bool atlas;
_errorString.clear();
return loadFile(path, &atlas, false);
}
bool MapList::loadDir(const QString &path)
{
_errorString.clear();
return loadDirR(path);
}
void MapList::clear() void MapList::clear()
{ {
for (int i = 0; i < _maps.count(); i++) for (int i = 0; i < _maps.count(); i++)

View File

@ -26,6 +26,7 @@ public:
private: private:
bool loadFile(const QString &path, bool *atlas, bool dir); bool loadFile(const QString &path, bool *atlas, bool dir);
bool loadDirR(const QString &path);
Map *loadListEntry(const QByteArray &line); Map *loadListEntry(const QByteArray &line);