The dive-computer freeing code was local to dive.c. Implementing
the replan undo-command will need that functionality. Therefore,
export it as a global function.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
I'm a bit confused why this enum has two extra values, NUM_DIVEMODE and
UNDEF_COMP_TYPE. I can see how this could create confusion. This may
benefit from addition review.
Found by Coverity. Fixes CID 350092.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I am at a loss for words. Especially as we didn't need those quotes in
the first place. What was I thinking?
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
At least in one of the logs we saw there seemed to be trailing spaces.
It should be enough for the BT name to start with "Mares Genius" in
order to be recognized.
Suggested-by: Jef Driesen <jef@libdivecomputer.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should fix the odd double builds for people who create branches for
pull requests in the main repository.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This means that PRs from people using the main repo for their staging
branches will get both transfer.sh and a release.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I wonder if this will cause issues where the actions sometimes run
twice. But we'll deal with that rather than dealing with not having the
tests on pull requests.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't have the "show all dive computers" logic on mobile, so we need
something like this.
Possibly we should use the libdivecomputer matching code if it exists,
but that's a much bigger change, let's do this incremental one for now.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The edit description wasn't detailed enough to need changing, but I
noticed a reference to behavior that we have disabled.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a couple more roles and remove the dive role that allows accesss to
the DiveObjectHelper in the first place.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
By getting a DiveObjectHelper and then dereferencing that we ended up
creating hundres and hundreds of these objects, only to immediately
destroy them after using a tiny part of the data.
Instead make those data available directly from the model, without
having to create a DiveObjectHelper forst.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We'll use them from the model in order to avoid creating this many
DiveObjectHelpers when showing a dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is disabled by default - but when compiled in it makes it a lot
easier to pinpoint why we are creating so many DiveObjectHelpers.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The planner has a computeVariations() function that can be run
in a worker thread. The code was not thread safe: a deco_state
object allocated on the stack of the caller was passed down to
the worker thread. It's well possible that the object would go
out of scope before the thread run.
Therefore, when running in the background, copy the object first
and free it in the worker thread.
Side note: Qt makes proper memory management again as difficult
as possible: You can't pass a std::unique_ptr<> to QtConcurrent::run,
because move-only objects are not supported. Not very friendly!
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
It is clear why this wasn't caught in my testing, but the bug should
have been really obvious simply reading through the code.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since requiring Qt >= 5.9.1, we can use the pointer-to-member-function
overloads of addAction (introduced in Qt 5.6). This has the advantage
of compile-time checking of the signal/slot parameters.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This is incredibly brute force, downloading a 3+GB installer and
installing all of the Qt/iOS binaries.
This first attempt is mainly to get an idea how long this will take and
if this will fit within the size constraints of the build VM. This
commit doesn't even try to build, yet.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
No artifacts from this build are preserved, this is just to make sure
that we can still build the desktop version against Qt 5.9.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This so far just works on push and hopefullt pull requests, not for tags
and therefore actual releases.
In order not to conflict with the binaries from Travis, I changed the
name to "ci-release" instead of "continuous".
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The AppImage works - I just need to figure out how to post releases. For now
it'a available on the Actions page as Artifact.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This feature is in beta right now and might change without notice, but instead
of dealing with the broken Travis Mac builds, this does seem progress.
The build artifact seems to work, but it's a bit more painful to get to. Go to
https://github.com/Subsurface-divelog/subsurface/actions and click on the
corresponding run - it's then in the top right corner under Artifacts. The one
oddity is that after unzipping the file you need to manually make
Contents/MacOS/Subsurface executable.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Also make sure Grantlee still compiles with Qt 5.13 by cherry picking a commit
that was added after the v5.1.0 release.
In order to identify this commit as comming from the build automation we
temporarily override the user name and email address. As a side effect this
also makes this work on Travis.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When the user taps on a TextField to enter text, usually the virtual
keyboard will pop up. This code tries to ensure that the keyboard
doesn't cover the entry field that the user was trying to work on.
In order to centralize these changes, this introduces a new
SsrfTextField type which we use to also remove a few redundant default
settings that we previously had for every field. The one TextArea for
the Notes field didn't seem worth creating yet another type for, so
there the changes are done directly in DiveDetailsEdit.
The awkward timer mechanism is necessary as the keyboard pops up
asynchronously and then triggers a change of height for the app, so we
need to wait a little bit before doing the adjustment.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
QML has ways to style icons - and we use that for the main theme color,
but it doesn't seem to work (anymore?) for the edit and save icons.
Instead of tracking down what changed there, simply switch between icons
with different foreground color, depending on theme.
All the other icons seem to work well in all three themes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is one of the side effects of switching to Kirigami 5.62 - but since
we build our mobile versions with Qt 5.12 and Qt 5.13, this really isn't
an issue.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This reverts commit 60e63afb82.
I merged this to early without paying attention to the fact that this
needed an updated build container as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While on mobile there should always be only one selected dive, it's very
cheap to make sure that amount_selected is tracked correctly. The
incrementing of amount_selected is done in case an invalid id is passed
in.
Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When switching to the global tool bar this was lost, and then it turned
out to be broken and required more patches to fix.
Commented out because it doesn't work at all.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way we'll get a working back icon on Android and also correct font
size for the (translated) Back text.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Kirigami isn't picking up our font for the Back entry in sub menus.
Also, we still don't get a back button icon on Android. This will
allow us to work around that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This looks extremely fishy to me, but it does seem sufficient to
get the forward and backward buttons to show up in the toolbar.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Whatever I try, the toolbar background is always based on the 'active'
color set in qtquickcontrols2.conf, not on anything that I can set in
QML code. So in an effort to brute-force the issue, this hardcodes the
subsurfaceTheme value in the toolbar UI code of Kirigami.
To make this easier, this (and one of the other hacks) is added to the
existing kirigami.diff.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>