diff options
Diffstat (limited to 'qt-ui/divelogimportdialog.cpp')
-rw-r--r-- | qt-ui/divelogimportdialog.cpp | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index 355f71356..39bcc3423 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -629,25 +629,49 @@ 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; + if (parse_seabear_csv_file(fileNames[i].toUtf8().data(), - r.indexOf(tr("Sample time")), - r.indexOf(tr("Sample depth")), - r.indexOf(tr("Sample temperature")), - r.indexOf(tr("Sample pO₂")), - r.indexOf(tr("Sample sensor1 pO₂")), - r.indexOf(tr("Sample sensor2 pO₂")), - r.indexOf(tr("Sample sensor3 pO₂")), - r.indexOf(tr("Sample CNS")), - r.indexOf(tr("Sample NDL")), - r.indexOf(tr("Sample TTS")), - r.indexOf(tr("Sample stopdepth")), - r.indexOf(tr("Sample pressure")), - ui->CSVSeparator->currentIndex(), - "csv", - ui->CSVUnits->currentIndex(), - delta.toUtf8().data(), - hw.toUtf8().data() - ) < 0) { + params, pnr - 1, "csv") < 0) { return; } // Seabear CSV stores NDL and TTS in Minutes, not seconds |