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>
Add commands for deleting devices and editing device nicknames
to include the device-handling in the undo system.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The XML-parameter code is a mess. Ownership is unclear. Allocation
and freeing of strings is in different functions. Sometimes
only every second string is free()d, because keys are not copied.
But this is done inconsistently. The caller has to know how
many parameters the callee may add.
Instead, let's add a small helper-struct that uses C++ memory
management, but exports a C-API. The array for the XML-library
is generated on the fly.
This is only the implementation, the old code is not yet replaced.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
For Windows, the Subsurface installers do not include
the file "qwindowsvistastyle.dll" required to make the
applications that are published to have a native look.
Modify the MXE *build.sh scripts to include the
file as "plugins/styles/qwindowsvistastyle.dll".
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Add undo commands to add / edit / delete filter presets.
These are styled after the other undo commands: On changes,
the UI is informed by DiveListNotifier signals. Editing is
a simple std::swap of values.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Implement a trivial model to provide the filter preset names
to the UI. Sadly, for now this features the QWidget/QML
column / name dichotomy. However, in this simple case that
shouldn't be too much of an issue.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Add a rudimentary list of filter presets to the core. The list
is sorted by name. Access is provided via a C interface so that
the presets can be written to the git and XML logs. Internally,
the list is realized by a C++ vector for convenience (euphemism for
laziness).
Morover, a C++ interface is provided for the UI. Currently names of
the presets cannot be edited, since this would mean that the order
of the list changes. This may be implemented later if required.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Add a model that keeps track of a list of filter constraint and makes
them accessible from Qt. Sadly, this is mostly repetitive boiler-plate
code, but this is due to Qt's model/view-API, which is a perfect example
of how *not* to design a reasonable modern API.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Adds a filter constraint object to the core, which represents one
constraint the user can filter dives with. The plan is to write these
constraints to the XML and git logs. Therefore, this code is written
in C-style except when it comes to handling strings and dates, which
is just too painful in plain C.
There is one pointer to QStringList in the class, though when compiled
with C, this is simply transformed into a pointer to void. Granted,
that smells of an ugly hack. However it's more pragmatic than
self-flaggelation with C string and list handling.
A filter constraint is supposed to be a very general thing, which can
filter for strings, multiple-choice lists, numerical ranges and date
ranges.
Range constraints have a range mode: less-or-equal, greater-or-equal
or in-range. Text constraints have a string mode: startswith, substring
or exact.
All the data are accessed via setter and getter functions for
at least basic levels of isolation, despite being written with
a C-interface in mind.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
These are the instructions that I use at this point.
Removed a long obsolete script - it's been many, many years since that last was
useful (it was still using qmake to try to build Subsurface)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This continues to be useless for other people as it requires my signing key,
but when signed like this I can then successfully submit the dmg for
notarization, so I'll update the signing script in order not to lose that
magic...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
core/device.h was declaring a number of functions that were related
to divecomputers (dcs): creating a fake dc for manually entered dives
and registering / accessing dc nicknames. On could argue whether
these should be lumped together, but it is what it is.
However, part of that was implemented in C++/Qt code in a separate
core/divecomputer.cpp file. Some function therein where only
accessible to C++ and declared in core/divecomputer.h.
All in all, a big mess. Let's simply combine the files and
conditionally compile the C++-only functions depending on
the __cplusplus define.
Yes, that means turning device.c into device.cpp. A brave soul
might turn the C++/Qt code into C code if they whish later on.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Dives for the seac action computer are imported by the seacsync
program into two tables in an sqlite3 database.
The dive information is read from the headers_dive table.
The dive_data table is then queried for each dive to get samples.
The seac action computer is the only current supported computer
by the seacsync program. It only supports two gas mixes, so the
parser will toggle between two cylinders whenever it detects a
change in the active O2 mix.
Dive start time is stored in UTC with a timezone offset.
A helper function to read this was added to qthelper.
Default cases have been added to some switch statements
to assist in future development for other dive types and
salinity.
Example database has been added to ./dives/TestDiveSeacSync.db
Signed-off-by: James Wobser <james.wobser@gmail.com>
- use hidapi grantlee and mdbtools from MXE
- update MXE version to use QT 5.15, and pull in libzstd and CMake 3.17.3
- fix linking of winmm on windows build with new mxe
- add some instructions on building the container
- add some new dependancies from QT 5.15 to the packaging
- add a patch to MXE to Build qtconnectivity with native-win32-bluetooth
[Dirk Hohndel: small refactor]
Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Number 3 overall committer with currently 9% of total commits and 27% of all
commits in the last three years.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
By using a std::string instead of a C-string, memory management
becomes so much simpler! This class will be used for keeping track
of deleted/added pictures in the undo system.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Even though the functionality is seemingly trivial, this is a bit
invasive, as the code has to be split into two distinct parts:
1) Post undo command
2) React to changes to the divelist
Don't compile that code on mobile.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This file is copied from the QBS project. It's under LGPL and therefore
compatible with our licensing. While it would be possible to retrieve
this file at build time from the original project, for now it seemed
easier to include it in our repo.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of using the Subsurface-divelog user on GitHub, we now use an org that
was generously donated to us.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is no longer created using GitHub actions (but all the necessary
information is still included in this repo). We need to be able to
shrink this container so our GitHub Action runs don't run out of disk
space.
Adjust the path where the resulting binaries are found with this build.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We no longer use libusb to access USB devices on Android, therefore
there's no point including libusb in our build. Also, we have never even
attempted to run the tests on Android, so let's not even pretend to
support building them.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If we install our support libraries into the NDK we later run into
include path order issues that result in strange errors around the
inclusion of math.h (because we find the C version of that include
file that ships with the NDK before we find the libstdc++ version
of math.h (because the include path for our support libraries is
listed before the libstdc++ include search path). By having a distinct
install-root for our libraries we can avoid this problem.
Remove the previous hack that tried to work around the symptoms of
this issue.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The official installer now requires the user to log in which we can't
really do in a scripted manner. Let's see how long this way of
installing things will be available.
While doing this remove an ancient hack of some Qt settings that we no
longer need.
This also tries to prune some things that we don't need in the Docker
image to reduce image size.
The mapbox plugin is removed as it would add a dependency to QtSql which
we otherwise don't need. And since the plugin isn't used, no point in
installing it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt 5.13.2 fixes a few bugs.
We are NOT switching to Qt 5.14 as that breaks a ton of things with
Android support. At this point even with qmake it near impossible to get
working Android binaries, no one appears to have a solution for cmake.
With qt-android-cmake current master fixes the problem that held us back
at the earlier commit, so let's go back to using master.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This code block was also for the OBS builds and is no longer needed now that we
have to separate make-package scripts.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It seemed very odd to have those steps mixed in with the Ubuntu/Debian
instructions. Yes, there is a bunch of overlap, but this seems much cleaner.
This also updates the spec files to something that works for the current
sources.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This cleans up a lot of the ancient mess in that file.
It's still confusingly usable to push sources to OBS as well (but that's now
hidden behind an option) and it is still somewhat custom-made for me, but it
should be much easier to reuse for others now.
In addition to Subsurface and libdivecomputer we are inclooding the googlemaps
sources and libgit2 1.0.0 sources. Bionic is the only remaining distro that we
support that doesn't have a new enough version of libgit2 (0.26 is the minimum
we expect), but since we are linking statically against it, maybe it's best to
simply force all of these builds to include libgit2 1.0.0.
Handling of the debian/* files in the script has been changed quite a bit to
make it easier for others to create a working setup. It now updates all of the
files with the exception of the changelog files from the sources we are
building from. I am hoping that this will be a not-so-subtle incentive for me
to keep the bundled versions up to date.
Since we no longer do beta releases, I removed that part from the file.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't want to try to track every change to this file in our source repo, so
this starting point is as goos as any.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I don't know why this is suddenly needed and wasn't before, but hopefully
this fixes the broken builds on GitHub.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The inconsistent-missing-override warning is annoying as it prevents
us from adding "override" modifiers: It will warn if we do this only
for selected functions. Sadly, this is the default on clang. Therefore,
we disable this warning for quite some time in CMakeLists.txt. For
consistency also do this in the Subsurface-mobile.pro file.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The weight-undo commands need this. Therefore, we have to compile the
WSInfoModel if we want to access the undo commands from mobile.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Create a model which represents all top-level items and, potentially, one
expanded trip as a flat list.
Pass down roles to the source model and let the source model handle that. We'll
have to do some ifdef-ery, but so be it.
Additionally, compile the base model on mobile as well.
This contains a couple of hacks to make things compile at all.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since the official Qt binaries can no longer be installed without disclosing
credentials (well, sure, that could be done through secrets), I decided that
we should go back to packaging just the part of the iOS Qt SDK that we need.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of passing the dive summary via a completely unstructured
QStringList to QML, implement a dynamic model. For potential reuse
on desktop (though somewhat unlikely) the model has two interfaces,
one for QtWidgets and one for QML. The former is based on columns,
whereas the later is based on roles. The number of columns is
set dynamically. The roles currently support access to two columns.
If more columns should be accessed from QML, more roles have to
be added manually.
This commit only creates the model and hooks it into QMLs global
context, but does not yet change the QML page.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We tend to use lower-case filenames. Let's do it for these files
as well. Simple search & replace.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Create DiveSummary class in backend-shared and make the DiveSummary calculation
results available to QML.
This adds a loop over all dives (could have been done with a model, but the
models available to mobile are very limited, so use the basic way).
[Dirk Hohndel: renamed the results variable and combined a couple of commits]
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Currently subsurfaceTheme resides in main.qml, where it does not naturally
belong.
Add C++ class that will replace subsurfaceTheme in main.qml in a 1-1 manner.
This opens future posibilities
- on top of the 3 themes, allow users to select colors/fonts
- add stylesheets to Template* components
- make day/night shift automatically.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add a header file that contains a duplicate of the enums,
that are needed in QML in one class.
the unit enums are added imidiatly, since they are needed
or will be neede shortly in Settings and DivePlannerSettings
This class will also contain Q_PROPERTY and signal/slot for
variables used in QML. This is done to allow e.g.
deco_mode qPrefUnits::planner_deco_mode()
void qPrefUnits::set_planner_deco_mode(deco_mode)
as strongly typed in C++
and
DECO_MODE planner_deco_mode()
void set_planner_deco_mode(DECO_MODE)
as strongly typed in QML
Remark: wrong assignments gives errors in QML
The advantage over using strings or the value directly is that
QML detects typos and flags them as errors/warnings.
It is important to note that the class may only contain
a) a function call to the implementation
b) a reference to a global variable e.g. prefs.
Added note to the original definitions of the enums that they
have been duplicated.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit does some final cleaning up to the code, mostly deleting
white space and comments.
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
WARNING: multi directory commit, needed to secure it builds.
move the core/plannerShared.* to backend-shared.
update CMakeLists.txt to include backend-shared lib in link process.
update ios project to reflect new directory
Signed-off-by: Jan Iversen <jan@casacondor.com>
WARNING: multi directory commit, needed to secure it builds.
move the core/exportfuncs.* to backend-shared.
update backend-shared/CMakeLists.txt to generate backend-shared lib
update CMakeLists.txt to include backend-shared lib in link process.
update ios project to reflect new directory
Signed-off-by: Jan Iversen <jan@casacondor.com>
Activate use of qml compiler, which provides:
- more error detection at compile time
- fast qml
- smaller footprint
Signed-off-by: Jan Iversen <jani@apache.org>
move location of 3rd build to follow same pattern as desktop/mobile build
update central .gitignore to silence libdivecomputer/build-ios, this should
really be in libdivecomputer, but it is more easy to put it in a subsurface
controlled file.
Signed-off-by: Jan Iversen <jani@apache.org>
move from build-ios/install-root/<arch> to
SSRF_CLONE/install-root/ios/<arch>
move fat libraries, include and bin to SSRF_CLONE/install-root/ios
Call "make" and not "make qmake_all" which is just a FORCE dependency.
Signed-off-by: Jan Iversen <jani@apache.org>
packaging/ios/build.sh expected a link ./Qt to the Qt installation.
scripts/build.sh expect ~/Qt to contain the Qt installation
change to ~/Qt and thus no longer need link
Signed-off-by: Jan Iversen <jani@apache.org>
Update schemes to only allow run.
Now it is possible to build/run/debug mobileExecutable as
well as desktop from within Xcode.
Xcode demands that the path to the debug executable it not relative,
this of course gives a portability problem.
The path selected are
~/develop/src/subsurface/build....
to at least give it a shine of not being fixed.
Signed-off-by: Jan Iversen <jani@apache.org>
Since we now have a selection.c translation unit, put the selection-
related functions there.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Create Xcode project, allowing easy editing of all sources.
the project uses "make mobile" and "make desktop" to generate the project,
so all CMake changes are automatically updated
the project uses folder references, so adding/removing a source is
automatically updated
The project expect build-mobile and build to be existing as well
as external libraries, so after cloning do a normal build before
using the project.
Signed-off-by: Jan Iversen <jani@apache.org>
The NOTICE and copyright are freeform. The new description key is required for
iOS 13, but of course the redundant old key is still required for older
builds...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When trying to debug on device Xcode really wants a debug build (which is
nearly unusably slow, but that's a different issue).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Those aren't allowed on iOS and adding these two flags removes some confusing
warnings that look like errors in the build log.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
Remove hidapi from manually built components and use the mxe based one instead.
Remove libzip as that is handled by mxe packages.
Update version of grantlee used to build with qt 5.13.1.
Also hide vscode files from git.
[Dirk Hohndel: combined two commits, cleaned up the commit message and removed
one now incorrect comment line from mxe-based-build.sh]
Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Qt documentation has specific suggestions how to build our own
version of OpenSSL in order to work on Android 5.x:
https://doc.qt.io/qt-5/android-openssl-support.html
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>