aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-05-11Map: ignore dive sites without location in centerOnSelectedDiveSite()Gravatar Berthold Stoeger
Don't zoom onto (0,0) for selected dive sites that have no location. 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: construct list of dive sites from dive site tableGravatar Berthold Stoeger
Instead of looping over the dive table and extract dive sites, loop over the dive site table. This makes it possible to show dive sites that have no dive associated with them. But we have to create to functions that check whether a dive site has any shown dives or has any selected dives. Moreover, change the code to add near dive sites of the same name if in edit mode. Other wise (erroneously added?) dive sites with the same name cannot be moved on the map. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Filter: prevent selection-change notifications in filter invalidationGravatar Berthold Stoeger
Invalidating the filter can cause numerous selection-change notifications. These cause a full UI reload. Therefore, go into "command" mode that was implemented for the undo commands. Then, all selection-changes are considered as "programmatical" and ignored. At the end of filter invalidation, a filter-finished signal causes a proper reload anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: remove skipReload logic in mapwidget.cppGravatar Berthold Stoeger
There used to be a flag to avoid reloading of the map. Since this is not used anymore, remove it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: don't recalculate selected dive sitesGravatar Berthold Stoeger
In MapWidgetHelper::centerOnSelectedDiveSite() the selected dive sites were recalculated. Simply use the ones we already know are selected. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Filter: don't reload when dive sites are set to the same valueGravatar Berthold Stoeger
When switching between the dive-site-table to the dive-site-edit tabs, the filter would be set to a dive site. Usually, this would be the same dive site as before. Nevertheless, this caused a full map-reload. Detect if the dive-sites to be filtered are the same and turn this operation into a no-op. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Filter: add reference counting for dive-site modeGravatar Berthold Stoeger
The dive-site-edit and dive-site-table tabs both put the filter into a special dive-site mode. When switching between both, it could happen that the one got its show befor the other got its hide event. Thus, the first would start dive-site filtering and the second stop it. Now the app was not in filter mode even though it should. To solve this problem, add reference counting for the filter's dive-site mode. In both tabs call the enter/exit functions on show/hide. In the dive-site-table tab, when the selection changes, use a set function that doesn't modify the reference count. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: in dive-site-edit mode, select those maps we filter forGravatar Berthold Stoeger
When dive sites are edited, we shouldn't highlight the sites of the current dive, but the currently edited site(s). 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: remove dead codeGravatar Berthold Stoeger
When entering map-edit mode and the dive site existed, its coordinates were extracted but never used. Remove that useless if-branch. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Selection: automatically unselect old selection in selectDives()Gravatar Berthold Stoeger
DiveListView::selectDives() would only select new dives but not clear the old selection. Thus, callers would have to clear the selection first. That would lead to two selection-changed signals. Move the unselectDives() call into DiveListView::selectDives(). The DiveListView has an internal flag to prevent double signals. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: remove MapWidget::centerOnSelectedDiveSiteGravatar Berthold Stoeger
This was only used locally and only a stub for calling MapWidgetHelper::centerOnSelectedDiveSite. Call the latter directly instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: reload on selection change directlyGravatar Berthold Stoeger
When changing the dive selection, we have to reload the map to show the correctly highlighted flags. Do this directly by hooking into the DiveListNotifier::divesChanged signal instead of indirectly via the MainTab. Moreover, on reload center on the highlighted dive sites. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Cleanup: remove MapWidgetHelper::m_selectedDiveIds memberGravatar Berthold Stoeger
This member variable was only used locally in functions. Accordingly, make it a function-local variable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: don't set map selection in selectVisibleLocations()Gravatar Berthold Stoeger
MapWidgetHelper::selectVisibleLocations() calls setSelection() on a single dive. Firstly, this make no sense anymore, as we now support multiple highlithed flags. Secondly, the highlted dives are now derived from the selected dives. Therefore, remove the call. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: don't update map-selection in centerOnSelectedDiveSite()Gravatar Berthold Stoeger
To detangle this code a little bit, let centerOnSelectedDiveSite() just do what is says: center on the selected dive sites. Don't update the selected dive site by calling MapLocationModel::setSelected(). 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>
2019-05-11Map: show all dive sites when in dive-site filter modeGravatar Berthold Stoeger
When on the dive site tab or editing a dive site, we want to show all dive sites so that the user can related different dive sites. Therefore export a "in dive site mode" flag from the filter model and don't filter in that case in MapWidgetHelper. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: don't reload map when in edit modeGravatar Berthold Stoeger
During edit mode, we could get spurious reload() requests owing to tabs being hidden. This led to undefined behavior: In some cases entering dive site edit mode would show all dive sites, in some only the dive site of the currently edited dive. Therefore, refuse to reload the map while in edit mode. The corresponding flag already exists. Partially fixes #2076 Reported-by: Doug Junkins <junkins@foghead.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: don't call exitEditMode() in MapWidget::reload()Gravatar Berthold Stoeger
On reload of the map, the map exits edit mode. Sounds logical at first, but the whole map-mode code is very unpredictable. What happened was that when switching from the dive site table to dive site edit mode, the code would enter map edit mode first. Then, the dive site tab got its hide-signal, which would reset the filter. This would reload the map and thus exit mode. Hence the user can't drag the flag on the map. Partially fixes #2076 Reported-by: Doug Junkins <junkins@foghead.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Mobile: add checkbox to force downloading all divesGravatar Dirk Hohndel
This has been a feature people have asked for quite frequently. It is taking up some valuable screen real estate - so the question could become if there should be a switch to enable / disable it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-11CSV Import: add heartrate supportGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-05-10Changelog updateGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-05-10SDE import: add custom fields to tagsGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-05-10Suunto import: add description to weight importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-05-10Suunto import: fix weight importGravatar Miika Turkia
Suunto apparently has a typo in their SDE format. Let's import also WEIGTH :D Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2019-05-06Create DivesiteImportDialog to select sites to importGravatar Doug Junkins
Creates the dialog box to select which sites to import from the file selected in mainwindow.cpp. The DivesiteImportModel is created as a table to display and select which sites are to be imported. Once the sites are selected, the Command::importDiveSites command is called to add the sites to the core dive site table with undo/redo functions. Signed-off-by: Doug Junkins <junkins@foghead.com>
2019-05-06Add "Import dive sites" menu to mainwindowGravatar Doug Junkins
Adds "Import->Import dive sites" menu to mainwindow.cpp and adds the on_actionImportDiveSites_triggered() method to prompt for the filename to import from. The files are parsed and then any dive and trip data is cleared before opening a dialog box to select which sites are to be imported. Signed-off-by: Doug Junkins <junkins@foghead.com>
2019-05-06Add undo/redo commands for importing dive sitesGravatar Doug Junkins
ImportDiveSites adds the provided dive sites to the core dive site table and stores the source data so it can be undone. Signed-off-by: Doug Junkins <junkins@foghead.com>
2019-05-05Travis: disable failing qt56 buildGravatar Dirk Hohndel
For some reason openSUSE 42.3 updates keep timing out, causing these builds to fail. Having a Qt5.5 and a Qt5.7 build should be sufficient for our purposes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-05Update libdivecomputerGravatar Dirk Hohndel
Suunto EON Steel/Core: make sure to properly sort the dive list Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-05Update libdivecomputerGravatar Dirk Hohndel
Garmin: be more permissive about the activity type Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-05Desktop user manual update: dive site managementGravatar willemferguson
Include text about dive site management. 5 new figures are introduced. Writing this enabled me to appreciate just how much time must have gone into writing the code. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-05-05Desktop: fix crash on dive site tabGravatar Berthold Stoeger
An interesting crash: 1) On the dive site tab select a dive site such that only one trip is shown. 2) Unselect all dives. 3) Press CTRL-A while the dive list has focus. 4) This will select a trip. 5) In MainTab::updateDiveInfo() this will switch to the previous tab active when in trip mode. 6) This will reset the filter. 7) This will reset the currentTrip field which we just set. 8) Since we just set the currentTrip field, we don't expect it to change and reference a null pointer. To fix, don't switch tabs when on the dive site tab. This also improves user experience as there seems to be no reason to switch away from the dive site tab. Currently the index of the dive site tab is hard-coded - this should be changed! Fixes #2077 Reported-by: Doug Junkins <junkins@foghead.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-05Cleanup: remove unused macro SURFACE_PRESSURE_STRINGGravatar Berthold Stoeger
The last user was removed in c3f07b9f81f09421a92d42d1b98e7c984b75e20d. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-30Bugfix for algorithm in get_distance()Gravatar Doug Junkins
Fixed bug in the Haversine function in get_distance() based on algorithm at https://www.movable-type.co.uk/scripts/latlong.html and added bounds to the 'a' term to avoid floating point errors for antipodal points. Signed-off-by: Doug Junkins <junkins@foghead.com>
2019-04-29Cleanup: make objects in desktop-widgets/modeldelegates.cppGravatar Berthold Stoeger
A number of objects in this file were global. Yet they weren't used anywhere else. Don't export these symbols by making them of static linkage. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Cleanup: fix leak in delegatesGravatar Berthold Stoeger
A copy of a C-string was assigned to a QString. The copy was never freed. Instead, assign the C-string directly. This does the right thing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Cleanup: implement proper Qt-model semantics in WeightInfoModelGravatar Berthold Stoeger
- Use a beginResetModel()/endResetModel() pair instead of distinct addRows / removeRows pairs. - Reuse the update function in the constructor(). - Let "rows" be the number of rows, not the number of rows minus one. - Remove updateInfo() function as it does the same as update(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Cleanup: implement proper Qt-model semantics in TankInfoModelGravatar Berthold Stoeger
- Use a beginResetModel()/endResetModel() pair instead of distinct addRows / removeRows pairs. - Reuse the update function in the constructor(). - Let "rows" be the number of rows, not the number of rows minus one. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Cleanup: remove biggerString() functionsGravatar Berthold Stoeger
The TankInfoModel and WeightInfoModel had biggerString() functions to determine the correct column widths for the tank- and weight-type columns. The users were removed around 2013. Remove these functions and the corresponding member variable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Cleanup: simplify YearInfo classGravatar Berthold Stoeger
YearInfo is a trivial wrapper around "stats_t *". All the constructor / destructor rigmarole seems completely unnecessary. Remove it. Probably the whole class could be removed, but for that I'd need more insight into Grantlee, which is low on my list of priorities for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Cleanup: remove stale include in desktop-widgets/templatelayout.cppGravatar Berthold Stoeger
Including <string> is not necessary in this file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Printing: fix memory leakGravatar Berthold Stoeger
For printing, DiveObjectHelpers are allocated and pointers to these are stored in a QVariantList. The objects are never freed. To fix this leak, keep the objects in a std::list<>. std::list<> was chosen because 1) Pointers to elements stay valid during its lifetime. 2) Objects can be constructed directly in the list with emplace_back() Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Cleanup: rename variable PrintOptions to printOptionsGravatar Berthold Stoeger
We're quite inconsistent when it comes to variable naming. The general usage is camelCase for Qt parts and snake_case for core code. Virtually nowhere do we start variable names with a capital letter. Therefore, turn this one weird case into camelCase. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Cleanup: remove TemplateLayout::m_engine member variableGravatar Berthold Stoeger
TemplateLayout::m_engine is a Grantlee::Engine that is reallocated for every function call. Instead of the archaic memory-management, remove the member variable and make it a local variable of the two functions that need it. There seems to be no point in keeping the object alive beyond the function's scope. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Cleanup: remove redundant string clearingGravatar Berthold Stoeger
The default QString constructor generates an empty string. No point in assigning the empty string to such a thing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Desktop: automatically update dive information tabGravatar Berthold Stoeger
Currently, the dive information tab was not updated when the user edited fields. The fields were only updated when switching between dives. Therefore, hook into the "divesChanged" signal and update the fields accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>