Commit graph

45 commits

Author SHA1 Message Date
Dirk Hohndel
3efafd1fde Enable building with NO_MARBLE again
This was broken in commit 7efa924067 ("Transform GlobeGPS in a static
instance() class").

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31 11:01:57 -07:00
Tomaz Canabrava
7efa924067 Transform GlobeGPS in a static instance() class
This is needed to start easing the transition from the completely
wrong and bogus MainWindow::instance()->globe() calls. this is still
wrong, but with it I removed one level of indirection.
I did that now because I wanted to not taint the location management
when I use it to deal with the globe.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31 10:28:17 -07:00
Tomaz Canabrava
0a473b3a2a Fix mouse interaction with the Location List
paint methods should be used only to paint, not to trigger other
widget behaviours ( we could got ourselves into a bad recursion
bug from that ). Also, enabled mouse tracking to correctly track
the mouse movement inside the widget.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16 18:34:22 -07:00
Dirk Hohndel
076f86202a Change API signature to act on dive_site, not uuid
This way in the future we can pass in a pointer to a dive site that isn't
linked in our dive site list yet (i.e., while we are editing).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-16 12:41:04 -07:00
Dirk Hohndel
83e5e4933f Globe: another attempt to fix the globe zoom
The fact that Marble doesn't tell us when it's done flying to the next
point is making this excessively complicated to get right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-08 13:45:24 -07:00
Dirk Hohndel
d541c2b601 Add helper function to determine the distance between two points
And use this to find a dive site within a certain radius of a GPS fix.
This will be used to figure out if dive sites might be the same.

This uses a new Qt5 component (Positioning) which was added in Qt5.2.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10 11:51:15 -07:00
Gehad elrobey
d88da53586 Fix building with NO_MARBLE issue
We can't build with -DNO_MARBLE after some previous commit broke
globe.cpp

- centerOnCurrentDive() is still existing in the code while removed from
header in 6b81fb49d0.

- Some referenced to MainWindow::instance()->globe() even if we are
building with no marble.

- include stdint.h

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-09 11:22:41 -07:00
Tomaz Canabrava
6b81fb49d0 Always send the UUID of the coordinates to the globe
We were relying in the current_dive to display the
globe coordinates correctly - but this is not always
the case: you can be inserting a new dive site and it
isn't yet inside of the dive until the user presses
accept. So always pass the uuid of the dive site that
we want to display.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07 08:04:32 -07:00
Lubomir I. Ivanov
9bda2e2d82 GlobeGPS: add empty function for NO_MARBLE
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04 10:08:14 -07:00
Tomaz Canabrava
f367414297 centerOnCurrentDive needs to be a slot
I'll connect this in the future with a few methods that will try to
maintain state between dive changes.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:35:08 -07:00
Tomaz Canabrava
fa373fd544 Rework the method to pick a dive site via the globe
The globe used to allow the user to pick a dive site if the dive didn't
have coordinates, but this is now wrong since when in dive site editing
mode we can select multiple times new coordinates for it, and it should
only be marked as finished when the user actually finishes it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03 21:32:36 -07:00
Tomaz Canabrava
9dc32de878 Remove Combobox from LocationManagement
I tought about it a bit, and the combobox of the location management was a
bit overkill - we already have another combobox to select the divesite and
also the plus button to add one.

If the user wanna edit the current divesite, he can go to menu and edit it.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-01 21:35:50 -07:00
Dirk Hohndel
d4b5854f82 Location management: reflect changes to the coordinates on the map
This is a bit aggressive as it changes the globe with every single
character that's entered, but it's better than what we had before.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-22 12:29:39 -07:00
Tomaz Canabrava
7d48c1fc26 Add the first call to registerApplicationState
This will be used to set the 'default' state. The other
two possible states right now are plan and add; those will
be created right next.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:44 -08:00
Dirk Hohndel
df46b85ee1 Don't just change the location when double clicking on the globe
Instead be consistent with other parts of the code and put us in editing
mode so the user can accept / reject the change.

See #800
Fixes #801

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19 17:38:17 +12:00
Tomaz Canabrava
89816f64c2 Headers cleanup.
Too much noise on the headers, this commit remove uneeded
headers when they are uneeded.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-26 15:47:02 -07:00
Dirk Hohndel
b42df1dab6 Globe: do a better job detecting double clicks and setting GPS coordinates
For some reasons Marble appears to sometimes not detect double clicks and
call the correct callback. With this commit we manually intercept the
double clocks and route them to the right function.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-11 09:31:01 -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
Anton Lundin
91c20357f5 Fix building with NO_MARBLE prepareForGetDiveCoordinates
Commit fb82da58a2 ("Globe: assume that we are looking at the
current_dive") changed the prototype for
GlobeGPS::prepareForGetDiveCoordinates. This patches the dummy in
NO_MARBLE.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 11:36:57 +09:00
Anton Lundin
1c64a986ee Fix building with NO_MARBLE, centerOnCurrentDive
Commit 2bc76beb65 ("Globe: we always center on the current dive") changed
GlobeGPS::centerOn to GlobeGPS::centerOnCurrentDive. This patches the
dummy in NO_MARBLE, too.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 11:36:18 +09:00
Anton Lundin
232098ad96 Fix building with NO_MARBLE after prototype change
4243fcb915 ("Dont set coordinates when two or more dives are selected")
Changed how the prototypes in GlobeGPS looks. This aligns NO_MARBLE
version of GlobeGPS with that.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-08 14:57:59 -07:00
Dirk Hohndel
fb82da58a2 Globe: assume that we are looking at the current_dive
As in commit 3870bdafee53 ("Globe: we always center on the current dive")
passing in a specific dive here makes no sense - it's always about the
current dive.

Fixes #513

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07 15:17:58 -07:00
Dirk Hohndel
2bc76beb65 Globe: we always center on the current dive
Simplify the API (we'll take advantage of this in the next commit).
We always center the globe on the current dive, so no point in passing
that dive in.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-07 15:17:47 -07:00
Tomaz Canabrava
4243fcb915 Dont set coordinates when two or more dives are selected
If a trip is selected (or for other reasons more than one dive), this
would change the GPS coordinates of the whole selection which almost
certainly isn't what the user wanted.
Instead, only allow changes of the coordinates on the globe if exactly one
dive is selected.

[Dirk Hohndel: massively rewritten and extended - but I didn't want to
               simply "steal" the commit from Tomaz...
	       This now maintains the "zoom out mode" for dives without
	       GPS coordinates and deals with edits of multiple dives that
	       are initiated the "normal way" by starting to edit other
	       data as well.]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-01 15:23:33 -07:00
Dirk Hohndel
7f3b487c77 Restore the previous globe zoom level after showing dive without GPS
Thanks to commit 83c5ab5871 ("Zoom out when dive has no coords.") we
show more of the globe when displaying dives without GPS data - but that
caused us to forget the zoom level we used before and so the experience
when switching back to a dive with GPS data was disappointing.

This makes sure we track the last valid zoom level and restore it when
needed.

I also replaced the deprecated zoomView() calls with setZoom() calls.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-01 14:48:14 -07:00
Anton Lundin
770bf9afba Introduce NO_MARBLE define, make GlobeGPS a dummy
Some users have requested a way to build subsurface without marble.

This hides all traces in the ui and creates a GlobeGPS-dummy thats
just a QLabel saying that marble is disabled, in case its shown
somehow. The dummy is there so we can just ignore the fact that marble
is disabled in the rest of the code.

Fixes #394

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-27 10:40:06 -07: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
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
Tomaz Canabrava
d26f109fba Fixes Setting the dive-location via the map.
This patch adds a context menu to set the dive location
via the globe, being the dive with a coordinate or not.

It also fixes setting the dive location on edit mode.

Fixes: #315

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02 09:44:55 -08:00
Tomaz Canabrava
abc81fbd01 Disables zooming by double click and context menu on marble.
Marble is a weird piece of Qt software, it seems that it wasn't
thought of being a library when first written. Most of its features
are not achieved by subclassing && overriding one of Qt default methods,
instead we need to eventFilter for almost everything ( which is a pain,
and a bit error prone - see our combo box delegate *puke*. )

This one's ready,  only one thing though - if we want to implement
our own context menu, we will need to use the eventFilter, and not
the contextMenuEvent.

Fixes #291

[Dirk Hohndel: this does not disable the context menu for me...]

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22 07:40:32 -08:00
Dirk Hohndel
e8a4420c59 Immediately show new locations on globe widget
When modifying or adding a dive location on the globe widget while in dive
edit or dive add mode, we now show the modified / new location right away
on the globe (assuming a location name has been given). This makes it much
easier to manually reposition a dive location.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 04:28:15 -08:00
Dirk Hohndel
7886719443 Handle double clicks on globe during dive edit mode
When we are editing or adding a dive, the globe widget needs to act
differently. Instead of directly changing the lat/lon of selected dives,
it needs populate the coordinate text field as if this information was
entered by the user (effectively all it is is a way to more conveniently
enter coordinates).

As a side effect, this also allows us to change the location once it has
been added (you just need to go into dive edit mode to do so).

There is one weird issue that occasionally (and I can't quite reproduce
this) I get lat/lon very close to 0/0 (as if the globe widget was centered
on 0/0 and not on whatever it is actually showing). That still needs to be
addressed.

Fixes #239
Fixes #131

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-19 04:12:31 -08:00
Dirk Hohndel
8f623c2c72 Fix marble losting track of zoom level
Marble had a bug on the way it treats zoom level, there's
no way for it to find out if it's user-input or algorithm input
and when a user clicks on a dive, it spins and centers on it,
but if the user clicks on another dive when it's still spinning,
it will get the zoom in the actual state ( spinning, usually zoom
is far away from the first position ) and continue the spin to the
other position.

This patch works by saving the first location and triggering a
helper function with a timer that will only update the zoom level
if the timer is not active ( and thus, will not get the bugged
zoom state set by the animation. ).

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 15:00:22 -07:00
Dirk Hohndel
07a16574e9 Consistently use slots / signals
We started out using Q_SLOTS and Q_SIGNALS but then changed our mind.
Let's make this consistent again.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-19 10:20:56 -07:00
Dirk Hohndel
b533cf299f Get single click on the map widget in a callback for further processing
Now Linus can write the code that selects the right dives...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05 14:44:12 +09:00
Dirk Hohndel
6f979b48ed Show locations with same name on the map if they are more than 50m apart
Not showing them at all was a little too blunt of an instrument. There
likely are dive spots with the same name at different resorts. And even
at the same resort you could have multiple morings for the same dive
site.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-05 12:16:34 +09:00
Thiago Macieira
7b75cfa808 Fix compilation: error: ‘GeoDataDocument’ does not name a type
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-30 12:03:25 +09:00
Henrik Brautaset Aronsen
5d05bb1207 Avoid marble widget resize when switching dives
The "no dive location" message box was displayed above the marble
widget, which made the layout splitter move horizontally.

Made the message box as an overlay on the map instead.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-25 08:17:14 -07:00
Dirk Hohndel
115e5e5fbc The never ending, futile fight for whitespace consistency
I just need to write a tool that does this...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-22 21:31:45 -07:00
Tomaz Canabrava
86021b24d9 Borrowed the KMessageWidget code to better show passive information.
Borrowed the code from KMessageWidget from Aurelian Gateau, Kdelibs,
to better show passive information and notifications. instead of a
popup blowing in the user's face, a nice, animated and well designed
widget will gracefully fade-in, show the notes, and fade out when
not needed anymore.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 21:58:49 -03:00
Tomaz Canabrava
56dbb7c2ff Added the possibility to change the coordinates of a dive.
Added the possibility to change the coordinates of a dive.
it's too intrusive in the moment, but it was a proof
of concept. so I'll commit as is and try to find a better
way to warn the user what's going on in the future, using
something less terrible than a popup exploding in his face.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 16:12:55 -03:00
Tomaz Canabrava
b89265c7f0 Adds rotation while selecting a dive.
This adds rotation, a very, very shinny feature.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 14:09:10 -03:00
Tomaz Canabrava
3a1a4c1874 removed whitespace.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 13:30:47 -03:00
Tomaz Canabrava
9038b3aa6e Added real support for the marble widget
The marble widget now shows the dive locations
and also will center on the dive that the user clicked
in the dive list.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 13:28:02 -03:00
Tomaz Canabrava
4098922b55 Adds preliminary support for Marble Widget
Adds preliminary support for marble widget, alongside with the
dive list. my idea is to let the view stay there at the left of the
dive list since we got a lot of unused space and a globe is something
nice to have - so you can look around where did you dived, the
dives near the one that's currectly selected, and so on.

I'm not using OpenStreetMaps right now, but a good thing about
marble is that it is skinnable - so for instance, a dive school
could present a dive lesson using subsurface with a globe from the
1600, to make it feel like 'history'.

This version will only compile to Qt4.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-17 08:14:10 -03:00