Commit graph

30 commits

Author SHA1 Message Date
Tomaz Canabrava
f0f8b91c00 Make the Axis set the changed flag when a new line is set
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-29 15:33:00 -07:00
Tomaz Canabrava
078332bae1 Change the Ruler text values when metric system changes.
"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-07-29 13:06:19 -07:00
Tomaz Canabrava
4c9dd0e698 Speed up the grid: don't repaint when uneeded.
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-26 14:07:48 -07:00
Tomaz Canabrava
6aab69b298 PreferencesChanged -> settingsChanged.
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-05-22 09:03:51 +09:00
Dirk Hohndel
2d24779b62 Make heartrate grid less confusing
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-28 12:45:42 -07:00
Dirk Hohndel
76e6420f6b Massive automated whitespace cleanup
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-27 20:09:57 -08:00
Tomaz Canabrava
44a72b805c Make it possible to hide some of the grid lines.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 17:30:25 -08:00
Tomaz Canabrava
0c5fd7db8e New template-based-function: remove the uneeded items on a QList.
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-15 17:16:15 -08:00
Tomaz Canabrava
fc55b2abfe Remove the class 'CartesianPlane'
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-15 17:16:02 -08:00
Dirk Hohndel
191a3064a7 Removed unused setup function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 11:17:23 -08:00
Dirk Hohndel
6be62c1d90 Make font label scale a per axis property
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-15 11:15:57 -08:00
Tomaz Canabrava
0333de426f Hide the extra axis labels on release mode, show on debug mode.
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-12 10:31:24 -08:00
Dirk Hohndel
92bbed3304 Take the on-canvas position into account for DiveCartesianAxis::valueAt()
We did this right for posAtValue(), but not for the inverse.

Fixes #438

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:37:09 -08:00
Boris Barbulovski
ccb1c33d02 Put include guard to every header
* 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-11 12:37:01 -08:00
Tomaz Canabrava
7fbeb71dce Remove code that was unused.
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-08 07:21:28 -08:00
Tomaz Canabrava
0ad2a69c42 Show the profile again.
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-08 07:21:13 -08:00
Tomaz Canabrava
9cf6b2be6b Break everything to make it correct next time.
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-08 07:16:16 -08:00
Tomaz Canabrava
7b9400685d Optimizations and fixes on the new profile.
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-05 06:30:33 -08:00
Tomaz Canabrava
607bf47989 Fix an issue added in the last commit
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-28 11:31:40 -08:00
Tomaz Canabrava
c99089e1fa Add settings awareness for the PP graph
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-27 09:15:28 -08:00
Tomaz Canabrava
bc7b221498 Prepare for plotting partial pressures in the new profile
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-22 12:35:52 -08:00
Tomaz Canabrava
edad8712b9 Make the colors of the texts be prettier.
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-19 21:38:10 -08:00
Tomaz Canabrava
cd3867d46a Remove the ticks on the Axis, we never used them on the old profile.
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-19 21:37:48 -08:00
Tomaz Canabrava
9d2344d01b Fix the positioning of the Labels using the new DiveTextItem
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-19 21:36:55 -08:00
Tomaz Canabrava
f9784d876e Made the Axis be aware of Direction.
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-17 06:18:56 +07:00
Tomaz Canabrava
58aeb6ce40 Added the Temperature Graph.
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-17 06:18:25 +07:00
Tomaz Canabrava
9cb5ea45d8 Started the code for a grid that knows how to handle itself.
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-17 06:16:47 +07:00
Tomaz Canabrava
8773b4f9f0 Create a Time Axis that knows how to plot the minutes.
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-16 10:12:30 +07:00
Tomaz Canabrava
67f2c0bcaa Added a 'Depth' Axis that knows how to add its strings on screen.
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-16 10:12:30 +07:00
Tomaz Canabrava
49f4052c67 Cartesian Axis, based on the Ruler class on the Dive Planner.
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>
2014-01-16 10:12:29 +07:00