summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2020-09-29filter: load filter presets from XML filesGravatar Berthold Stoeger
This is a bit painful: since we don't want to modify the filter presets when the user imports (as opposed to opens) a log, we have to provide a table where the parser stores the presets. Calling the parser is getting quite unwieldy, since many tables are passed. We probably should introduce a structure representing a full log-book at one point, which collects all the things that are saved to the log. Apart from that, this is simply the counterpart to saving to XML. The interpretation of the string data is performed by core functions, not the parser itself to avoid code duplication with the git parser. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29cleanup: move function declarations from dive.h to parse.hGravatar Berthold Stoeger
The parse_* functions should probably be declared in parse.h. Arguably, parse_xml_init() and parse_xml_exit() should be moved to an init.h file, however that doesn't yet exist. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29includes: move declaration of set_filename() from dive.h to qthelper.hGravatar Berthold Stoeger
Declare the function in the header file corresponding to the source file where the function is defined. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: implement saving of presets to XML fileGravatar Berthold Stoeger
Users might want to move their presets with there log-file. Therefore, save the presets to the log. The alternative would be to save them to the preferences. However, on the mailinglist it was decided that moving the presets to a mobile device is a wanted feature. The XML saving code has a rather reasonable interface, therefore this turned out to be pretty easy to implement. The filter presets are saved into a <filterpresets> ... </filterpresets> block Each individual preset is saved into a <filterpreset name='...'> ... </filterpreset> Block with a unique name attribute. Each preset contains zero or one fulltext and zero or more constraint entries. The type and mode(s) are controlled by attributes, the "payload" is saved in the block. Note that all the formatting is done by functions in core/filterconstraint.c and not the parser itself. A preset in the XML file might look like this: <filterpreset name='test1'> <fulltext mode='startswith'>Train</fulltext> <constraint type='planned'>0,0</constraint> <constraint type='sac' range_mode='range' negate='1'>5000,10000</constraint> </filterpreset> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add filter preset tableGravatar Berthold Stoeger
Add a table view that shows all presets and a button to delete old presets. When clicking on an item, load the preset. When the filter is reset, deselect any item. Change the preset-loading code: instead of simply loading the preset, select the preset in the table. Thus, it will be loaded implicitly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: connect load filter preset functionality to uiGravatar Berthold Stoeger
Add a button to the filter preset widget that allows the user to load a previously saved filter preset. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: connect DiveListNotifier signals to filter preset modelGravatar Berthold Stoeger
Thus, the model is kept up to date if filter presets are changed by undo commands. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: create a primitive "create filter preset" dialogGravatar Berthold Stoeger
The dialog asks the user for a name and warns if the name already exists, i.e. an old filter preset will be overwritten. Possibly, this should contain an auto-completion facility in the case that the user wants to overwrite old presets. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add filter preset undo commandsGravatar Berthold Stoeger
Add undo commands to add / edit / delete filter presets. These are styled after the other undo commands: On changes, the UI is informed by DiveListNotifier signals. Editing is a simple std::swap of values. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add (very primitive) filterpresetmodelGravatar Berthold Stoeger
Implement a trivial model to provide the filter preset names to the UI. Sadly, for now this features the QWidget/QML column / name dichotomy. However, in this simple case that shouldn't be too much of an issue. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add primitive filter presetsGravatar Berthold Stoeger
Add a rudimentary list of filter presets to the core. The list is sorted by name. Access is provided via a C interface so that the presets can be written to the git and XML logs. Internally, the list is realized by a C++ vector for convenience (euphemism for laziness). Morover, a C++ interface is provided for the UI. Currently names of the presets cannot be edited, since this would mean that the order of the list changes. This may be implemented later if required. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: unify desktop and mobile filtersGravatar Berthold Stoeger
Switch the mobile code to use the constraint-based filter. The one thing that is still commented out is dive-site mode, since mobile doesn't (yet) have a dive-site edit feature. And even if it had, the dive list probably wouldn't be shown at the same time. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: connect new filtercode to filterwidget2Gravatar Berthold Stoeger
Replace the static filterwidget with a list of filterconstraints. The first attempt of using a table widget failed, because Qt's table delegates are dysfunctional. It's not that they are bad, they just don't work at all. Therefore, this code "simulates" a table in that on addition / deletion of constraints it keeps track of the rows of all constraints so that each constraint-widget can be associated with a row of the constraint model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add a filter constraint widgetGravatar Berthold Stoeger
This add a widget that represents a single filter constraint. Since filter constraints are very general, the widget has to consider a number of cases: - numerical ranges - star-widget ranges - string lists - multiple choice lists Moreover, it supports units, which must be updated when the preferences change. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add filter constraint modelGravatar Berthold Stoeger
Add a model that keeps track of a list of filter constraint and makes them accessible from Qt. Sadly, this is mostly repetitive boiler-plate code, but this is due to Qt's model/view-API, which is a perfect example of how *not* to design a reasonable modern API. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add filter constraint object to the coreGravatar Berthold Stoeger
Adds a filter constraint object to the core, which represents one constraint the user can filter dives with. The plan is to write these constraints to the XML and git logs. Therefore, this code is written in C-style except when it comes to handling strings and dates, which is just too painful in plain C. There is one pointer to QStringList in the class, though when compiled with C, this is simply transformed into a pointer to void. Granted, that smells of an ugly hack. However it's more pragmatic than self-flaggelation with C string and list handling. A filter constraint is supposed to be a very general thing, which can filter for strings, multiple-choice lists, numerical ranges and date ranges. Range constraints have a range mode: less-or-equal, greater-or-equal or in-range. Text constraints have a string mode: startswith, substring or exact. All the data are accessed via setter and getter functions for at least basic levels of isolation, despite being written with a C-interface in mind. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29fulltext: remember original queryGravatar Berthold Stoeger
So far, the fulltext-query structure only saves an canonicalized upper-cased version of the query. However, if we want to save the fulltext query to the log (filter presets) or want to restore an old fulltext query, we have to store the original query. We don't want to confront the user with the mangled upper-cased version. Therefore, also save the original version. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29core: add functions to core/time.cGravatar Berthold Stoeger
To support the new filter code, add helper functions that turn timestamps into year and day-of-week to core/time.c. Internally, these functions simply call utc_mktime() to break down the timestamp and then extract the wanted value. This may appear inefficient, but testing shows that modern compilers are quite effective in throwing away the unneeded calculations. FWIW in this respect clang10 outperformed gcc10. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29Use correct pO2 when computing MOD in equipment tabGravatar Robert C. Helling
The cylinder model is used both in the planner and the equipment tab. We have three preferences for the pO2 that is used to compute MOD: In the planner, there is one for the bottom part of the dive and another one for deco. Those are set in the planenr UI. There is another value, controlled in the Tec Prefernces. That one should be used in the equipment tab rather than the one from the planner. Fixes #2984 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-09-29Prefer "GPS1" for divecomputer download dive site resolutionGravatar Linus Torvalds
I think we only have one dive computer that supports GPS data right now: the Garmin Descent Mk1. It reports the dive coordinates as "GPS1" and "GPS2" for the entry point and exit point respectively. Often GPS1 is missing, because the dive computer may not have gotten a GPS lock before the diver jumped into the water, so when that happens we'll use GPS2 for the dive site location. But when GPS1 exists, we should prefer that. And that's what we already did in logic in dc_get_gps_location(), but for the initial dive site created at download time, we just picked any divecomputer reported string that started with "GPS". And since GPS2 is reported after GPS1 by the Garmin Descent, it would end up overwriting the entry point that we _should_ have preferred. Add the same kind of "explicitly prefer GPS1" logic to the initial dive download case as we already had elsewhere. Reported-by: @brysconsulting Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-09-29cleanup: remove unnecessary includes in divelistview.cppGravatar Berthold Stoeger
Most of these became unnecessary when including media in the undo system. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29Update INSTALL to correct PCLinuxOS packagelistGravatar Jason Bramwell
PCLinuxOS package list was stale, it contained a typo and also had missing packages. Signed-off-by: Jason Bramwell <jb2cool@gmail.com>
2020-09-29gps: remove unused member functionGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-28build-system: update OBS spec fileGravatar Dirk Hohndel
Just trying to keep things in sync with what we actually use in the automated builds. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-28build-system: document how to create a Windows installerGravatar Dirk Hohndel
These are the instructions that I use at this point. Removed a long obsolete script - it's been many, many years since that last was useful (it was still using qmake to try to build Subsurface) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-28mobile: update version to 3.0.16Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-27mobile/dive-list: correctly update view when changing dive dateGravatar Dirk Hohndel
If the dive timestamp changes, the dive could move in the dive list. But the current dive actually doesn't change (it's still the same dive, right?). Yet we need to update the dive list as well as the shown dive (especially if this is after adding a dive, which is first inserted with the current time and then updated with whatever the user enters). Fixes: #2971 Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-27Updating INSTALL to bring it up to date for latest distro versionsGravatar Jason Bramwell
Update INSTALL to improve installation instructions for Fedora and Raspberry Pi. Fedora Add 2 packages: bluez-libz-devel redhat-rmp-config Raspberry Pi (untested) Bump version numbers to Buster/20.04 Update package list to reflect Debian/Ubuntu Added: libbluetooth-dev qtdeclarative5-dev qtdeclarative-private-dev Signed-off-by: Jason Bramwell <jb2cool@gmail.com>
2020-09-27documentation: layout change for README badgesGravatar Dirk Hohndel
I just think this looks nicer than having them across that many lines... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-27documentation: update INSTALL file to add libbluetooth-dev etcGravatar Jason Bramwell
When attempting to compile under Debian and Ubuntu the build script would get stuck looking for bluez. This change adds libbluetooth-dev to the suggested install packages for Debian and Ubuntu. Thus update also changes the yum install command in the Fedora instructions to the newer dnf command as well as updating the versions listed of Debiand and Ubuntu to the latest versions. Signed-off-by: Jason Bramwell <jb2cool@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-23Update translations from Transifexv4.9.7Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-22cleanup: silence two compiler warnings in git-access.cGravatar Berthold Stoeger
gcc complained about two constructs of the kind remote_id && SSRF_INFO("..."); And while I am not a fan of excessive warnings, I must say it has a point here. That's just code obfuscation. In fact, it appears that the condition was wrong - the SSRF_INFO should probably be invoked if remote_id is NULL. The way it was written it would be invoked if it was *not* NULL. Change both instances to unfancy if statements. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-21translations: initialize water type strings at run timeGravatar Berthold Stoeger
The water type strings were static and therefore passed through gettextFromC::tr() before main(). One would hope to get a warning in such a case, but this is not the case. Therefore, use the QT_TRANSLATE_NOOP macro to register the strings in Qt's translation system and translate the list when needed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-21Update to current libdivecomputerGravatar Dirk Hohndel
Fix memory usage bugs identified by Coverity Fix salt/freshwater parsing for Mares Genius Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-21Bailout segment is part of bottom timeGravatar Robert C. Helling
The clock is only valid in ascent. In each cycle of the 'critial volume algorithm' it re-initialized to the bottom time at the beginning of deco. So the time spent on bailout should be added to this bottom time. Thanks to Coverty for spotting this. Coverity-scan: CID-362079 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-09-20Update translations from TransifexGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-20selection: when changing current dive make sure it is selectedGravatar Berthold Stoeger
When an undo command selected invisible dives, a current dive outside of the list of selected dives was chosen. This could have the very unfortunate effect that the current dive was set, though not selected. From an UI point of view this meant that the dive was displayed, but edits would not be registered. Change the setClosestCurrentDive function to select the current dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-20dive list: on reload update filter statusGravatar Berthold Stoeger
At some time, when introducing the global reset signal the filter stopped being reloaded when loading a new log. This leads to very strange UI behavior: dives disappear when editing fields unrelated to the filter. Therefore, when reloading the model, reset the filter. One might argue whether this is the correct place. On the other hand, we might even make the filter a sub-object of the dive-list model. Let's think about this. Partially solves #2961 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-20build-system/packaging: add bluez dependency for Coverity buildGravatar Dirk Hohndel
I had missed this one in commit d73e0a0fb4028ea967ce24a162328853dd248dac ("build-system/packaging: add bluez dependency for Linux builds"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-19Update ReleaseNotesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-19build-system/packaging: add bluez dependency for Linux buildsGravatar Dirk Hohndel
I hope this captures all the variations Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-19core/bluetooth: only Linux / Windows are supported by libdc rfcommGravatar Dirk Hohndel
For Android the Qt Bluetooth code seems to work just fine. And for macOS nothing appears to work right now, but at least the Qt implementation compiles and links. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-19core/bluetooth: switch to use libdivecomputer rfcomm supportGravatar Linus Torvalds
The Qt based implementation apparently got broken at some point and now fails to connect to rfcomm dive computers like the Shearwater Petrel. This uses the libdivecomputer rfcomm backend. Tested to work with bluez on Linux as well as with the native Windows implementation. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-19Update to current libdivecomputerGravatar Dirk Hohndel
Merge Shearwater PNF fix. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-19Update Shearwater sample time calculationGravatar Miika Turkia
At least Shearwater Cloud seems to use multiple formats for sample time recorded in the database. Sometimes the time is in seconds, sometimes in milliseconds, and sometime it is something I have no idea about. Thus switching to calculating the sample id myself and using sample interval to calculate the actual sample time. Seems to be more reliable than trying to guess what format Shearwater is using for this specific dive. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-09-19media: read timestamp from mvhd header of MP4/QuickTime videosGravatar Berthold Stoeger
ExifTools (and probably other meta-data editors) modifies the mvhd creation date, but leaves the individual creation dates in the tracks unchanged. Therefore, use the mvhd atom. Reported-by: Eric Tanguy <erictanguy2@orange.fr> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-17mobile: update version to 3.0.15Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-17Update to current libdivecomputerGravatar Dirk Hohndel
This adds BLE transport as an option for the McLean Extreme. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-17Extend BLE uuid matching to the characteristics, add ignore-listGravatar Linus Torvalds
This extends the uuid matching to the low-level characteristics too, so that we can ignore the McLean Extreme characteristics that aren't interesting. It also renames the uuid matching to be about a "uuid_list" rather than being about the service we're matching, since we're now using it for other uuid's than just services. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-09-17Fix 'uud' typo in BLE uuid matching codeGravatar Linus Torvalds
Silly typo with a missing 'i' in 'uuid' that happened when I wrote this code originally, and that compiled fine thanks to the error being duplicated with cut-and-paste to all relevant places. Fix it now, since I'll extend the uuid matching to the actual characteristics for the McLean Extreme. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>