Parser: parse into custom dive site table

To extend the undo system to dive sites, the importers and downloaders
must not parse directly into the global dive site table. Instead,
pass a dive_site_table argument to parse into.

For now, always pass the global dive_site_table so that this commit
should not cause any functional change.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-02-28 22:45:17 +01:00 committed by Dirk Hohndel
parent 926b6895bb
commit 37146c5742
36 changed files with 216 additions and 185 deletions

View file

@ -905,10 +905,10 @@ void DiveLogImportDialog::on_buttonBox_accepted()
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);
parse_seabear_log(qPrintable(fileNames[i]), &table, &trips, &dive_site_table);
} 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);
parse_txt_file(qPrintable(pair.second), qPrintable(pair.first), &table, &trips, &dive_site_table);
} else {
char *params[49];
int pnr = 0;
@ -925,7 +925,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
pnr = setup_csv_params(r, params, pnr);
parse_csv_file(qPrintable(fileNames[i]), params, pnr - 1,
specialCSV.contains(ui->knownImports->currentIndex()) ? qPrintable(CSVApps[ui->knownImports->currentIndex()].name) : "csv",
&table, &trips);
&table, &trips, &dive_site_table);
}
}
} else {
@ -989,7 +989,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
params[pnr++] = intdup(r.indexOf(tr("Rating")));
params[pnr++] = NULL;
parse_manual_file(qPrintable(fileNames[i]), params, pnr - 1, &table, &trips);
parse_manual_file(qPrintable(fileNames[i]), params, pnr - 1, &table, &trips, &dive_site_table);
} else {
char *params[51];
int pnr = 0;
@ -1006,7 +1006,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
pnr = setup_csv_params(r, params, pnr);
parse_csv_file(qPrintable(fileNames[i]), params, pnr - 1,
specialCSV.contains(ui->knownImports->currentIndex()) ? qPrintable(CSVApps[ui->knownImports->currentIndex()].name) : "csv",
&table, &trips);
&table, &trips, &dive_site_table);
}
}
}
@ -1019,7 +1019,7 @@ TagDragDelegate::TagDragDelegate(QObject *parent) : QStyledItemDelegate(parent)
{
}
QSize TagDragDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
QSize TagDragDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
{
QSize originalSize = QStyledItemDelegate::sizeHint(option, index);
return originalSize + QSize(5,5);