summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2016-04-24 21:11:19 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-04-25 12:31:27 -0700
commitd6f6a8c7f811ba36658ea8b764fd9446fc12dd15 (patch)
treec917beaf8cd15fa24822c362e5b77362bc56a1c4
parent9fe0cbaae4542927767233c20afe697cca4c9636 (diff)
downloadsubsurface-d6f6a8c7f811ba36658ea8b764fd9446fc12dd15.tar.gz
Basic GUI part for DL7 import
This sets the basic properties properly but is still missing the parsing of meta-data, especially used units. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/divelogimportdialog.cpp18
-rw-r--r--qt-ui/divelogimportdialog.h2
2 files changed, 18 insertions, 2 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp
index ae12b7c54..d6f9ee783 100644
--- a/qt-ui/divelogimportdialog.cpp
+++ b/qt-ui/divelogimportdialog.cpp
@@ -15,6 +15,7 @@ const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] =
{ "Manual import", },
{ "APD Log Viewer - DC1", 0, 1, 15, 6, 3, 4, 5, 17, -1, -1, 18, -1, 2, "Tab" },
{ "APD Log Viewer - DC2", 0, 1, 15, 6, 7, 8, 9, 17, -1, -1, 18, -1, 2, "Tab" },
+ { "DAN DL7", 1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "|" },
{ "XP5", 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Tab" },
{ "SensusCSV", 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "," },
{ "Seabear CSV", 0, 1, 5, -1, -1, -1, -1, -1, 2, 3, 4, 6, -1, ";" },
@@ -26,6 +27,7 @@ static enum {
MANUAL,
APD,
APD2,
+ DL7,
XP5,
SENSUS,
SEABEAR,
@@ -378,6 +380,7 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
bool seabear = false;
bool xp5 = false;
bool apd = false;
+ bool dl7 = false;
// reset everything
ColumnNameProvider *provider = new ColumnNameProvider(this);
@@ -459,6 +462,12 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
blockSignals(true);
ui->knownImports->setCurrentText("XP5");
blockSignals(false);
+ } else if (firstLine.contains("FSH")) {
+ dl7 = true;
+ firstLine = "|Sample time|Sample depth||||||||";
+ blockSignals(true);
+ ui->knownImports->setCurrentText("DAN DL7");
+ blockSignals(false);
}
// Special handling for APD Log Viewer
@@ -543,7 +552,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 && !apd) {
+ if (triggeredBy != KNOWNTYPES && !seabear && !xp5 && !apd && !dl7) {
blockSignals(true);
ui->knownImports->setCurrentIndex(0); // <- that's "Manual import"
blockSignals(false);
@@ -657,6 +666,13 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
* actual data.
*/
while (strlen(f.readLine()) > 3 && !f.atEnd());
+ } else if (dl7) {
+ while ((firstLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
+ if (firstLine.contains("ZDP")) {
+ firstLine = f.readLine().trimmed();
+ break;
+ }
+ }
}
while (rows < 10 && !f.atEnd()) {
diff --git a/qt-ui/divelogimportdialog.h b/qt-ui/divelogimportdialog.h
index 03bb14029..6185c58e3 100644
--- a/qt-ui/divelogimportdialog.h
+++ b/qt-ui/divelogimportdialog.h
@@ -116,7 +116,7 @@ private:
QString separator;
};
-#define CSVAPPS 8
+#define CSVAPPS 9
static const CSVAppConfig CSVApps[CSVAPPS];
};