aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/mapwidget.h
AgeCommit message (Collapse)Author
2018-10-21Add 'location_t' data structureGravatar Linus Torvalds
Instead of having people treat latitude and longitude as separate things, just add a 'location_t' data structure that contains both. Almost all cases want to always act on them together. This is really just prep-work for adding a few more locations that we track: I want to add a entry/exit location to each dive (independent of the dive site) because of how the Garmin Descent gives us the information (and hopefully, some day, other dive computers too). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-10-11Map: pass down dive site in prepareForGetDiveCoordinates()Gravatar Berthold Stoeger
Instead of reading out the global object "displayed_dive_site", pass the dive site to be edited in arguments to prepareForGetDiveCoordinates() and enter edit mode. Simplify the code in LocationInformationWidget by not using signals to call the prepareForGetDiveCoordinates() function. While doing this, collect common code in accept() and reject() in the already existing resetState() function. This is another entry in a series of commits that makes data-flow more clear by removing access to the global "displayed_dive_site" object. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-11Map: split void MapWidget::setEditMode()Gravatar Berthold Stoeger
The setEditMode(bool) function behaves very differently, when entering and exiting edit mode. Therefore, split it in two versions. This will allow to pass arguments that make sense only when entering the edit mode. Since setEditMode() doesn't exist anymore, turn the editMode Q_PROPERTY line to the MEMBER version. Accordingly, remove the reader function. If QML wants to enter edit mode, it should invoke the appropriate function and not simply set the flag. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-11Map: pass changed coordinates via signalGravatar Berthold Stoeger
The coordinates of a "dragged flag" were passed out-of-bound via the global "displayed_dive_site" object and then a signal was sent to notify of the changed coordinates. Instead, pass the coordinates directly via the signal. This makes the data- and control-flow more clear. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-11Map: remove LocationInformationWidget::coordinatesChanged signalGravatar Berthold Stoeger
This was used by LocationInformationWidget to instruct the map that the coordinates of the current dive site has changed. There is no reason why this couldn't be a function call, as no other object ever connect()s to this signal. In fact, such a function already exists viz. updateLocationOnMap. Therefore, replace the signal by a simple function call. Moreover, the uuid and coordinates of the dive site were transported via the global "displayed_dive_site" object. Instead, pass this information in the parameters of the function. This makes it easier to reason about data- and control-flow. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-08Map: zoom on dive sites when flipping through dive site listGravatar Berthold Stoeger
The dive site list was connected to centerOnDiveSite(). Apparently, the currently selected dive site should have been shown in the map. Yet, this never worked, because the actual dive site of the selected dive had precedence in centerOnDiveSite(). It seems that centerOnDiveSite() had actually to purposes: 1) center on the passed in dive site 2) center on the dive sites of the selected dives Therefore, split this function in two separate functions for each of these use-cases. This allows us to remove some pre-processor magic (mobile vs. desktop) and to remove a parameter from the MainTab::diveSiteChanged() signal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-09map-widget: allow real-time updates of edited markersGravatar Lubomir I. Ivanov
This patch allows updating the location of map markers while editing a dive site and updating the text in the LocationInformationWidget in real-time. Currently it is only possible to see the marker changes by clicking 'Apply'. The modification required the following changes: - add the MapWidget::updateCurrentDiveSiteCoordinatesToMap() slot and call it each time the GPS text updates - separate the updateCurrentDiveSiteCoordinates(FromMap/ToMap) logic by having the FromMap/ToMap suffix to method names - make MapWidgetHelper::updateCurrentDiveSiteCoordinatesToMap() call a new MapLocationModel::updateMapLocationCoordinates() method, which updates selected location coordinates and the model - add MapLocation::setCoordinateNoEmit() that does not emit a signal when updating a coordinate Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28Map: try to wait for Map to loadGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-28Switch new files to unix line endingsGravatar Dirk Hohndel
I thought we had this automated, but Lubomirs commits introduced a few files with dos line endings. This is purely a change of line endings, no other changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-28map: whitespace cleanup in QML and C++ filesGravatar Lubomir I. Ivanov
- remove ";"s - remove {} where not needed or move them to the same line Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget: add a method to set update editMode in MapWidgetHelperGravatar Lubomir I. Ivanov
The local slot coordinatesChangedLocal() tracks the MapWidgetHelper coordinatesChanged() signal and emit a coordinatesChanged() signal to any listeners (e.g. MainWindow). Also add a small change in centerOnDiveSite(), to not be called if we are skipping the reload (skipReload is updated by selectedDivesChanged()). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget: connect the helper selectedDivesChanged() signalGravatar Lubomir I. Ivanov
The selectedDivesChanged() signal from MapWidgetHelper is connected to a local slot. One problem here is that this crashes with the calls to DiveListView(). The dive list widget triggers events that call reload() on the MapWidget (same happens for Marble's Globe class) and that crashes somewhere in the QML shared library. TODO: investigate. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28add the SPDX-License-Identifier to new source filesGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.cpp: obtain a reference of the MapWidgetHelper from QMLGravatar Lubomir I. Ivanov
Use findChild() to obtain the only MapWidgetHelper object created in the MapWidget.qml. Store the reference as a member variable - m_mapHelper. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.h: force-undefine the IGNORE macro from winbase.hGravatar Lubomir I. Ivanov
By including <QQuickWidget>, <winbase.h> is included from <windows.h>. <winabase.h> has the IGNORE macro defined. Undefine it localy in mapwidget.h to prevent a conflict with maintah.h's EditMode::IGNORE enum. NOTE: possibly similar case to the undefine in btdeviceselectiondialog.h:22. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget.h: remove redundant "core/divesite.h" includeGravatar Lubomir I. Ivanov
The header should be included only in the .cpp file Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget: add the placeholder prepareForGetDiveCoordinates() slotGravatar Lubomir I. Ivanov
Port from GlobeGPS. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget: add the coordinatesChanged() signalGravatar Lubomir I. Ivanov
Port from GlobeGPS. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget: add the placeholder repopulateLabels() methodGravatar Lubomir I. Ivanov
Another placeholder for the Marble port. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget: add the method centerOnIndex()Gravatar Lubomir I. Ivanov
Again for the port from Marble, later can be removed / renamed. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget: add public slot endGetDiveCoordinates()Gravatar Lubomir I. Ivanov
Later this has to be replaced / renamed if needed. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget: add an empty reload() methodGravatar Lubomir I. Ivanov
Call same method in MainWindow if the NO_MARBLE macro is defined. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28mapwidget: add placeholder centerOnDiveSite() public slotGravatar Lubomir I. Ivanov
This is WIP and would be developed futher, so that the new map widget can center on a divesite location. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28map: add placeholder .cpp and .h files for the new map widgetGravatar Lubomir I. Ivanov
The files are WIP and located in desktop-widgets, as these would only be used by the desktop version. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>