1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-19 04:02:09 +01:00

Remove the weired file lists copies

It used to be written in the Qt4 documentation to iterate over a copy, but
there is aparently no real reason doing that...
This commit is contained in:
Martin Tůma 2020-12-06 13:03:32 +01:00
parent 2b8c3f64ac
commit 07fa377e38

View File

@ -765,14 +765,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"),
_dataDir, Data::formats()); _dataDir, Data::formats()));
QStringList list = files;
for (QStringList::Iterator it = list.begin(); it != list.end(); it++) for (int i = 0; i < files.size(); i++)
openFile(*it); openFile(files.at(i));
if (!list.isEmpty()) if (!files.isEmpty())
_dataDir = QFileInfo(list.first()).path(); _dataDir = QFileInfo(files.last()).path();
} }
bool GUI::openFile(const QString &fileName) bool GUI::openFile(const QString &fileName)
@ -874,14 +873,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"),
_poiDir, Data::formats()); _poiDir, Data::formats()));
QStringList list = files;
for (QStringList::Iterator it = list.begin(); it != list.end(); it++) for (int i = 0; i < files.size(); i++)
openPOIFile(*it); openPOIFile(files.at(i));
if (!list.isEmpty()) if (!files.isEmpty())
_poiDir = QFileInfo(list.first()).path(); _poiDir = QFileInfo(files.last()).path();
} }
bool GUI::openPOIFile(const QString &fileName) bool GUI::openPOIFile(const QString &fileName)
@ -1431,18 +1429,17 @@ 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"),
_mapDir, MapList::formats()); _mapDir, MapList::formats()));
QStringList list = files;
MapAction *lastReady = 0; MapAction *lastReady = 0;
for (QStringList::Iterator it = list.begin(); it != list.end(); it++) { for (int i = 0; i < files.size(); i++) {
MapAction *a = loadMap(*it); MapAction *a = loadMap(files.at(i));
if (a) if (a)
lastReady = a; lastReady = a;
} }
if (!list.isEmpty()) if (!files.isEmpty())
_mapDir = QFileInfo(list.first()).path(); _mapDir = QFileInfo(files.last()).path();
if (lastReady) if (lastReady)
lastReady->trigger(); lastReady->trigger();
} }