mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Tweak cylinder equipment tooltips
While playing around with the current subsurface, I realized that while we
give the gas volume and Z factor for the beginning/end pressures in the
newly added tooltips, there is no way to actually see that same
information for the working pressure.
So if you have filled in cylinder type information, but don't have any
actual gas usage information, there will be no cylinder tooltips at all.
But you might still want to know what the actual volume for a particular
cylinder is, and what the Z value for that working pressure is.
So this tweaks the tool-tips a bit.
When mousing over the pressure fields (ie "working pressure", "start" and
"end"), it now always gives the cylinder gas volume and Z factor for that
pressure, so for example on an AL72 that has a working pressure of 3000
psi and that contains air the tooltip will say:
69 cuft, Z=1.040
when you mouse over the working pressure field (that's obviously with
imperial units, in metric you'll see liters of gas).
When mousing over the type/size field, it gives the used gas amounts, ie
something like this:
37 cuft (82 cuft -> 45 cuft)
but if the cylinder doesn't have starting/ending pressures (and thus no
used gas information), this patch will make subsurface show the working
pressure data instead, so that you at least get something.
This all seems more useful than what my first version gave.
NOTE! This makes commit adaeb506b7
("Show both the nominal and "real"
size for an imperial cylinder") kind of pointless. You now see the real
size in the tooltip when you mouse over the size, and now it actually
works both for imperial and metric people, so the tooltip is in many ways
the better model.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7725842383
commit
a8e8d56ec0
1 changed files with 11 additions and 2 deletions
|
@ -63,6 +63,8 @@ static QString gas_volume_string(int ml, const char *tail)
|
|||
return QString("%1 %2 %3").arg(vol, 0, 'f', decimals).arg(unit).arg(tail);
|
||||
}
|
||||
|
||||
static QVariant gas_wp_tooltip(cylinder_t *cyl);
|
||||
|
||||
static QVariant gas_usage_tooltip(cylinder_t *cyl)
|
||||
{
|
||||
pressure_t startp = cyl->start.mbar ? cyl->start : cyl->sample_start;
|
||||
|
@ -75,7 +77,7 @@ static QVariant gas_usage_tooltip(cylinder_t *cyl)
|
|||
used = (end && start > end) ? start - end : 0;
|
||||
|
||||
if (!used)
|
||||
return QVariant();
|
||||
return gas_wp_tooltip(cyl);
|
||||
|
||||
return gas_volume_string(used, "(") +
|
||||
gas_volume_string(start, " -> ") +
|
||||
|
@ -94,6 +96,11 @@ static QVariant gas_volume_tooltip(cylinder_t *cyl, pressure_t p)
|
|||
return gas_volume_string(vol, "(Z=") + QString("%1)").arg(Z, 0, 'f', 3);
|
||||
}
|
||||
|
||||
static QVariant gas_wp_tooltip(cylinder_t *cyl)
|
||||
{
|
||||
return gas_volume_tooltip(cyl, cyl->type.workingpressure);
|
||||
}
|
||||
|
||||
static QVariant gas_start_tooltip(cylinder_t *cyl)
|
||||
{
|
||||
return gas_volume_tooltip(cyl, cyl->start.mbar ? cyl->start : cyl->sample_start);
|
||||
|
@ -228,9 +235,11 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
|
|||
case REMOVE:
|
||||
ret = tr("Clicking here will remove this cylinder.");
|
||||
break;
|
||||
case TYPE:
|
||||
case SIZE:
|
||||
case WORKINGPRESS:
|
||||
return gas_usage_tooltip(cyl);
|
||||
case WORKINGPRESS:
|
||||
return gas_wp_tooltip(cyl);
|
||||
case START:
|
||||
return gas_start_tooltip(cyl);
|
||||
case END:
|
||||
|
|
Loading…
Reference in a new issue