summaryrefslogtreecommitdiffstats
path: root/profile.c
AgeCommit message (Collapse)Author
2013-11-20Don't interpolate gas consumption when at surfaceGravatar Anton Lundin
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>
2013-11-20Use get_cylinder_index in per_cylinder_mean_depthGravatar Anton Lundin
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>
2013-11-15Make the info box look as it did in 3.1Gravatar Anton Lundin
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>
2013-11-14Remove duplicated SAC data from information overlayGravatar Anton Lundin
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>
2013-11-14Break calculated deco info to separate varsGravatar Anton Lundin
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>
2013-11-13Break up calculate_deco_informationGravatar Anton Lundin
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>
2013-11-13Reorder info in information windowGravatar Anton Lundin
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>
2013-11-13Remove the special handling of ndl < 3mGravatar Anton Lundin
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>
2013-11-13Introduce an on/off switch for calculating ndl/ttsGravatar Anton Lundin
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>
2013-11-13Fill up plot_data with temperature all the wayGravatar Anton Lundin
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>
2013-10-20Use configured vertical speed units in rulerGravatar Anton Lundin
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>
2013-10-17Show SAC in the mouseover.Gravatar Anton Lundin
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>
2013-10-17Move sac-calculation to profile.cGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17Rename T: to Temp: in Information boxGravatar Anton Lundin
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>
2013-10-14Only calculate decompression if the user turned the preference onGravatar Dirk Hohndel
There's no point in wasting the cycles otherwise. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-11Remove some arguments, that we find in plot_dataGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-09Next step towards working translationsGravatar Dirk Hohndel
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>
2013-10-09Disable unused functionGravatar Dirk Hohndel
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>
2013-10-07Remove even more code and declarationsGravatar Dirk Hohndel
There's lots more stuff that can go. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06Make Windows cross compile againGravatar Dirk Hohndel
But this is broken as the utf8/utf16 conversions in windows.c are gone without glib. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06Remove lots of ifdef'ed out code from GTK/glib versionGravatar Dirk Hohndel
There's still a ton more left, but this is a start. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06Trying to switch to Qt translationGravatar Dirk Hohndel
This compiles and looks about right, but it doesn't appear to work, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-06First steps towards removing glib dependenciesGravatar Dirk Hohndel
- 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>
2013-10-04Added configuration options for vertical speed units.Gravatar Patrick Valsecchi
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>
2013-10-03Fix unitialized variable useGravatar Patrick Valsecchi
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>
2013-10-01Ascending/descending speeds are usually expressed in x/minGravatar Patrick Valsecchi
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>
2013-09-27Added a ruler which can be dragged along the profileGravatar Maximilian Güntner
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>
2013-09-23Remove o2/he from plot_data and fix gas plot textGravatar Anton Lundin
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>
2013-09-18Show sample time in the mouseover.Gravatar Anton Lundin
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>
2013-09-18Only calculate with he when he is present in eventGravatar Anton Lundin
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>
2013-07-05Calculate deco stops, TTS and NDLGravatar Anton Lundin
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>
2013-06-21Round up times instead of downGravatar Anton Lundin
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>
2013-06-21Use the gasmix straight offGravatar Anton Lundin
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>
2013-05-31Show the gas with the pressure diagramGravatar Dirk Hohndel
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>
2013-05-31Show ceilings for individual tissuesGravatar Robert Helling
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>
2013-05-17Merge branch 'Qt'Gravatar Dirk Hohndel
After the 3.1 release it is time to shift the focus on the Qt effort - and the best way to do this is to merge the changes in the Qt branch into master. Linus was extremely nice and did a merge for me. I decided to do my own merge instead (which by accident actually based on a different version of the Qt branch) and then used his merge to double check what I was doing. I resolved a few things differently but overall what we did was very much the same (and I say this with pride since Linus is a professional git merger) Here's his merge commit message: This is a rough and tumble merge of the Qt branch into 'master', trying to sort out the conflicts as best as I could. There were two major kinds of conflicts: - the Makefile changes, in particular the split of the single Makefile into Rules.mk and Configure.mk, along with the obvious Qt build changes themselves. Those changes conflicted with some of the updates done in mainline wrt "release" targets and some helper macros ($(NAME) etc). Resolved by largely taking the Qt branch versions, and then editing in the most obvious parts of the Makefile updates from mainline. NOTE! The script/get_version shell script was made to just fail silently on not finding a git repository, which avoided having to take some particularly ugly Makefile changes. - Various random updates in mainline to support things like dive tags. The conflicts were mainly to the gtk GUI parts, which obviously looked different afterwards. I fixed things up to look like the newer code, but since the gtk files themselves are actually dead in the Qt branch, this is largely irrelevant. NOTE! This does *NOT* introduce the equivalent Qt functionality. The fields are there in the code now, but there's no Qt UI for the whole dive tag stuff etc. This seems to compile for me (although I have to force "QMAKE=qmake-qt4" on f19), and results in a Linux binary that seems to work, but it is otherwise largely untested. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-16Correctly set the unselected dive.Gravatar Tomaz Canabrava
The selected dive was being set to zero when the program started, but zero is actually the first dive. There were workarounds on the gtk code for that probably Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-16Initialize / reset selected_dive to -1Gravatar Dirk Hohndel
The value of 0 that we used is actually a valid value and could cause confusion. Suggested-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-10Tweaks to maintabGravatar Amit Chaudhuri
Align statistics tab labels as per infotab. Amend helper function to show degree symbol for temp measurements. Change order of member initialisation list to match order of decl (ProfileGraphicsView::ProfileGraphicsView) Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09Removed unused code that I'm sure it's safe to delete.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09Plot the vertical ruler on the left of the profile.Gravatar Tomaz Canabrava
Plot the numbers on the left of the profile. It seems that everythign is being plotted - But I can see that there are coordinate-errors on the code. ( the GTK one plots some curves below of the dive, but the Qt one is overlapping - probably the way that I'm using the gc information) Need to investigate a bit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09Plotting deco text.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-09Plotting cylinder pressure text.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09Plotting depth text.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09Plotting temperature text.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-09Plot of the Cylinder Pressure over time.Gravatar Tomaz Canabrava
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>
2013-05-08Stop passing around gc and piGravatar Dirk Hohndel
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>
2013-05-08Plot the temperature GraphGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06Plotting the Events doneGravatar Tomaz Canabrava
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>
2013-05-06Port the plot text method to Qt, also test it by actually plotting somethingGravatar Tomaz Canabrava
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>