This commit is rather big, and I forgot to cut it in pieces.
The first part creates a new 'calculate_gas_information' that will not
fill the profile_info->maxpp member ( that should be removed from it as
soon as the new dialog is finished ). The reason for that is that all of
the profile data will be calculated and the graph needs to update
dynamically, so whenever the settings changes, I ask for the model which
is the biggest graph and replot only the ones we need.
The second part adds a new animation function 'animdelete' to fade-out and
delete the item when it's done. the old function 'hide' did just that but
a hide shouldn't delete anything.
The third part is preferenes awareness for the PP graphs. I created two
new functions that receive the settings key for visibility and use the
QSettings to show / hide them. This also works quite well for the axis;
if no graph is visible, the axis will also hide itself.
The fourth part is colors. The pp graphs now have the correct colors.
And a bit of code cleanup too.
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>
Another futile attempt to cleanup the code and make coding style and
whitespace consistent. I tried to add a file that describes the key points
of our coding style. I have no illusions that this will help the least
bit...
This commit should ONLY change whitespace
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>
Earlier we converted the C++ code to using true/false, and this converts
the C code to using the same style.
We already depended on stdbool.h in subsurfacestartup.[ch], and we build
with -std=gnu99 so nobody could build subsurface without a c99 compiler.
[Dirk Hohndel: small change suggested by Thiago Macieira: don't include
stdbool.h for C++]
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Interpolated pressure should always be set, even it we didn't
calculate a new one. In this case we should just use the last one.
Signed-off-by:Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When an interpolated segment is on the surface we get no pressure time -
and try to divide by zero.
(plus a small whitespace issue that slipped throught the cracks earlier)
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>
These adds some ifdef's around some debug functions to disable them when
not using them.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
last_pressure is updated a couple of lines later, so no need to do it
here.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
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>
While playing with the ruler, I figured that it happened only once that
my minimum speed was not 0 for a segment long enough to get any display.
And it was a "dive" in an hyperbaric chamber...
This patch replaces the minimum speed with the maximum descent speed and
the maximum speed with the maximum ascent speed.
Signed-off-by: Alexandre Belloni <alexandre.belloni@piout.net>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't calculate pressure-track for depth above SURFACE_THRESHOLD,
because then we would guess that were actually at surface breathing.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use get_cylinder_index that handles SAMPLE_EVENT_GASCHANGE and
SAMPLE_EVENT_GASCHANGE2.
This also removes the need for a special case where get_gasidx returns
-1, because get_cylinder_index always returns the "closest" gas that it
finds.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In the Gtk version there were no option to disable the showing of time
in the mouse over, so this removes that option to limit the amount of
clutter in the settings panel.
This also renames the time and temperature to match the names they used
to have. T -> @, Temp -> T
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When reordering the info overlay content to make it jump around less,
somehow the SAC data got printed twice.
[Dirk Hohndel: rewrote incorrect commit message]
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>
Break the huge calculate_deco_information into three different functions.
One for the current deco calculations, one for the ndl/tts/deco stop and
one for the gas calculations.
This makes it easier to disable/enable different functionality.
This also gets rid if the ccrdive state variable, and keeps that state
in the plot_data struct. Now we calculate the deco before we calculate
the gas properties, so if we have a po2, we're in ccr-mode, and if we
don't, we're in oc mode.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When moving along the plot, it's hard to look at a certain value when its
place in the info box moves due to values being added or removed above it.
This commit moves the "stable" values up top in the info box and the
values that come and go further down, so that the box expands downwards.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This changes the special handling of ndl calculations when we deem that we
are too shallow for doing them. Previously we just set ndl to -1 and
printed a "-", now we return and print max_ndl, just as how most
divecomputers work.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Let the user choose if the calculation of ndl and tts is worth the time
it takes.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This will fill out the gaps of temperature data between all the points
so we always have a temperature to show in the info box.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Ruler was hard-coded to use seconds as speed unit. This makes it use
get_vertical_speed_units to switch between seconds and minutes.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is really nice to have when looking at specific parts of a dive.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
D as in depth, T as in time and not another T as in temp.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This may seem like a really odd change - but with this change the Qt tools
can correctly parse the C files (and qt-gui.cpp) and get the context for
the translatable strings right.
It's not super-pretty (I'll admit that _("string literal") is much easier
on the eye than translate("gettextFromC", "string literal") ) but I think
this will be the price of success.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I am not removing this but leaving it around as this is useful for a
feature that we still need to enable - the ability to filter out which
events to display. This existed in 3.1 but is missing in the Qt version.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- remove the build flags and libraries from the Makefile / Configure.mk
- remove the glib types (gboolean, gchar, gint64, gint)
- comment out / hack around gettext
- replace the glib file helper functions
- replace g_ascii_strtod
- replace g_build_filename
- use environment variables instead of g_get_home_dir() & g_get_user_name()
- comment out GPS string parsing (uses glib utf8 macros)
This needs massive cleanup, but it's a snapshot of what I have right now, in
case people want to look at it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Some people (free divers) are loving ft/s or m/s units for vertical speeds.
Now they can choose between /min or /s in the configuration (only Qt UI).
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I ran subsurface with valgrind and it found a few errors.
[Dirk Hohndel: split this out from a much bigger patch that is still under
review]
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There is debate on this one, as free divers WANT the xx/sec values.
This needs to become flexible depending on whether you are in freedive
mode or not.
Fixes#202
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
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>
This is really nice to have when looking at specific coutures of a dive
or events.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Old gasswitch events only contains O2, so don't look at he part when
the event doesn't contain a He part.
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>
When seeing that you have 0 min left, it looks kinda wierd, so rather
round up instead of down.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In calculate_deco_information we compute the ppo2 so we can graph it,
but if we send that ppo2 on to add_segment it will just reverse the
computation and introduce errors.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>