aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/globe.cpp
AgeCommit message (Collapse)Author
2014-08-21Crash clicking on the globe without a diveGravatar Karina Mochetti
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-04Correctly remove the Close button from most message widgetsGravatar Dirk Hohndel
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-07-11misc capitalisation and spellingGravatar Tim Wootton
Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-29Globe: don't show the location edit message after aborting planGravatar Dirk Hohndel
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-11Globe: do a better job detecting double clicks and setting GPS coordinatesGravatar Dirk Hohndel
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-05-22Gratuitous whitespace changesGravatar Dirk Hohndel
I keep trying to get to consistenct. Completely hopeless. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20Fix building with NO_MARBLE prepareForGetDiveCoordinatesGravatar Anton Lundin
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-20Fix building with NO_MARBLE, centerOnCurrentDiveGravatar Anton Lundin
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-11Correct the usage of std::string and QStringGravatar Tomaz Canabrava
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-08Fix building with NO_MARBLE after prototype changeGravatar Anton Lundin
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-07Globe: assume that we are looking at the current_diveGravatar Dirk Hohndel
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-07Globe: we always center on the current diveGravatar Dirk Hohndel
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-04Add conditional so globe.cpp builds with older versions of MarbleGravatar Dirk Hohndel
In commit 7f3b487c77c7 ("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-01Only change dive coordinates on double clickGravatar Dirk Hohndel
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-01Dont set coordinates when two or more dives are selectedv4.0.97Gravatar Tomaz Canabrava
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-01Restore the previous globe zoom level after showing dive without GPSGravatar Dirk Hohndel
Thanks to commit 83c5ab58718e ("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-01A better guard for 'dive being editted'Gravatar Tomaz Canabrava
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-01Zoom out when dive has no coords.Gravatar Tomaz Canabrava
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-03-27Introduce NO_MARBLE define, make GlobeGPS a dummyGravatar Anton Lundin
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-03Remove pointless assignmentsGravatar Dirk Hohndel
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-02-27Massive automated whitespace cleanupGravatar Dirk Hohndel
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-12Replace mainWindow() with MainWindow::instance()Gravatar Boris Barbulovski
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-09globe.cpp improvementsGravatar Boris Barbulovski
* 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-01-16Fix some memory leaks.Gravatar Boris Barbulovski
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-16Whitespace and coding style updatesGravatar Dirk Hohndel
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-15Convert to TRUE/FALSE to stdbools true/falseGravatar Anton Lundin
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>
2013-12-26Small code simplificationGravatar Patrick Valsecchi
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-24silly whitespace fix.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-12-24Rework foreach for a faster iteration.Gravatar Tomaz Canabrava
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-03Attempt to fix the 'click goes to 0,0' thing on the globe.Gravatar Tomaz Canabrava
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-03Fix ignoring empty selections on the globe and code cleanup.Gravatar Tomaz Canabrava
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-02Move code outside of for-loop.Gravatar Tomaz Canabrava
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-02Huge speedup when selecting Dives from the Globe View.Gravatar Tomaz Canabrava
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-02Fixes Setting the dive-location via the map.Gravatar Tomaz Canabrava
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-11-29Turn off dive location edit hint when cancelling dive editGravatar Dirk Hohndel
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-29Make sure Subsurface will find Marble theme when installed on LinuxGravatar Dirk Hohndel
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-26Re-enable adding a location to selected dive via double-click on the mapGravatar Vinicius Machado
The fix for 'double click on the map shouldn't zoom' had broken the selection of the current location for the selected dive, this patch fixes that. See #291 Signed-off-by: Vinicius Machado <vsmachado@gmail.com> Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22Hide everything 'floatable' by default on the globe.Gravatar Tomaz Canabrava
Later we spacifically enable the scale, but Dirk asked me to use the bare minimum of marble. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-22Disables zooming by double click and context menu on marble.Gravatar Tomaz Canabrava
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-19Immediately show new locations on globe widgetGravatar Dirk Hohndel
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-19Handle double clicks on globe during dive edit modeGravatar Dirk Hohndel
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-17Make it possible to set the coordinates via map for all selected dives.Gravatar Tomaz Canabrava
This patch makes it possible to set the coordinates on the map for all selected dives. Note however that after a coordinate is set, user cannot edit it unless he multi-edit it with a dive that doesn't have coordinate's set. this is just because it's missing a 'edit coords' button. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-16Fix wrong handling of Dive Table, and revert some wrong changes.Gravatar Tomaz Canabrava
This patch just reverts some wrong changes that I'v done on a past commit ( sorry ) and correctly handles the selectDive, by using a IDX instead of the dive pointer, as dirk told me it's extremely error-prone since the pointer can change. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-11Stop clicks on the globe from changing dive list selection while editingGravatar Dirk Hohndel
This caused us to get royally confused when manually adding a dive and trying to set the location through the marble widget. Fixes # 229 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17Fix marble losting track of zoom levelGravatar Dirk Hohndel
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-13Fix uninitialized variableGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-11Good deal of whitespace fixes and code cleanup.Gravatar Tomaz Canabrava
I just went thru all of subsurface code removing some whitespaces issues and trying to make the code prettyer, I also removed a few QString issues.d Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-26Fixed the display of Subsurface in Smaller ScreensGravatar Tomaz Canabrava
This patch fixes the display of subsurface in smaller screens by creating ScrollArea containers that are now englobbing each of the Tab-pages and the Planner Widget. Some of those widgets were pretty big by the amount of things on it and it was too big for small ( 14" and 15" ) screens. This seems to fix it, and looks good both on Gtk+ and Oxygen styles. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Coordinate some mark_divelist_changed() callsGravatar Lubomir I. Ivanov
1) Make a call mark_divelist_changed(TRUE) when the user adds new cylinder or weight entries. 2) Call mark_divelist_changed(FALSE) in MainWindow::on_actionClose_triggered() so that each time after a file is closed or a new one is created it does not ask immediately the user for a save confirmation for the blank file/divelist. 3) Call mark_divelist_changed(TRUE) once a dive's geo location has changed in GlobeGPS::changeDiveGeoPosition(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-07Fix compile: mixup of GeoDataCoordinates and GeoDataPointGravatar Thiago Macieira
Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>