mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add depth colum to cylinder model
To make the planner work this adds a new column to the Cylinder widget (depth - for the depth at which we want to change to a certain gas during deco). This also tries to hide that column in the equipment view and hide the start/end pressure columns in the planner view. Oddly that fails :-( Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
cd1149e57f
commit
d72c69db7a
7 changed files with 28 additions and 6 deletions
|
@ -58,8 +58,8 @@ void CleanerTableModel::setHeaderDataStrings(const QStringList& newHeaders)
|
|||
|
||||
CylindersModel::CylindersModel(QObject* parent): current(0), rows(0)
|
||||
{
|
||||
// enum{REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE,};
|
||||
setHeaderDataStrings( QStringList() << "" << tr("Type") << tr("Size") << tr("WorkPress") << tr("StartPress") << tr("EndPress") << tr("O2%") << tr("HE"));
|
||||
// enum{REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, DEPTH};
|
||||
setHeaderDataStrings( QStringList() << "" << tr("Type") << tr("Size") << tr("WorkPress") << tr("StartPress") << tr("EndPress") << tr("O2%") << tr("HE") << tr("Switch at"));
|
||||
}
|
||||
|
||||
CylindersModel *CylindersModel::instance()
|
||||
|
@ -148,6 +148,12 @@ QVariant CylindersModel::data(const QModelIndex& index, int role) const
|
|||
case HE:
|
||||
ret = percent_string(cyl->gasmix.he);
|
||||
break;
|
||||
case DEPTH:
|
||||
if (prefs.units.length == prefs.units.FEET)
|
||||
ret = mm_to_feet(cyl->depth.mm);
|
||||
else
|
||||
ret = cyl->depth.mm / 1000;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Qt::DecorationRole:
|
||||
|
@ -279,6 +285,15 @@ bool CylindersModel::setData(const QModelIndex& index, const QVariant& value, in
|
|||
changed = true;
|
||||
}
|
||||
break;
|
||||
case DEPTH:
|
||||
if (CHANGED(toDouble, "ft", "m")) {
|
||||
if (value.toInt() != 0) {
|
||||
if (prefs.units.length == prefs.units.FEET)
|
||||
cyl->depth.mm = feet_to_mm(value.toString().remove("ft").remove("m").toInt());
|
||||
else
|
||||
cyl->depth.mm = value.toString().remove("ft").remove("m").toInt() * 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
dataChanged(index, index);
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue