diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2015-02-07 16:42:28 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-02-07 08:56:27 -0800 |
commit | 0e264872089f197ab1e240151eb4f1649150bc9a (patch) | |
tree | ffe4a385128af11124b693fb5645e5fd5d040157 /qt-ui/divelogimportdialog.cpp | |
parent | 936fc2dae76fd3a2f8e661e23da1b0c52fcaf36c (diff) | |
download | subsurface-0e264872089f197ab1e240151eb4f1649150bc9a.tar.gz |
Select the known import for APD automatically
If the filename has extension of .apd, then set the known import
automatically.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelogimportdialog.cpp')
-rw-r--r-- | qt-ui/divelogimportdialog.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index ca3a2bec5..bb4701ce3 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -361,6 +361,7 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy) bool matchedSome = false; bool seabear = false; bool xp5 = false; + bool apd = false; // reset everything ColumnNameProvider *provider = new ColumnNameProvider(this); @@ -387,10 +388,13 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy) } // Special handling for APD Log Viewer - if (triggeredBy == KNOWNTYPES && value == 1) { + if ((triggeredBy == KNOWNTYPES && value == 1) || (triggeredBy == INITIAL && fileNames.first().endsWith(".apd", Qt::CaseInsensitive))) { + apd=true; firstLine = "Sample time\tSample depth\t\t\t\t\tSample pO₂\t\t\t\t\t\t\t\t\tSample temperature\t\tSample CNS\tSample stopdepth"; blockSignals(true); ui->CSVSeparator->setCurrentText(tr("Tab")); + if (triggeredBy == INITIAL && fileNames.first().contains(".apd", Qt::CaseInsensitive)) + ui->knownImports->setCurrentText("APD Log Viewer"); blockSignals(false); } @@ -433,7 +437,7 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy) } if (matchedSome) { ui->dragInstructions->setText(tr("Some column headers were pre-populated; please drag and drop the headers so they match the column they are in.")); - if (triggeredBy != KNOWNTYPES && !seabear && !xp5) { + if (triggeredBy != KNOWNTYPES && !seabear && !xp5 && !apd) { blockSignals(true); ui->knownImports->setCurrentIndex(0); // <- that's "Manual import" blockSignals(false); |