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>
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>
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>
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>
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>
If the extern "C" is missing, the C++ compiler will try to find a
function by its mangled name. Since the function is in a .c file,
there will be no mangled name.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
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>
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>
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>
The compiler on MacOSX wouldn't build Subsurface when bool
was redefined.
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Doing this on Arch Linux with gcc 4.8.0 helped find one real bug.
The rest are simply changes to make static functions externally visible
(as they are kept around to eventually become helpers used by Qt) which
for now avoids the warnings.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Apparently only older Linux toolchains didn't bother to throw up with the
remainders of Gtk related code.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>