Commit graph

299 commits

Author SHA1 Message Date
Dirk Hohndel
d9fd4cb69b Fix crash with empty dive list
Don't access current_dc unless there is a valid current_dive.

Fixes #817

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-24 14:42:25 -08:00
Dirk Hohndel
c3614424f9 Correcly look at all relevant dive computer structures
When calculating maxima for a dive, we need to take data from all existing
dive computer structures plus potentially also a fake dive computer
structure that is just passed in in order to create a meaningful profile.

Commit 86c961614b ("Actually walk all dive computers, don't just claim
to do so") missed that second case and no longer took the fake_dc into
account, breaking the display of dives that don't have samples.

Reported-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-24 07:07:02 +12:00
Dirk Hohndel
6aee901f6f Don't show previous dive computer text
There were situations when the last text was still shown. E.g. when the
current file was closed and then a new dive was imported from CSV.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-24 06:54:16 +12:00
willem ferguson
4487e13e15 Code cleanup: CCR setpoint and o2 sensor visualisation
This patch does some cleaning up of the code that provides visualisation
of CCR o2 sensor and o2 setpoint data. It reduces the number of
conditional evalauations that are required and it improves the readability
of these parts of the code.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-23 21:41:28 +12:00
willem ferguson
a700be3207 CCR option: display o2 sensor data
This patch creates the possibility of viewing the individual sensor
values when the po2 button on the profile toolbar is activated. This
follows exactly the procedure for optionally displaying the setpoint
values while viewing po2. A checkbox in the preferences panel determines
whether sensor information is shown. By default it is set to OFF. When
checked, and the po2 button is activated, sensor1 values are shown in
grey, sensor2 in blue and sensor3 in brown.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-21 17:00:18 +12:00
Dirk Hohndel
86c961614b Actually walk all dive computers, don't just claim to do so
If the first dive computer had pressure samples, but the second one (and
no higher one) did, then we would draw a flat horizontal line for the tank
pressure graph (but lable it with the correct pressures). This routine
that is hunting for the actual maxima and minima does have to really go
through all dive computers, not just "this one and up".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19 21:52:08 +12:00
Thiago Macieira
f5726ffa9d Fix build: add missing #includes
qt-ui/profile/profilewidget2.cpp:1351:10: error: invalid use of incomplete type ‘class QDebug’
qt-ui/printlayout.cpp:141:27: error: variable ‘QPointer<ProfileWidget2> profile’ has initializer but incomplete type

In commit f9ceff009b ("Clean up the header files") things got broken for
an as of now unreliesed future version of Qt.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-18 21:26:53 +12:00
Joakim Bygdell
76e3a10f08 Move the heart rate graph
Move the heart rate graph down to the same space as the tissue saturation
graph so that it does not overlap with temperature or partial pressures.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-18 21:26:06 +12:00
Dirk Hohndel
f9ceff009b Clean up the header files
Lots and lots and lots of header files were being included without being
needed. This attempts to clean some of that crud up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-18 21:25:59 +12:00
Tomaz Canabrava
501f72c697 Speed Improvemens: fewer calls to mapFromScene / mapToScene
We did three cals to mapToScene / mapFromScene on the mouse moveEvent at
the ProfileWidget2 where we only needed to call one in the common case and
two in the worst case.

This doesn't really help in terms of speed (unless you have a really old
cpu) but since it's code that gets called *very* often, it seemed a
reasonable thing to do.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-15 07:24:13 +13:00
Cristine Guadelupe
2b19341609 Remove instantMeanDepthLine
Take instantMeanDepthLine out of the code. We have the moving average line
plus the exact data in the information overlay.

Signed-off-by: Cristine Guadelupe <cristineguadelupe@me.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-14 12:24:57 +13:00
Robert C. Helling
e219bc70f8 Refactor dctype -> divemode
... and repair a failed rebase (sorry).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:25 -08:00
Willem Ferguson
d45e870289 Repair minor bug in CCR setpoint graph
Correct minor malfunction with CCR setpoint display. It was showing even
when the po2 display was turned off. This patch ensures that the setpoint
graph only shows when the po2 toolbar button is activated (and in addition
the appropriate checkbox in the Preferences).

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-09 09:16:29 -08:00
Lubomir I. Ivanov
2b311b1c2c profile: don't show instantMeanDepth for printMode
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07 12:29:59 -08:00
Dirk Hohndel
925bb019c7 Fix potential crash
Commits 0de3bc8452 ("Display CCR setpoint values on the po2 graph") and
65eed80e37 ("Don't always show the setpoint graph") didn't take into
account that current_dive could be NULL and therefore accessing current_dc
could crash.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 20:35:57 -08:00
Dirk Hohndel
65eed80e37 Don't always show the setpoint graph
We need to use the same conditional here as we do earlier in the code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-05 11:14:59 -08:00
Willem Ferguson
0de3bc8452 Display CCR setpoint values on the po2 graph
When a CCR dive is viewed and the toolbar button for PO2 is activated,
both the PO2 (green line) and the O2 setpoint (red line) are shown.
This allows evaluation of the PO2 in the CCR loop with respect to the
pre-configured O2 setpoint.

The setpoint graph can be disabled from the Preferences/Graphs tab
by checking the appropriate checkbox.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-05 09:18:06 -08:00
Anton Lundin
6b17f20081 Close two compiler warnings about reordering
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-04 17:52:21 -08:00
Dirk Hohndel
c4954d90a1 Whitespace cleanup
Quite a bit of wild white space going on...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-01 16:28:37 -08:00
Krzysztof Arentowicz
b6f47883c3 Get rid of mean depth line
Flat mean depth line (whole dive, not the instant one) is redundant as we now
 have a much more useful mean depth graph.

Signed-off-by: Krzysztof Arentowicz <k.arentowicz@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-01 16:28:20 -08:00
Krzysztof Arentowicz
e3378e299a Plot mean depth data
As we already have running depth sum values for each sample
why don't just plot running average depth graph.

Signed-off-by: Krzysztof Arentowicz <k.arentowicz@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-01 16:23:22 -08:00
Tomaz Canabrava
b3e3947b79 Make the moving mean depth line work
It's a bit jumpy, but works.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30 16:14:53 -08:00
Tomaz Canabrava
d6fddcaadc Add a new signal to send the current time/depth of the mouse pos
As the explanation says. :)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30 16:14:40 -08:00
Tomaz Canabrava
3e239c7e3e Add the instantMeanDepth on Scene
But nothing is hoocked yet.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30 16:13:41 -08:00
Tomaz Canabrava
146030f805 Add skeleton for the instant mean depth line
This class will hold the visible line of the mean depth for the time 'now'

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30 16:12:28 -08:00
Anton Lundin
1a4380c8c1 Connect QGraphicsScene to its parrent
This is to prevent a leak of QGraphicsScene.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-18 08:34:00 -08:00
Anton Lundin
8571268d21 Have ProfileWidget2 delete its allocated data
This creates a destructor for ProfileWidget2 that deletetes its new'ed
objects on exit.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-18 07:22:39 -08:00
Robert C. Helling
b72c32da7d Turn of replotting while the cylinder type combo box is active
Since replotting is expensive and it is triggered while scrolling
through the list of cylinders, better not do it for improved
user experience and replot only after the combo box loses
focus.

I hope this...

Fixes #768

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-17 21:33:55 -08:00
Joakim Bygdell
8d4a3842ee Prevent the tank bar from overlaping the temperature graph.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-12 11:55:23 -08:00
Dirk Hohndel
719cfe0ece Trivial white space fix
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-10 15:49:12 -07:00
Dirk Hohndel
c76cb59aa0 More temperature plot position tuning
Depending on the options shown, the latest change appears to have moved
the temperature graph a bit too low. This seems to work better in my
experiments.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-10 15:48:19 -07:00
Joakim Bygdell
6653d98e67 Rearrange the vertical positions to better accomodate the temperature graph.
Fixes #778

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-10 09:39:53 -07:00
Robert C. Helling
aa22e0610c Don't interpolate pressure while dragging waypoints
A profiler session in the planner shows that for deep long dives
a significant amount of CPU time is spent in populate_pressure_information()
which interpolates the cylinder pressure graphs.

This patch introduces a "fast" flag for the replot of the profile
which is active while the mouse button is still pressed and that
suppresses this calculation.

In the future, this flag could be used for other responsiveness tunings
of the plot.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-04 16:26:47 -06:00
Robert C. Helling
fb265c2929 Context menu entry to change setpoint
This patch adds a context menu entry to add a setpoint change
event. In particular, this can be used to turn a logged dive into
a CCR dive.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-01 14:23:45 -08:00
Dirk Hohndel
3dc864f1b1 Profile: adjust tank pressures at gas change (incomplete)
This code sets up the UI that will allow the user to adjust tank pressures
at a gaschange event. The actual changing of the pressure is not
implemented, yet, so this is disabled until someone finds time to do so.

The scenario is this: a tec diver or sidemount diver without pressure
sensors on at least one of their tanks still wants to reasonably
accurately track gas consumption during a dive. The diver takes notes of
the pressures at every tank switch (I find that odd, but apparently some
cave divers indeed do that as they switch back and forth between different
gases) and then wants to adjust the pressures in Subsurface to match those
written down.

One difficulty here is that the first and last pressure of a tank with no
sensor data is still considered "sensor pressure" - this is basically an
implementation detail in the code that is used to do the pressure
interpolation to have constant-SAC pressure plots for tanks without
sensors. So when we check if there is indeed no pressure data available at
the gas change, we can't just work with the interpolated pressure - if
this is the first (or last) time the tank was used, that pressure may be
marked as sensor pressure.

What's missing is the UI to enter the desired new pressure plus the black
magic that actually inserts this into the dive in a way that doesn't break
the assumptions in the rest of the code. I'm running out of time to do
that but wanted to preserve this code so someone can continue this later.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19 16:29:27 -08:00
Dirk Hohndel
f2a2ded04e Profile: don't offer to switch to an already active tank
Adding a gas change to tank that we are already breathing from makes no
sense, so let's not offer this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19 22:44:33 +00:00
Dirk Hohndel
639e079131 Profile: add helper function to get the sample entry for a mouse position
This seems quite useful to have.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19 22:40:42 +00:00
Dirk Hohndel
21658383e5 Profile: keep the plotInfo in the corresponding member variable
We had the variable. As a pointer. Which we used memset to clear. Ouch -
that smells like some bad cut and paste.

With this change the object keeps the corresponding plotInfo around (just
like some others do) and can use it later. I suspect this code could use
some larger cleanup, but it's a bit too late for this in the development
cycle, I guess. I'm sure I'll regret this in the future...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19 22:28:16 +00:00
Dirk Hohndel
76c44dd6a3 Don't offer to add a gas change if there is ony one gas
In the context menu of the profile it makes no sense to offer the ability
to switch gases unless there is a gas to switch to.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-19 22:15:33 +00:00
Salvo 'LtWorf' Tomaselli
4ef35f0651 Mark string for translation
An error string was left untranslated.

Signed-off-by: Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-15 06:02:30 -08:00
Dirk Hohndel
89e7cae854 Fix partial pressure graph thresholds
Since we only store things in the preferences if they are different from
the default, the existing code that simply compared with the settings
value didn't work when people used the defaults.

We now compare to the actual preference at runtime which should address
that.

Fixes #731

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-01 09:22:07 -07:00
Dirk Hohndel
4fa3f89378 Fix adding gas change to a dive
Yikes this was stupid. We mixed changing the displayed_dive and the
current_dive. So we'd pass in the displayed_dive and a pointer to the
dive_computer structure of the current dc in the current dive. Oops.

This makes much more sense. And:

Fixes #738

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-30 14:08:10 -07:00
Dirk Hohndel
669da22d8c Allow the user to switch to a gas in a specific tank
When entering a gas switch manually, explicitly show the different tanks
that are available and correctly switch between different tanks with the
same gas.

See #702

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-29 16:25:00 -07:00
Dirk Hohndel
f81d316570 Correctly place the first gas label in drop to bottom mode
When dropping to the bottom in plan (and add) mode, the gas label was
placed along the diagonal line from (0,0) to the second dive data point
(i.e. the one at the end of the "at deptch" segment). That looks terrible,
the label needs to be along the segment that we are spending at the
bottom.

This patch fixes that problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-21 14:27:50 -07:00
Joakim Bygdell
00c3b8dbaa Untangle the graphs at the bottom of the profile.
When multiple graphs are displayed at the same time they end up being printed on top of each other.
Scale the lowest graph to accommodate the tankbar.
Add an intermediate scaling step to the depth axis when pp graphs or the tissue graph are visible.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-10 02:41:26 -04:00
Robert C. Helling
15a99f8789 Add tissue saturation plot to tooltip
This adds a graphical representation of tissue loadings at the current moment during the dive
to the tooltip box. The layout is inspired by the Sherwater Petrel.Add tissue saturation plot to tooltip

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-19 21:48:05 -07:00
Robert C. Helling
3fc9c1e005 Tissue saturation plot a la Sherwater Pretel
This adds a toolbox icon to turn on a tissue plot inspired by the bar
graph of the Sherwater Petrel,

It shows the inert gas partial pressures for individual compartments. If
they are below the ambient pressure (grey line) they are shown in units of
the ambient pressure, if they are above, the excess is shown as a
percentage of the allowed overpressure for plain Buehlmann. So it has the
same units as a gradient factor. Thus also the a gradient factor line (for
the current depth) is shown.

The different tissues get different colors, greener for the faster ones and bluer
for the slower ones.

Positioning and on/off icon action still need some tender loving care.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-19 21:46:30 -07:00
Tomaz Canabrava
9acf1caca3 A much better Toolbar for the profile.
Using QToolBar I was able to remove much of the dead code
from the mainwindow.ui xml file by transforming the QToolButtons
into actions and loading them dynamically in the .cpp code.
I couldn't use the designer for this ( as I wanted ) because
Qt has no notion of ToolBars outside of the areas where the
MainWindow should have one, and we use it in a very different
area.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-23 08:09:11 -07:00
Dirk Hohndel
0b5e3389e2 Make sure tank bar button triggers tank bar
This worked flawlessly on Mac and Linux, but on Windows I needed to add
the explicit setVisible here - not quite sure why.

Fixes #710

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-21 07:52:14 -05:00
Dirk Hohndel
642ad1e0fe Fix crash when calling the planner twice in a row
Turns out that the fix in commit f7119bdccf ("Planner: make sure no old
handles are around when entering Add/Plan") was incorrect. We ONLY want to
remove the existing handlers when we re-plan a dive, NOT when we call add
or plan.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-19 21:57:15 -05:00