[RFC PATCH] Tweak cylinder equipment tooltips
Dirk Hohndel
dirk at hohndel.org
Sun Jan 15 16:34:01 PST 2017
I'd love to hear others comment on this. I'm in the middle of doing the
4.6 release so I'm a bit busy right now (sources are tagged and pushed,
first binaries are up and I'm in the process of testing them - next come
the edits to the website)
/D
> On Jan 15, 2017, at 4:07 PM, Linus Torvalds <torvalds at linux-foundation.org> wrote:
>
>
> 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 adaeb506b7a1 ("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 at linux-foundation.org>
> ---
>
> This has an RFC because this is all obviously a subjective. Very few
> people care about the compressibility factor, and realistically the main
> reason to show it is to explain when people get confused.
>
> Also, arguably, with this patch we really could just revert that now less
> useful commit adaeb506b7a1. Again, it's a matter of taste. The tooltip
> shows the same real gas volume information, and now also works for metric
> cylinders. But the tooltip obviously needs that mouse-over.
>
> So which is better? Both? A matter of taste, I suspect.
>
> But I signed off on the patch, because while I think this is a RFC and
> might be good to have people opine on it, I also think the patch is
> perfectly fine to just apply.
>
> qt-models/cylindermodel.cpp | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
> index c2c94f76..530ea635 100644
> --- a/qt-models/cylindermodel.cpp
> +++ b/qt-models/cylindermodel.cpp
> @@ -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:
More information about the subsurface
mailing list