aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2020-10-16build-system: add GitHub action for openSUSE Leap 15.2Gravatar Dirk Hohndel
This way we test a Qt 5.15 build. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-16build-system: add GitHub action for Ubuntu 20.10Gravatar Dirk Hohndel
This way we test a Qt 5.14 build. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-16build-system: improve finding of libdivecomputer.aGravatar Dirk Hohndel
On some systems it ends up in lib64 instead of lib. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-16build-system: fix libgit2 detectionGravatar Dirk Hohndel
Usually ldconfig isn't in the user's path. Suggested-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-16core: use case-insensitive comparison for device modelsGravatar Berthold Stoeger
The code in core/libdivecomputer.c used string insensitive comparison for device models, before being merged into core/device.c. Let's reinstate that behavior, since it appears to be more logical. On would assume that two different vendors will not use the same model with different casing (and the same device-ids), so that should be safe. This uses strcoll to correctly sort unicode, which will hopefully never be needed! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16cleanup: replace std::find_if by std::any_ofGravatar Berthold Stoeger
To search for devices with the same model, we used find_if(). However, that was only to check whether such a thing exists, not to actually do something with said device. Therefore, change this to std::any_of() to make it clear what the purpose of the statement is. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16core: add device_table parameter to device table functionsGravatar Berthold Stoeger
Instead of accessing the global device table directly, add a parameter to all device-table accessing functions. This makes all places in the code that access the global device table grep-able, which is necessary to include the device-table code in the undo system. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16core: remove call_for_each_dc()Gravatar Berthold Stoeger
The core now loops over the devices directly - no need for this callback. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16core: use C accessors in core/save-xml.c instead of callbackGravatar Berthold Stoeger
We now can loop over devices from C and check for selection. So let's get rid of the last user of the call_for_all_devices() callback. Code readability improvement is not stellar, but one less place where we shoe-horn user data through a void-pointer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16core: factor out device_is_used_by_selected_dive() functionGravatar Berthold Stoeger
We have a callback for all devices with a twist: it can loop over those devices that are used by a selected dive. This is used for exporting a subset of the dive log. Factor out the "is device used by selected dive" part of the function and make it available to C. The goal is to make the whole callback thing unnecessary and let C code loop directly over the device list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16core: use C accessors in core/save-git.c instead of callbackGravatar Berthold Stoeger
Now we can simply loop over the list of devices. In this case, it's not much more readable, but at least we don't have that nasty pass user-data through "void *" pattern. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16cleanup: remove device::operator!=()Gravatar Berthold Stoeger
This was not used. Moreover, mark device::operator==() for removal. This is used for detecting changes in the DiveComputerModel. This can be removed once that is integrated into the undo system. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16core: use C accessors in core/libdivecomputer.c instead of callbackGravatar Berthold Stoeger
Searching the proper device for the divecomputer was done via a callback. Very hard to follow code. Since we can now access "struct device" from C, obtain it directly via get_device_for_dc(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16core: make get_device_for_dc() accessible from CGravatar Berthold Stoeger
The function getDCExact() was used to search for a device structure matching a divecomputer. Since C code can now access struct device, we can export that function to C. Rename it to get_device_for_dc() for consistency with naming of the core functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16core: add C struct device and struct device_table accessorsGravatar Berthold Stoeger
Up to now, "struct device" and "struct device_table" were C++ only, because they used C++ strings for convenience. Since we switched from QString to std::string, we can create accessors for these structs. For the C code, we simply declare them as opaque structs and give the full definition only for C++. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16cleanup: use std::vector in struct device_tableGravatar Berthold Stoeger
Since we converted from QString to std::string, let's also use std::vector instead of QVector. We don't need COW semantics and all the rigmarole. Let's try to keep Qt data structures out of the core. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16cleanup: use std::string in struct deviceGravatar Berthold Stoeger
struct device is a core data structure and therefore shouldn't use QString. QString stores as UTF-16 (which is a very questionable choice in itself). However, the real problem is that this puts us in lifetime-management hell when interfacing with C code: The UTF-16 has to be converted to UTF-8, but when returning such a string, this puts burden on the caller who has to free it. In fact, instead of looping over devices from C-code we had a callback that sent down temporary C-strings with qPrintable. In contrast, std::string is guaranteed to store its data as contiguous null-terminated and C-compatible strings. Therefore, replace the QString by std::string. Keep the QString just in one place that formats a hexadecimal number to avoid any potential change. The disadvantage of using std::string is that it will crash when constructed with a NULL argument, consistent with C-style functions such as strcmp, etc. Arguably, NULL is different from the empty string even though we treat both as the same. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16cleanup: fix tiny memory hole in device.cppGravatar Berthold Stoeger
empty_string() returns true for "". Thus, we can't simply overwrite the pointer if empyt_string() returns true, but must free the string regardless. The joys of C memory management! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-16build-system/macOS: remove Qt SQL plugins and suppress some errorsGravatar Dirk Hohndel
Technically with this the app might be ready for AppStore inclusion. I don't see myself spending the energy on that, TBH. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-16Duration is in secondsGravatar Miika Turkia
The dive duration is given in seconds in the Shearwater cloud database. (At least nowadays.) Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-10-16build-system: switch to current libhidapiGravatar Dirk Hohndel
A few years ago the upstream for libhidapi changed - it became part of the libusb GitHub org. Switching to the latest version appears to fix some odd problems with talking to the Suunto Eon Steele/Core dive computers on macOS (at least I can no longer reproduce the problem after switching to the current version). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-16build-system: add GitHub scanningGravatar Dirk Hohndel
Enable the newly re-imagined Semmel based CodeQL scanning. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-16parser: fix parsing of DAN filesGravatar Berthold Stoeger
The last two parameters of the parse_dan_format() function were mixed up: sites should come before filter_presets. This should have caused crashes, for DAN files with dive sites. I don't understand why this didn't cause compiler warnings. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-13core: fix detection of duplicate device namesGravatar Berthold Stoeger
Recently (c9b8584bd2) the sort criteria of the device-table was changed from (model/id) to (id/model). However, that messed with the detection of duplicate device names: there, the code searched for the first element greater or equal to (model / 0). With the reversal of the sort criteria, this would now always give the first element. Therefore, do a simple non-binary search, which is much more robust. The binary search was a silly and pointless premature optimization anyway - don't do such things if not necessary! Since only one place in the code search for existence for a model-name, fold the corresponding function into that place. Moreover, change the code to do a case-insensitive compare. This is consistent with the dc_match_serial() code in core/libdivecomputer.c, where matching models is case-insensitive! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-13cleanup: remove unused function is_default_dive_computer()Gravatar Berthold Stoeger
The last actual user was apparently removed back in 2013(!): 34db6dc2bea6173c070c9820a2e57a511b9ca0b1 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-13Update translations from TransifexGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-11documentation: update build instructions for various Debian/Ubuntu flavorsGravatar Dirk Hohndel
This was missing the Qt Quick Controls.2 needed for the mobile on desktop build and all the modules for actually running subsurface-mobile. Also, there was a white space inconsistency that I fixed while I was at it. And an outdated reference to ancient Fedora changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-11Set the NO_PRINTING variable properlyGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-10-11core: sort device-table by id/model instead of model/idGravatar Berthold Stoeger
The device table is accessed by core via a callback using call_for_each_dc(). This sorts the table by device-id. It is unclear whether this is needed - since currently all it does is make sure that the devices have a fixed order in XML and git log files. In any case, this means that the table had to be copied and sorted in call_for_each_dc(). Since the frontend now does its own sorting, we can just keep the core table sorted as it needs it. This in turn will ultimately make it possible to replace the callback by a simple loop. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-11desktop: make divecomputer table sortableGravatar Berthold Stoeger
Add a small proxy-model on top of DiveComputerModel so that clicking on table headers makes the table sortable. The UI feature here is not as important as the fact that the UI does its own sorting and we can keep the device-table in the core sorted differently. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-09CHANGELOG.md: add note about fixing missing Vista themeGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2020-10-09packaging/windows: add the /styles folderGravatar Lubomir I. Ivanov
For Windows, the Subsurface installers do not include the file "qwindowsvistastyle.dll" required to make the applications that are published to have a native look. Modify the MXE *build.sh scripts to include the file as "plugins/styles/qwindowsvistastyle.dll". Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2020-10-08build-system: remove Grantlee references from legacy scriptsGravatar Dirk Hohndel
I debated about this commit... we don't use these scripts any more, but it seems like it would be worse to leave the Grantlee references in them. Yet of course this is all no longer tested. Maybe it is time to delete the scripts from the tree. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-08build-system: remove Grantlee from the packaging scriptsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-08build-system: remove Grantlee from the container setup scriptsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-08build-system: remove Grantlee from the get-dep-lib scriptGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-08build-system: remove building Grantlee from Snap buildGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-08build-system: remove building Grantlee from AppImage buildGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-08build-system: remove building Grantlee cmakeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-08build-system: remove building Grantlee from build scriptGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-08Remove code references to GrantleeGravatar Robert C. Helling
These are no longer needed. What is still missing is removing Grantlee from the various build systems. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-08Interpret divelist printing templatesGravatar Robert C. Helling
This is a first step of an efford to get rid of the Grantlee dependency. This implements template processing for those constructs used in our divelist and statistics printing templates. It implements a template parser for loops over dives, cylinders and year and variable replacement. As the previous Grantlee code, it does not really use Qt's QObject introspection capabilities but reuses the old long chain of if-else-statements. The grantlee code is not yet removed. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-06Update translations from TransifexGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-06Update translation source stringsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-06build-sytem: hide archived Subsurface version from translation scanGravatar Dirk Hohndel
The release process creates full Subsurface trees under tmp. Don't pick those up when looking for source strings. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-06cleanup: use safe connect() in ConfigureDiveComputerDialogGravatar Berthold Stoeger
The pointer-to-member-function version is compile-time checked and therefore less risky with respect to refactoring. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-06cleanup: use pointer-to-function connect() in ConfigureDiveComputerGravatar Berthold Stoeger
This version is compile-time checked and therefore less risky with respect to refactoring. Since the same three signals were connect()ed for three different threads-objects, do this in a new function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-05Remove empty vertical space from filter QListWidgetGravatar willemferguson
In the filter the dropdown lists for selecting dive mode or day-of-week has a lot of white space at the bottom. This PR removes that white space. Actually the white space at the bottom of a QListWidget appears to be a known bug (actually an omission) for the current Qt V15. The above solution is a brute-force workaround to achieve the same end result. The active line is actually the setFixedSize(). The other line, however, comprises good QT layout policy to minimise widget size. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-10-05core: don't merge sample-derived pressures in merge_one_cylinder()Gravatar Berthold Stoeger
These will be recalculated from the pressures in fixup_dive() anyway. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-05core: improve merging of cylinders pressuresGravatar Berthold Stoeger
When merging cylinders pressures derived from samples were taken as maximum of the start and minimum of the end pressure, which makes sense, since we believe that this is the same cylinder. However, for manually entered pressures, this was not done. Moreover, when one dive had manual pressures and the other only pressure from samples, the manual pressure was taken. However, that could have been the wrong one, for example if the end pressure was manually set for the cylinder of the first part of the dive, but not the last. Therefore, improve merging of manuall set pressures in two ways: 1) use maximum/minimum for start/end pressure 2) if the pressure of one cylinder was manually set, but not for the other, complete with the sample pressure (if that exists). Fixes #2884. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>