Commit graph

94 commits

Author SHA1 Message Date
Dirk Hohndel
32ad046f56 Allow editing of dive sites
And hook things up when double clicking the globe.

The user experience isn't consistent with what we do on the main tab
(i.e., no coloring of fields that are changed), but it seems to work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13 14:27:35 -08:00
Dirk Hohndel
4e95beabc2 Remove coordinates from main tab
It seems to make sense to only have them on the dive site screen. For the
main UI they were redundant (we have the map) and not all that useful. The
only time people would want them is if they wanted to manually add GPS
coordinates for a dive, but that should now be done via the dive site UI.

There are a couple of FIXMEs in the code and a few code blocks that have
been commented out as they will be needed in one form or another once this
GPS handling is done on the dive site UI, which right now it is NOT.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 22:45:47 -08:00
Dirk Hohndel
d488c37cc1 Show dive coordinates on map based on dive site
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-12 11:19:27 -08:00
Tomaz Canabrava
6b038c2a9a Remove the ProfileWidget from mainwindow.ui
It is now in mainwindo.cpp

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
238c0573da Remove information panel from mainwindow.ui
Now it's created in the mainwindow.cpp as part of the new
way to configure the interface.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Tomaz Canabrava
cf4d55c470 Remove the DiveList from the mainwindow.ui
It's now set up from the mainwindow.cpp file.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10 10:45:45 -08:00
Dirk Hohndel
f448bfd574 Hide the old flag when editing a location on the map
This ONLY hides the old flag if the current dive is the only dive on that
location (which seems to make sense).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19 17:39:31 +12:00
Dirk Hohndel
803d390044 Show a flag when editing a location on the globe
Since we don't modify the dive list, the new flag wouldn't show up until
we accepted the change - that's not user friendly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-19 17:39:31 +12: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
Dirk Hohndel
f9ceff009b Clean up the header files
Lots and lots and lots of header files were being included without being
needed. This attempts to clean some of that crud up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-18 21:25:59 +12:00
Guillaume GARDET
1910d6d546 Fix compilation with upstream Marble
<marble/MarbleDebug.h> is not availaible in all Marble versions.
As Marble::MarbleDebug::setEnabled(verbose) is only used when
MARBLE_SUBSURFACE_BRANCH is defined, also include header file only when
MARBLE_SUBSURFACE_BRANCH is set.

Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-17 08:09:54 -08:00
Dirk Hohndel
bceff788fb Only setup marble debug output when comiling against our branch
Otherwise this might break the compile.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-16 07:06:22 -08:00
Dirk Hohndel
9fe458ea2e Enable Marble debug messages from Subsurface command line
Calling Subsurface with -v now gets you debug output. Of course, with a
regular "release" build of Marble you still won't see much. But with the
changes in the special Subsurface-testing branch you actually get some
very useful information when debugging a lack of maps in Marble.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-13 17:08:58 -08:00
Lubomir I. Ivanov
8c8943bf00 globe.cpp: fix a NO_MARBLE warning
Make eventFilter() return a value for NO_MARBLE.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-27 07:35:53 -07:00
Karina Mochetti
66cbdea8a1 Crash clicking on the globe without a dive
When the user right clicks the globe, we should only present the menu action
if there's a current dive, if not, we disable it.

Signed-off-by: Karina Mochetti <karina.mochetti@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-21 14:31:15 -05:00
Dirk Hohndel
78fee70450 Correctly remove the Close button from most message widgets
The only time we want the close button is when showing an error at the
bottom of the main window.

In the other cases (maintab, globe) we need to explicitly hide it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-04 22:45:17 -07:00
Tim Wootton
3a16a64616 misc capitalisation and spelling
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-11 07:06:26 -07:00
Dirk Hohndel
abb9a6c12d Globe: don't show the location edit message after aborting plan
For some reason the isVisible() check failed, even though the message is,
indeed, visible. But it doesn't seem to hurt to unconditionally hide the
message, so I'm doing that instead.

Fixes #576

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-29 17:45:11 -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
Tomaz Canabrava
cf848e5233 Correct the usage of std::string and QString
QStrings shouldn't be == "" to check for empty string, use .isEmpty()
QStrings shouldn't be != "" to check for non empty, use .size()
std::string shouldn't be cleared with = "", use .clear()

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-11 01:57:00 -07: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
Dirk Hohndel
8f657ff775 Add conditional so globe.cpp builds with older versions of Marble
In commit 7f3b487c77 ("Restore the previous globe zoom level after
showing dive without GPS") I was a bit too aggressive in replacing a
deprecated API function - people still need to be able to compile against
Marble versions older than 4.10.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-04 11:37:23 -07:00
Dirk Hohndel
7a85b9fb27 Only change dive coordinates on double click
Apparently this only happens on Windows, but there we would change the
dive coordinates on a SINGLE click when editing a dive. With this change
we simply bail if the event isn't a double click.

Fixes #505

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-01 21:25:20 -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
Tomaz Canabrava
9fcd6b2658 A better guard for 'dive being editted'
Mouse activity on the globe should not select dives when one or more dives
are being edited. This improves the detection of that state.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-01 10:12:16 -07:00
Tomaz Canabrava
83c5ab5871 Zoom out when dive has no coords.
This patch makes the globe zoom out to show it complete when
the dive has no coordinates.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-01 09:59:07 -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
d24d2288f3 Remove pointless assignments
tissue_tolerance wasn't used after it was assigned.
type was overwritten after it was assigned.
serial was overwritten after the last /= 100.
event is assigned in the for loop.
clear isn't used after the assignment

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 21:40:56 -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
Boris Barbulovski
c86822c2f4 Replace mainWindow() with MainWindow::instance()
C++ style of accessing single instance class object.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 11:42:59 -08:00
Boris Barbulovski
e88c198b93 globe.cpp improvements
* Add missing variable members to the initializer lists.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09 14:42:07 -08:00
Boris Barbulovski
6cc65f5e1c Fix some memory leaks.
Memory leaks were caused by broken parent/child relations.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 12:15:47 +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
Anton Lundin
7e9582631d Convert to TRUE/FALSE to stdbools true/false
I had problems with this one on Qt5.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:52:31 +07:00
Patrick Valsecchi
06875c7cbd Small code simplification
Use QStringList::contains instead of iterating the list.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-26 08:42:20 -08:00
Tomaz Canabrava
10519bcc50 silly whitespace fix.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24 07:23:10 -08:00
Tomaz Canabrava
6925d13aa4 Rework foreach for a faster iteration.
The old code used a QString instead of a const QString&, wich
mean that each foreach step the string was copied.
added a break on the if-found-true to stop the foreach, since
we already found it.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24 07:23:10 -08:00
Tomaz Canabrava
9190c97a3c Attempt to fix the 'click goes to 0,0' thing on the globe.
This patch attempts to fix the 'click goes to 0,0' bug on the
globe. it moves a bit of code around and I particulary don't
like the way that we are dealing with 'EditMode', I think I'll
refactor that for 4.1. We are alredy dealing with a bunch
of states, maybe a State Machine will help on removing code-complexity.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03 18:48:17 -08:00
Tomaz Canabrava
80265e4b3f Fix ignoring empty selections on the globe and code cleanup.
If the 'mouseClicked' didn't get any dives at the click-geolocation,
ignore it and do not try to select an empty selection. this was
causing a lot of issues when map-navigation.

Also, good deal of code cleanup.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-03 11:07:59 -08:00
Tomaz Canabrava
599ffdc2a9 Move code outside of for-loop.
This piece of code didn't need to be on the for-loop, so
let's remove it out of it.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02 11:41:03 -08:00
Tomaz Canabrava
7481746d91 Huge speedup when selecting Dives from the Globe View.
The old code ( slow++ ) ignored that each new dive-selection
we recreated all information on the profile window, so this
version ( a lot more verbose, I know. ) will ignore all dives
that are being selected and will only send the 'dive was selected'
information in the last line of the algorithm, instead of calling
it for each dive on the list of 'to be selected' dives.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-02 11:40:39 -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
Dirk Hohndel
d668f5dc8e Turn off dive location edit hint when cancelling dive edit
Simply clear the edited dive (regardless of whether it's set) and hide the
message if visible. The previous code was a little too convoluted...

Fixes #305

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-29 13:12:44 -08:00
Dirk Hohndel
d936c55a01 Make sure Subsurface will find Marble theme when installed on Linux
We need the marble data to go into a subdirectory of /usr/share/subsurface
and we need to search for both data and marbledata when trying to find the
theme.

Fixes #310

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-29 11:46:41 -08:00