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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
When we prepare the axis to show something on the Profile
we need to add the remaining ticks to show on screen,
Since this method tries to animately move / remove things
before calling this.
This has no animations yet - will have in the future.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>