summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2017-05-07 13:41:09 +0300
committerGravatar Miika Turkia <miika.turkia@gmail.com>2017-05-07 13:53:52 +0300
commit0dfa448d8c7132bd0058a6fb3bc820fdde2a4759 (patch)
treecd1b2e74436ea9c2aa41d6290b68fc8a0f8a0ef2 /desktop-widgets
parentab1813a4454cbe639e99eaee7cd1115bfed1cf8f (diff)
downloadsubsurface-0dfa448d8c7132bd0058a6fb3bc820fdde2a4759.tar.gz
Refactor Seabear import
Moving the GUI independent Seabear import functionality to Subsurface core. This will allow Robert to call it directly from download from DC. Tested with H3 against released and daily versions of Subsurface. The result differs somewhat, but it is actually fixing 2 bugs: - Temperature was mis-interpreted previously - Sample interval for a dive with 1 second interval was parsed incorrectly Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelogimportdialog.cpp51
1 files changed, 1 insertions, 50 deletions
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index 9a455fcdb..51046216f 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -846,58 +846,9 @@ void DiveLogImportDialog::on_buttonBox_accepted()
if (ui->knownImports->currentText() != "Manual import") {
for (int i = 0; i < fileNames.size(); ++i) {
if (ui->knownImports->currentText() == "Seabear CSV") {
- char *params[40];
- int pnr = 0;
- params[pnr++] = strdup("timeField");
- params[pnr++] = intdup(r.indexOf(tr("Sample time")));
- params[pnr++] = strdup("depthField");
- params[pnr++] = intdup(r.indexOf(tr("Sample depth")));
- params[pnr++] = strdup("tempField");
- params[pnr++] = intdup(r.indexOf(tr("Sample temperature")));
- params[pnr++] = strdup("po2Field");
- params[pnr++] = intdup(r.indexOf(tr("Sample pO₂")));
- params[pnr++] = strdup("o2sensor1Field");
- params[pnr++] = intdup(r.indexOf(tr("Sample sensor1 pO₂")));
- params[pnr++] = strdup("o2sensor2Field");
- params[pnr++] = intdup(r.indexOf(tr("Sample sensor2 pO₂")));
- params[pnr++] = strdup("o2sensor3Field");
- params[pnr++] = intdup(r.indexOf(tr("Sample sensor3 pO₂")));
- params[pnr++] = strdup("cnsField");
- params[pnr++] = intdup(r.indexOf(tr("Sample CNS")));
- params[pnr++] = strdup("ndlField");
- params[pnr++] = intdup(r.indexOf(tr("Sample NDL")));
- params[pnr++] = strdup("ttsField");
- params[pnr++] = intdup(r.indexOf(tr("Sample TTS")));
- params[pnr++] = strdup("stopdepthField");
- params[pnr++] = intdup(r.indexOf(tr("Sample stopdepth")));
- params[pnr++] = strdup("pressureField");
- params[pnr++] = intdup(r.indexOf(tr("Sample pressure")));
- params[pnr++] = strdup("setpointFiend");
- params[pnr++] = intdup(-1);
- params[pnr++] = strdup("separatorIndex");
- params[pnr++] = intdup(ui->CSVSeparator->currentIndex());
- params[pnr++] = strdup("units");
- params[pnr++] = intdup(ui->CSVUnits->currentIndex());
- params[pnr++] = strdup("delta");
- params[pnr++] = strdup(delta.toUtf8().data());
- if (hw.length()) {
- params[pnr++] = strdup("hw");
- params[pnr++] = strdup(hw.toUtf8().data());
- }
- params[pnr++] = NULL;
+ parse_seabear_log(fileNames[i].toUtf8().data());
- if (parse_seabear_csv_file(fileNames[i].toUtf8().data(),
- params, pnr - 1, "csv") < 0) {
- return;
- }
- // 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;
- }
} else {
char *params[49];
int pnr = 0;