aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/diveprofileitem.h
AgeCommit message (Collapse)Author
2014-04-10Feature to show or hide heart rate graphGravatar Lakshman
Adds new push button "HR" to the button bar on the dive profile to toggle display of heart rate. TODO: New icon for the heart rate button is needed. Fixes #485 Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15Bugfix: generalize pp graphs to allow for multi over-threshold periodsGravatar Jan Mulder
Especially in O2 decompression parts of a dive, the pp02 is typically very close to the threshold value (normally 1.60 bar). The old implementation of the pp profile graphs assumes that there is exacty 1 consecutive set of samples that needs to be in the "warning color". This results in an erroneous display of the mentioned graphs, connecting multiple episodes of too high pp with bogus lines in between. This fix generalizes the pp graph logic to allow for multiple segments of high pp, each to been drawn seperately in the "warning color". Signed-off-by: Jan Mulder <jlmulder@planet.nl> 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-17Make part of the context menu work (gas change event)Gravatar Tomaz Canabrava
The code of the context menu and the gas change event callback is mostly the same as the old profile, with minimum modifications, as this changes the order of the code on the callback to make it a bit saner (declare variables first, call code later). This also fixes a bug on the model that was not cleaning itself in the correct way after a call to clear. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Make the mean depth line follow the size of the axis.Gravatar Tomaz Canabrava
When we move, shrink or expand the depth axis, the meandepth should also change it's position. this patch adds that. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> 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-11Clean up include filesGravatar Dirk Hohndel
They should have a newline at the end. Forward declarations of classes should be 'class'. Function / method definitions don't end on a ';' Remove obsolete QStateMachine forward reference. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Clear the data when the model resets.Gravatar Tomaz Canabrava
This patch does a few things: 1 - reset the model when user closes the dive file 2 - connects the 'rowsAboutToBeRemoved' in a way that the graphics can remove their polygons too 3 - adds a 'clear' virtual method so items that don't follow the rules can clean themseves up. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09diveprofileitem.cpp improvementsGravatar Boris Barbulovski
* Initialize/construct all variable members in constructor list. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-05Optimizations and fixes on the new profile.Gravatar Tomaz Canabrava
This patch optimizes a few items when hitting the 'save preferences' dialog, since when a preference is modified, all the items try to reload their visual based on wether a preference changed or not, the correct code for 'hey, my pref changed, let's update' needed to be done. now the axis will only set a new maximum if it's different from the old one ( and thus, going to a new dive with the same maxdepth or maxtime as the old one will not touch their axis, not triggering gratuitous animations. ) also, the 'incr by 3m' was not being called - it seems that our 'syncsettings' method is not storing things on the 'prefs' global var. I added just for the incr by 3m case, but it's something that we need to check later. 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-29Show gradient factor.Gravatar Tomaz Canabrava
The gradient factor is shown with this patch, but the correct position should still be adjusted. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-29Make the calculated ceiling be preferences awareGravatar Tomaz Canabrava
This patch only adds preference-awareness for the ceiling. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-27Add settings awareness for the PP graphGravatar Tomaz Canabrava
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>
2014-01-23Added the first Partial Gas Pressure: PN2Gravatar Tomaz Canabrava
This makes the beginning of the partial gas pressures, there's two more. but this code uses a good part of the Model View system, and it's way clearer than the old one. Luckly the other 2 missing items will be even more clear ( the diffs ) to do, because I just need to create a new PartialPressureGasItem and set the properties. <3 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-22Make the tissues be preferences-aware.Gravatar Tomaz Canabrava
This patch adds a new class DiveCalculatedTissue that's preferences aware. It knows when to show or hide itself. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-22Add a MeanDepthItem that has 2 strings.Gravatar Tomaz Canabrava
Dirk's implementation of the MeanDepth item was correct, but in order to add the 2 strings to it ( one at the begin, one at the end ) I had to put more stuff inside the ProfileWidget that's already packed with graphics items. So I created a new class MeanDepthItem that contains these 2 strings and will get updated whenever the value changes. I also fixed a math inconsistency where I changed RIGHT to LEFT. (wich fixed a few text-placements, and broke others.) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-21Better use of the preferences changed signal.Gravatar Tomaz Canabrava
When the preferences changed signal is fired, the items that can change their visual based on the preferences now have to reimplement the preferencesChanged method, so they know if they need to be replotted on screen. I already implemented that for two of the items ( ProfileDepth and Ceiling ) but others might need that too. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-21Draw the Ceiling in red if preferences are marked for that.Gravatar Tomaz Canabrava
This code actually uses the preferences for something. It will show and hide the calculated ceiling in red if the prefrerences are changed for that. One bad thing that I did in this commit ( so it was easy to try ) is that a preference change will redraw the whole graph - not optimized. I'll make this better in a later commit so that only the affected items will be redrawn. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-21Add the DiveCalculatedCeiling item.Gravatar Tomaz Canabrava
This item plots the DiveCalculatedCeiling over the profile. I still need to add the Calc All Tissues version. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-21Plot gas value function ported to the new canvas.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-21Add the gas presssure profile texts.Gravatar Tomaz Canabrava
This just adds the texts for the gas profile. I've also added a method on the dataModel() to return the diveId of the last used dive in a way that the other methods can use it. This code is almost 1-to-1 with the old one, a bit of thinkering can be used to merge this loop with the upper one. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-21Add the depth text.Gravatar Tomaz Canabrava
Depth text got added to the new profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19Fixed Temperature TextGravatar Tomaz Canabrava
This fixes temperature text replacing the old code with the new DiveTextItem. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Plot the Temperature Text.Gravatar Tomaz Canabrava
I Moved the 'plot text' method of the Old Graphics to the new layout - this one was mostly unchanged as it was already good as is. And used the TemperatureProfileItem to also display texts. This was the first implementation of the new system that uses *less* code than the original one, wich makes me happy. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Add the gas pressure plot.Gravatar Tomaz Canabrava
Added the Gas Pressure Graph with the related Model Changes to access the cylinder index, pressure, interpolated pressure and SAC. The plot does not correctly plot its color right now but it's not hard to do. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Add Information about the Pressure to the Model.Gravatar Tomaz Canabrava
Added missing information about the pressure to the model; this shows that I didn't do something right, as the model has 0 pressure information. Need to fix that on the next commit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Added the Temperature Graph.Gravatar Tomaz Canabrava
Added the Temperature Graph with its related classes. A Temperature Axis is also created so the item is plotted on the right place. Currently the Temperature Axis is just like the depth axis - top is zero, wich means that the graph is inverted. Also, the Temperature axis is being displayed as this helps debugging. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Transform the DiveProfileItem to an Abstract GeneralizationGravatar Tomaz Canabrava
The DiveProfileItem contained much of the complexity and algorithms for almost all line-based items on the canvas, so I transformed that to a general abstraction and implemented a new DiveProfileItem that uses it. this should reduce a bit of code since the implementation of the PP Graphs, Temperature Cylinder Pressure and maybe a few others will only need to reimplement the paint() and the modelDataChanged() methods. The rest is ready. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Added the DiveProfileItem that uses the DiveProfileModel to diplay data.Gravatar Tomaz Canabrava
I've used the paint() method on it ( even if it's not necessary on a QGraphicsView ) to reduce absurdely the number of items that are inserted on the QGraphicsScene ( each small line of the profile should be an item if it was not for this, it's like that on the old profile. ) and thus reducing the memory consumption, speed and so on. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>