1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35: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()
{
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 (*)"));
QStringList list = files;
if (!fileName.isEmpty()) {
if (!_poi.loadFile(fileName)) {
QString error = tr("Error loading POI file:\n%1")
.arg(_poi.errorString()) + QString("\n");
if (_poi.errorLine())
error.append(tr("Line: %1").arg(_poi.errorLine()));
QMessageBox::critical(this, tr("Error"), error);
} else {
_showPOIAction->setChecked(true);
_track->loadPOI(_poi);
_poiFilesMenu->addAction(createPOIFileAction(
_poi.files().indexOf(fileName)));
}
for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
openPOIFile(*it);
}
bool GUI::openPOIFile(const QString &fileName)
{
if (fileName.isEmpty())
return false;
if (!_poi.loadFile(fileName)) {
QString error = tr("Error loading POI file:\n%1")
.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.render(&p, QRectF(0, 0, printer.width(), 200));
p.end();
}
void GUI::reloadFile()

View File

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