aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/divecartesianaxis.h
AgeCommit message (Collapse)Author
2014-07-29Make the Axis set the changed flag when a new line is setGravatar Tomaz Canabrava
This was preventing the recalculation of the ticks, making the line static when we enabled or disabled the PP graphs. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-29Change the Ruler text values when metric system changes.Gravatar Tomaz Canabrava
"ups", as I did this in Metric system I forgot to update to imperial when the user selected it. Fixes #665 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-26Speed up the grid: don't repaint when uneeded.Gravatar Tomaz Canabrava
Added a flag to only recalculate the axis when needed. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22PreferencesChanged -> settingsChanged.Gravatar Tomaz Canabrava
We used both preferencesChanged and settingsChanged in different methods and classes to mean the same thing, this adds consistency. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-28Make heartrate grid less confusingGravatar Dirk Hohndel
Having all the grid lines in the same color made things visually confusing. To clean this up a little make the heartrate lines a light gray color. Fixes #484 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-15Make it possible to hide some of the grid lines.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15New template-based-function: remove the uneeded items on a QList.Gravatar Tomaz Canabrava
This function is for non-duplication of code for different QLists, since I now have Texts and Lines, I needed to make the code in a way that it worked without dupplication. It's a pretty standard use of templates, I think that even the C guys will not be offended by it. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15Remove the class 'CartesianPlane'Gravatar Tomaz Canabrava
This class was pratically a re-do of the axis, I'll do the axis to plot the lines when it feels like it. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15Removed unused setup functionGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15Make font label scale a per axis propertyGravatar Dirk Hohndel
This way the partial pressure graph can have smaller pressure labels than all the other labels on the profile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Hide the extra axis labels on release mode, show on debug mode.Gravatar Tomaz Canabrava
The extra axis labels on the Temperature and Cylinder Pressure graphs are not wanted in release mode as they create a lot of visual clutter, but they are useful to have in debug mode since we can then better understand what went wrong. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Take the on-canvas position into account for DiveCartesianAxis::valueAt()Gravatar Dirk Hohndel
We did this right for posAtValue(), but not for the inverse. Fixes #438 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-08Remove code that was unused.Gravatar Tomaz Canabrava
Ancient code that was unused and only adding complexity to the DiveCartesianAxis. Also remove the spacing between the text and the lines of the Axis. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08Show the profile again.Gravatar Tomaz Canabrava
This patch re-enables a few items on the profile, most notably, the profile itself. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08Break everything to make it correct next time.Gravatar Tomaz Canabrava
This commit breaks the whole new profile. <3 The problem with the old code is that I was using the QStateMachine and I just got tired of it. I will implement a much-simpler state machine to do what I want instead of hitting my head on the wall to understand how that was supposed to work. This commit also adds a few helper methods to simplify the understanding of the constructor and tries to make the logic a bit better. No graphics are being show right now. :) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> 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-01-28Fix an issue added in the last commitGravatar Tomaz Canabrava
The last commit made the time and all other axis behave like the time axis. Not cool. 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-22Prepare for plotting partial pressures in the new profileGravatar Tomaz Canabrava
This patch makes the cartesian axis of the profile depth shrink and (together with it) the Profile Depth and the grid lines. There will probabla bey a lot of things that didn't have their correct position fixed, so I'll fix them in the later commits. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19Make the colors of the texts be prettier.Gravatar Tomaz Canabrava
Just fixes some colors of the texts on the canvas. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19Remove the ticks on the Axis, we never used them on the old profile.Gravatar Tomaz Canabrava
This patch just cleans a bit the Cartesian Axis, we never used ticks on it, just the grid lines ( that I need to animate a bit. ) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-19Fix the positioning of the Labels using the new DiveTextItemGravatar Tomaz Canabrava
This uses a combination of items on the canvas which makes it easier to position it where I want. This also broke the other texts because I forgot about them. I will fix that on the next commit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17Made the Axis be aware of Direction.Gravatar Tomaz Canabrava
Now we can create an axis that's topToBottom, BottomToTop, LeftToRight and RightToLeft. This was needed for the Temperature Plot, because it should be inverted (starting on the bottom). 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-17Started the code for a grid that knows how to handle itself.Gravatar Tomaz Canabrava
The code for this item is a bit too big to be just the grid of the dives and I know that, don't bully me. :) The main idea of this grid is that it knows when it should be updated. this is a bit different than the old code where all the painting happened on the same method. This is bad because it's more code, but it's better because if I break the grid, only the grid will be broken, and it's easyer to spot the breakage. in the old code if I did the wrong thing with the graphics context, the whole graph gots messed out. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Create a Time Axis that knows how to plot the minutes.Gravatar Tomaz Canabrava
Created a Time Axis based on the CartesianAxis that knows how to plot the minutes. This is needed because the CartesianAxis donesn't knows about minutes at all, and would plot the seconds instead. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Added a 'Depth' Axis that knows how to add its strings on screen.Gravatar Tomaz Canabrava
The CartesianAxis used a simple method to put things on screen which is wrong for almost any case besides the 'current value here' since we store things in milimeters on the axis, we need to convert those to meters before showing on the profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Cartesian Axis, based on the Ruler class on the Dive Planner.Gravatar Tomaz Canabrava
This is the same class as the Ruler, but uses the DiveLineItem and DiveTextItem classes created to make it animateable. The next few commits will work on that part. The Ruler was a very bad name for a class that's actually an Axis, that's why I depreceated the later. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>