summaryrefslogtreecommitdiffstats
path: root/qt-ui/csvimportdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/csvimportdialog.cpp')
-rw-r--r--qt-ui/csvimportdialog.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/qt-ui/csvimportdialog.cpp b/qt-ui/csvimportdialog.cpp
index caafe3562..192080503 100644
--- a/qt-ui/csvimportdialog.cpp
+++ b/qt-ui/csvimportdialog.cpp
@@ -28,6 +28,7 @@ CSVImportDialog::CSVImportDialog(QWidget *parent) :
connect(ui->CSVDepth, SIGNAL(valueChanged(int)), this, SLOT(unknownImports(int)));
connect(ui->CSVTime, SIGNAL(valueChanged(int)), this, SLOT(unknownImports(int)));
connect(ui->CSVTemperature, SIGNAL(valueChanged(int)), this, SLOT(unknownImports(int)));
+ connect(ui->temperatureCheckBox, SIGNAL(clicked(bool)), this, SLOT(unknownImports(bool)));
}
CSVImportDialog::~CSVImportDialog()
@@ -35,11 +36,12 @@ CSVImportDialog::~CSVImportDialog()
delete ui;
}
+#define VALUE_IF_CHECKED(x) (ui->x->isEnabled() ? ui->x->value() : -1)
void CSVImportDialog::on_buttonBox_accepted()
{
char *error = NULL;
- parse_csv_file(ui->CSVFile->text().toUtf8().data(), ui->CSVTime->value(), ui->CSVDepth->value(), ui->CSVTemperature->value(), &error);
+ parse_csv_file(ui->CSVFile->text().toUtf8().data(), ui->CSVTime->value(), ui->CSVDepth->value(), VALUE_IF_CHECKED(CSVTemperature), &error);
if (error != NULL) {
mainWindow()->showError(error);
@@ -61,6 +63,13 @@ void CSVImportDialog::on_CSVFileSelector_clicked()
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
+#define SET_VALUE_AND_CHECKBOX(CSV, BOX, VAL) ({\
+ ui->CSV->blockSignals(true);\
+ ui->CSV->setValue(VAL);\
+ ui->CSV->setEnabled(VAL >= 0);\
+ ui->BOX->setChecked(VAL >= 0);\
+ ui->CSV->blockSignals(false);\
+ })
void CSVImportDialog::on_knownImports_currentIndexChanged(int index)
{
if (index == 0)
@@ -68,13 +77,16 @@ void CSVImportDialog::on_knownImports_currentIndexChanged(int index)
ui->CSVTime->blockSignals(true);
ui->CSVDepth->blockSignals(true);
- ui->CSVTemperature->blockSignals(true);
ui->CSVTime->setValue(CSVApps[index].time);
ui->CSVDepth->setValue(CSVApps[index].depth);
- ui->CSVTemperature->setValue(CSVApps[index].temperature);
ui->CSVTime->blockSignals(false);
ui->CSVDepth->blockSignals(false);
- ui->CSVTemperature->blockSignals(false);
+ SET_VALUE_AND_CHECKBOX(CSVTemperature, temperatureCheckBox, CSVApps[index].temperature);
+}
+
+void CSVImportDialog::unknownImports(bool arg1)
+{
+ unknownImports();
}
void CSVImportDialog::unknownImports(int arg1)