summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-01-24 17:03:10 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-24 14:49:28 -0800
commit6bb1fee9a61f412fd20fd8fabda249294bee10c7 (patch)
treef767435fefa07e3af78d1ed517acbc43ee48cbaf
parentafae2af13f744da03b8cf472cb2b7d7aefff1209 (diff)
downloadsubsurface-6bb1fee9a61f412fd20fd8fabda249294bee10c7.tar.gz
Enable importing of dive profile from CSV files
This assumes that we have either dive details or dive profile, not combined log files. Before the change in the import UI, user selected the import type by the tab on import dialog, now we make an educated guess based on whether sample time field is available. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/divelogimportdialog.cpp68
1 files changed, 42 insertions, 26 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp
index 838ea8974..8c3099fc4 100644
--- a/qt-ui/divelogimportdialog.cpp
+++ b/qt-ui/divelogimportdialog.cpp
@@ -551,32 +551,48 @@ void DiveLogImportDialog::on_buttonBox_accepted()
}
} else {
for (int i = 0; i < fileNames.size(); ++i) {
- parse_manual_file(fileNames[i].toUtf8().data(),
- ui->CSVSeparator->currentIndex(),
- ui->CSVUnits->currentIndex(),
- ui->DateFormat->currentIndex(),
- ui->DurationFormat->currentIndex(),
- r.indexOf(tr("Dive #")),
- r.indexOf(tr("Date")),
- r.indexOf(tr("Time")),
- r.indexOf(tr("Duration")),
- r.indexOf(tr("Location")),
- r.indexOf(tr("GPS")),
- r.indexOf(tr("Max depth")),
- r.indexOf(tr("Mean depth")),
- r.indexOf(tr("Divemaster")),
- r.indexOf(tr("Buddy")),
- r.indexOf(tr("Notes")),
- r.indexOf(tr("Weight")),
- r.indexOf(tr("Tags")),
- r.indexOf(tr("Cyl. size")),
- r.indexOf(tr("Start pressure")),
- r.indexOf(tr("End pressure")),
- r.indexOf(tr("O₂")),
- r.indexOf(tr("He")),
- r.indexOf(tr("Air temp.")),
- r.indexOf(tr("Water temp."))
- );
+ if (r.indexOf(tr("Sample time")) < 0)
+ parse_manual_file(fileNames[i].toUtf8().data(),
+ ui->CSVSeparator->currentIndex(),
+ ui->CSVUnits->currentIndex(),
+ ui->DateFormat->currentIndex(),
+ ui->DurationFormat->currentIndex(),
+ r.indexOf(tr("Dive #")),
+ r.indexOf(tr("Date")),
+ r.indexOf(tr("Time")),
+ r.indexOf(tr("Duration")),
+ r.indexOf(tr("Location")),
+ r.indexOf(tr("GPS")),
+ r.indexOf(tr("Max depth")),
+ r.indexOf(tr("Mean depth")),
+ r.indexOf(tr("Divemaster")),
+ r.indexOf(tr("Buddy")),
+ r.indexOf(tr("Notes")),
+ r.indexOf(tr("Weight")),
+ r.indexOf(tr("Tags")),
+ r.indexOf(tr("Cyl. size")),
+ r.indexOf(tr("Start pressure")),
+ r.indexOf(tr("End pressure")),
+ r.indexOf(tr("O₂")),
+ r.indexOf(tr("He")),
+ r.indexOf(tr("Air temp.")),
+ r.indexOf(tr("Water temp."))
+ );
+ else
+ parse_csv_file(fileNames[i].toUtf8().data(),
+ r.indexOf(tr("Sample time")),
+ r.indexOf(tr("Sample depth")),
+ r.indexOf(tr("Sample temperature")),
+ r.indexOf(tr("Sample po2")),
+ r.indexOf(tr("Sample cns")),
+ r.indexOf(tr("Sample ndl")),
+ r.indexOf(tr("Sample tts")),
+ r.indexOf(tr("Sample stopdepth")),
+ r.indexOf(tr("Sample pressure")),
+ ui->CSVSeparator->currentIndex(),
+ specialCSV.contains(ui->knownImports->currentIndex()) ? CSVApps[ui->knownImports->currentIndex()].name.toUtf8().data() : "csv",
+ ui->CSVUnits->currentIndex()
+ );
}
}
process_dives(true, false);