summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2018-04-28 12:20:39 +0300
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-05-01 22:42:10 +0300
commit12e4b6d62c06cde3e8ad0d1202ebd52b020f693c (patch)
treeff47ddc9bd3c204d9000dd8d823948dc614a3966 /desktop-widgets
parentc53442e37edb19f9481f4f0bb7e6b7b7773aea43 (diff)
downloadsubsurface-12e4b6d62c06cde3e8ad0d1202ebd52b020f693c.tar.gz
CSV import: include visibility and rating in import
Add support for visibility and rating to CSV import dialog. Fixes #1212 Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelogimportdialog.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index 84cff0f97..5633d50a2 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -49,7 +49,7 @@ ColumnNameProvider::ColumnNameProvider(QObject *parent) : QAbstractListModel(par
tr("O₂") << tr("He") << tr("Sample time") << tr("Sample depth") << tr("Sample temperature") << tr("Sample pO₂") << tr("Sample CNS") << tr("Sample NDL") <<
tr("Sample TTS") << tr("Sample stopdepth") << tr("Sample pressure") <<
tr("Sample sensor1 pO₂") << tr("Sample sensor2 pO₂") << tr("Sample sensor3 pO₂") <<
- tr("Sample setpoint");
+ tr("Sample setpoint") << tr("Visibility") << tr("Rating");
}
bool ColumnNameProvider::insertRows(int row, int count, const QModelIndex &parent)
@@ -784,6 +784,10 @@ int DiveLogImportDialog::setup_csv_params(QStringList r, char **params, int pnr)
params[pnr++] = intdup(r.indexOf(tr("Sample pressure")));
params[pnr++] = strdup("setpointField");
params[pnr++] = intdup(r.indexOf(tr("Sample setpoint")));
+ params[pnr++] = strdup("visibilityField");
+ params[pnr++] = intdup(r.indexOf(tr("Visibility")));
+ params[pnr++] = strdup("ratingField");
+ params[pnr++] = intdup(r.indexOf(tr("Rating")));
params[pnr++] = strdup("separatorIndex");
params[pnr++] = intdup(ui->CSVSeparator->currentIndex());
params[pnr++] = strdup("units");
@@ -875,7 +879,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
} else {
for (int i = 0; i < fileNames.size(); ++i) {
if (r.indexOf(tr("Sample time")) < 0) {
- char *params[55];
+ char *params[59];
int pnr = 0;
params[pnr++] = strdup("numberField");
params[pnr++] = intdup(r.indexOf(tr("Dive #")));
@@ -927,6 +931,10 @@ void DiveLogImportDialog::on_buttonBox_accepted()
params[pnr++] = intdup(r.indexOf(tr("Air temp.")));
params[pnr++] = strdup("watertempField");
params[pnr++] = intdup(r.indexOf(tr("Water temp.")));
+ params[pnr++] = strdup("visibilityField");
+ params[pnr++] = intdup(r.indexOf(tr("Visibility")));
+ params[pnr++] = strdup("ratingField");
+ params[pnr++] = intdup(r.indexOf(tr("Rating")));
params[pnr++] = NULL;
parse_manual_file(qPrintable(fileNames[i]), params, pnr - 1);