Commit graph

18109 commits

Author SHA1 Message Date
Dirk Hohndel
e9073a7570 build-system: first steps towards a 64bit Windows build
This is barely scratching the surface (no put intended), and of course the
container needs to be updated, first, to have a 64bit version of MXE installed,
but this seems to help make libmtp build correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-30 12:24:36 -07:00
Dirk Hohndel
cdf1865246 build-system: add libmtp for our Windows builds
This uses latest master (as that's the only one that has the explicit
Descent Mk2i support in it).

Right now, unfortunately the MXE build fails.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-30 12:24:36 -07:00
Dirk Hohndel
0b13cbd81b build-system: add libmtp for Linux and macOS
Since MXE doesn't offer libmtp I'll need to add code to manually build
libmtp there.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-30 12:24:36 -07:00
Dirk Hohndel
4b24730ee6 add initial support for the Garmin Descent Mk2i
This brings in the needed libdivecomputer updates and builds Subsurface against
libmtp in order to support downloading dive data via MTP (since the Mk2/Mk2i
no longer provide a FAT filesystem via USB).

In order for this to work you need to have libmtp installed on your system.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-30 12:24:36 -07:00
Doug Junkins
31813af49a desktop: make edit icon non-transparent
Switched the edit icon to one that has the pencil color set to
white instead of transparent so that it remains visible when
switching to Mac OSX dark mode.

Signed-off-by: Doug Junkins <junkins@foghead.com>
2020-10-29 15:00:20 -07:00
Doug Junkins
e6956b9d57 desktop: add label to dive computer table
There was no "title" property on the dive computer table which
was causing an default label of "GroupBox" to appear above the
table. Added a title property to clean up the UI.

Signed-off-by: Doug Junkins <junkins@foghead.com>
2020-10-29 15:00:20 -07:00
Doug Junkins
6dccce21da desktop: use default colors for dive info labels
Removed the style change to force a style change for the labels on
the dive information page to Medium Blue. This makes labels more
readable in MacOSX dark mode since the default style changes colors
when the mode is shifted from light to dark or vice versa.

Signed-off-by: Doug Junkins <junkins@foghead.com>
2020-10-29 15:00:20 -07:00
Berthold Stoeger
7c70459f6c cleanup: remove unnecessary includes from maintab
These are artifacts from when the maintab contained more stuff.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-28 11:27:58 +01:00
Berthold Stoeger
d747d76762 cleanup: refactor subsurfacesysinfo.cpp
This used to be a copy of QSysInfo. However, once the requirement
was raised to Qt5.4, this was replaced by a subclass of the original
QSysInfo - which made the whole file mostly obsolete.

Just use QSysInfo directly where needed.

Only for windows.c, which can't call directly into Qt, keep the
isWin7Or8() helper function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-27 16:18:09 -07:00
Berthold Stoeger
49fc05de7e desktop: move MinMaxAvgWidget to TabDiveStatistics
This is its only user and the widget is scheduled for removal.
Let's move it there temporarilly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-26 20:56:56 -07:00
Berthold Stoeger
ab94956759 cleanup: remove dive.h include in simplewidgets.h
Let's simply forward declare the needed structures.
Also removes removes two more unnecessary includes.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-26 20:56:56 -07:00
Dirk Hohndel
2a876be844 tests: don't fail if TestGitStorage can reach the server
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
b554b3d060 build-system: use openSUSE Tumbleweed latest
Without a distro update, Leap 15.2 appears to only give us Qt 5.12.
Since the upgrade takes forever and causes problems as it requests a senseless
'reboot' of the container, let's try using Tumbleweed instead.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
f3c23946f4 documentation: remove mention of Grantlee in INSTALL file
We don't use Grantlee anymore.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
f193c2ef08 cleanup: fix deprecated QVector constructor
Annoyingly, the replacement has only been available since Qt 5.14.
To make the code less messy, implement our own stdToQt conversion helper.

Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
1a0cf0bb44 cleanup: remove struct/class confusion
DiveSiteChange is defined as a struct, not as a class.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
369baa5b74 cleanup: move variable declaration closer to use
This way we avoid an unused variable warning on mobile builds.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
c5eaac122e cleanup: remove reference to deprecated enum value
This had been deprecated for quite a while.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
10695e51ee cleanup: remove unnecessary call to qsrand
We actually don't use random numbers anywhere outside TestGitStorage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
bbb55b2973 cleanup: replace deprecated swap() usage
Instead of using the two different ways Qt supports swap, depending on the Qt
version in use, let's simply use std::swap()

Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
c463da3fac cleanup: replace deprecated pos() member
Again, replacement was just recently added.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
7fb4dd7a03 cleanup: remove unused function argument
Also, only compile the static function where it is used.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
0c2bfc1103 cleanup: replace long obsolete delta() member
This has been deprecated for years.
The delta() member dealt with the old style mouse wheel that is associated with
a vertical scroll - so we need the y-component.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
bbf76f9ee7 cleanup: don't initialize flags with just an integer
This is slightly different from the previous cleanup around QFlag use as this
one is related to QtWebKit flags. But the logic is the same.
Just syntax to avoid a warning.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
d58c962bdb cleanup: replace deprecated signal
Again, the replacement was only implemented in Qt 5.14, so more conditional
code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
ffecc00f42 cleanup: SkipEmptyParts syntax has changed
Sadly, the new enum has only been available since Qt 5.14, so this is a rather
ugly replacement.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
f8f83a9986 cleanup: model isn't used in the lambda
Simply cleaning up a warning.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
aa5f2e7c73 cleanup: replace deprecated sprintf()/vsprintf() calls
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
c5fcdfae30 cleanup: remove obsolete connections
Not sure how this even ended up in this .ui file.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
ea4e83fead cleanup: fix deprecated role
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
5aaff77b9e cleanup: replace deprecated use of child member
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
87563eb404 cleanup: fix deprecated form of QProcess::start
You are now required to always provide a list of arguments.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
f871b8dfac cleanup: fix deprecated QFlags use
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
484a50b6a8 cleanup: initialize all members of weightsystem
The auto_filled member was recently added and not initialized in the UEMIS
downloader.

Fixes CID 362080

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
0d733747d1 cleanup: fix resource leak
Fixes CID 362078
Fixes CID 362081

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Dirk Hohndel
77195ccb88 cleanup: fix resource leak
And address typo in comment.

Fixes CID 362915

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-26 19:27:03 -07:00
Berthold Stoeger
e7b56c2d31 filter: use 64-bit integer literal for generating bit fields
For multiple-choice constraints we use a bit field of type
uint64_t. This means we theoretically support up to 64 items.
Currently use at most seven.

Coverity complained (correctly) that we use the expression
"1 << x" to generate the bitfields. However 1 is a 32-bit
literal on most platforms, which makes this undefined
behavior for x >= 32. Change the integer literal to 64-bit
1ULL.

Moreover, when detecting items with an index >= 64, don't
even attempt to set the according bit, since this is
undefined behavior and the compiler is free to do as it
pleases in such a case.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 16:23:46 -07:00
Berthold Stoeger
b984839836 cleanup: remove pref.h include in dive.h
If source files want to access preferences functions, they should
include pref.h themselves.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
a719bfbeaf cleanup: move git-pref declarations into core/pref.h
These seem to be an artifact.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
975ef65913 cleanup: move sort_dive_table declaration to divetable.h
Apparently this was forgotten in a previous include-reshuffling.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
f2494931e9 cleanup: move cylinder_use_text declaration to equipment.h
This is unrelated to struct dive and also wasn't defined in
dive.c

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
df4c0ed403 cleanup: remove unused macros / declarations from dive.h
Nobody was using these return-code macros and the functions
do not exist since a long time.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
f728923c79 cleanup: move interpolate inline function to its own header file
This is not really related to struct dive, so let's move it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
f9c3227975 cleanup: remove system includes from dive.c
Let the various source files include the system headers they need
themselves.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
2b86fe84f9 cleanup: move application flags to core/subsurfacehelper.h
These flags are not dive-related, therefore move their declaration
to the appropriate header file. Likewise, move their definition
from parse-xml.c to subsurfacehelper.c

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
17d21dbf40 cleanup: move function declarations to divelist.h
unregister_dive() and delete_single_dive are defined in
divelist.c, as they take an "index" argument into the global
divelist. Therefore, move their declarations to divelist.h.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
0e196310f9 cleanup: split out divecomputer functions from dive.c
Since dive.c is so huge, split out divecomputer-related functions
into divecomputer.[c|h], sample.[c|h] and extradata.[c|h].

This does not give huge compile time improvements, since
struct dive contains a struct divecomputer and therefore
dive.h has to include divecomputer.h. However, it make things
distinctly more clear.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
4aa571d5a0 cleanup: remove get_times() functions
The function
1) was misnamed: it determined the time of the first selcted dive.
2) had only one caller.
3) would crash if there was no selected dive.

Let's just fold the functionality into the caller. It's a one-liner
anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
464dd93fe8 cleanup: move fill_pressures from dive.c to gas.c
This function does not access a dive structure.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
8212acc992 cleanup: break out event-related code into event.[c|h]
In an effort to reduce the size of dive.h and dive.c, break out
the event related functions. Moreover event-names were handled
by the profile-code, collect that also in the new source files.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00