summaryrefslogtreecommitdiffstats
path: root/qt-ui/models.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-17 14:03:37 +0000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-17 14:03:37 +0000
commit0c3f13d128f366b036a77dfd2d195cbcac8547ba (patch)
tree02586f27258dfd9103796f7cc8236b9895e52322 /qt-ui/models.cpp
parent1739042f3431e5b399db0cf49106c98478436a2f (diff)
downloadsubsurface-0c3f13d128f366b036a77dfd2d195cbcac8547ba.tar.gz
Add the ability to modify the cylinder use in the UI
Thanks to Tomaz for writing a first draft of the delegate. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/models.cpp')
-rw-r--r--qt-ui/models.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 7cf305d83..9464d6c37 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -76,7 +76,7 @@ CylindersModel::CylindersModel(QObject *parent) : changed(false),
{
// enum {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, DEPTH};
setHeaderDataStrings(QStringList() << "" << tr("Type") << tr("Size") << tr("Work press.") << tr("Start press.") << tr("End press.") << trUtf8("O" UTF8_SUBSCRIPT_2 "%") << tr("He%")
- << tr("Switch at"));
+ << tr("Switch at") << tr("Use"));
initTrashIcon();
}
@@ -172,6 +172,9 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
case DEPTH:
ret = get_depth_string(cyl->depth, true);
break;
+ case USE:
+ ret = QString(cylinderuse_text[cyl->cylinder_use]);
+ break;
}
break;
case Qt::DecorationRole:
@@ -297,6 +300,13 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
cyl->depth = string_to_depth(vString.toUtf8().data());
changed = true;
}
+ break;
+ case USE:
+ if (CHANGED()) {
+ cyl->cylinder_use = (enum cylinderuse)vString.toInt();
+ changed = true;
+ }
+ break;
}
if (addDiveMode)
DivePlannerPointsModel::instance()->tanksUpdated();