aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2013-12-29 07:52:44 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-29 04:13:18 -0800
commit03666fb7656ae19fe11d22094846a1279dc4b9f8 (patch)
tree9dd964cfd67b34542812564a4d2800e15512dfac
parent7c8a39015a969d853fa5ff4b73f7e1f30aa39a17 (diff)
downloadsubsurface-03666fb7656ae19fe11d22094846a1279dc4b9f8.tar.gz
Use field numbers in CSV import instead of indexes
For the common user, a field number is more intuitive than field index. So let's use that in numbering CSV import fields. Fixes #388 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/csvimportdialog.cpp10
-rw-r--r--qt-ui/csvimportdialog.ui20
2 files changed, 21 insertions, 9 deletions
diff --git a/qt-ui/csvimportdialog.cpp b/qt-ui/csvimportdialog.cpp
index 690640222..b88d9ceca 100644
--- a/qt-ui/csvimportdialog.cpp
+++ b/qt-ui/csvimportdialog.cpp
@@ -6,8 +6,8 @@
const CSVImportDialog::CSVAppConfig CSVImportDialog::CSVApps[CSVAPPS] = {
{"", },
- {"APD Log Viewer", 0, 1, 15, 6, 17, 18, "Tab"},
- {"XP5", 0, 1, 9, -1, -1, -1, "Tab"},
+ {"APD Log Viewer", 1, 2, 16, 7, 18, 19, "Tab"},
+ {"XP5", 1, 2, 10, -1, -1, -1, "Tab"},
{NULL,}
};
@@ -43,13 +43,13 @@ CSVImportDialog::~CSVImportDialog()
delete ui;
}
-#define VALUE_IF_CHECKED(x) (ui->x->isEnabled() ? ui->x->value() : -1)
+#define VALUE_IF_CHECKED(x) (ui->x->isEnabled() ? ui->x->value() - 1: -1)
void CSVImportDialog::on_buttonBox_accepted()
{
char *error = NULL;
- parse_csv_file(ui->CSVFile->text().toUtf8().data(), ui->CSVTime->value(),
- ui->CSVDepth->value(), VALUE_IF_CHECKED(CSVTemperature),
+ parse_csv_file(ui->CSVFile->text().toUtf8().data(), ui->CSVTime->value() - 1,
+ ui->CSVDepth->value() - 1, VALUE_IF_CHECKED(CSVTemperature),
VALUE_IF_CHECKED(CSVpo2),
VALUE_IF_CHECKED(CSVcns),
VALUE_IF_CHECKED(CSVstopdepth),
diff --git a/qt-ui/csvimportdialog.ui b/qt-ui/csvimportdialog.ui
index 6abbb4beb..9c89704f3 100644
--- a/qt-ui/csvimportdialog.ui
+++ b/qt-ui/csvimportdialog.ui
@@ -68,10 +68,10 @@
<item row="0" column="1">
<widget class="QSpinBox" name="CSVTime">
<property name="minimum">
- <number>0</number>
+ <number>1</number>
</property>
<property name="value">
- <number>0</number>
+ <number>1</number>
</property>
</widget>
</item>
@@ -85,10 +85,10 @@
<item row="1" column="1">
<widget class="QSpinBox" name="CSVDepth">
<property name="minimum">
- <number>0</number>
+ <number>1</number>
</property>
<property name="value">
- <number>1</number>
+ <number>2</number>
</property>
</widget>
</item>
@@ -101,6 +101,9 @@
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="CSVTemperature">
+ <property name="minimum">
+ <number>1</number>
+ </property>
<property name="enabled">
<bool>false</bool>
</property>
@@ -115,6 +118,9 @@
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="CSVpo2">
+ <property name="minimum">
+ <number>1</number>
+ </property>
<property name="enabled">
<bool>false</bool>
</property>
@@ -132,6 +138,9 @@
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="CSVcns">
+ <property name="minimum">
+ <number>1</number>
+ </property>
<property name="enabled">
<bool>false</bool>
</property>
@@ -149,6 +158,9 @@
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="CSVstopdepth">
+ <property name="minimum">
+ <number>1</number>
+ </property>
<property name="enabled">
<bool>false</bool>
</property>