[PATCH 4/4] Add quirk for Seabear CSV NDL/TTS in minutes

Anton Lundin glance at acc.umu.se
Wed Jul 9 13:13:39 PDT 2014


In the Seabear CSV the NDL and TTS fields are in minutes, not seconds as
there time field. This is a ugly quirk but it gets the job done.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 qt-ui/divelogimportdialog.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp
index 98dbefd..27bb26b 100644
--- a/qt-ui/divelogimportdialog.cpp
+++ b/qt-ui/divelogimportdialog.cpp
@@ -11,7 +11,7 @@ const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] =
 	{ "APD Log Viewer", 1, 2, 16, 7, 18, -1, -1, 19, "Tab" },
 	{ "XP5", 1, 2, 10, -1, -1, -1, -1, -1, "Tab" },
 	{ "SensusCSV", 10, 11, -1, -1, -1, -1, -1, -1, "," },
-	{ "Seabear CSV", 1, 2, 6, -1, -1, -1, -1, 5, ";" },
+	{ "Seabear CSV", 1, 2, 6, -1, -1, 3, 4, 5, ";" },
 	{ NULL, }
 };
 
@@ -92,6 +92,16 @@ void DiveLogImportDialog::on_buttonBox_accepted()
 					  VALUE_IF_CHECKED(Tags));
 		}
 	}
+	if (ui->knownImports->currentText() == QString("Seabear CSV")) {
+		/* Seabear CSV stores NDL and TTS in Minutes, not seconds */
+		struct dive *dive = dive_table.dives[dive_table.nr - 1];
+		for(int s_nr = 0 ; s_nr <= dive->dc.samples ; s_nr++) {
+			struct sample *sample = dive->dc.sample + s_nr;
+			sample->ndl.seconds *= 60;
+			sample->tts.seconds *= 60;
+		}
+	}
+
 	process_dives(true, false);
 
 	MainWindow::instance()->refreshDisplay();
-- 
1.9.1



More information about the subsurface mailing list