aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/divelogimportdialog.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-17 12:32:22 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-24 09:51:37 -0700
commita2614665942959b95eef8453730cd3ac66ac42a3 (patch)
treee8491231112634e6fa188a605ddab47910cfe8c2 /desktop-widgets/divelogimportdialog.cpp
parent41975435a2a93733a0e46a7e594ffba193be6e87 (diff)
downloadsubsurface-a2614665942959b95eef8453730cd3ac66ac42a3.tar.gz
parser: add device_table to parser state
If we want to avoid the parsers to directly modify global data, we have to provide a device_table to parse into. This adds such a state and the corresponding function parameters. However, for now this is unused. Adding new parameters is very painful and this commit shows that we urgently need a "struct divelog" collecting all those tables! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/divelogimportdialog.cpp')
-rw-r--r--desktop-widgets/divelogimportdialog.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index eccdd2264..e6243e98d 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -13,6 +13,7 @@
#include "core/filterpreset.h"
#include "core/qthelper.h"
#include "core/divesite.h"
+#include "core/device.h"
#include "core/trip.h"
#include "core/import-csv.h"
#include "core/xmlparams.h"
@@ -880,15 +881,16 @@ void DiveLogImportDialog::on_buttonBox_accepted()
struct dive_table table = empty_dive_table;
struct trip_table trips = empty_trip_table;
struct dive_site_table sites = empty_dive_site_table;
+ struct device_table devices;
struct filter_preset_table filter_presets;
QStringList r = resultModel->result();
if (ui->knownImports->currentText() != "Manual import") {
for (int i = 0; i < fileNames.size(); ++i) {
if (ui->knownImports->currentText() == "Seabear CSV") {
- parse_seabear_log(qPrintable(fileNames[i]), &table, &trips, &sites, &filter_presets);
+ parse_seabear_log(qPrintable(fileNames[i]), &table, &trips, &sites, &devices, &filter_presets);
} else if (ui->knownImports->currentText() == "Poseidon MkVI") {
QPair<QString, QString> pair = poseidonFileNames(fileNames[i]);
- parse_txt_file(qPrintable(pair.second), qPrintable(pair.first), &table, &trips, &sites);
+ parse_txt_file(qPrintable(pair.second), qPrintable(pair.first), &table, &trips, &sites, &devices);
} else {
xml_params params;
@@ -902,7 +904,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
setup_csv_params(r, params);
parse_csv_file(qPrintable(fileNames[i]), &params,
specialCSV.contains(ui->knownImports->currentIndex()) ? qPrintable(CSVApps[ui->knownImports->currentIndex()].name) : "csv",
- &table, &trips, &sites, &filter_presets);
+ &table, &trips, &sites, &devices, &filter_presets);
}
}
} else {
@@ -938,7 +940,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
xml_params_add_int(&params, "visibilityField", r.indexOf(tr("Visibility")));
xml_params_add_int(&params, "ratingField", r.indexOf(tr("Rating")));
- parse_manual_file(qPrintable(fileNames[i]), &params, &table, &trips, &sites, &filter_presets);
+ parse_manual_file(qPrintable(fileNames[i]), &params, &table, &trips, &sites, &devices, &filter_presets);
} else {
xml_params params;
@@ -952,7 +954,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
setup_csv_params(r, params);
parse_csv_file(qPrintable(fileNames[i]), &params,
specialCSV.contains(ui->knownImports->currentIndex()) ? qPrintable(CSVApps[ui->knownImports->currentIndex()].name) : "csv",
- &table, &trips, &sites, &filter_presets);
+ &table, &trips, &sites, &devices, &filter_presets);
}
}
}