aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models/maplocationmodel.h
AgeCommit message (Collapse)Author
2019-05-11Map: automatically update names on the mapGravatar Berthold Stoeger
Currently, dive site names are only updated on full reload. Instead hook directly into the corresponding signal in the MapLocationModel to set the name. Also to the coordinates directly there instead of going via the MapWidgetHelper. In the MapWidgetHelper, just center on the changed dive site. Hook into the signal directly there and remove the slot from the MapWidget. This makes the whole call-chain at least one call shorter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: in edit mode place no-gps dive sites at center of mapGravatar Berthold Stoeger
Move the code to add the first selected dive site from MapWidgetHelper::enterEditMode() to MapLocationModel::reload(). Thus, the list of sites is built only at one place. For this it is necessary to pass a pointer to the map, so that new dive sites can be added at the center of the map. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: make edit mode depend on dive-site-filteringGravatar Berthold Stoeger
Since the dive-site-filter is active either on the dive-site-edit page or the dive-site-list page, use that as the flag for dive-site-edit mode. Moreover, when the filter is reset, the MapWidgetHelper::reloadMapLocations() function is called, so we can use that place to enter/exit edit mode. This makes it easier to keep everything consistent. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: show multiple selected dive sitesGravatar Berthold Stoeger
If multiple dives are selected, highlight all corresponding sites. For that, replace the MapLocationModel::m_selectedDs pointer by a QVector<>. Fill the vector in MapLocationModel::reload() and add a isSelected() member function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: move calculation of list from map-helper to map-modelGravatar Berthold Stoeger
The map model keeps track of the dive site positions on the map. Therefore, it seems more logical to have the code calculating the map position in the model, not in the helper-class. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive list: don't pass dive_site via uintptr_t through QMLGravatar Berthold Stoeger
Now that struct dive_site * is a proper Q_METATYPE it is not necessary anymore to pass dive-sites as opaque uintptr_t types. Simply pass a QVariants or directly via dive_site *. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: replace dive->dive_site_uuid by dive_siteGravatar Berthold Stoeger
Replace the UUID reference of struct dive by a pointer to dive_site. This commit is rather large in lines, but nevertheless quite simple since most of the UUID->pointer work was done in previous commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-29Cleanup: reinstate override modifiersGravatar Berthold Stoeger
This reverts commit 1c4a859c8d0b37b2e938209fe9c4d99e9758327a, where the override modifiers were removed owing to the noisy "inconsistent override modifiers" which is default-on in clang. This warning was disabled in 77577f717f5aad38ea8c4c41c10c181486c4337f, so we can reinstate the overrides. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-01Cleanup: remove all override modifiersGravatar Berthold Stoeger
Commit df156a56c08a56eb380711a507ef739d8150a71f replaced "virtual" by "override" where appropriate. Unfortunately, this had the unintended consequence of producing numerous clang warnings. If clang finds a override-modified function in a class definition, it warns for *all* overriden virtual functions without the override modifier. To solve this, go the easy route and remove all overrides. At least it is consistent. 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: mark function as overrideGravatar Dirk Hohndel
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-28maplocationmodel: use READ method selectedUuidGravatar Lubomir I. Ivanov
Also emit the selectedUuidChanged signal. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocation: add helpers for coordinate and uuidGravatar Lubomir I. Ivanov
getRole() returns a QVariant and the cast is a small overhead. Using these helpers will reduce the overhead. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: add the "namer" propertyGravatar Lubomir I. Ivanov
The MapLocation QObject now has a QString property "name", which is translating the dive_site->name member. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: fix some public / private declarationsGravatar Lubomir I. Ivanov
Make the m_* variables private. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: make setSelectedUuid() accept "fromClick" flagGravatar Lubomir I. Ivanov
The idea of this flag is to be able to only to emit the selectedLocationChanged() signal when the user clicked on the map (fromClick == true). MapWidgetHelper::selectedLocationChanged() listens for this signal and only then it will select nearby dives based on a "small-cicle". If "fromClick" is false, it's the backend or the dive list that updated the selection and MapWidgetHelper::selectedLocationChanged() should no be called. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: add the helper method getMapLocationForUuid()Gravatar Lubomir I. Ivanov
getMapLocationForUuid() accepts a UUID, searches the MapLocation table and returns a pointer. Make use of the new method in setSelectedUuid(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: add a "selectedUuid" property to MapLocationModelGravatar Lubomir I. Ivanov
Inside the QML Map class there is a MapItemView item. This item uses a delegate that receive a "model" property from the MapLocationModel, but infact that's a QObject with the MapLocation defined properties. That's how MapItemView works. The problem here is that "model" QObject cannot be cast back to a MapLocation as the meta data in there does not include a MapLocation sub-class, for some reason. Even if using propery() on that QObject to fetch data like coordinates works, instead of storing this strange object pointer, store the MapLocation UUID (from dive_site) which is a uint32_t. setSelectedUuid() deals with this oddity and finds the correct MapLocation pointer in the table and dispatches a selectedLocationChanged() signal for it. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: add a "uuid" property to MapLocationGravatar Lubomir I. Ivanov
The "uuid" property will be the one from the dive_site. At first it will also be used to track the active marker/flag selection. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: use QVector for the MapLocation storageGravatar Lubomir I. Ivanov
QVector is faster, use it for "m_mapLocations" instead of QList. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: add the addList() methodGravatar Lubomir I. Ivanov
This method should be used if many markers are added at once. It's main purpose is to reduces the number of beingInsertRows() calls. Make MapWidgetHelper::reloadMapLocations() use it. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: store the coordinate as QGeoCoordinateGravatar Lubomir I. Ivanov
Instead of maintaining a seperate latitude/longitude values in C++ and passing them to QML separatelly, pass them as a QGeoCoordinate. This reduces the number of model "roles" and also prevents the creations of extra objects in QML (e.g. via QtPositioning.coordinate(..)). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28maplocationmodel: implement the clear() and add() methodsGravatar Lubomir I. Ivanov
- add() will be used to add a MapLocation to the model with beginInsertRows()...endInsertRows() - clear() will be used to clear the model with beginRemoveRows()... endRemoveRows() NOTE: emiting dataChanged() does not seem to update the QML view for this model so calling being<..>Rows() seems to be the "correct Qt approach" to do this. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28qt-models/maplocationmodel: add new classes for map model based handlingGravatar Lubomir I. Ivanov
The QML Map widget requires a QAbstractListModel based model to operate with good performance. Technically gpslistmodel.cpp can be used for that same purpose (e.g. has GPS coordinates), but the way it updates may complicate the Map widget integration. Thus, a new model is created - MapLocationModel, with items of type MapLocation, for an attempt for a clean project structure on the C++ side. For now it only handles latitude and longitude. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>