Commit graph

30 commits

Author SHA1 Message Date
Dirk Hohndel
08c42813e5 Revert "In statistics, ignore gas use of planned dives"
This reverts commit 1d8662006c.

Mistakenly pushed to master

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-02-03 07:31:03 -08:00
Robert C. Helling
1d8662006c In statistics, ignore gas use of planned dives
When merged with real dives, those would double count otherwise.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-02 12:37:24 -08:00
Robert C. Helling
c1dc0c9ce0 Allow user to disable a cylinder in planner
In the cylinder table, the last column ("use") always showed
OC-GAS. Editing was enabled, but the user had to guess to enter
a small integer meaning dilluent or CCR oxygen cylingder. I guess,
nobody has ever done that.

This patch makes this column clickable. A click toggles if the cylinder
is used for planning or not. This wait it is much easier to investigate
the consequences of gas loss on a plan.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-23 22:11:51 -08:00
Dirk Hohndel
7f7c008247 Revert "Show both the nominal and "real" size for an imperial cylinder"
This reverts commit adaeb506b7.

commit a8e8d56ec0 ("Tweak cylinder equipment tooltips") does a much
better job allowing the user to know the true volume of the cylinder
(given the gas entered) and clutters the UI a lot less.
2017-01-16 03:30:57 -08:00
Linus Torvalds
a8e8d56ec0 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>
2017-01-16 03:22:33 -08:00
Linus Torvalds
638e7fb28f Add cylinder equipment tooltips with gas volume
This adds tooltips for the equipment tab for each cylinder, showing the
amount of gas used.

When you mouse over the size and working pressure fields, the tooltip will
show the amount of gas used (along with start and end gas volumes). And
when you mouse over the start and end pressures, it will show the start
and end gas volumes, and the Z factor used.

I started doing this because of the gas volume questions in the last day
or two (and a few from a few weeks ago). When even Robert Helling starts
wondering about the effects of compressibility on the SAC calculation, our
numbers are clearly too opaque.

With these tooltips, at least you can see what went into the used gas
calculations, instead of having to add debugging options to print out Z
factors.

[ This patch also adds a "rint()" to get the rounding right in the
  gas_volume() function.  Although rounding to the nearst milliliter
  really doesn't matter, it's the right thing to do after doing FP
  calculations ;^]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-01-12 14:17:09 -08:00
Rick Walsh
9710ac8926 CylindersModel: add tooltips for Deco switch at, Bot MOD and MND
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-10 15:05:14 -07:00
Rick Walsh
b78e6525eb Remove unnecessary DivePlannerPointsModel functions and variables
Commit b1ed04a means that DivePlannerPointsModel::rememberTanks() and related
functions and variables are no longer required

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:54:51 +09:00
Rick Walsh
f96f3abcdc Relabel cylindermodel "Deco MOD" column to "Deco switch at"
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 10:53:39 +09:00
Rick Walsh
bb31517951 Planner: update cylinder mixes and MND and MOD when prefs are changed
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:48 -07:00
Rick Walsh
ffca5674bf Fixup: don't capitalise best_He
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:41 -07:00
Rick Walsh
f08b0e0e3e Planner: automate calculation of best mix for max depth
Add option to calculate the best mix portion of O2 and He for the dive's max
depth if the user enters * in the MOD and MND cylinder fields. Gas portions
are automatically recalculated if the max depth of the dive changes.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:25 -07:00
Rick Walsh
274ff270d8 Be more clear about deco MOD / switch depth and bottom MOD
The switch depth of a decompression gas is its MOD. By renaming the heading to
"Deco MOD", it is more clearly distinguished from the  bottom MOD, and it is
more obvious how they relate to the Bottom pO2 and Deco pO2 preferences.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:16 -07:00
Rick Walsh
6ed5e0d621 Add MOD and MND fields to cylindermodel
Adds fields to the planner cylinder model for maximum operating depth (MOD)
for a bottom mix gas, and maximum narcotic depth (MND). Fields are read/write,
so changing MOD changes %O2 and vice-versa. Changing MND changes %He and
vice-versa.

When setting MOD directly, the %O2 is truncated (rounded down) to an integer,
which re-calculates the MOD, which is sometimes a few metres greater than the
input depth. This is desireable behaviour, as the rounding is conservative.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:10 -07:00
Rick Walsh
1ba61d7ad5 Update gas deco MOD when deco pO2 is changed
This fix is reasonably straightforward when the divedatapoint structure stores
the cylinder rather than gasmix.

Fixes #970

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:01 -07:00
Rick Walsh
b1ed04a7f4 Have divedatapoint store cylinder id instead of gasmix
Determining the correct cylinder index from a known gas mix can be
complicated, but it is trivial to look up the gasmix from the cylinder_t
structure.

It makes sense to remember which cylinder is being used. This simplifies
handling changing a cylinder's gas mix, either directly by the user, or
indirectly in the planner. It also permits tracking of multiple cylinders of
the same mix, e.g. independent twins / sidemount.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:07:25 -07:00
Rick Walsh
8acbeed555 Add some gas mix validation to the planner
A few basic rules for gas validation:
	We can't have <0%, or >100% of either O2 or He
	O2 + He must not be >100%
	Switch depth can't be <0%

This places limits on user-input values

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-28 14:24:10 -07:00
Rick Walsh
67dda48c88 Add best mix function to planner cylinder model
This allows calculation and selection of best mix in the planner cylinder
entry, by entering the gas depth, followed by "b" for best (trimix) mix, or
"bn" for best nitrox mix.

The UI is not intuitive, but it is quick and easy.  At the very least, it
should be documented.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-21 07:03:30 -07:00
Lubomir I. Ivanov
cae99471ad CylindersModel: clamp the "cylinderuse" values
If the value for "use" is negative or larger than the number of
elements in "enum cylinderuse", later CylindersModel::data() can
request a string in the lines of cylinderuse_text[cyl->cylinder_use],
which can SIGSEGV.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-29 09:07:59 -07:00
Dirk Hohndel
7be962bfc2 Move subsurface-core to core and qt-mobile to mobile-widgets
Having subsurface-core as a directory name really messes with
autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an
autocomplete conflict and also was inconsistent with the desktop-widget
name for the directory containing the "other" UI.

And while cleaning up the resulting change in the path name for include
files, I decided to clean up those even more to make them consistent
overall.

This could have been handled in more commits, but since this requires a
make clean before the build, it seemed more sensible to do it all in one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:33:58 -07:00
Tomaz Canabrava
fb037ba55f Silence warnings in CylinderModel
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08 20:58:21 -08:00
Tomaz Canabrava
beb0bc7a1d Silence more warnings
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-07 11:23:27 -08:00
Linus Torvalds
adaeb506b7 Show both the nominal and "real" size for an imperial cylinder
This is questionable, but perhaps useful.

When showing imperial cylinder sizes, show both the nominal value (with
no compensation for compressibility of the gas) and the "actual" amount
of gas the cylinder contains.

So an AL80 will show as a size of "80 (77)cuft", because while 80 is the
nominal size, the actual amount of gas that will fit is just 77 cuft.

[Dirk Hohndel: adjusted to take translation of the unit into account]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25 01:19:00 +01:00
Linus Torvalds
288aff9dbb Don't use "get_volume_string()" for cylinder size string
We had two totally different usage cases for "get_volume_string()": one
that did the obvious "show this volume as a string", and one that tried
to show a cylinder size.

The function used a magic third argument (the working pressure of the
cylinder) to distinguish between the two cases, but it still got it
wrong.

A metric cylinder doesn't necessarily have a working pressure at all,
and the size is a wet size in liters.  We'd pass in zero as the working
pressure, and if the volume units were set to cubic feet, the logic in
"get_volume_string()" would happily convert the metric wet size into the
wet size in cubic feet.

But that's completely wrong.  An imperial cylinder size simply isn't a
wet size.  If you don't have a working pressure, you cannot convert the
cylinder size to cubic feet.  End of story.

So instead of having "get_volume_string()" have magical behavior
depending on working pressure, and getting it wrong anyway, just make
get_volume_string do a pure volume conversion, and create a whole new
function for showing the size of a cylinder.

Now, if the cylinder doesn't have a working pressure, we just show the
metric size, even if the user had asked for cubic feet.

[Dirk Hohndel: added call to translation functions for the units]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-25 00:58:09 +01:00
Guido Lerch
f1c682b55a Fixing annoying compiler warning
Adding { } to if clause to avoid dangling warning
/Users/guidolerch/src/subsurface/qt-models/cylindermodel.cpp:117:
warning: add explicit braces to avoid dangling else [-Wdangling-else]

[Dirk Hohndel: combined two of Guido's patches to one that is simpler]

Signed-off-by: Guido Lerch <guido.lerch@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-22 19:37:50 +09:00
Joakim Bygdell
0c9d71234f Show correct icon when only one gasmix in the list
When there is only one gasmix in the list we should show the icon that tells the
user that they can't remove the last gasmix from the list.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-19 11:45:12 -07:00
Robert C. Helling
a7d18a9fa6 Round MOD of gas rather than truncate
For the proper calculation, we need to take salinity and surface pressure
into account (rather than depth = bar * 10 - 10)

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05 15:53:49 -07:00
Dirk Hohndel
c01c35ca0c Cylinder model: fix an obscure case that would access cylinder -1
If we remove a cylidner for a unique gas and that is allowable, then don't
try to copy from cylinder with index same_gas (which is still -1).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21 21:30:38 -07:00
Tomaz Canabrava
32b0afa3e7 Move Tankinfomodel to its own file
Another change to make it easier to program the mobile ui. This was a
fairly easy patch: just moved the contents of the file and fixed the
includes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:10:30 -07:00
Tomaz Canabrava
f432b764e7 Move DivePlannerModel and CylinderModel to qt-models
Still trying to make it easier for the Mobile Port:
This patch is a bit bigger than I hopped, but it was the smallest that I
could get.

A lot of TODO items where added where I broke the code because the current
implementation would break the QML implementtion on the designer. I'll
most probably fix those myself when I finish the transition to the models
to the new folder.

I only moved both models at once because there's an interdependency
between them (seems inevitable, tough, but I'll take a better look at it
later).

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-29 14:09:13 -07:00