Commit graph

137 commits

Author SHA1 Message Date
Robert C. Helling
030c094854 Remove disfunctional asc. rate signals and add disable keyboardTracking
The connection wasn't working anyway since the signal comes without
value while the slot wanted a value and thus only created a runtime
warning.

Turning of keyboard tracking means that when typing the number 123 the
value change signal is not fired three times (with values 1, 12, and 123)
but is only fired upon pressing enter or the spin box losing focus.

We should add a similar setting to the depth, duration and runtime
columns of the DivePlannerPointsModel but i have no clue how to do that.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-10-07 08:42:06 -07:00
Stefan Fuchs
cf409b59ba Planner settings ascend and descende rate: Wire up UI elements correctly
Wire up the UI elements (QSpinBoxes) for ascend rates (4x) and descend rate
(1x) correctly so that the profile and calculation is updated immediately
after the value is changed (e.g. increased/decresed by 1) by clicking
the QSpinBox arrows.
Until now one had to click into the profile or change another planner
preference first before the change became effective.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-04 08:41:10 +02:00
Robert C. Helling
a6f186279f Add a checkbox to turn off plan variations
... as those come with a performance penalty

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-09-20 08:54:41 -07:00
Dirk Hohndel
5a4485b63b Random whitespace cleanup
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-27 11:07:20 -07:00
Dirk Hohndel
9021a44ccc Add SPDX header to desktop widgets
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Jan Mulder
89b914e47d Preserve dive mode when planning a dive
Data such as cilinders and used gasses are populated fromn the currently
selected dive when starting the planner. It is more logical to use
the dive mode (OC, CCR, pSCR) of the currently selected dive
as well. This commits changes this.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-04-20 10:57:11 -07:00
Jeremie Guichard
597539ce39 Fix double to int truncation in C++ code
Wfloat-conversion enabled for C++ part of the code
Fix warnings raised by the flag using lrint

Original issue reported on the mailing list:
The ascent/descent rates are sometimes not what is expected.
E.g. setting the ascent rate to 10m/min results in an actual
ascent rate of 9m/min.
This is due to truncating the ascent rate preference,
then effectively rounding up the time to reach each stop to 2s intervals.
The result being that setting the ascent rate to 10m/min
results in 20s to ascend 3m (9m/min), when it should be exactly 18s.

Reported-by: John Smith <noseygit@hotmail.com>
Reported-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-24 09:39:25 -07:00
Dirk Hohndel
08284275e7 Merge branch 'master' of https://github.com/dje29/subsurface 2017-03-11 08:41:41 -08:00
Stefan Fuchs
fa7d3b6ecb Add tooltip for add cylinder button in planner
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-11 08:07:35 -08:00
Robert C. Helling
295b1b78d8 Make depth conversion work for negative depths
This is needed in the altitude pressure conversion as there
negative altitudes are possible (for diving in the netherlands
or the Dead Sea).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-11 08:03:25 -08:00
Stefan Fuchs
8a4d3876d6 Disable minimum gas calculation for recreational mode
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-11 08:01:35 -08:00
Stefan Fuchs
7f8c3592ce Minimum gas calculation - Calculations and UI parameters
Add minimum gas calculation to planner output.
Add the two UI parameters prefs.sacfactor and prefs.problemsolvingtime.
Connect UI signals and slots for recalculation of diveplan.

Disable minimum gas calculation if there was already a warning before.
If minimum gas result is larger then cylinder start pressure give warning message instead of result.

Add line break before pO2 warnings but only if warnings exist.

Signed-off-by: Joachim Ritter <jritter@bitsenke.de>
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-11 08:01:35 -08:00
Jeremie Guichard
406e4287eb Change calls to rint into lrint avoiding conversion warnings
Using gcc option "-Wfloat-conversion" is useful to catch
potential conversion errors (where lrint should be used).
rint returns double and still raises the same warning,
this is why this change updates all rint calls to lrint.
In few places, where input type is a float, corresponding
lrinf is used.

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-08 14:04:17 +07:00
Stefan Fuchs
e34e2693ea Enable bottom pO2 option also for recreational dives in planner
Bottom pO2 gas option in planner should be always enabled because
also recreational dives can use nitrox and produce "high pO2" warnings.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-07 16:21:28 -08:00
Jan Mulder
5c89115efe Fixes cylinder table headers not translated
The cylinder table was constructed very ealy from the contructor of the
planner, so early that the tr() functions are not registered. This fix
instantiates the cylinderModel from the maintab (as it is done
with, for example, the weightsModel) and lets the planner user
this instantiated (and proper translating) cylinderModel.

Fixes: #206

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-02-21 07:28:15 -08:00
Anton Lundin
78059d4010 Update altitude limits on unit change
The limits set in diveplanner.ui is intended for the unit set there,
meters. If we move between units we need to update the limits to.

This fixes #201

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2017-02-14 07:29:52 -08:00
Robert C. Helling
935734100f Rename prefs.deco_mode to prefs.planner_deco_mode
This is to avoid confusion with planner.display_deco_mode.
When accessing the "current deco mode" use the decoMode()
helper function.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-06 20:43:23 -08:00
Robert C. Helling
fb2ba72e42 Set surface pressure and salinity correctly when replanning
We need to initialize the UI elements accordingly.

Fixes #1094

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-12-26 12:47:54 -08:00
Rick Walsh
46f3b0f238 Planner: connect emitDataChanged slot to ascent/descent rate editingFinished
Call the emitDataChanged slot when ascent and descent rate spinboxes lose
focus.  Without this connection, rates are not updated immediately after
editing the value with keyboard numbers and hitting tab or enter.

It is necessary to keep the valueChanged(int) connections, because
editingFinished() is not triggered by changing the value with the arrows.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-27 20:36:02 -07:00
Rick Walsh
7e09a6c7bc Separate VPM-B conservatism preference for planner and profile
Separate the VPM-B conservatism preference into diveplan.vpmb_conservatism for
planning dives and prefs.vpmb_conservatism for profile ceiling display of
saved dives.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 08:30:11 -07:00
Rick Walsh
7b891904e7 Rename conservatism_level to vpmb_conservatism
Make the variable purpose less ambiguous

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 08:29:56 -07:00
Tomaz Canabrava
8f178301d8 Settings update: Use the Settings to store the plannersettings
Instead of settings things manually in the code. (btw,
if we use lambdas the code can be quite smaller)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27 11:40:45 -07:00
Tomaz Canabrava
ad7524fda1 Organize the connect calls per object.
Just to make it easy on the eyes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27 11:40:45 -07:00
Tomaz Canabrava
f8f87b7294 Settings update: Move preferences sync / initialization
Move Preferences sync / initialization out of the planner
widget prerferences to the ObjectWrapper.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-08-27 11:40:45 -07: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
9fbd11744f Add function to calculate gas maximum narcotic depth
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:08:06 -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
1e607ae98d fixup: Don't confuse EAD and END
The previous patch (Planner: add best mix EAD preference) used the term EAD
(equivalent air depth) in variable names and strings, when it should have been
END (equivalent narcotic depth).
They're not the same thing and shouldn't be confused.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-21 07:03:55 -07:00
Rick Walsh
9b29173363 Planner: add best mix EAD preference
Add best mix EAD preference and UI, along with a tooltip describing what it
does

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-05-21 07:03:38 -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
Robert C. Helling
e93c99c8bc When changing units from psi to bar first change value, then max
otherwise the max interferes with the value. Furthermore this increases
the max values a bit.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-23 09:34:49 -07:00
Robert C. Helling
48007ebc30 Make the reserve gas units aware
In the planner, for recreational mode, there is a setting indicating
the pressure at which the diver should be back at the surface. This
pressure was hardcoded to bar.

Fixes #1027

[Dirk Hohndel: small modifications, more reasonable step for psi,
               more reasonable maxima]

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-22 16:16:38 -07:00
Dirk Hohndel
7eb787ee5d Remove unused member function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-09 21:50:26 -08:00
Dirk Hohndel
f85883c707 Create date and time formats preferences
Now we can actually change them in preferences instead of just deriving
them from the language set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-02 12:51:31 -08:00
Tomaz Canabrava
1d6683f3e0 Move Profile widget out of desktop-widgets
The reason for that is, even if profile widget is made with qpainter
and for that reason it should be a desktop widget, it's being used
on the mobile version because of a lack of QML plotting library that
is fast and reliable.

We discovered that it was faster just to encapsulate our Profile in
a QML class and call it directly.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Tomaz Canabrava
e49d6213ad Move qt-ui to desktop-widgets
Since we have now destkop and mobile versions, 'qt-ui' was a very
poor name choice for a folder that contains only destkop-enabled
widgets.

Also, move the graphicsview-common.h/cpp to subsurface-core because
it doesn't depend on qgraphicsview, it merely implements all the
colors that we use throughout Subsurface, and we will use colors on both
desktop and mobile versions

Same thing applies for metrics.h/cpp

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30 10:36:49 -07:00
Renamed from qt-ui/diveplanner.cpp (Browse further)