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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
When importing a divelog, import filter presets. If there are
equal names, import only if the presets differ. In that case,
disambiguate the name. This made things a bit more complicated,
as comparison of filter presets had to be implemented.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>