summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
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 09:08:34 -0700
commite31df43cde1dfc66054921b8f12bec27805dfd1e (patch)
treef43c247339980c40305580331090a62811b69cb0 /desktop-widgets
parent74f01927113827dbaf0c85833aea0bd78fd2a803 (diff)
downloadsubsurface-e31df43cde1dfc66054921b8f12bec27805dfd1e.tar.gz
Detect DL7 depth units
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelogimportdialog.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index e70a75204..8bb8c77d7 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -471,10 +471,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);
}