[PATCH 07/12] Detect DL7 depth units
Miika Turkia
miika.turkia at gmail.com
Sun Apr 24 11:11:20 PDT 2016
Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
desktop-widgets/divelogimportdialog.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index e70a752..8bb8c77 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);
}
--
2.5.0
More information about the subsurface
mailing list