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

Enabled loading multiple POI files at once

This commit is contained in:
Martin Tůma 2016-03-22 19:47:11 +01:00
parent e0fd77bbfd
commit 14290bf1f0
2 changed files with 27 additions and 16 deletions

View File

@ -513,22 +513,34 @@ bool GUI::loadFile(const QString &fileName)
void GUI::openPOIFile() void GUI::openPOIFile()
{ {
QString fileName = QFileDialog::getOpenFileName(this, tr("Open POI file"), QStringList files = QFileDialog::getOpenFileNames(this, tr("Open POI file"),
QString(), tr("GPX files (*.gpx);;CSV files (*.csv);;All files (*)")); QString(), tr("GPX files (*.gpx);;CSV files (*.csv);;All files (*)"));
QStringList list = files;
if (!fileName.isEmpty()) { for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
if (!_poi.loadFile(fileName)) { openPOIFile(*it);
QString error = tr("Error loading POI file:\n%1") }
.arg(_poi.errorString()) + QString("\n");
if (_poi.errorLine()) bool GUI::openPOIFile(const QString &fileName)
error.append(tr("Line: %1").arg(_poi.errorLine())); {
QMessageBox::critical(this, tr("Error"), error); if (fileName.isEmpty())
} else { return false;
_showPOIAction->setChecked(true);
_track->loadPOI(_poi); if (!_poi.loadFile(fileName)) {
_poiFilesMenu->addAction(createPOIFileAction( QString error = tr("Error loading POI file:\n%1")
_poi.files().indexOf(fileName))); .arg(_poi.errorString()) + QString("\n");
} if (_poi.errorLine())
error.append(tr("Line: %1").arg(_poi.errorLine()));
QMessageBox::critical(this, tr("Error"), error);
return false;
} else {
_showPOIAction->setChecked(true);
_track->loadPOI(_poi);
_poiFilesMenu->addAction(createPOIFileAction(
_poi.files().indexOf(fileName)));
return true;
} }
} }
@ -608,8 +620,6 @@ void GUI::saveFile(const QString &fileName)
} }
scene.addItem(&info); scene.addItem(&info);
scene.render(&p, QRectF(0, 0, printer.width(), 200)); scene.render(&p, QRectF(0, 0, printer.width(), 200));
p.end();
} }
void GUI::reloadFile() void GUI::reloadFile()

View File

@ -71,6 +71,7 @@ private:
void createTrackView(); void createTrackView();
void createTrackGraphs(); void createTrackGraphs();
bool openPOIFile(const QString &fileName);
bool loadFile(const QString &fileName); bool loadFile(const QString &fileName);
void saveFile(const QString &fileName); void saveFile(const QString &fileName);
void updateStatusBarInfo(); void updateStatusBarInfo();