aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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>
2019-04-16Desktop: don't show special dive site entries if there is no filterGravatar Berthold Stoeger
In the dive site selection widget there are two special entries (add dive site with given name). Don't show this if the user didn't enter a string. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-16Desktop: enable sorting in dive site selection widgetGravatar Berthold Stoeger
The dive site selection widget implements a lessThan() function, but that was never called. Apparently in a QListView one has to start sorting by hand? Do just that. In any case, the lessThan function was erroneous as it would happily sort away the first two special entries. Fix it with a special case for these to. Finally use case insensitive string comparison. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-16Cleanup: access filter-model directly without castGravatar Berthold Stoeger
To reset the filter-model, LocationInformationWidget would extract the model from the diveSiteListView and then downcasts it. Instead, it can access it directly, because the filter-model is a subobject of LocationInformationWidget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-16Cleanup: remove global DiveLocationLineEdit variableGravatar Berthold Stoeger
DiveLocationLineEdit stored a pointer to itself in a global variable so that the DiveLocationModel can access it to access the filter text. Instead, on change simply pass the filter text down from DiveLocationLineEdit to DiveLocationModel. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-16Mobile: reinstate roleNames function in ConnectionListModelGravatar Berthold Stoeger
Commit c69ca4df80c9c74aa842b7f1fb3c44b22ae3232e removed the roleNames function, which is not needed according to the docs, as a default function is provided. For unknown reasons this broke the QML combo box. Reinstate the function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-16Don't show surface gas in gas use listGravatar Robert C. Helling
Skip gas use calculation for the gas that was used in the surface segment added by the planner in the end. Reported-by: philippe@philmassart.net Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-04-15Dive site: display proper text for the two special optionsGravatar Berthold Stoeger
The dive-site line edit box features two special entries for adding new dive sites. These should display different texts depending on whether the current dive has a dive site or not. The current check is wrong, because it used displayed_dive, but since the last set of undo-changes, this might not be filled out correctly anymore. Instead the code should check the actual current dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-15make sure to clear dives on dive split failureGravatar Linus Torvalds
The dive splitting code returns an error code when splitting fails, but it turns out that the C++ UI code doesn't actually look at the error code, and instead expected the resulting dives to be NULL if an error happened and the split didn't succeed for whatever reason. Which is kind of lazy of it, but we might as well clear the resulting dives and make the UI code happy. This should fix the problem that Celia Marlowe reported on the Subsurface google groups forum. Reported-by: Celia Marlowe Acked-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Fixes: 145f70aab5 ("Undo: implement split-out of dive computer") Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-04-15FTDI support: ignore case when comparing magic device nameGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-04-15Cleanup: remove completers from MainTab objectGravatar Berthold Stoeger
This struct is used to store the completers during construction of the object. But it is never accessed afterwards. Therefore, remove it from the object and remove the structure definition from the header file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-15Cleanup: Move dive-equipment tab into own translation unitsGravatar Berthold Stoeger
Most tabs in the dive-information widget have there own translation units and ui-files. Only the equipment tab was married with the main tab. Move it out to get more reasonably sized translation units and some isolation. Currently, this needs ugly hacks when entering / checking for edit mode: Access to MainTab is via the MainWindow. And vice/versa, when accessing the DiveEquipmentTab from the MainTab, the former is hardcoded as the first item of an array. These hacks will soon be removed though, when making equipment editing undoable. The tabs will then be independent. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-15Cleanup: Remove MainTab::getEditMode() functionGravatar Berthold Stoeger
The only caller of said function used to check whether MainTab is in edit mode. For this case there is already a function - use that instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-15Core: turn add_single_dive() to append_dive()Gravatar Berthold Stoeger
The only external caller of add_single_dive() used it to append a dive to the global dive list. Rename the function accordingly and remove the index parameter. The internal caller can use the local insert_dive() function, which doesn't consider selection. That shouldn't be a problem, as the caller is doing import. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-15Undo: don't store insertion index in undo commandGravatar Berthold Stoeger
When adding dives in an undo command, the index is saved in the command. This seemed logical at first, because why calculate the index more than once? But actually it made the code rather subtle and brittle when multiple dives were added. Moreover, this is a pointless optimization, as it doesn't optimize the common case (only one execution). Remove this for now and calculate the index on every execution. If it ever turns out to be a bottle neck, it will be much more effective to turn the linear search of the index into a binary search. A further sensible optimization would be inserting in batches. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-15Cleanup: free dive table in trips and dive sitesGravatar Berthold Stoeger
Trips and dive sites were changed to use dive tables instead of linked lists. But the memory used for the tables wasn't freed. Do this. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-13Update CHANGELOGGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-04-14Desktop: remove edit-check in tag-widget completerGravatar Berthold Stoeger
The tag-widget was only showing the completer if we were in edit mode. The edit mode does not exist anymore - therefore remove the check. Hopefully this has no unintended consequences, like the completer not disappearing when it should. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-13Add export option to export dive sites.Gravatar Doug Junkins
Selecting "Selected dives" exports the dive sites for the selected dives. Selecting "All dives" exports all dive sites. XML format is the subsection of the divelog XML that describes the sites headed with a <divesites> section like: <divesites program='subsurface' version='3'> </divesites> Signed-off-by: Doug Junkins <junkins@foghead.com>
2019-04-14Desktop: destroy maintab before destructing mainwindowGravatar Berthold Stoeger
Apparently, in some Qt-versions the destructor of the base class calls hide on child-objects (according to Qt's object hierarchy). This is obviously called after the derived class has been destructed. In a concrete case, the base class of the destructed MainWindow would hide the TabDiveSite object. That would reset the filtering if a dive site was selected, which would indirectly access the MainWindow, which is already partially destroyed. Therefore, destroy the MainTab before destroying the MainWindow. Do this by keeping it as a std::unique_ptr subobject. Thus, it will be destroyed before the MainWindow and remove itself from Qt's object hierarchy. Reported-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>