mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Import sensor values for autodetected APD files
If APD Log Viewer format is automatically detected, we should set the sensor values to be imported properly. These need to be added to the firstline and since we convert the number 2 from column headers to subscript, this step must be skipped for the APD import. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
bf45eddceb
commit
ac4871c699
1 changed files with 13 additions and 5 deletions
|
@ -448,7 +448,7 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
|
||||||
// Special handling for APD Log Viewer
|
// Special handling for APD Log Viewer
|
||||||
if ((triggeredBy == KNOWNTYPES && value == APD) || (triggeredBy == INITIAL && fileNames.first().endsWith(".apd", Qt::CaseInsensitive))) {
|
if ((triggeredBy == KNOWNTYPES && value == APD) || (triggeredBy == INITIAL && fileNames.first().endsWith(".apd", Qt::CaseInsensitive))) {
|
||||||
apd=true;
|
apd=true;
|
||||||
firstLine = "Sample time\tSample depth\tSample setpoint\t\t\t\tSample pO₂\t\t\t\t\t\t\t\t\tSample temperature\t\tSample CNS\tSample stopdepth";
|
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";
|
||||||
blockSignals(true);
|
blockSignals(true);
|
||||||
ui->CSVSeparator->setCurrentText(tr("Tab"));
|
ui->CSVSeparator->setCurrentText(tr("Tab"));
|
||||||
if (triggeredBy == INITIAL && fileNames.first().contains(".apd", Qt::CaseInsensitive))
|
if (triggeredBy == INITIAL && fileNames.first().contains(".apd", Qt::CaseInsensitive))
|
||||||
|
@ -479,10 +479,18 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
|
||||||
if (triggeredBy == INITIAL || (triggeredBy == KNOWNTYPES && value == MANUAL) || triggeredBy == SEPARATOR) {
|
if (triggeredBy == INITIAL || (triggeredBy == KNOWNTYPES && value == MANUAL) || triggeredBy == SEPARATOR) {
|
||||||
// now try and guess the columns
|
// now try and guess the columns
|
||||||
Q_FOREACH (QString columnText, currColumns) {
|
Q_FOREACH (QString columnText, currColumns) {
|
||||||
columnText.replace("\"", "");
|
/*
|
||||||
columnText.replace("number", "#", Qt::CaseInsensitive);
|
* We have to skip the conversion of 2 to ₂ for APD Log
|
||||||
columnText.replace("2", "₂", Qt::CaseInsensitive);
|
* viewer as that would mess up the sensor numbering. We
|
||||||
columnText.replace("cylinder", "cyl.", Qt::CaseInsensitive);
|
* also know that the column headers do not need this
|
||||||
|
* conversion.
|
||||||
|
*/
|
||||||
|
if (triggeredBy == KNOWNTYPES && value != APD) {
|
||||||
|
columnText.replace("\"", "");
|
||||||
|
columnText.replace("number", "#", Qt::CaseInsensitive);
|
||||||
|
columnText.replace("2", "₂", Qt::CaseInsensitive);
|
||||||
|
columnText.replace("cylinder", "cyl.", Qt::CaseInsensitive);
|
||||||
|
}
|
||||||
int idx = provider->mymatch(columnText);
|
int idx = provider->mymatch(columnText);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
QString foundHeading = provider->data(provider->index(idx, 0), Qt::DisplayRole).toString();
|
QString foundHeading = provider->data(provider->index(idx, 0), Qt::DisplayRole).toString();
|
||||||
|
|
Loading…
Reference in a new issue