aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/divecartesianaxis.cpp
AgeCommit message (Collapse)Author
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-04-16Renaming the prefs struct members to be consistent with the QSettings.Gravatar Gehad Elrobey
-Renaming prefs members for consistency. -Changing references of QSettings to the prefs structure instead. -Removing unused functions in pref.h were left over from an old version. -Changing the data-type of bool members to short for consistency with other members. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10Profile2: fix some initializer list order warningsGravatar Lubomir I. Ivanov
Such can be disabled with -Wno-reorder and are clearly more of a nuisance, but C++98 12.6.2.5 says the order should be the same as in the class declaration. On theory this would only speed the compile times a tiny amount. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03Whitespace cleanupGravatar Dirk Hohndel
Minor change to the perl postprocessing script and resulting changes to the affected source files. This deals with two issues: - "foreach"-like structures were not always treated correctly - some longer calculations that ended on "+ constant" were reformatted in a rather unatractive manner In one source file (divelist.c) I ended up adding braces to the sources... trying to cascade the indentation further down without having the block there seemed a lot more trouble than it's worth. 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-17Missing initializerGravatar Dirk Hohndel
This was causing us to access uninitialized memory at times. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-16Clean up some warningsGravatar Dirk Hohndel
Unused variables, more initialization order complaints. 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-15Better setup of the defaults for the grid.Gravatar Tomaz Canabrava
This patch creates better defaults for the grid lines, size, position and z-level. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15Create the grids.Gravatar Tomaz Canabrava
Create the grids, and the way that they move is fabulous <3 Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15Change the axis update method to move the lines.Gravatar Tomaz Canabrava
Change the axis update method to move the lines alongside the texts. 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-15If the depth is zero, dont show it.Gravatar Tomaz Canabrava
The first depth label of its axis is always zero, do not show 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-15New Profile: make axis labels smallerGravatar Dirk Hohndel
Previously all text in the new profile was deawn in the same font. With this change the labels on all axes are smaller. It might be even better to allow per-axis configuration of the label size as along the time axis the bigger size looked better. But especially for partial pressures this looks much better. 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-11Use our macro for FP comparisonsGravatar Dirk Hohndel
I think that catches all the ones we missed (thanks clang -Wfloat-equal). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Fix bug in logic expressionGravatar Dirk Hohndel
Yes, the old code made perfect sense when you read it - except the C++ compiler turned it into something quite different from what was intended. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Do not add the items to the scene twice.Gravatar Tomaz Canabrava
Those items have parent(), which means that when the parent has a scene, they are automatically added and removed from the scene. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Fixed item visibility on emptyState after being on profileState.Gravatar Tomaz Canabrava
Background was not correctly back to it's original position and a few other items kept their visibility when it shouldn't. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09Initialize variable members in DiveCartesianAxis class.Gravatar Boris Barbulovski
* Initialize variable members in DiveCartesianAxis class. Note: Initialized values I put needs to be doublechecked. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08Re-enable more items on the new profile.Gravatar Tomaz Canabrava
Temperature and DC Label. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08Partial pressures and cylinder pressure back on profile.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> 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-08Fix time and half of depth lines.Gravatar Tomaz Canabrava
Comment out most of the items on the profile since they are currently completely broken ( positioning, etc ). Also, remove the settingsChanged stuff from the DepthAxis because it doesn't have the shrinked / expanded size on it ( it sits on the profile code ) so I'll most probably move that to the profile settingsChanged in the future - or if anyone knows of a better place to have this, I'm all ears. 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-05Fix DepthAxis when partial pressures aren't used.Gravatar Michael Andreen
Set showWithPPGraph so that animateChangeLine() is always called the first time settingsChanged() is called. Signed-off-by: Michael Andreen <harv@ruin.nu> 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-29Fix positioning of many text items.Gravatar Tomaz Canabrava
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-28Use the same behavior as the old time markersGravatar Tomaz Canabrava
This commit adds the same behavior for the old time markers on the new ones. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-28Do not create label if string is empty.Gravatar Tomaz Canabrava
Do not create a text label if the returned string is empty. Also, fixed a potential crash after not creating a label and adding it to the list of created labels. 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-25Fix potential crash at startupGravatar Dirk Hohndel
Strangely enough, on the system I build this, I don't see the crash. But when I create a DMG and run it on a different Mac, it crashes if updateTicks() is called but scene() still returns 0. 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-21Prevent potential math overflow in new profileGravatar Robert C. Helling
Test for max_temp == min_temp to prevent math overflow when calculating temperature axis in new profile Signed-off-by: Robert C. Helling <helling@atdotde.de> 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-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-17Fix compile time warningsGravatar Dirk Hohndel
Plus some small whitespace fixes. 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-16Get rid of build warningsGravatar Dirk Hohndel
This is just to make it more obvious when new issues get introduced. The build should always be free of warnings... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16Whitespace and coding style updatesGravatar Dirk Hohndel
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>