summaryrefslogtreecommitdiffstats
path: root/profile.h
AgeCommit message (Collapse)Author
2014-05-22Gratuitous whitespace changesGravatar Dirk Hohndel
I keep trying to get to consistenct. Completely hopeless. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07Remove a Lot of Dead Code.Gravatar Tomaz Canabrava
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>
2014-02-27Massive automated whitespace cleanupGravatar Dirk Hohndel
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>
2014-02-23New profile: create new class for DiveHeartrateItemGravatar Dirk Hohndel
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>
2014-02-11Put include guard to every headerGravatar Boris Barbulovski
* 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>
2014-02-10Use 'struct membuffer' for profile info string generationGravatar Linus Torvalds
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>
2014-02-10Add support for heartrate and bearing information in samplesGravatar Linus Torvalds
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>
2014-02-06Adapt the ToolTip to work on the new profileGravatar Tomaz Canabrava
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>
2014-02-05Created a method to check if calculations should take place.Gravatar Tomaz Canabrava
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>
2014-01-17Create a version of create_graph_info that doesn't depend on GC.Gravatar Tomaz Canabrava
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>
2014-01-16Reworked the calculate_max_limits and plotted the dive.Gravatar Tomaz Canabrava
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>
2014-01-16Added a Model that should handle the Dive ProfileGravatar Tomaz Canabrava
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>
2014-01-08Reinstating SURFACE_THRESHOLD test in pressure_time functionGravatar Rodrigo Severo
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>
2014-01-08Discontinuity and stall on tank pressure interpolated linesGravatar Rodrigo Severo
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>
2013-12-03Disable calc_ndl_tts for printGravatar Anton Lundin
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>
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-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-15profile.h: Adjust text sizes (*_TEXT_SIZE)Gravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-07Minor include file unwindingGravatar Dirk Hohndel
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-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-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-28Fix the positioning of text in the dive profileGravatar Dirk Hohndel
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>
2013-05-10Fix some compiler warningsGravatar Dirk Hohndel
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>
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 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>
2013-05-06Avoid redefinition of typedef ‘bool’Gravatar Henrik Brautaset Aronsen
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>
2013-05-04Plot of the Mean DephGravatar Tomaz Canabrava
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>
2013-05-04Start plotting something.Gravatar Tomaz Canabrava
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>
2013-05-04Moved the plot from the cairo version to the Qt versionGravatar Tomaz Canabrava
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>