This adds delegates to simplify configuration of setpoint values in the
OSTC's.

Signed-off-by: Anton Lundin <gla...@acc.umu.se>
---
 qt-ui/configuredivecomputerdialog.cpp | 10 +++++++++-
 qt-ui/configuredivecomputerdialog.h   |  1 +
 qt-ui/configuredivecomputerdialog.ui  |  8 ++++----
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/qt-ui/configuredivecomputerdialog.cpp 
b/qt-ui/configuredivecomputerdialog.cpp
index 95225bd..2ac1e36 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -47,7 +47,11 @@ QWidget *GasSpinBoxItemDelegate::createEditor(QWidget 
*parent, const QStyleOptio
        } else if (type == DEPTH) {
                sb->setMinimum(0);
                sb->setMaximum(255);
-               sb->setSuffix("m");
+               sb->setSuffix(" m");
+       } else if (type == SETPOINT) {
+               sb->setMinimum(0);
+               sb->setMaximum(255);
+               sb->setSuffix(" cbar");
        }
        return sb;
 }
@@ -142,12 +146,16 @@ 
ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDia
        ui.ostc3GasTable->setItemDelegateForColumn(4, new 
GasSpinBoxItemDelegate(this, GasSpinBoxItemDelegate::DEPTH));
        ui.ostc3DilTable->setItemDelegateForColumn(3, new 
GasTypeComboBoxItemDelegate(this, GasTypeComboBoxItemDelegate::OSTC3));
        ui.ostc3DilTable->setItemDelegateForColumn(4, new 
GasSpinBoxItemDelegate(this, GasSpinBoxItemDelegate::DEPTH));
+       ui.ostc3SetPointTable->setItemDelegateForColumn(1, new 
GasSpinBoxItemDelegate(this, GasSpinBoxItemDelegate::SETPOINT));
+       ui.ostc3SetPointTable->setItemDelegateForColumn(2, new 
GasSpinBoxItemDelegate(this, GasSpinBoxItemDelegate::DEPTH));
        ui.ostcGasTable->setItemDelegateForColumn(1, new 
GasSpinBoxItemDelegate(this, GasSpinBoxItemDelegate::PERCENT));
        ui.ostcGasTable->setItemDelegateForColumn(2, new 
GasSpinBoxItemDelegate(this, GasSpinBoxItemDelegate::PERCENT));
        ui.ostcGasTable->setItemDelegateForColumn(3, new 
GasTypeComboBoxItemDelegate(this, GasTypeComboBoxItemDelegate::OSTC));
        ui.ostcGasTable->setItemDelegateForColumn(4, new 
GasSpinBoxItemDelegate(this, GasSpinBoxItemDelegate::DEPTH));
        ui.ostcDilTable->setItemDelegateForColumn(3, new 
GasTypeComboBoxItemDelegate(this, GasTypeComboBoxItemDelegate::OSTC));
        ui.ostcDilTable->setItemDelegateForColumn(4, new 
GasSpinBoxItemDelegate(this, GasSpinBoxItemDelegate::DEPTH));
+       ui.ostcSetPointTable->setItemDelegateForColumn(1, new 
GasSpinBoxItemDelegate(this, GasSpinBoxItemDelegate::SETPOINT));
+       ui.ostcSetPointTable->setItemDelegateForColumn(2, new 
GasSpinBoxItemDelegate(this, GasSpinBoxItemDelegate::DEPTH));
 
        QSettings settings;
        settings.beginGroup("ConfigureDiveComputerDialog");
diff --git a/qt-ui/configuredivecomputerdialog.h 
b/qt-ui/configuredivecomputerdialog.h
index c304f10..19bab0a 100644
--- a/qt-ui/configuredivecomputerdialog.h
+++ b/qt-ui/configuredivecomputerdialog.h
@@ -16,6 +16,7 @@ public:
        enum column_type {
                PERCENT,
                DEPTH,
+               SETPOINT,
        };
 
        GasSpinBoxItemDelegate(QObject *parent = 0, column_type type = PERCENT);
diff --git a/qt-ui/configuredivecomputerdialog.ui 
b/qt-ui/configuredivecomputerdialog.ui
index ae39bbf..a0a0a2e 100644
--- a/qt-ui/configuredivecomputerdialog.ui
+++ b/qt-ui/configuredivecomputerdialog.ui
@@ -1217,12 +1217,12 @@
               </column>
               <column>
                <property name="text">
-                <string>Set point [cbar]</string>
+                <string>Set point</string>
                </property>
               </column>
               <column>
                <property name="text">
-                <string>Change depth [m]</string>
+                <string>Change depth</string>
                </property>
               </column>
               <item row="0" column="0">
@@ -2466,12 +2466,12 @@
               </column>
               <column>
                <property name="text">
-                <string>Set point [cbar]</string>
+                <string>Set point</string>
                </property>
               </column>
               <column>
                <property name="text">
-                <string>Change depth [m]</string>
+                <string>Change depth</string>
                </property>
               </column>
               <item row="0" column="0">
-- 
2.1.4

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to