summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelogimportdialog.cpp
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-01-16 22:50:16 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-17 05:57:45 +0700
commite9f3d652e8b060419778d5578c1ad019d65c5879 (patch)
tree235aa018e25b8d45a05d57552fef8393504accd7 /qt-ui/divelogimportdialog.cpp
parent2167088f1c9b7e0b9dcda085bf83c27f1257e37a (diff)
downloadsubsurface-e9f3d652e8b060419778d5578c1ad019d65c5879.tar.gz
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>
Diffstat (limited to 'qt-ui/divelogimportdialog.cpp')
-rw-r--r--qt-ui/divelogimportdialog.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp
index e37b9a8d7..52f95a785 100644
--- a/qt-ui/divelogimportdialog.cpp
+++ b/qt-ui/divelogimportdialog.cpp
@@ -8,6 +8,7 @@ const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] =
{"", },
{"APD Log Viewer", 1, 2, 16, 7, 18, 19, "Tab"},
{"XP5", 1, 2, 10, -1, -1, -1, "Tab"},
+ {"SensusCSV", 10, 11, -1, -1, -1, -1, ","},
{NULL,}
};
@@ -19,6 +20,9 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList *fn, QWidget *parent) :
ui->setupUi(this);
fileNames = *fn;
+ /* Add indexes of XSLTs requiring special handling to the list */
+ specialCSV << 3;
+
for (int i = 0; !CSVApps[i].name.isNull(); ++i)
ui->knownImports->addItem(CSVApps[i].name);
@@ -49,7 +53,6 @@ DiveLogImportDialog::~DiveLogImportDialog()
void DiveLogImportDialog::on_buttonBox_accepted()
{
char *error = NULL;
-
for (int i = 0; i < fileNames.size(); ++i) {
parse_csv_file(fileNames[i].toUtf8().data(), ui->CSVTime->value() - 1,
ui->CSVDepth->value() - 1, VALUE_IF_CHECKED(CSVTemperature),
@@ -57,6 +60,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
VALUE_IF_CHECKED(CSVcns),
VALUE_IF_CHECKED(CSVstopdepth),
ui->CSVSeparator->currentIndex(),
+ specialCSV.contains(ui->knownImports->currentIndex()) ? CSVApps[ui->knownImports->currentIndex()].name.toUtf8().data() : "csv",
&error);
if (error != NULL) {
mainWindow()->showError(error);
@@ -78,6 +82,11 @@ void DiveLogImportDialog::on_buttonBox_accepted()
})
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)
return;
@@ -100,5 +109,6 @@ void DiveLogImportDialog::on_knownImports_currentIndexChanged(int index)
void DiveLogImportDialog::unknownImports()
{
- ui->knownImports->setCurrentIndex(0);
+ if (!specialCSV.contains(ui->knownImports->currentIndex()))
+ ui->knownImports->setCurrentIndex(0);
}