summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2016-04-24 21:11:20 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-25 12:31:36 -0700
commitf7ec0b3dd0a73c6bea3265f11e090ed2867d8e52 (patch)
tree0035fa94c07d39bdda23d6d0f549088831580547
parentd6f6a8c7f811ba36658ea8b764fd9446fc12dd15 (diff)
downloadsubsurface-f7ec0b3dd0a73c6bea3265f11e090ed2867d8e52.tar.gz
Detect DL7 depth units
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/divelogimportdialog.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp
index d6f9ee783..0beb5fd15 100644
--- a/qt-ui/divelogimportdialog.cpp
+++ b/qt-ui/divelogimportdialog.cpp
@@ -463,10 +463,21 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
ui->knownImports->setCurrentText("XP5");
blockSignals(false);
} else if (firstLine.contains("FSH")) {
+ QString units = "Metric";
dl7 = true;
+ while ((firstLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
+ /* DL7 actually defines individual units (e.g. depth, temp, pressure, etc.)
+ * and there are quite a few other options as well, but let's use metric
+ * unless depth unit is clearly Imperial. */
+
+ if (firstLine.contains("ThFt")) {
+ units = "Imperial";
+ }
+ }
firstLine = "|Sample time|Sample depth||||||||";
blockSignals(true);
ui->knownImports->setCurrentText("DAN DL7");
+ ui->CSVUnits->setCurrentText(units);
blockSignals(false);
}