Commit graph

105 commits

Author SHA1 Message Date
Tomaz Canabrava
688276b6f2 Fix moving the ToolTip box with the mouse.
When I changed the way that the tooltip box behaved,
I accidentaly 'ate' the mouseMoveEvent, it was being
used only to show tooltips instead of everything
that it should have. this simple patch fixes it.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-08 14:20:15 -07:00
Tomaz Canabrava
ef7ace9926 Plot the temperature Graph
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08 14:19:10 -07:00
Tomaz Canabrava
ce8d30b938 Make tooltips works
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-08 14:18:27 -07:00
Tomaz Canabrava
2089c124a5 Work on the tooltips - WIP.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-08 14:18:27 -07:00
Tomaz Canabrava
76e1436f68 Better design for the ToolTip Handler.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-08 14:18:27 -07:00
Amit Chaudhuri
b5d5b05140 Fix crash on right click dive trip
A null pointer dereference occured after right click on a dive trip
because updateDiveInfo was called with dive == -1 causing get_dive(int)
to return null.

Wrap to avoid crash and clear dive info widget text labels.

[Dirk Hohndel: this is different from the fix I had committed earlier;
               I decided to combine the ideas, clean this one up a bit
	       more and this is the result]

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08 12:10:51 -07:00
Dirk Hohndel
661aa67e89 Avoid potential crash if no dive is selected
I missed to spots where we would unconditionally dereference the dive
pointer.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Reported-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-08 10:51:15 -07:00
Dirk Hohndel
df01a5d35f Added a bit of documentation on how to use the ToolTips & removed 2 bad-api methods
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-07 16:14:15 -07:00
Dirk Hohndel
d590cb9519 Adds real support for ToolTips.
This patch changes the Event drawing so it can display tooltips. It is now
the responsibility of the item to show / hide a tooltip.

A bit of code-refactoring got on here too because I was using only
QGraphicsItem calls and I wanted to use a hover in / hover out event
to show / hide the tooltip.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-07 16:14:15 -07:00
Tomaz Canabrava
c928b9cb94 Added the first overlay of the tooltips, with some test data.
The tooltips now can:
1 - be moved around the canvas
2 - dynamically expand / retreat when a new tooltip is added.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-07 16:14:11 -07:00
Thiago Macieira
5e4f06e6ad Enable the code that was #if 0'ed out
Linking error is fixed.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 20:56:41 -07:00
Dirk Hohndel
b75a89aa86 Start populating the maintab Dive Info widget
Establish some useful helpers and use them when updating the values.

One of the helpers (from statistics.c) puzzlingly doesn't link - so that's
ifdefed out.

Also had to re-arrange the settings reading code (it came too late) and to
extract the expanding code of the top dive from the settings reading code
(as it had no business being there to begin with).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 20:38:38 -07:00
Tomaz Canabrava
1a8239a240 Finish the plotting of the events
Beautification of the triangles done, Tooltips are also displaying
Some rework on the code - don't know if dirk will accept, I'v changed
an if-else-if-else by a ternary operator, since it improves legibility
a little bit.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 20:30:29 -07:00
Tomaz Canabrava
867435442b Plotting the Events done
There are subtle differences, the Cairo version looks
prettier - but that's fixable. I did a small triangle
and a exclamation mark on it. maybe a gradient would
make a good difference there.

this item has a ItemIgnoresTransformation tag, so
scalling, rotating or zooming will not change it's
size.

The tooltips are not yet ported.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 20:30:22 -07:00
Tomaz Canabrava
55f31dc011 Make the text ignores transformations on the scene
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-06 13:55:18 -07:00
Tomaz Canabrava
1b392b35bc Port the plot text method to Qt, also test it by actually plotting something
The plot_text function from the cairo-methods are now ported
on the qt version. this patch moves around some code since
quite defines are already used and I didn't want to reinvent
the whell.

Original code used varargs, but I prefered to change it
, so now it receives just a reference to a QString object
and the string must be constructed before sending,
using the .arg methods.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 13:55:06 -07:00
Dirk Hohndel
b3fce3497c Fill Dive Notes widget
Make sure we clear things out if no dive is selected.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 10:16:16 -07:00
Tomaz Canabrava
06eab74a72 Added the code to populate the tabs when a dive is selected.
So, this is what happens now:
Every tab should be populated from updateDiveInfo method, it will be
called whenever a new dive is selected
I'm already populating the 'notes' box to show how it can be done.
If you are unsure what's the name of anything, open the file maintab.ui on
the designer, click on the item and check its objectName, the access is
ui->objectName from here on.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 09:58:13 -07:00
Amit Chaudhuri
baee897574 Add various keyboard shortcuts.
Add shortcuts to match GTK version for view menu items and the log menu
so that e.g. Ctrl+1 selects the list view.

Remove debug statements from the view functions. Leave in place for
functions with no obvious actions yet coded.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 06:12:53 -07:00
Amit Chaudhuri
f07614fb2f Reformat statistics tab in MainTab tab widget
Rename various labels and text into clear pairs and reflect changes into
.cpp file.

To avoid clashes with names on other tabs use '..All..' to emphasise
that this page deals with an aggregate across the selected dives.

Re-format the statistics tab.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 06:11:02 -07:00
Dirk Hohndel
e960a5b558 Add most settings to the QSettings code
This is missing the char * based settings (as I have no idea how to do
those) plus the map provider. Everything else should work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-05 21:11:08 -07:00
Tomaz Canabrava
8e35868b9b Fixed some bad drawings
Removed the lines of the graphs that doesn't supposed to have lines.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-05 19:30:54 -03:00
Tomaz Canabrava
be0f2e0e8d Enabled some Render Hints for Antialiasing
Enabled some Render Hints for Antialiasing and
smooth transformations.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-05 09:55:56 -07:00
Dirk Hohndel
1238fde17c Merge branch 'PlotsV2' of https://github.com/tcanabrava/subsurface into Qt
Minor conflicts based on my cleanup of Tomaz' earlier commits.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-05 09:50:11 -07:00
Tomaz Canabrava
c72609046a Finished the port of the plot_profile code.
There are a few regressions, mostly because the text
is not being plotted yet and the background of some
of the curves are not being applied.
This is because QGrapdien is based on the coordinates
of the items that I wanna paint, but I'v setted a
QGradient that's global and doesn't take this into
consideration.

all curves are being plotted. in Small resolutions
they plot bad. but it's just a matter of redrawing
in the correct resolution.

the Line widths are being hardcoded now, on the cairo
version they weren't, this will need a bit of porting
too.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-05 13:42:33 -03:00
Tomaz Canabrava
adcae4d913 Added the code to plot the actual Graph.
This version already plots the dive-graph, with the
gradient and all that jazz. One thing that will be
easily spotted is that the size of the line is very
thick - easily changed, I'm just using the default.
As soon as everything is plotted correctly I'll
fix the lines.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-04 19:55:46 -07:00
Tomaz Canabrava
f269f86496 Plot of the Mean Deph
The mean depth now is plotted correctly.
I wanted to do more stuff on this commit, but since
it required that a few things on profile.c got moved
to profile.h, commited to not have a huge blob for review.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 19:55:16 -07:00
Tomaz Canabrava
19048b98e5 Start plotting something.
The first plotting method was removed from profile.c
to profilegraphics.cpp and some conversion ( almost 1 to 1 )
was made so that the code could work.

Since the code is big - this commit has just a part of it
working - it plots the grid. but already works for testing
the resizing of the window and Zooming ( unimplemented )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-04 19:55:12 -07:00
Tomaz Canabrava
fa82ba6079 Moved the plot from the cairo version to the Qt version
Started working on the Qt version of the Plot, initially
nothing is printed - but this is not a bad thing,
the program doesn't explodes too. :)

some work had to be done about the 'bool/gboolean' stuff
so I removed all gbooleans in the code that I'v encountered.

A new file was created ( profile.h ) so I could put the
signatures of helper methods that cairo used to call.

till now the code computes the max limits.
Next patch the first drawing will be made.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 19:51:33 -07:00
Tomaz Canabrava
ec4d4566ad Converted the Colors.h code to Qt
The colors on colors.h were done to fill a special
struct by Subsurface - I removed that structure and
replaced the code that generated the map of colors
to a QMap. I know that this changes are not very
'welcomed', but C++ has issues on creating & initializing
complex static members, this was the best way that I could
think of.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-04 19:51:29 -07:00
Tomaz Canabrava
8353d57164 Started the code for the Profile Plotting
This small patch adds a new class - ProfileGraphicsView
it's a QGraphicsView based class that will holds all
graphics-items for the plotting.

The setup is simple, just call ui->ListView->plot( dive )  ( that's
already a ProfileGraphicsView and magic will happen.

Since Im using a QGraphicsView , the size of the canvas doesn't
matter and I'm fixing it at 0,0,100,100. when a resize is done,
the resizeEvent will be called, fitting the scene's rectangle on
the view.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-04 19:49:52 -07:00
Tomaz Canabrava
926224122e Added the code to plot the actual Graph.
This version already plots the dive-graph, with the
gradient and all that jazz. One thing that will be
easily spotted is that the size of the line is very
thick - easily changed, I'm just using the default.
As soon as everything is plotted correctly I'll
fix the lines.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 20:18:16 -03:00
Tomaz Canabrava
09597cd2d8 Plot of the Mean Deph
The mean depth now is plotted correctly.
I wanted to do more stuff on this commit, but since
it required that a few things on profile.c got moved
to profile.h, commited to not have a huge blob for review.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 19:36:40 -03:00
Tomaz Canabrava
1b1ea35fac Start plotting something.
The first plotting method was removed from profile.c
to profilegraphics.cpp and some conversion ( almost 1 to 1 )
was made so that the code could work.

Since the code is big - this commit has just a part of it
working - it plots the grid. but already works for testing
the resizing of the window and Zooming ( unimplemented )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 19:20:49 -03:00
Tomaz Canabrava
c74dc11167 Moved the plot from the cairo version to the Qt version
Started working on the Qt version of the Plot, initially
nothing is printed - but this is not a bad thing,
the program doesn't explodes too. :)

some work had to be done about the 'bool/gboolean' stuff
so I removed all gbooleans in the code that I'v encountered.

A new file was created ( profile.h ) so I could put the
signatures of helper methods that cairo used to call.

till now the code computes the max limits.
Next patch the first drawing will be made.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 18:43:42 -03:00
Tomaz Canabrava
a58412cb31 Converted the Colors.h code to Qt
The colors on colors.h were done to fill a special
struct by Subsurface - I removed that structure and
replaced the code that generated the map of colors
to a QMap. I know that this changes are not very
'welcomed', but C++ has issues on creating & initializing
complex static members, this was the best way that I could
think of.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 16:41:49 -03:00
Tomaz Canabrava
243016633d Started the code for the Profile Plotting
This small patch adds a new class - ProfileGraphicsView
it's a QGraphicsView based class that will holds all
graphics-items for the plotting.

The setup is simple, just call ui->ListView->plot( dive )  ( that's
already a ProfileGraphicsView and magic will happen.

Since Im using a QGraphicsView , the size of the canvas doesn't
matter and I'm fixing it at 0,0,100,100. when a resize is done,
the resizeEvent will be called, fitting the scene's rectangle on
the view.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 16:12:43 -03:00
Dirk Hohndel
fcd6903621 Small changes to the selection logic
Now it correctly uses the existing helper functions and keeps our idea of
the selection consistent.

There is a small behavioral change compared to the Gtk code. Range
selections no longer have the last dive clicked on as selected_dive but
instead the dive with the highest index that was selected. I don't think
that is a major issue for anyone.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-03 20:58:44 -07:00
Tomaz Canabrava
7add8594a7 Added code to select / desselect a range of items
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-03 21:49:40 -03:00
Dirk Hohndel
c385e7aae8 Make Ctrl-q work as Quit
It's annoying to always have to close the window with the mouse.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-03 16:30:36 -07:00
Dirk Hohndel
ce5fc7d0ec Select the first dive
This works regardless whether the first dive is in a trip or not.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-03 12:53:33 -07:00
Dirk Hohndel
0a19a964e0 Temporarily expand all dives so the automatic width calculation works
Suggested-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-03 12:49:58 -07:00
Amit Chaudhuri
8577410fcd Reformat dive info page in tab widget
Clean up the formatting.
Distinguish between headings and value labels.
Tidy up text appearance (remove trailing ':')

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-03 11:47:06 -07:00
Dirk Hohndel
8677721e85 Remove the majority of the Gtk related code
- rip all Gtk code from qt-gui.cpp
- don't compile Gtk specific files
- don't link against Gtk libraries
- don't compile modules we don't use at all (yet)
- use #if USE_GTK_UI on the remaining files to disable Gtk related parts
- disable the non-functional Cochran support while I'm at it

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-03 11:37:09 -07:00
Dirk Hohndel
a6b89b3254 Don't hard-code column width.
Auto-detect on first start and keep in settings afterwards. So if the user
resizes them, Subsurface remembers the correct sizes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 22:06:01 -07:00
Dirk Hohndel
ff2ce39970 Merge branch 'tomaz-css' into Qt
Tomaz' code does a much better job of shading the dive list!

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 17:02:55 -07:00
Tomaz Canabrava
696c9ccacd Added code to Select a dive, fixed minor annoyances.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 16:56:48 -07:00
Tomaz Canabrava
82b1b04920 Test the CSS for styling the TableView
This is a test and I shouldn't be taken seriously.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 16:56:13 -07:00
Dirk Hohndel
021ef8ad09 Alternate background colors for dive list
This was written with massive hand-holding by Tomaz - actually, this was
mostly proposed via IRC by Tomaz and then implemented by me...

Right now because of the list-of-lists nature of the model we have the
small issue that every trip starts with a dark background dive, even if
the trip itself has a dark background.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 14:52:26 -07:00
Dirk Hohndel
c4e2c322a3 Set better column widths in the dive list
This code seems rather crude to me. I'm sure this could be done better.

This also makes the column alignment work again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 14:49:56 -07:00