Commit graph

55 commits

Author SHA1 Message Date
Tomaz Canabrava
d2569c6688 Remove a ton of code.
The code removed was already ported to the New Profile.
We managed to clean quite a bit. huhhy

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:36:44 -07:00
Tomaz Canabrava
f67693b2e0 Make mouse dragging work as it should.
This patch makes mouse dragging work as it should, a tiny
bit different than the old version, but I think it's a better
way. What's missing: Keyboard actions.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:32:23 -07:00
Tomaz Canabrava
ea4d4ac020 Make the planner actually work.
This commit makes the planner actually work. There ar still
a few edges, but oh, joy - the new Profile gave a very unexpected
and nice addition to it - Grab the last handler of the initial
dive, and move it to the right, or get any handler, and move it
to the bottom to see what I mean.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-24 07:28:39 -07:00
Dirk Hohndel
5ba573240f Gratuitous whitespace changes
I keep trying to get to consistenct.
Completely hopeless.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 11:40:22 -07:00
Tomaz Canabrava
f99ccc8ac2 Profile now correctly displays the planned dive.
But it doesn't move the handlers yet, and when you confirm it you also
must click on the dive to select it or the profile will show garbage.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 14:41:26 +09:00
Tomaz Canabrava
e249fe8703 Disconnect temporary connections on the Profile.
This code adds the disconnections of temporaries. A temporary connection
is a connection that should be active only on a certain state, and we need
to clean that for the new state that will enter after.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 14:31:37 +09:00
Tomaz Canabrava
27afb33806 Move two necessary functions for the Planner behavior to the Profile code.
Those two functions are important and necessary for the Planner, they
create and remove the little balls that act as handlers so the profile
can be edited with the mouse.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 14:28:54 +09:00
Tomaz Canabrava
3661f291a4 Enable editing the 'Add dive' from the new profile.
This is highly broken in many ways - but it's the right first step.
I ported two of the most important methods from the old profile and now if
you are in add dive mode, double clicking on the new profile will
correctly add a handler on the planned dive. To see and move the handler
around, however, you need to activate the old planner.

Next step: add the handlers on the new profile.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 09:11:50 +09:00
Tomaz Canabrava
119950b6db Move settings of the Ruler to the Ruler.
As with any other graphics object, the settings for the ruler
should be managed by the ruler, clearing up the Profile logic
and making the code easier to read.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-22 09:05:30 +09:00
Dirk Hohndel
a117428ff4 Add ability to make a dive computer the first dive computer of a dive
If a dive has multiple dive computers we enable a special context menu
when the user right-clicks on the dive computer name AND is not already
showing the first dive computer. In that case we offer to make the
currently shown dive computer the first one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-19 20:12:59 +09:00
Yosef Hamza
0f5664e584 Edit name option for bookmarks
Add the option to edit the name of a bookmark to be more meaningful for
the user they prefer.
It works just as simple bookmarks and can be removed and hidden.
It won't accept names longer than 22 characters because longer names will
display as garbage text.
Also changed the code from displaying flag depending on event name to
depending on event type.

Signed-off-by: Yousef Hamza <jo.adama.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-03 12:49:22 -07:00
Lubomir I. Ivanov
06a1cb0975 Profile2: add some print related flags
Some flags like printMode and isGrayscale are missing yet needed.
The flag printMode is required so that we know *when* to hide
certain elements such as the ruler and tool tip (e.g. not needed
while printing).

isGrayscale should be passed to all getColor() calls, so that
the greyscale color table is respected.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-27 10:58:22 -07:00
Dirk Hohndel
401aa210ff New profile: add event manipulation to context menu
This got lost when we switched to the new profile.
Remove event works. Hide events does call hide() on the DiveEventItem but
for some reason it stays visible. I'll hope for one of the more
experienced Qt people to fix that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-15 21:12:34 -07:00
Lubomir I. Ivanov
41cec17cff Profile2: reset the zoom level when a new profile is drawn
If the user has zoomed in but then changes to a new dive,
we may want to reset the scale back to the original value (1.0)
based on the current zoomLevel, so that the profile is not stuck
in zoomed mode.

This patch adds a snippet that resets the QGraphicsView scale,
zoomLevel variable and also the toolTip position.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 09:02:31 -07:00
Lubomir I. Ivanov
324b8cbff1 Profile2: use a different image when no profile is visible
This patch adds a new image resource named poster.png which,
is shown instead of the 3 posters. The main reason for that
is due to the poster text not being visible. This new image
is pretty much the Subsurface logo only.

It also removes the grid lines, while the poster is visible.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 09:02:25 -07:00
Tomaz Canabrava
24c5b2e3c1 Code Cleanup ( that fix 2 bugs )
This code cleanup fixes the two issues that I raised on
my last e-mail. hurrah.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-09 08:50:54 -07:00
Tomaz Canabrava
ac9a23ef3b Remove the old profile from the main screen of Subsurface
This patch partially removes the code for the old profile from
Subsurface. It removes the use of the old profile on the mainwindow,
but keeping the code in the tree for now.

A bit of code-cleanup also entered this commit because I had to change
every instance of the code that used the old profile.

Now to the real code-cleanup

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-07 08:54:20 -08: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
35e102b176 New profile: add the RulerItem
This patch adds the RulerItem inside of the new profile, and already takes
settings into consideration.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00
Tomaz Canabrava
1695894130 New profile: connect the scale action
Just quick'n dirty glue code so that when the user clicks on the 'scale'
toolbar item, the new profile graphic is scaled.

Lovely thing: Animations for free. <3

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 10:48:47 -08:00
Dirk Hohndel
b5a02e50aa New profile: create new class for DiveHeartrateItem
This allows us to give it a different color (red) and make it a smaller
size.

While implementing this I also fixed the size of the temperature text in
the new profile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-23 15:28:31 -08:00
Dirk Hohndel
fd1a62568b New profile: partial addition of heartrate
This was done during an IRC hacking session with Tomaz.
It compiles, it shows something but not the right graph.
Committed here so Tomaz and I can continue to work on it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-19 17:19:57 -08:00
Tomaz Canabrava
31ee4dac65 Make part of the context menu work (gas change event)
The code of the context menu and the gas change event callback is mostly
the same as the old profile, with minimum modifications, as this changes
the order of the code on the callback to make it a bit saner (declare
variables first, call code later).

This also fixes a bug on the model that was not cleaning itself in the
correct way after a call to clear.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-17 14:50:14 -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
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
Dirk Hohndel
d49acdb3c0 Clean up include files
They should have a newline at the end.
Forward declarations of classes should be 'class'.
Function / method definitions don't end on a ';'
Remove obsolete QStateMachine forward reference.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11 12:34:34 -08:00
Boris Barbulovski
1d871eb749 ProfileWidget2 class improvements
* Reorder ProfileWidget2 class constructor initialize list.
* Initialize(lazy) ProfileWidget2::plotInfo structure.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Tomaz Canabrava
d66e4b5236 Fix the 'Empty' profile state that was broken for ages.
Show a nice poster that Luisa did for Subsurface ( we have a few other
options that I'm waiting her to send. )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:18:40 -08:00
Tomaz Canabrava
86bc3bd58f Start to make things sane again...
Change the 'namespace ItemPos' declared on the commit before this one to a
struct that will have all the 'on canvas' and 'off canvas' positions and
representations of all items, so we know where to change.

Also remove the remaining stuff from planer that was going to exist on
this profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:18:12 -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
6de9b329d1 Huge code cleanup.
This patch starts the cleanup that will take a few iterations to finish.
The current profile code uses QStateMachine, and it's much too verbose
for something we can do with less than a third of its lines of code.

I also added on the beginning of the redesign of the profile code for
planner, edit and a few other things that are going to be ported to
the new profile in the future, but not currently - I just lack the time
to make that work for the next release.

This commit basically:
 - moves all 'new' calls to the initializer-list
 - create a new 'setupItem' private method to concentrate the calls
   that any item will do

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-08 07:14:50 -08:00
Tomaz Canabrava
49f8456ce8 Remove a lot of unused code.
This will probably be added back in the future, but for now
they have no use and it was making me nauseaus.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 11:32:32 -08:00
Tomaz Canabrava
2a9289ac99 Add an event filter to hide normal tooltips
This patch adds an event filter to hide normal tooltips on the new
profile. All tooltips should be displayed in the Notification Area.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 06:31:55 -08:00
Tomaz Canabrava
19585d9a13 Add the tooltip item to the new profile.
The functionality is not there yet - just the item hovering
the screen.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-06 06:28:21 -08:00
Tomaz Canabrava
a649bcc7bc Added Mouse based Zoom / Movement.
This patch uses the same code that lubomir used on the
old profile. It strangely didn't worked - most probably
because the scene has a fixed width() and height() of
100. the zoom works, and the movement works, but only
on the 100 first pixels of the profile.

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
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
b5e8ef160a Added the Po2 Partial Pressure Graph.
Important to note that no Partial Pressure Graph handles
settings yet.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-23 21:11:15 -08:00
Tomaz Canabrava
1cae362c16 Added the code for the PHE gas pressure.
Using the PartialPressureGasItem the addition of a new partial plot
is very easy.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-23 21:11:15 -08:00
Tomaz Canabrava
caa45a1539 Added the first Partial Gas Pressure: PN2
This makes the beginning of the partial gas pressures, there's
two more. but this code uses a good part of the Model View system,
and it's way clearer than the old one. Luckly the other 2
missing items will be even more clear ( the diffs ) to do,
because I just need to create a new PartialPressureGasItem and
set the properties. <3

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-23 21:11:15 -08:00
Tomaz Canabrava
cde9bc0de9 Make the tissues be preferences-aware.
This patch adds a new class DiveCalculatedTissue that's preferences aware.
It knows when to show or hide itself.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-22 13:28:25 -08:00
Tomaz Canabrava
2e2a87e619 Add a MeanDepthItem that has 2 strings.
Dirk's implementation of the MeanDepth item was correct, but in order to
add the 2 strings to it ( one at the begin, one at the end ) I had to put
more stuff inside the ProfileWidget that's already packed with graphics
items.

So I created a new class MeanDepthItem that contains these 2 strings and
will get updated whenever the value changes.

I also fixed a math inconsistency where I changed RIGHT to LEFT.
(wich fixed a few text-placements, and broke others.)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-22 12:29:41 -08:00
Tomaz Canabrava
b08da94007 Draw the Ceiling in red if preferences are marked for that.
This code actually uses the preferences for something. It will show and
hide the calculated ceiling in red if the prefrerences are changed for
that. One bad thing that I did in this commit ( so it was easy to try ) is
that a preference change will redraw the whole graph - not optimized. I'll
make this better in a later commit so that only the affected items will be
redrawn.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-21 14:25:09 -08:00
Tomaz Canabrava
ce7c3f8314 Add the tissues to the profile graph
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-21 11:35:24 -08:00
Tomaz Canabrava
8065374793 Add the DiveCalculatedCeiling item.
This item plots the DiveCalculatedCeiling over the profile. I still need
to add the Calc All Tissues version.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-21 11:35:09 -08:00
Tomaz Canabrava
caba6500d6 Add the dive computer text.
Added the dive computer text on the bottom left side of the new Profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-21 09:38:46 -08:00
Dirk Hohndel
3bbc4ecd0b Add mean depth to new profile
With massive hand-holding by Tomaz.
Writing for the new profile code is slightly different. You don't draw
anything, you just tell the widget where things are supposed to end up and
how they are supposed to look. Really nice.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-18 14:38:21 -08:00
Tomaz Canabrava
4ff73cf537 Add the gas pressure plot.
Added the Gas Pressure Graph with the related Model Changes
to access the cylinder index, pressure, interpolated pressure
and SAC.

The plot does not correctly plot its color right now but it's not hard to
do.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17 14:04:47 -08:00
Tomaz Canabrava
e3ec5ef290 Added the Cylinder Pressure Axis
The cylinder pressure axis is the 'Y' axis for the Cylinder plot.
I positioned it in around 20% to 60% of the screen state.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17 14:04:47 -08: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
1f80788286 Added a DiveEventItem that knows how to handle itself.
Simply pass a event to the item and it will know what
to do. The sad part is that this isn't true yet - there's
quite a bit of boilerplate that a lot of the items are needing,
but the good part is that the boolerplate is the same in
all of the items, which means that I can create a tiny bit
of abstraction to encapsulate it and the code will be
way smaller to setup the items on the canvas.

Right now the items are being correctly placed on the
right places. It doesn't supports hidding / showing yet.

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