mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Treat Sensus CSV import specially on GUI
As Sensus import needs a specific XSLT and user specified parameters are not used nor needed, tune the GUI accordingly (disable options and add Sensus in the list of known imports). Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2167088f1c
commit
e9f3d652e8
2 changed files with 14 additions and 3 deletions
|
@ -8,6 +8,7 @@ const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] =
|
||||||
{"", },
|
{"", },
|
||||||
{"APD Log Viewer", 1, 2, 16, 7, 18, 19, "Tab"},
|
{"APD Log Viewer", 1, 2, 16, 7, 18, 19, "Tab"},
|
||||||
{"XP5", 1, 2, 10, -1, -1, -1, "Tab"},
|
{"XP5", 1, 2, 10, -1, -1, -1, "Tab"},
|
||||||
|
{"SensusCSV", 10, 11, -1, -1, -1, -1, ","},
|
||||||
{NULL,}
|
{NULL,}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,6 +20,9 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList *fn, QWidget *parent) :
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
fileNames = *fn;
|
fileNames = *fn;
|
||||||
|
|
||||||
|
/* Add indexes of XSLTs requiring special handling to the list */
|
||||||
|
specialCSV << 3;
|
||||||
|
|
||||||
for (int i = 0; !CSVApps[i].name.isNull(); ++i)
|
for (int i = 0; !CSVApps[i].name.isNull(); ++i)
|
||||||
ui->knownImports->addItem(CSVApps[i].name);
|
ui->knownImports->addItem(CSVApps[i].name);
|
||||||
|
|
||||||
|
@ -49,7 +53,6 @@ DiveLogImportDialog::~DiveLogImportDialog()
|
||||||
void DiveLogImportDialog::on_buttonBox_accepted()
|
void DiveLogImportDialog::on_buttonBox_accepted()
|
||||||
{
|
{
|
||||||
char *error = NULL;
|
char *error = NULL;
|
||||||
|
|
||||||
for (int i = 0; i < fileNames.size(); ++i) {
|
for (int i = 0; i < fileNames.size(); ++i) {
|
||||||
parse_csv_file(fileNames[i].toUtf8().data(), ui->CSVTime->value() - 1,
|
parse_csv_file(fileNames[i].toUtf8().data(), ui->CSVTime->value() - 1,
|
||||||
ui->CSVDepth->value() - 1, VALUE_IF_CHECKED(CSVTemperature),
|
ui->CSVDepth->value() - 1, VALUE_IF_CHECKED(CSVTemperature),
|
||||||
|
@ -57,6 +60,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
||||||
VALUE_IF_CHECKED(CSVcns),
|
VALUE_IF_CHECKED(CSVcns),
|
||||||
VALUE_IF_CHECKED(CSVstopdepth),
|
VALUE_IF_CHECKED(CSVstopdepth),
|
||||||
ui->CSVSeparator->currentIndex(),
|
ui->CSVSeparator->currentIndex(),
|
||||||
|
specialCSV.contains(ui->knownImports->currentIndex()) ? CSVApps[ui->knownImports->currentIndex()].name.toUtf8().data() : "csv",
|
||||||
&error);
|
&error);
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
mainWindow()->showError(error);
|
mainWindow()->showError(error);
|
||||||
|
@ -78,6 +82,11 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
||||||
})
|
})
|
||||||
void DiveLogImportDialog::on_knownImports_currentIndexChanged(int index)
|
void DiveLogImportDialog::on_knownImports_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
|
if (specialCSV.contains(index)) {
|
||||||
|
ui->groupBox_3->setEnabled(false);
|
||||||
|
} else {
|
||||||
|
ui->groupBox_3->setEnabled(true);
|
||||||
|
}
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -100,5 +109,6 @@ void DiveLogImportDialog::on_knownImports_currentIndexChanged(int index)
|
||||||
|
|
||||||
void DiveLogImportDialog::unknownImports()
|
void DiveLogImportDialog::unknownImports()
|
||||||
{
|
{
|
||||||
ui->knownImports->setCurrentIndex(0);
|
if (!specialCSV.contains(ui->knownImports->currentIndex()))
|
||||||
|
ui->knownImports->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ private:
|
||||||
bool selector;
|
bool selector;
|
||||||
QStringList fileNames;
|
QStringList fileNames;
|
||||||
Ui::DiveLogImportDialog *ui;
|
Ui::DiveLogImportDialog *ui;
|
||||||
|
QList<int> specialCSV;
|
||||||
|
|
||||||
struct CSVAppConfig {
|
struct CSVAppConfig {
|
||||||
QString name;
|
QString name;
|
||||||
|
@ -39,7 +40,7 @@ private:
|
||||||
QString separator;
|
QString separator;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CSVAPPS 4
|
#define CSVAPPS 5
|
||||||
static const CSVAppConfig CSVApps[CSVAPPS];
|
static const CSVAppConfig CSVApps[CSVAPPS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue