Commit graph

20 commits

Author SHA1 Message Date
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
6f5974f3e8 Use the same methods as the old profile to discover the boundaries.
This method gathers information about the max and minimum sizes of
the cartesian axis that we should plot. It's still a bit cumberstone
for my taste, but this shouldn't be a problem. I think we need to
rework the 'Zoomed' version of it, since zoom or without zoom,
we should be good to go using the QGraphicsView.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17 06:16:07 +07:00
Dirk Hohndel
2e08f75618 Get rid of build warnings
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-16 12:44:18 +07:00
Dirk Hohndel
49a4a11a44 Fix compile error when not building with CONFIG+=debug
There are still some warnings left, but at least it compiles now.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 12:28:33 +07:00
Dirk Hohndel
a27f67c026 Whitespace and coding style updates
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>
2014-01-16 11:50:56 +07:00
Tomaz Canabrava
dd64f1792d Reworked the calculate_max_limits and plotted the dive.
Created a new version of calculate_max_limits that doesn't have a
graphics_context and returns a plot_info. The code is basically the same
as the old calculate_max_limits, so there's not much to talk about.

The rest of the code is just boilerplate to plug the Profile
code with the axis and model stuff, to be plotted on screen.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 10:12:31 +07:00
Tomaz Canabrava
52064d9e02 Added debug code to help understand the Profile
This commit adds a QTableView if built in debug mode. This is very userful
to understand the Profile that will be drawn by the graphics classes and
fix the possible errors.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 10:12:31 +07:00
Tomaz Canabrava
7affccdf5b Importantly, I had forgotten to start the state machine
The state machine needs to be started before it works; now the animations
are working. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 10:12:31 +07:00
Tomaz Canabrava
7ba4fe885e Added names to the states, so it's easier to debug.
There's a Qt visual debug / helper tool made by KDAB named GammaRay that
uses QObject instrospection to understand what's happening on a QProject.
This tool uses the Object Name to display the items on a list, so I've
added the QState's names to their objects, which greatly helps debugging
with Gamma Ray the states of the StateMachine.

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
6f7967e0e0 Added a Context menu so we can test the state switching.
The context menu added here should only be temporary, it's an easy and
simple way to test the transitions of the items on screen.
They seem a bit broken atm, I'll try to fix that. :)

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
c301367259 Added the Animations for the transitions of the States.
This code creates the animations that will be triggered when an state
changes. Things like hiding items and such should be handled this way.

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
74cb7d6b2a Aparrently there's no need for a showEvent here.
Just removed some code that I tougth to use, but it looks
like it's just a waste of lines.

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
ff49cb1929 Fix the size of the scene on screen and Background improvements.
It seems that I forgot to add the background pixmap, but this is being
done right now by luisa. This patch fixes the size of the scene by
scaling everything to the size of the viewport as soon as a resize is
done, and it also fixes the size of the - to be included - background
pixmap.

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
816f6db356 Added all the state transitions for each state.
This code adds all state transitions for the items on screen; they do not
animate yet, but already move to the correct location (the location seems
wrong on the screen, because I'v not correctly zoomed out the canvas yet).

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
0703706600 Added Constants to the code, to ease the setup of the transitions.
Those constants will be used later on to setup all transitions of
the Graphics Items on the canvas. They are the correct positions
of each item inside and outside of the scene, in a way that the
state machine can animate them smootly.

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
02e3021333 Started the work on the States for the Profile.
This is a start of the work on the States for the Profile.  All setup is
done, all connections are done.  Maybe there's something missing because I
never worked with QStateMachine before, but it seems to work correctly.

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
cdb447434d Added the flag to ignore item transformations on the background.
The background should be a Pixmap and thus it cannot zoom in or
out; this keeps it the same size always, the full height of the
scene.

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
93d464fcb7 Setup the default icon sizes and locations.
Setup the default item sizes and locations inside of the QGraphicsScene.
Also added every item to the scene so that it's correctly displayed on
screen.

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
b50ae87007 Initializing the new Profile Class.
Beginning of the code for the constructor, just constructing
some of the items and preparing for the State Machine to come.

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
946e3855b2 Add the skeleton for the New Profile System.
The idea of this widget is to display and edit the profile.

It has:
 1 - ToolTip / Legend item, displays every information of the current
     mouse position on it, plus the legend for the maps.
 2 - ToolBox, displays the QActions that are used to do special stuff
     on the profile ( like activating the plugins. )
 3 - Cartesian Axis for depth ( y )
 4 - Cartesian Axis for Gases ( y )
 5 - Cartesian Axis for Time  ( x )

It needs to be dynamic, things should *flow* on it, not just appear / disappear.
It's the last attempt to create a QGraphicsView based Profile System,
as the next will most probably be written in QML.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 09:45:42 +07:00