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>
This commit is contained in:
Miika Turkia 2016-04-24 21:11:19 +03:00 committed by Dirk Hohndel
parent 8a4f2f998a
commit 74f0192711
2 changed files with 18 additions and 2 deletions

View file

@ -17,6 +17,7 @@ const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] =
{ "Manual import", SILENCE_WARNING }, { "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 - 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" }, { "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" }, { "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, "," }, { "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, ";" }, { "Seabear CSV", 0, 1, 5, -1, -1, -1, -1, -1, 2, 3, 4, 6, -1, ";" },
@ -28,6 +29,7 @@ enum Known {
MANUAL, MANUAL,
APD, APD,
APD2, APD2,
DL7,
XP5, XP5,
SENSUS, SENSUS,
SEABEAR, SEABEAR,
@ -386,6 +388,7 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
bool seabear = false; bool seabear = false;
bool xp5 = false; bool xp5 = false;
bool apd = false; bool apd = false;
bool dl7 = false;
// reset everything // reset everything
ColumnNameProvider *provider = new ColumnNameProvider(this); ColumnNameProvider *provider = new ColumnNameProvider(this);
@ -467,6 +470,12 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
blockSignals(true); blockSignals(true);
ui->knownImports->setCurrentText("XP5"); ui->knownImports->setCurrentText("XP5");
blockSignals(false); 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 // Special handling for APD Log Viewer
@ -551,7 +560,7 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
} }
if (matchedSome) { 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.")); 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); blockSignals(true);
ui->knownImports->setCurrentIndex(0); // <- that's "Manual import" ui->knownImports->setCurrentIndex(0); // <- that's "Manual import"
blockSignals(false); blockSignals(false);
@ -665,6 +674,13 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
* actual data. * actual data.
*/ */
while (strlen(f.readLine()) > 3 && !f.atEnd()); 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()) { while (rows < 10 && !f.atEnd()) {

View file

@ -116,7 +116,7 @@ private:
QString separator; QString separator;
}; };
#define CSVAPPS 8 #define CSVAPPS 9
static const CSVAppConfig CSVApps[CSVAPPS]; static const CSVAppConfig CSVApps[CSVAPPS];
}; };