Commit graph

16296 commits

Author SHA1 Message Date
Berthold Stoeger
36d42a6a57 Cleanup: turn DiveListModel into standard singleton
DiveListModel was one of those "special" singletons that could
be created explicitly with new. This would make sense if a
parameter were passed to the constructor. We only passed null,
so one might as well turn that into a classical singleton with
default constructor.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-04 09:19:10 -07:00
Berthold Stoeger
2560734624 Cleanup: initialize DiveListSortModel in constructor
The model was initialized in the global run_ui() function.
Move that into the constructor of the class.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-04 09:19:10 -07:00
Anton Lundin
a30e6b306f android-build: Add some more libzip hacks
This hacks the libzip build to not try to find zlib, because it fails
doing so on modern NDK. We just tell it that its there, and be done with
it.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2019-10-04 09:16:30 -07:00
Anton Lundin
e68891d776 mobile: Expose ftdi if compiled in
Expose ftdi connection posibilities if its compiled in, not only on
Android. Its useful to be able to test it on a Linux machine to.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2019-10-04 09:16:30 -07:00
Anton Lundin
43cd80dfc1 android-build: Add support for x86_64
This adds support for building x86_64 apks.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2019-10-04 09:16:30 -07:00
Anton Lundin
dbdfb9b517 android-build: Load variables file relative source dir
Not everybody have their build dir in the same place, but we can always
find the files relative each other.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2019-10-04 09:16:30 -07:00
Robert C. Helling
85c31f0303 Analyze gasswitches in CCR bailout
The test if we have to create gas switches wasn't yet aware
of the bailout option.

Reported-by: Dennis Arreborg <dennis@arreborg.eu>
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-10-03 08:38:19 -07:00
Dirk Hohndel
e7e21aec6b Mobile: fix reloading dive list after download
There was a sad typo in commit eecca6aab0 ("Mobile: replace model-reset
by row-addition in DiveListModel::reload()").

Additionally, we need to also refresh the dive list so that the new
dives are shown.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
1c24ac1a94 Mobile: don't allow width change without rotation
We get incorrect changes to a new screen width that causes us to try
draw to a much larger screen than we actually have. Ignore those
changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
cd98cb8921 Mobile: add more debugging output for screen width issue
Somehow we need to be able to figure out which width information is
correct.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
fdfa540747 Android: move OnePlus font hack earlier
We want the new default font in place before the QML engine is
initialized.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
c90050f449 Mobile: recalculate base units only for first real change
Different Android devices seem to have different patterns of throwing
incorrect width information at us. This seems like a really bad hack,
but for the ones I've seen so far this should give us the right width
information.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
fb26f6b0fa Avoid duplicate debug output from GPS module
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
7fa25de58a Android: allow passing through -quick argument
So even setups relying on the wrapper script can do faster rebuilds.
This also cleans up a bug that made passing through the release
parameter fail in the past, and removes overly verbose debugging output.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
285f5661ea build-system: add option to enable profiling
Simply nice to have - even though it didn't help me track down the issue
this time around.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
94b8d4070f Mobile: update version to 2.2.2
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Dirk Hohndel
d635d5de1f Mobile: only print debug output if there's information
On many devices the Screen property doesn't give us a manufacturer,
model, or name.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
45106260dd Cleanup: Remove DownloadThread QML-type
The download thread is not accessed directly by QML anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
4d5acc8461 Import: remove DiveImportedModel::lastIndex
This is redundant, as the actual size is stored in the dive table.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
a33f381dc6 Cleanup: remove DiveImportedModel::firstIndex
This index was never set to anything else than 0. Might as
well remove it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
5037fcdbdc Import: avoid model inconsistency in DiveImportedModel::recordDives()
DiveImportedModel::recordDives() called add_imported_dives(). But that
actually consumes the dive and dive-site tables. Which in turn will
lead to an inconsistent model.

Properly reset the model by using the consumeTables() function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
087a80194a Import: keep dive and dive site tables in DiveImportedModel
The DiveImportedModel and DownloadThread used the same table
of dives and dive sites. This made it very hard to keep the
model consistent: Every modification of the download thread
would make the model inconsistent and could lead to memory
corruption owing to dangling pointers.

Therefore, keep a copy in the model. When updating the model,
use move-semantics, i.e. move the data and reset the tables
of the thread to zero elements.

Since the DiveImportedModel and the DownloadThread are very
tightly integrated, remove the accessor-functions of the
dive and dive-site tables. They fulfilled no purpose
whatsoever as they gave the same access-rights as a public
field.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
a353bcb296 Cleanup: make table argument to get_dive_from_table() const
Even though the returned dive is not const, the table is not
changed, as it only contains pointers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
a1a2492438 Cleanup: remove dive_table and dive_site_table Q_METATYPEs
These are not passed through QML anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
7615e71760 Import: remove QML properties from DownloadThread
QML doesn't access these directly anymore but goes via the model.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
81268adfd3 Import: extract number of dives from model not from thread
The plan is to make the model the authoritative source of
the imported dives. Therefore, access the number of
downloaded dives from there.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
36676120ab Import: clear table via model not via thread
Clearing the table in the thread leaves the model in an inconsistent
state. Don't do that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
8f3c85f58d Import: get tables from DiveImportedModel not DownloadThread
When importing dives, consume the tables from DiveImportedModel
and not the DownloadThread. This appears more logical and avoids
an inconsistent state of the DiveImportedModel: On import the
tables would be reset, but the DiveImportedModel wasn't
informed of that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
10d4ba82a2 Documentation: add comment to Command::importDives
Add a comment that the passed-in dives are consumed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
a24b1a4027 Desktop: Use DiveImportedModel::deleteDeselected()
In DownloadFromDCWidget::on_ok_clicked() deselected dives were
directly deleted from the dive table, leaving DiveImportedModel
in an inconsistent state. Use the function in DiveImportedModel
instead. This also removes code duplication.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
30b384cebd Import: keep model state consistent when deleting unselected dives
In DiveImportedModel::deleteDeselected(), unselected dives were
deleted from the dive-table. But this left the model in an
inconsistent state and the frontend was not informed of the
missing dives.

Fix this by invoking the appropriate beginRemoveRows()/
endRemoveRows() pairs. Move the functionality into its
own function so that it can be reused by the desktop version.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
ad7ffa0af0 Import: Make DownloadThread a subobject of DiveImportedModel
Currently, desktop and mobile are accessing the DownloadThread
and the DiveImportedModel concurrently. This makes a big data
flow mess. To achieve a more hierarchical data flow, start
by making the DownloadThread a subobject of DiveImportedModel.

Start the download by calling a function in DiveImportedModel.

Route the finished signal through DiveImportedModel. Thus,
the model can reload itself with the new data.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
6e343c734a Core: implement move functions for dive and dive_site table
To allow efficient moving of downloaded dives from the download
thread to the model, implement a general move function that
moves table data. Instantiate that function for the dive and
dive_site tables.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-02 08:04:49 -07:00
Berthold Stoeger
eecca6aab0 Mobile: replace model-reset by row-addition in DiveListModel::reload()
Owing to apparent QML breakage, a model-reset leads to the DiveDetail
page being reloaded for every dive in the list(!). Therefore, add
rows instead.

This leads to extremely subtle code, as it is now imperative that
the model has been properly cleared beforehand. Nevertheless, for
now we have to do this to fix a severe performance regression.

Fixes #2295

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-27 16:33:37 -07:00
Berthold Stoeger
649ac1f83a Mobile: clear dive data via model
Clearing the dive data directly in the core leaves us with an
inconsistent model. Therefore, clear via the model.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-27 16:33:37 -07:00
Berthold Stoeger
f0fc1f3a56 Mobile: Don't access dive-id via DiveObjectHelper
There is already a role to do that. Query the model directly to
avoid creating a full DiveHelperObject.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-27 16:33:37 -07:00
Dirk Hohndel
9ae7040a91 Revert the singleton PR
It turns out that this isn't working the way it was intended to.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-27 16:26:58 -07:00
Berthold Stoeger
400b218f76 Cleanup: remove GpsLocation::instance() function
The last user was removed in 8576edd8d6.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-25 13:35:30 -07:00
Berthold Stoeger
4d3686edec Cleanup: Pass gpsTrackers directly to GpsListModel::update()
Instead of using the GpsLocation singleton in GpsListModel::update()
to extract the gpsTrackers, pass the gpsTrackers as function argument.

The caller has direct access to the GpsLocation object anyway and this
make things less entangled.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-25 13:35:30 -07:00
Berthold Stoeger
05200f9266 Cleanup: unify idiosyncratic singletons
The way we handle singletons in QML, QML insists on allocating the
objects. This leads to a very idiosyncratic way of handling
singletons: The global instance pointer is set in the constructor.

Unify all these by implementing a "SillySingleton" template. All
of the weird singleton-classes can derive from this template and
don't have to bother with reimplementing the instance() function
with all the safety-checks, etc.

This serves firstly as documentation but also improves debugging
as we will now see wanted and unwanted creation and destruction
of these weird singletons.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-25 13:35:30 -07:00
Berthold Stoeger
f20d6187f0 Cleanup: remove GpsLocation::hasInstance()
This function was not used anywhere.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-25 13:35:30 -07:00
Paul Buxton
c1aa686f9c AppImage: Fix path of machine-id in dbus library
When building dbus within the appimage, cmake picks up the installation
path of various files dbus uses through the GNUInstallDirs package,
however this doesn't work under the appimage build.
So we replace the variable with the normal location of this file.

Signed-off-by: Paul Buxton <paubuxton.mail@googlemail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-23 13:38:57 -07:00
Paul Buxton
4b391c448d AppImage: Fix missing libssl1.1
Add ssl to the AppImage build.
Add helper script to fetch required dependancies.
Update docker build container used.

Signed-off-by: Paul Buxton <paubuxton.mail@googlemail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-23 13:38:57 -07:00
Dirk Hohndel
b2230855e6 Mobile: make sure QML gets notified when value changes
This addresses the following warning when running the mobile app:
INFO: QQmlExpression: Expression qrc:/qml/DownloadFromDiveComputer.qml:339:5 depends on non-NOTIFYable properties:
INFO:     QMLManager::DC_forceDownload

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21 16:31:27 -07:00
Dirk Hohndel
71a75bfda5 Mobile: more space around menu button on Download page
This looked fine when playing with it on the desktop, but required
more space on device for some reason.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21 16:30:12 -07:00
Berthold Stoeger
9322c54b6a Mobile: pass section directly to tripTitle() and tripShortDate()
Instead of converting the section-heading string to a trip-pointer
in QML and pass that to the tripTitle() and tripShortDate()
functions, pass the string and convert in C++ code.

Hopefully, this makes the code more robust.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21 16:12:23 -07:00
Berthold Stoeger
ce751bd696 Mobile: pass trip-ids through QML, not formatted pointers
The section heading in the QtQuick ListView has to be a string.
Therefore, we passed a pointer formatted using hexadecimal notation.
Later, that was converted back without being checked.
A very scary proposition, so let's pass unique integer trip-id instead.
This means that on converting back we have to scan the trip table,
but that is a very minor cost comsidering to the gained robustness.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21 16:12:23 -07:00
Berthold Stoeger
067a481b78 Core: add unique id to trip
To make it easier to pass around trips through QML, give each trip
a unique id. The id is generated in alloc_trip() and uses the same
function to generate unique dive ids.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21 16:12:23 -07:00
Fabio Rueda
356293da7d If only one dive selected, only one temperature in stats tab
In stats tab, when only one dive is selected, on one stat, only average is
shown, except temperature which 3 same temps for max, min and avg are shown.

[Dirk Hohndel: fixed whitespace]

Signed-off-by: Fabio Rueda <avances123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21 16:10:25 -07:00
Berthold Stoeger
b3e5e5eef4 Cleanup: remove bogus assignment in startFilterDiveSites()
In MultiFilterSortModel::startFilterDiveSites(), the setting of the
dive sites to be filtered is done later in the code. Therefore,
remove the assignment in the first line of the function. Under
some circumstances, this would prevent a needed map reload!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-09-21 16:07:24 -07:00