aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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>
2019-04-29Desktop: use current_dive in information tabGravatar Berthold Stoeger
The information tab used displayed_dive to fill out its field. For consistency with the main tab and in a bigger effort to remove displayed_dive, use current_dive instead. Only clear the fields if no current_dive is set. The code used to clear the fields and overwrite them later. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Desktop: set dive fields only when not in trip modeGravatar Berthold Stoeger
On the main-tab, when looking at a trip, the fields were filled out with dive-data and then either hidden or overwritten with trip data. Move the update of the fields into the corresponding if-branch that is only active if on dive-mode. This means removing the UPDATE_* macros, which updated or cleared dive-fields depending on whether a current dive was set. These operations are now performed explicitly in the corresponding if-branches. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-28Support for Scubapro G2 HUD discovery via bluetoothGravatar William Perry
Signed-off-by: William M Perry <wmperry@gmail.com>
2019-04-25Update (and fix) device mobile ID's for Scubapro dive computersGravatar Linus Torvalds
I'm not sure this is actually relevant for anything any more, but this adds the USB device ID's for the Scubapro G2 Console and HUD versions. It also fixes things to use the proper vendor name (a bit too much cut-and-paste, where the code said "Suunto" instead of "Scubapro"). The real device ID changes are in libdivecomputer, this is just the Android xml list for recognized USB devices that likely nobody really uses. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-04-24Update libdivecomputerGravatar Dirk Hohndel
This adds ID entries for the Scubapro G2 HUD (but no GPS parsing support yet) and the Aladin H Matrix. Also fix ndl/deco parsing for for Aqualung i450T. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-04-18qt-ble: return DC_STATUS_TIMEOUT rather than DC_STATUS_IO on timeoutGravatar Linus Torvalds
This didn't use to matter, because none of the BLE-using backends did retry on timeout until recently. But Jef started doing packet sending retry for the Mares Icon backend, and now we should make sure to distinguish the "IO failed" from "IO timed out" cases. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-04-16Write dive data as video subtitlesGravatar Robert C. Helling
This commit adds an entry to the dive media context menu which offers to write a subtitle file. This creates an .ass file for the selected videos. In an attempt to to clutter the screen too much, don't show irrelevant entries (zero temperature or NDL and show TTS only for dives with stops). VLC is able to show these subtitles directly, they can be integrated into the video file with ffmpeg. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-04-16Update libdivecomputerGravatar Dirk Hohndel
Merge upstream updates from Jef: - better Mares Bluelink Pro downloading - Suunto DX CCR and gas mix fixes Signed-off-by: Dirk Hohndel <dirk@hohndel.org>