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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
In some cases we don't appear to remove all of the old handles from the
scene and end up showing a handle from a previous instance of the planner
in the upper right corner of the profile.
This patch makes sure that we remove any stray handles that might still be
around before entereing plan or add mode.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Which actually makes the code much clearer as now the object is at the
correct spot on the canvas and the positions inside are relative to that.
No more magic gradiants starting at "92"
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also restructures the code a bit to make it a little more sane and changes
the colors slightly.
With these changes I think we can claim that this
Fixes#557
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This shows a color-coded bar at the bottom of the graph that corresponds
with the active gas.
Todo:
- text that explicitly states gas on the left edge of the bar
- better vertical positioning of the bar
- ability to turn this on and off
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This prevents zooming out to more than max in the planner. Using a Mac
MagicMouse it happens at times that the finger slides on the mouse while
dragging a waypoint which can result in zooming out further than max.
Fixes#695
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While on Linux it was drawn as fine 1px line, on Mac it came out rather
fat and obnoxious by default. With this it's always set to a very thin
line.
This still needs more work, but let's leave it where it is for Beta 5.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was missing from the conversion from the oldPlanner
to the new one, and it also works ok on the profile.
One thing is missing is the Labels on the bottom / left
saying which position it is, but it's already userful.
Fixes#674
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We had pointers to data structures on the stack which we frequently
reallocated. These data structure contain basically a filename and an
offset. We then create a hash of the pointers to those datastructures with
the filename being the key. And then we passed those pointers around
through a Qt model(!!!) only in order to then later look up by filename
what the offset might be.
I am at a loss for words for the lunacy behind this design.
How about we just remember the offsets and pass the integers around?
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Because of the way deleteLater() is implemented, the pictures need to be
hidden, otherwise they might stay around at the wrong time (e.g., when
printing).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we disconnect the picture releated signals then in dive add and dive
plan mode the pictures from the last shown dive could appear on the
profile. That's not cool.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Almost invisible, mostly looking like an odd bug in the profile code,
there was a tiny red line at depth 0 in the planned profile. Turns out
that was the missing mean depth. We didn't populate enough data in the
dive computer of the dive we generated from the plan (and the length of
the depth line was incorrectly determined by the duration of the dive
instead of the duration stored in the dive computer).
Fixes#570
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added the remove_picture functionality, with code
shamelessy stolen from remove_event, and hoock it
up with the interface.
Fixes#650
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since the idea is to remove the picture in the future, we need
to not hold the row on the model, as when we delete one, the
other pictures will change the row. but the QUrl is unique.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
"ups", as I did this in Metric system I forgot to update
to imperial when the user selected it.
Fixes#665
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
[Dirk Hohndel: took only one of the two parts and adjusted commit message
accordingly]
Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This simplifies so much of the code that we were using to control
the visibility of the HeartRate. now things are much saner.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This breaks compatibility with old preferences, but it's a single
key and not that very important so I don't think it's a bigger issue
I've renamed prefs.animation to prefs.animation_speed to denote
that it's a value, and not a state.
Also, fixed the places that were treating it as a state (on/off)
to treat it like a correct value.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The pictures were being plotted in print mode, the main
reason for this was that when we entered print mode and
had already a picture plotted, the method would return
before removing them from the screen. This fixes it.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
for some reason we did a if(true) setValue(true) else serValue(false)
now we just use the value to set the value. =p
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch makes sure that YAxis is not expanded to cover heart rate
when it is displayed on profile panel.
Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I don't like that the event structure includes the variable length array.
That really makes it a pain to change the name of an event (on the flip
side, freeing events is easier I guess).
Anyway, to correctly rename an event we need to actually remove the event
from the correct dc and then add a new event with the new name. The
previous code was insane (it only worked if the new name was of smaller or
equal length, otherwise it had a beautiful buffer overflow).
And of course we need to do this both for the current_dive and the
displayed_dive.
Fixes#616
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use a macro that works to get the current DC.
Fixes#613
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>