mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-12-02 23:49:09 +01:00
Only trigger the last loaded map
This commit is contained in:
parent
c2e50e5213
commit
2b8c3f64ac
@ -1434,19 +1434,25 @@ void GUI::loadMap()
|
|||||||
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open map file"),
|
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open map file"),
|
||||||
_mapDir, MapList::formats());
|
_mapDir, MapList::formats());
|
||||||
QStringList list = files;
|
QStringList list = files;
|
||||||
|
MapAction *lastReady = 0;
|
||||||
|
|
||||||
for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
|
for (QStringList::Iterator it = list.begin(); it != list.end(); it++) {
|
||||||
loadMap(*it);
|
MapAction *a = loadMap(*it);
|
||||||
|
if (a)
|
||||||
|
lastReady = a;
|
||||||
|
}
|
||||||
if (!list.isEmpty())
|
if (!list.isEmpty())
|
||||||
_mapDir = QFileInfo(list.first()).path();
|
_mapDir = QFileInfo(list.first()).path();
|
||||||
|
if (lastReady)
|
||||||
|
lastReady->trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GUI::loadMap(const QString &fileName)
|
MapAction *GUI::loadMap(const QString &fileName)
|
||||||
{
|
{
|
||||||
// On OS X fileName may be a directory!
|
// On OS X fileName may be a directory!
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return false;
|
return 0;
|
||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
QList<Map*> maps = MapList::loadMaps(fileName, error);
|
QList<Map*> maps = MapList::loadMaps(fileName, error);
|
||||||
@ -1454,7 +1460,7 @@ bool GUI::loadMap(const QString &fileName)
|
|||||||
error = tr("Error loading map:") + "\n\n"
|
error = tr("Error loading map:") + "\n\n"
|
||||||
+ fileName + "\n\n" + error;
|
+ fileName + "\n\n" + error;
|
||||||
QMessageBox::critical(this, APP_NAME, error);
|
QMessageBox::critical(this, APP_NAME, error);
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapAction *lastReady = 0;
|
MapAction *lastReady = 0;
|
||||||
@ -1470,10 +1476,7 @@ bool GUI::loadMap(const QString &fileName)
|
|||||||
connect(a, SIGNAL(loaded()), this, SLOT(mapLoaded()));
|
connect(a, SIGNAL(loaded()), this, SLOT(mapLoaded()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastReady)
|
return lastReady;
|
||||||
lastReady->trigger();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::mapLoaded()
|
void GUI::mapLoaded()
|
||||||
|
@ -120,7 +120,7 @@ private:
|
|||||||
|
|
||||||
bool openPOIFile(const QString &fileName);
|
bool openPOIFile(const QString &fileName);
|
||||||
bool loadFile(const QString &fileName);
|
bool loadFile(const QString &fileName);
|
||||||
bool loadMap(const QString &fileName);
|
MapAction *loadMap(const QString &fileName);
|
||||||
void updateStatusBarInfo();
|
void updateStatusBarInfo();
|
||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
void updateNavigationActions();
|
void updateNavigationActions();
|
||||||
|
Loading…
Reference in New Issue
Block a user