Commit graph

16285 commits

Author SHA1 Message Date
Dirk Hohndel
320d2c47aa Mobile: fix incorrect variable dereference for dive site
Since we are accessing the model, this is the variable we should use.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
f69b93de40 Mobile: don't push map page if it's already on the stack
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
4e583f9120 Mobile: avoid dereferencing undefined values
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Dirk Hohndel
face9ba1a8 Mobile: fix cacheBuffer for log window
The old value made no sense at all. Why would we want to cache up to 10k
entries of the log?

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:38:26 -07:00
Berthold Stoeger
a4ca3c520c Undo: simplify profile repainting code
The profile repainting code that was called when a dive changed was
located in a separate function. Not only did it take a redundant
parameter, it also performed very weird stuff like entering and
exiting plan state. That did not work at all. Replace by a simple
call to plotDive() and things work much better.

There was a comment about DivePlannerPointsModel and profile
getting out of sync. So let's keep an eye out for that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-26 11:36:23 -07:00
Berthold Stoeger
8dea2ada3b Undo: turn dive- and trip-fields into flags
The divesEdited signal sends the changed field as a parameter.
Since some undo-commands change multiple fields, this led to
numerous signals for a single command. This in turn would lead
to multiple profile-reloads and statistic recalculations.

Therefore, turn the enum into a bitfield. For simplicity,
provide a constructor that takes classical flags and turns
them into the bitfield. This is necessary because C-style
named initialization is only supported on C++20 onward!

Is this somewhat overengineered? Yes, maybe.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-26 11:36:23 -07:00
Berthold Stoeger
5c4d163a41 Undo: update statistics if dive changed
On undo/redo, the dive statistics tab was not updated even
if a selected dive was changed. Fix that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-26 11:36:23 -07:00
Berthold Stoeger
c479c5ca36 Desktop: use undo command when replanning dive
Instead of copying the displayed dive, generate an undo command.
This makes the replanning an undoable action and fixes a bug
where the dive details have not been updated correctly.

Fixes #2280

Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-26 11:36:23 -07:00
Berthold Stoeger
7b730602c6 Undo: implement ReplanDive command
Implement an undo command that overwrites the dive-computers and
cylinders of the current dive with a given dive. This will be used
when replanning a dive.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-26 11:36:23 -07:00
Berthold Stoeger
6a6b992a77 Desktop: make salinity a field known to the undo system
The undo system sets updates individual dive fields on
redo respectively undo. Make salinity such a field, since
it is changed on replanning a dive.

To do this, break out the "update salinity" functionality
into its own function, add an entry to the DiveField enum
and add the corresponding switch-case.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-26 11:36:23 -07:00
Berthold Stoeger
d16d57577d Core: export dive-computer freeing function
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>
2019-10-26 11:36:23 -07:00
Dirk Hohndel
70737b9eec Cleanup: use correct loop bounds
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>
2019-10-26 11:35:16 -07:00
Dirk Hohndel
56e8ac0bd7 Cleanup: free nickname only once
Found by Coverity. Fixes CID 350123

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-26 11:35:16 -07:00
Dirk Hohndel
13a1154650 GitHub Actions: one more set of typos fixed
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>
2019-10-26 04:39:32 -07:00
Dirk Hohndel
394948e2cf Mares: improve BT discovery logic
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>
2019-10-26 04:39:32 -07:00
Dirk Hohndel
d4ce793540 GitHub Actions: fix several errors in previous commits
I have no excuse.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-25 22:07:03 -04:00
Dirk Hohndel
2aac551089 GitHub Actions: add apt-get update before installing curl
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-25 21:49:41 -04:00
Dirk Hohndel
de1e439110 GitHub Actions: only build pushes into and PR against master
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>
2019-10-25 18:32:50 -07:00
Dirk Hohndel
f83505b554 GitHub Actions: push to transfer.sh for PRs, post release for pushes
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>
2019-10-25 18:32:50 -07:00
Dirk Hohndel
a07c2feb95 GitHub Actions: run them on pull requests as well
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>
2019-10-25 14:13:15 +02:00
Linus Torvalds
7273161acf Mares: add BT discovery logic
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>
2019-10-25 04:34:51 -07:00
Dirk Hohndel
96386fbcc1 Update libdivecomputer
- Add support for the Oceanic Geo 4.0
- clean up Shearwater tank pressure handling
- minor fixlets

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-24 06:33:07 -04:00
Anton Lundin
d99b889c62 GitHub Actions: Add automatic coverity scan
This adds a automatic coverity scan build based on linux-bionic-5.9.yml

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2019-10-23 07:20:57 -04:00
Dirk Hohndel
78f914e7f0 Small update to the mobile manual
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>
2019-10-21 15:50:41 -04:00
Dirk Hohndel
e6298f9352 Mobile: allow editing dive number
No checks regarding duplicate numbers - we trust the user knows what
they are doing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-21 15:50:41 -04:00
Dirk Hohndel
158a2ec159 Mobile: remove remaining accesses to DiveObjectHelper from QML
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>
2019-10-20 16:08:55 -04:00
Dirk Hohndel
32ae3810ce Core: move cylinder list getter into helper function
Thie way we can use it from the dive list model.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-20 16:08:55 -04:00
Dirk Hohndel
613a3112d2 Mobile: get dive details directly from the model
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>
2019-10-20 16:08:55 -04:00
Dirk Hohndel
09c7115e21 Core: make helper functions global
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>
2019-10-20 16:08:55 -04:00
Dirk Hohndel
5a10cd42f7 Core: debug helper for DOH constructor
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>
2019-10-20 16:08:55 -04:00
Berthold Stoeger
769403a4b2 Planner: copy deco state before passing it to worker thread
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>
2019-10-20 16:20:58 +02:00
Dirk Hohndel
f7c8d65add GitHub Actions: fix logic error for new tags
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>
2019-10-20 06:46:30 -04:00
Berthold Stoeger
fdfcbd0315 Cleanup: use pointer-to-member-function in addAction() calls
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>
2019-10-20 03:51:11 -04:00
Dirk Hohndel
39c36af808 Travis: remove last Travis builds
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-19 08:56:40 -04:00
Dirk Hohndel
39203a7ebd GitHub Action: add iOS build
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>
2019-10-19 08:55:31 -04:00
Dirk Hohndel
b652e5dd66 Travis: remove redundant builds
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-18 20:46:01 -07:00
Dirk Hohndel
0e11ef39d0 GitHub Actions: add Linux Bionic / Qt 5.9 build
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>
2019-10-18 20:46:01 -07:00
Dirk Hohndel
d608f027d1 GitHub Actions: add Android build
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-18 20:46:01 -07:00
Dirk Hohndel
6b334ac7d9 GitHub Actions: improve naming and location of files
Just to make things a little more consistent.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-18 20:46:01 -07:00
Dirk Hohndel
2f1997fb3a GitHub Actions: support creation of releases based on tags
And fix parsing of ref.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-18 20:46:01 -07:00
Dirk Hohndel
aff54e17e5 GitHub Actions: post releases
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>
2019-10-18 20:46:01 -07:00
Dirk Hohndel
f099b22820 GitHub Actions: build Windows binaries
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-18 20:46:01 -07:00
Dirk Hohndel
ef3d67be08 GitHub Actions: add Linux Qt 5.12 container build
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>
2019-10-16 10:57:32 -07:00
Dirk Hohndel
754fffc795 GitHub Actions: first CI/CD build for Mac based on GitHub Actions
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>
2019-10-14 21:00:10 -07:00
Dirk Hohndel
0f3d287200 Desktop: update to Grantlee 5.1
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>
2019-10-14 21:00:10 -07:00
Dirk Hohndel
01f1bea995 Mobile: ensure input fields stay visible after keyboard opens
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>
2019-10-14 13:39:45 -07:00
Dirk Hohndel
85d810119b Mobile: pick icons depending on theme
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>
2019-10-14 13:39:45 -07:00
Dirk Hohndel
804a5be71f Travis: test mobile build under Linux-Trusty-Qt-5.12
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-14 13:37:17 -07:00
Dirk Hohndel
5ce4b3d5eb build-system: Subsurface-mobile now requires Qt 5.11
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>
2019-10-14 13:37:17 -07:00
Dirk Hohndel
3df2be5c16 build-system: require Qt 5.9.1 or newer
With this all BT platforms now support BLE

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-14 13:37:17 -07:00