aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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>
2020-10-05cleanup: remove libdc_serial field in device_data_tGravatar Berthold Stoeger
This was only set but never read. Therefore, remove it. Divecomputer serial numbers are now handled via a string-based interface. We can't remove the integer-based firmware number, because that is still used by the OSTC firmware check in ConfigureDiveComputerDialog. Let's not risk breaking that. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-05cleanup: remove DC_FIELD_STRING conditional compilationGravatar Berthold Stoeger
This dates from 2014 - this should be obsolete: we certainly don't support such old libdivecomputer versions. Moreover, we bundle our own anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-05download from dive computer: correctly list transports triedGravatar Dirk Hohndel
Instead of just 'BT' or 'device name' (which is wrong in cases where we don't use a device name in the first place, like USBHID), try to list the actual transports that we will consider. A big part of this patch is just moving code around so we don't need a forward declaration of the static helper function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-05libdc/debug: provide better info regarding libdc interactionGravatar Dirk Hohndel
Instead of just sending this to the user through the progress bar text, also send things to stderr in verbose mode. That should make it easier to debug situations where we fail to download from a dive computer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-05clenup: remove bogus connect statement.Gravatar Berthold Stoeger
In OstcFirmwareCheck::saveOstcFirmware() we find the connect() call connect(dialog, SIGNAL(finished(int)), config, SLOT(dc_close())); whereby "config" is of the type "ConfigureDiveComputer". However, the function signature of ConfigureDiveComputer::dc_close reads as void dc_close(device_data_t *data); and indeed "data" is accessed inside the function. I don't understand how this doesn't crash, but clearly something is amiss. Let's remove that connect statement. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-05Use get_n2 helper functionGravatar Robert C. Helling
Now, that we have this helper function that should have been introduced long ago, we can make some more expressions more idiomatic. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-10-03planner: limit depth and time of segments to sane valuesGravatar Berthold Stoeger
Using non-sensical depth and times for segments in the planner may lead to an unresponsive UI. Therefore limit depth to 1000 m/3300 ft and time to 100 h. Limiting of depth is done in settingsChanged() since it has to adapt to the user changig their preferred units. Fixes #2762. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03cleanup: make device code more consistent with coreGravatar Berthold Stoeger
We keep track of device, i.e. distinct dive computers with id in the core. The corresponding code stuck out like a sore thumb. Firstly, because it is C++. But more importantly, because it used inconsistent nameing conventions. Notably it defined a "DiveComputerNode" when this is something very different from "struct dive_computer", the latter being the dive-computer related data of a single dive. Since the whole thing is defined in "device.h" and the function to create such an entry is called "create_device_node", call the structure "device". Use snake_case for consistency with the other core structures. Moreover, call the collection of devices "device_table" in analogy with "dive_table", etc. Overall, this should make the core code more consistent style-wise. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03cleanup: use getDCExact() instead of callback in set_dc_deviceid()Gravatar Berthold Stoeger
core/device.c used to be a C file, which couldn't access the C++ divecomputer list directly. Therefore, instead of a simple loop, searching for a matching DC was implemented via a callback with void * user data parameter. Wild. Since the file is now C++, let's just use direct access to the C++ data structures to make this readable by mere humans. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03cleanup: pass divecomputer to getDC() and getDCExact() helpersGravatar Berthold Stoeger
These are used to search for device nodes and were passed model and device id (for the exact version). However, all callers used them to search for the node corresponding to a specific struct divecomputer, so let's just pass that instead to make the caller site less complex. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03cleanup: hide DiveComputerList implementation detailsGravatar Berthold Stoeger
Remove the declaration of helper functions needed only in core/device.cpp. To this goal, turn the member functions into free functions. Cosmetics: turn the DiveComputer[Node|List] "class"es into "struct"s, since all members were public anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03Subsurface User manual update: FilterGravatar willemferguson
This adds text to the user manual pertaining to the filter tool. 2 Figures removed, 7 figures added. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-10-03filter: add tank size filter constraintGravatar Berthold Stoeger
This is an actual user request. Fixes #1787. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03filter: implement filtering for gas mixesGravatar Berthold Stoeger
This adds filter constraints for numerical filtering for gas-mixes. Currently, this does a "match any" kind of search, which means that a dive is filtered if any of its cylinders matches. We should also implement "all-of" and "none-of" modes for cylinder filtering. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03core: add N2 and general gas component accessorsGravatar Berthold Stoeger
There were helper functions to access O2 and He component fractions. Add another one for N2. Indeed, this can be used in three cases, where N2 was deduced indirectly. Moreover, add a general accessor with a gas_component argument. This will be used by the filter code to filter for gas components. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03core: make gas type enum globally availableGravatar Berthold Stoeger
The deco-routines used an enum to pass around the inert gas type. Make that globally available and make it include O2. This will be used in a future commit to generalize access of gas fractions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03dive list: when moving dives, delete first and add laterGravatar Berthold Stoeger
When moving dives between trips, the core moves the dives internally and sends a signal to the model. The model adds and removes the dives accordingly. However, when adding the new dive, the old trip hasn't changed its position, so the ordering is wrong leading to an inconsistent state. Therefore, remove the dives first and then readd them. There could still be pathological cases where this fails. However, in the short term this is an improvement. Note that in similar cases, the dives were indeed removed then added, so this case here seems to be an oversight. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03cleanup: use getDiveSelection() to loop over selected divesGravatar Berthold Stoeger
getDiveSelection() returns a vector of the selected dives. Use that instead of looping over the dive table and checking manually. This removes a few lines of code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03desktop: allow moving dives to arbitrary tripsGravatar Berthold Stoeger
The UI only allowed adding dives to trips above or below the current dive (and even that is buggy). This is a strange restriction, since trips are designed to be non-contiguous. Allow adding dives to any trip using the new trip selection dialog. The undo-command is already there, so only little code to write. This feature was requested on the mailing list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03desktop: add trip selection dialogGravatar Berthold Stoeger
A simple dialog to select a trip. Simply fill a QListWidget without the model/view rigmarole. So much less painful! Of course that means that the dialog has to be regenerated everytime it is used. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-03cleanup: replace get_trip_date_string() by get_trip_string()Gravatar Berthold Stoeger
The get_trip_date_string() formatted, as the name implies, the date of a trip. It was passed a number of parameters and had only one caller, which would also add the location if it existed. Therefore, move all that logic into the helper function and name it get_trip_string(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-02desktop: fix paging through dive list with page-up key, etcGravatar Berthold Stoeger
In the dive list we have horrible code, which intercepts all events to save the selection before/after the event. This was necessary because we couldn't get Qt's selection data flow under control. This means intercepting all events that can change the selection. The page-up, page-down, home and end keys were forgotten. Add these cases. Fixes #2957. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-01membuffer: be defensive about bad C library vsnprintf implementationsGravatar Linus Torvalds
Dirk reports that some Windows users have had odd corruption in the commit messages in the cloud storage. They make no sense at all unless there is some very weird Windows library bug. The prime suspect is 'vsnprintf()' returning a negative error when the target buffer is too small (rather than the proper "this is how much space it would need"). That is a very traditional C library bug that I thougth had been fixed everywhere, but there doesn't really seem to be a lot of other likely causes. So let's make our membuffer code be defensive against bad libraries that return negative error numbers from vsnprintf. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-09-30Update libdivecomputer to fix Garmin GPS recordingGravatar Linus Torvalds
The Garmin Descent parser had a bug that would re-use possibly stale GPS locations between dives (and in theory other data fields too, although in practice I think only GPS data was ever leaked between dives). This updates libdivecomputer to a fixed version. Reported-by: @brysconsulting Link: https://github.com/subsurface/subsurface/issues/2980 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-09-30Android BLE discovery: use discovery agentGravatar Dirk Hohndel
Android can't scan for classic BT devices, so when BT support was first added, we simply didn't use the discovery agent at all and relied on the list of paired BT devices provided by Android. This still worked fine for a lot of BLE devices that allowed 'bonding' with the Android device - similar to pairing. But some BLE devices (like the Shearwater Peregrine) don't support bonding and so our Android code didn't see them at all. With this commit we start a BLE only scan on Android to add to the list of already paired devices. Fixes: #2974 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-30bluetooth discovery: report more information about progressGravatar Dirk Hohndel
We certainly should log errors and the complete list of discovered devices. Also, it's good practice to set a specific search time (I picked three minutes). This way we won't constantly scan and drain resources. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-30bluetooth discovery: differentiate discovered and paired devicesGravatar Dirk Hohndel
We call the same helper from two spots. Once when we report the already paired BT devices on Android, and once from the deviceDescovered signal for the discovery agent. Let's make sure we can tell where the info came from. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-30documentation: release tasksGravatar Dirk Hohndel
I think I'm the only one using this list, but it makes sense to have it in the repo Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-29cleanup: rename FilterWidget2 to FilterWidgetGravatar Berthold Stoeger
The name "FilterWidget2" is historical and has no meaning anymore, since the current version has little to nothing to do with the "second" version of the widget. Rename the class and source files accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29CHANGELOG.md update concerning new filter systemGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: avoid unnecessary filter recalculations when loading setGravatar Berthold Stoeger
When loading a stored filter set, we would get numerous constraintChanged signals, which caused filter recalculations. Use the ignoreSignal flag to prevent these. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: add modified flagGravatar Berthold Stoeger
When editing the filter, the modified flag is set and shown to the user. After saving / loading / clearing the filter, the flag is reset. This simulates (probably badly) a usual load/save interface. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: show currently selected preset in a text fieldGravatar Berthold Stoeger
This provides some visual feedback on the currently selected preset. Update when changing selection or clearing the filter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: save timestamps in user-readable formatGravatar Berthold Stoeger
So far we saved timestamps by their 64-bit value as decimal strings. Change this to a user readable format. The parsing routine still supports decimal numbers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: when clearing the filter unselect the current filter presetGravatar Berthold Stoeger
It makes no sense to have the a filter preset selected after clearing the filter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: when a filter preset is selected, suggest its name on saveGravatar Berthold Stoeger
The goal here is to let the user edit already existing sets and save them using their old name. This is a stop-gap measure until we get a proper filter-set editing interface. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29core: add helper functions to format / parse timestampsGravatar Berthold Stoeger
To save datetime-based filter constraints to git or XML, it is preferrable to use human-readable representations. Therefore, add helper functions to format / parse timestamp_t 64-bit values in the "YYYY-MM-DD hh:mm:ss" format. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>