mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
41975435a2
commit
a261466594
25 changed files with 242 additions and 139 deletions
|
@ -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]), ¶ms,
|
||||
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(¶ms, "visibilityField", r.indexOf(tr("Visibility")));
|
||||
xml_params_add_int(¶ms, "ratingField", r.indexOf(tr("Rating")));
|
||||
|
||||
parse_manual_file(qPrintable(fileNames[i]), ¶ms, &table, &trips, &sites, &filter_presets);
|
||||
parse_manual_file(qPrintable(fileNames[i]), ¶ms, &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]), ¶ms,
|
||||
specialCSV.contains(ui->knownImports->currentIndex()) ? qPrintable(CSVApps[ui->knownImports->currentIndex()].name) : "csv",
|
||||
&table, &trips, &sites, &filter_presets);
|
||||
&table, &trips, &sites, &devices, &filter_presets);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue