In bf205726 DEPTH/Switch at was disabled by commenting out that code.
This puts it back behind ifdefs

Signed-off-by: Anton Lundin <gla...@acc.umu.se>
---
 qt-ui/diveplanner.cpp |  5 +++--
 qt-ui/maintab.cpp     |  5 +++--
 qt-ui/models.cpp      | 22 +++++++++++++++-------
 qt-ui/models.h        |  5 ++++-
 4 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 1351c17..da5bb53 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -937,8 +937,9 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, 
Qt::WindowFlags f) : QWidg
        QTableView *view = ui.cylinderTableWidget->view();
        view->setColumnHidden(CylindersModel::START, true);
        view->setColumnHidden(CylindersModel::END, true);
-       // disabled as pointless outside of the disabled planner
-       // view->setColumnHidden(CylindersModel::DEPTH, false);
+#ifdef ENABLE_PLANNER
+       view->setColumnHidden(CylindersModel::DEPTH, false);
+#endif
        view->setItemDelegateForColumn(CylindersModel::TYPE, new 
TankInfoDelegate(this));
        connect(ui.cylinderTableWidget, SIGNAL(addButtonClicked()), 
DivePlannerPointsModel::instance(), SLOT(addCylinder_clicked()));
        connect(ui.tableWidget, SIGNAL(addButtonClicked()), 
DivePlannerPointsModel::instance(), SLOT(addStop()));
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 9828389..682ff52 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -88,8 +88,9 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
 
        ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::TYPE, 
new TankInfoDelegate(this));
        ui.weights->view()->setItemDelegateForColumn(WeightModel::TYPE, new 
WSInfoDelegate(this));
-       // disabled as this column is pointless outside the disabled planner
-       // ui.cylinders->view()->setColumnHidden(CylindersModel::DEPTH, true);
+#ifdef ENABLE_PLANNER
+       ui.cylinders->view()->setColumnHidden(CylindersModel::DEPTH, true);
+#endif
        completers.buddy = new QCompleter(&buddyModel, ui.buddy);
        completers.divemaster = new QCompleter(&diveMasterModel, ui.divemaster);
        completers.location = new QCompleter(&locationModel, ui.location);
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 1689139..5b011d7 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -67,7 +67,9 @@ CylindersModel::CylindersModel(QObject *parent) : current(0), 
rows(0)
 {
        //      enum {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, 
DEPTH};
        setHeaderDataStrings(QStringList() << "" << tr("Type") << tr("Size") << 
tr("WorkPress") << tr("StartPress") << tr("EndPress") << trUtf8("O" 
UTF8_SUBSCRIPT_2 "%") << tr("He%")
-                            // while the planner is disabled, we don't need 
this column: << tr("Switch at")
+#ifdef ENABLE_PLANNER
+                       << tr("Switch at")
+#endif
                             );
 }
 
@@ -143,9 +145,11 @@ QVariant CylindersModel::data(const QModelIndex &index, 
int role) const
                case HE:
                        ret = percent_string(cyl->gasmix.he);
                        break;
-                       // case DEPTH:
-                       //      ret = get_depth_string(cyl->depth, true);
-                       //      break;
+#ifdef ENABLE_PLANNER
+               case DEPTH:
+                       ret = get_depth_string(cyl->depth, true);
+                       break;
+#endif
                }
                break;
        case Qt::DecorationRole:
@@ -258,9 +262,13 @@ bool CylindersModel::setData(const QModelIndex &index, 
const QVariant &value, in
                        changed = true;
                }
                break;
-               // case DEPTH:
-               //      if (CHANGED())
-               //              cyl->depth = 
string_to_depth(vString.toUtf8().data());
+#ifdef ENABLE_PLANNER
+       case DEPTH:
+               if (CHANGED()) {
+                       cyl->depth = string_to_depth(vString.toUtf8().data());
+                       changed = true;
+               }
+#endif
        }
        dataChanged(index, index);
        if (addDiveMode)
diff --git a/qt-ui/models.h b/qt-ui/models.h
index 9a198f6..14969f8 100644
--- a/qt-ui/models.h
+++ b/qt-ui/models.h
@@ -102,7 +102,10 @@ public:
                END,
                O2,
                HE,
-               /* DEPTH, */ COLUMNS
+#ifdef ENABLE_PLANNER
+               DEPTH,
+#endif
+               COLUMNS
        };
 
        explicit CylindersModel(QObject *parent = 0);
-- 
1.8.3.2

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

Reply via email to