mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Support for comma as field separator for ADP
This adds support for comma as field separator for ADP import. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
71273945c6
commit
2b14a9c95d
1 changed files with 12 additions and 3 deletions
|
@ -507,10 +507,19 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
|
||||||
|
|
||||||
// Special handling for APD Log Viewer
|
// Special handling for APD Log Viewer
|
||||||
if ((triggeredBy == KNOWNTYPES && (value == APD || value == APD2)) || (triggeredBy == INITIAL && fileNames.first().endsWith(".apd", Qt::CaseInsensitive))) {
|
if ((triggeredBy == KNOWNTYPES && (value == APD || value == APD2)) || (triggeredBy == INITIAL && fileNames.first().endsWith(".apd", Qt::CaseInsensitive))) {
|
||||||
|
QString apdseparator;
|
||||||
|
int tabs = firstLine.count('\t');
|
||||||
|
int commas = firstLine.count(',');
|
||||||
|
if (tabs > commas)
|
||||||
|
apdseparator = "\t";
|
||||||
|
else
|
||||||
|
apdseparator = ",";
|
||||||
|
|
||||||
apd=true;
|
apd=true;
|
||||||
firstLine = "Sample time\tSample depth\tSample setpoint\tSample sensor1 pO₂\tSample sensor2 pO₂\tSample sensor3 pO₂\tSample pO₂\t\t\t\t\t\t\t\t\tSample temperature\t\tSample CNS\tSample stopdepth";
|
|
||||||
|
firstLine = "Sample time" + apdseparator + "Sample depth" + apdseparator + "Sample setpoint" + apdseparator + "Sample sensor1 pO₂" + apdseparator + "Sample sensor2 pO₂" + apdseparator + "Sample sensor3 pO₂" + apdseparator + "Sample pO₂" + apdseparator + "" + apdseparator + "" + apdseparator + "" + apdseparator + "" + apdseparator + "" + apdseparator + "" + apdseparator + "" + apdseparator + "" + apdseparator + "Sample temperature" + apdseparator + "" + apdseparator + "Sample CNS" + apdseparator + "Sample stopdepth";
|
||||||
blockSignals(true);
|
blockSignals(true);
|
||||||
ui->CSVSeparator->setCurrentText(tr("Tab"));
|
ui->CSVSeparator->setCurrentText(apdseparator);
|
||||||
if (triggeredBy == INITIAL && fileNames.first().contains(".apd", Qt::CaseInsensitive))
|
if (triggeredBy == INITIAL && fileNames.first().contains(".apd", Qt::CaseInsensitive))
|
||||||
ui->knownImports->setCurrentText("APD Log Viewer - DC1");
|
ui->knownImports->setCurrentText("APD Log Viewer - DC1");
|
||||||
blockSignals(false);
|
blockSignals(false);
|
||||||
|
@ -596,7 +605,7 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
|
||||||
}
|
}
|
||||||
if (triggeredBy == KNOWNTYPES && value != MANUAL) {
|
if (triggeredBy == KNOWNTYPES && value != MANUAL) {
|
||||||
// an actual known type
|
// an actual known type
|
||||||
if (value == SUBSURFACE) {
|
if (value == SUBSURFACE || value == APD || value == APD2) {
|
||||||
/*
|
/*
|
||||||
* Subsurface CSV file needs separator detection
|
* Subsurface CSV file needs separator detection
|
||||||
* as we used to default to comma but switched
|
* as we used to default to comma but switched
|
||||||
|
|
Loading…
Add table
Reference in a new issue