summaryrefslogtreecommitdiffstats
path: root/qt-ui/globe.cpp
AgeCommit message (Collapse)Author
2015-10-30Move qt-ui to desktop-widgetsGravatar Tomaz Canabrava
Since we have now destkop and mobile versions, 'qt-ui' was a very poor name choice for a folder that contains only destkop-enabled widgets. Also, move the graphicsview-common.h/cpp to subsurface-core because it doesn't depend on qgraphicsview, it merely implements all the colors that we use throughout Subsurface, and we will use colors on both desktop and mobile versions Same thing applies for metrics.h/cpp Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-01Don't zoom out the globe if the dive site has no GPSGravatar Dirk Hohndel
This may or may not look intuitive, but it can cause problems with the zoom seemingly stuck all out (because of the timeouts). So instead stay where you are. If the current dive site has GPS then its flag will be bigger and brighter - so there still is visual feedback. But there's less crazy zooming around. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-27Do not try to center if already on centerGravatar Tomaz Canabrava
This makes the globe smoother while moving around same gps dive sites. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31Enable building with NO_MARBLE againGravatar Dirk Hohndel
This was broken in commit 7efa92406794 ("Transform GlobeGPS in a static instance() class"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-31Transform GlobeGPS in a static instance() classGravatar Tomaz Canabrava
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-16Fix mouse interaction with the Location ListGravatar Tomaz Canabrava
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-16Change API signature to act on dive_site, not uuidGravatar Dirk Hohndel
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-12Globe: Remove workarounds for ancient Marble versionsGravatar Dirk Hohndel
We build against our own Marble, anyway. So this isn't needed anymore. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-08Globe: another attempt to fix the globe zoomGravatar Dirk Hohndel
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-06-27Globe: use lighter and darker flags to mark the current dive siteGravatar Dirk Hohndel
This may be too subtle... the current dive site now has a brighter flag than the others. I may need to make it an even bigger difference or maybe make the flag a little bigger or something... but it's a start. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Globe: change the logic to remember the current zoom valueGravatar Dirk Hohndel
We start out with our default. If we zoom out because of no GPS data, we remember the now current zoom value, but only if we aren't in the middle of a "flight". If we are in the middle of a flight we simply keep the last value we remembered - that means we might forget a user made change, but at least we won't suddenly remember a random number as our zoom value. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Globe: only remember the last zoom if we are not flyingGravatar Dirk Hohndel
No point in remembering the "current" zoom while we are flying to a new position. Also make sure you remember things before we start a new flight. Finally, set the radius to 1000 which is what Marble recommends for a zoom that shows the whole globe. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-26Globe: reset the view when called with no divesiteGravatar Dirk Hohndel
Returning here was simply wrong; we need to zoom out. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-21Initialize membersGravatar Dirk Hohndel
Globe: initialize doubleClick member ShiftTimesDialog: initialize when (not sure this could be a problem) SetpointDialog: dc could be uninitialized or could be 0 and dereferenced Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-13Simplify distance calculationsGravatar Anton Lundin
This simplifies the distance calculations and removes a dependency. This version uses propper math instead of my to simple previous version. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-10Add helper function to determine the distance between two pointsGravatar Dirk Hohndel
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-07Plot the current dive site in edit modeGravatar Tomaz Canabrava
We were ignoring the displayed_dive_site as we were adding it and the changes weren't accepted yet. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-07Always send the UUID of the coordinates to the globeGravatar Tomaz Canabrava
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-04GlobeGPS: add empty function for NO_MARBLEGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Clear up editDiveGeoPosition for the new approachGravatar Tomaz Canabrava
We can only enter in editing state by opening the editing dialog, so the mainwindow check is now invalid. and also we shouldn't set the editingmode to false, since we will edit until the user clicks close. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Use for_each_dive_site to populate the dives in the globeGravatar Tomaz Canabrava
When we didn't have a proper dive_site_table, the dive sites where scattered across all dives and so we looped over all dives to find the dive sites and add them to the tree. Now this is a bit cleaner, a bit faster. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-03Rework the method to pick a dive site via the globeGravatar Tomaz Canabrava
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-05-31Don't ask for globe-coordinates for a diveGravatar Tomaz Canabrava
Only ask that for dive_site_management. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-22Location management: reflect changes to the coordinates on the mapGravatar Dirk Hohndel
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-03-15Change the zoom level on globe if no coordinates are setGravatar Claudiu Olteanu
As flo269 suggested in bug #507, a full view of Earth would be better when a dive has no coordinates. Fixes #507 Reported-by: flo269 Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-13Allow editing of dive sitesGravatar Dirk Hohndel
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-12Remove coordinates from main tabGravatar Dirk Hohndel
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-12Show dive coordinates on map based on dive siteGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-10Remove the ProfileWidget from mainwindow.uiGravatar Tomaz Canabrava
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-10Remove information panel from mainwindow.uiGravatar Tomaz Canabrava
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-10Remove the DiveList from the mainwindow.uiGravatar Tomaz Canabrava
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-01-19Hide the old flag when editing a location on the mapGravatar Dirk Hohndel
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-19Show a flag when editing a location on the globeGravatar Dirk Hohndel
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-19Don't just change the location when double clicking on the globeGravatar Dirk Hohndel
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-18Clean up the header filesGravatar Dirk Hohndel
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>
2014-12-17Fix compilation with upstream MarbleGravatar Guillaume GARDET
<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-16Only setup marble debug output when comiling against our branchGravatar Dirk Hohndel
Otherwise this might break the compile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-13Enable Marble debug messages from Subsurface command lineGravatar Dirk Hohndel
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-10-27globe.cpp: fix a NO_MARBLE warningGravatar Lubomir I. Ivanov
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-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>