Since earlier have we had support for our own calculated TTS. This adds
support for holding TTS values reported by a dive computer.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is just removal of dead code from the old profile, probably there's
still a bit more to remove, but this is a very good cleanup already.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This allows us to give it a different color (red) and make it a smaller
size.
While implementing this I also fixed the size of the temperature text in
the new profile.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
* ensure include guard to every header
* comment endif guard block
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The profile info was generated using nasty string concatenation that the
membuffers are much better at anyway. And membuffers don't need those
arbitrarily sized fixed buffers (500 bytes? Why 500 bytes?).
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
libdivecomputer already supports this, but we didn't save it.
Tested-by: Oscar Isoz <jan.oscar.isoz@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With this patch the tooltip is ready to work on the new profile, we just
need to actually use it.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Created a method to check if calculations should take place
taking into consideration what changed on the model. if the
model changes *everything*, them, all calculations should
be done, but if just some of the columns of the model are
changed, only those columns should trigger an visual update
on the items.
In theory this patch looks right, but something is wrong (
calculations are not being made. ), so I'll commit this any
how, and fix on the next commit.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This version of the create plot info is the same as before, with the
difference that it doesn't depends on the gc.
Also fixed a crash.
The Pressure Index, Information and interpolated seems wrong,
I'm getting only zeroes.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Created a new version of calculate_max_limits that doesn't have a
graphics_context and returns a plot_info. The code is basically the same
as the old calculate_max_limits, so there's not much to talk about.
The rest of the code is just boilerplate to plug the Profile
code with the axis and model stuff, to be plotted on screen.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This model encapsulates the plot_info struct and provides
a consistent way to show it using the Qt Model view system
in the C++ and QML way. For a QGraphicsItem that should show
a Profile, this is the start.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The small straight parts at the end of tank pressure lines are more of a
aesthetic issue, not causing real harm so it is no reason to remove the
SURFACE_THRESHOLD test from pressure_time function only because of this.
Also improved interpolate data debuging, rearranged
get_pr_interpolate_data and removed an unused variable from
get_pr_interpolate_data. No real change here, just trying to make the code
clearer.
[Dirk Hohndel: clean up whitespace damage from this and the previous
commit]
Signed-off-by: Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Interpolated lines for tank pressures were presenting discontinuities
(sudden drops) and stalls (horizontal lines) with certain dive profiles.
The main reason seems to be that the discrete interpolation of tank
pressure was adding small pressure increments that could be rounded down
or up repeatedly generating cumulative rounding errors that would mean
either a delay on pressure drop that would be drawn as a sudden drop or as
a premature pressure drop that would result in a flat line.
This patch changes the way the discrete interpolation is done, so that we
don't have cumulative rounding errors distorting tank pressure lines.
To calculate accumulated pressure_time values the get_pr_interpolate_data
function was created. The fact that get_pr_interpolate_data transverses
the beginning of the plot_info entry list for each entry that needs
interpolated tank pressure isn't optimal at all. There might be a way to
properly track the data necessary to interpolate tank pressures from
inside the main pi->entry loop in fill_missing_tank_pressures.
Unfortunately I didn't manage to do it inside fill_missing_tank_pressures
so we have get_pr_interpolate_data.
The SURFACE_THRESHOLD test from pressure_time function was also removed as
no matter how shallow the diver is, if he is using the cylinder to breathe
the cylinders tank pressure should be affected.
Signed-off-by: Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
NDL and TTS doesn't show up in the printed profiles, and it takes
significant time to calculate, so just don't do it.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Store the calculated values in separate variables in the plot_data
struct, and display them separate. This makes sure we don't confuse the
calculated values with the ones from a dc, and now we can compare the
two.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a ruler QGraphicsItem which can be dragged
along the profile. The ruler displays minimum, maximum and
average for depth and speed (ascent/descent rate). Also, all used
gas will be displayed.
This also adds a new attribute to struct plot_data to store the
speed (not just as velocity_t).
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
plot_data.o2 and plot_data.he was wrong for all dives, due to that
cylinderindex was set right first in populate_pressure_information, and
thus those two contained bogus information.
This makes the plot-text use cylinderindex-lookup as everything else.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Calculate TTS and NDL, and Deco stops when they don't already exist in
the samle and show them in the mouse-over.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is a feature that had been requested a few times in the past and when
debugging my "show only used gases" commit I realized that this would have
been extremely useful to have...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I think that displaying tissue loadings either as pressure or as
percentages is not very intuitive but that it makes much more sense when
translated to ceiling depths.
This change enables just that for the 16 tissues in our calculated ceiling
and visualizes this in the profile graph.
There is a checkbox in the preferences to turn this on. If enabled, all
tissues having non-trivial ceilings are also shown in the info box.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This had been bugging me for a while - the label texts were all not
quite where I expected them to be. I think this looks much better now.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Passing the alignment as int instead of float or double was actually a bug
as CENTER is defined as (-0.5) ...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
a few code was moved around, a macro that contained
the form of x ? : y; had to be rewritten to x ? x : y
since c++ doesn't allow ternarys without the middle operator.
The color-choosing for the Cylinder Pressure broke
on the Qt port - but it's a small issue.
I'm painting everyone as 'dark green' now, will
fix that later.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Make the graphics_context part of the ProfileGraphicsView and remember
that the plot info is already a part of the graphics_context (we kept
passing around both of them in the Gtk code... pointless but a leftover
from before adding the pi to the gc...)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are subtle differences, the Cairo version looks
prettier - but that's fixable. I did a small triangle
and a exclamation mark on it. maybe a gradient would
make a good difference there.
this item has a ItemIgnoresTransformation tag, so
scalling, rotating or zooming will not change it's
size.
The tooltips are not yet ported.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The plot_text function from the cairo-methods are now ported
on the qt version. this patch moves around some code since
quite defines are already used and I didn't want to reinvent
the whell.
Original code used varargs, but I prefered to change it
, so now it receives just a reference to a QString object
and the string must be constructed before sending,
using the .arg methods.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The compiler on MacOSX wouldn't build Subsurface when bool
was redefined.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The mean depth now is plotted correctly.
I wanted to do more stuff on this commit, but since
it required that a few things on profile.c got moved
to profile.h, commited to not have a huge blob for review.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The first plotting method was removed from profile.c
to profilegraphics.cpp and some conversion ( almost 1 to 1 )
was made so that the code could work.
Since the code is big - this commit has just a part of it
working - it plots the grid. but already works for testing
the resizing of the window and Zooming ( unimplemented )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Started working on the Qt version of the Plot, initially
nothing is printed - but this is not a bad thing,
the program doesn't explodes too. :)
some work had to be done about the 'bool/gboolean' stuff
so I removed all gbooleans in the code that I'v encountered.
A new file was created ( profile.h ) so I could put the
signatures of helper methods that cairo used to call.
till now the code computes the max limits.
Next patch the first drawing will be made.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>