summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
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 09:08:25 -0700
commit74f01927113827dbaf0c85833aea0bd78fd2a803 (patch)
tree1bf524d57666fea2f37423fcb515643e0583ed07 /desktop-widgets
parent8a4f2f998a0fbfd6c0fe44b8f8578be8245d3946 (diff)
downloadsubsurface-74f01927113827dbaf0c85833aea0bd78fd2a803.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>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelogimportdialog.cpp18
-rw-r--r--desktop-widgets/divelogimportdialog.h2
2 files changed, 18 insertions, 2 deletions
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index f53d734f2..e70a75204 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -17,6 +17,7 @@ const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] =
{ "Manual import", SILENCE_WARNING },
{ "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, ";" },
@@ -28,6 +29,7 @@ enum Known {
MANUAL,
APD,
APD2,
+ DL7,
XP5,
SENSUS,
SEABEAR,
@@ -386,6 +388,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);
@@ -467,6 +470,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
@@ -551,7 +560,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);
@@ -665,6 +674,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/desktop-widgets/divelogimportdialog.h b/desktop-widgets/divelogimportdialog.h
index 811775379..750bc10fa 100644
--- a/desktop-widgets/divelogimportdialog.h
+++ b/desktop-widgets/divelogimportdialog.h
@@ -116,7 +116,7 @@ private:
QString separator;
};
-#define CSVAPPS 8
+#define CSVAPPS 9
static const CSVAppConfig CSVApps[CSVAPPS];
};