Commit graph

13298 commits

Author SHA1 Message Date
Jan Mulder
522b922d2a filter: setStringList() at end of every change
This is mainly code maintenance. Instead of emitting explicit
dataChanged signals, we can make sure that setStringList()
is called after all model data manipulation is ready. Accoording
to the Qt docs: "The model will notify any attached views
that its underlying data has changed".

In itself, this does not solve the tripped assert mentioned in
commit 5962f00679, but this calling at the end just feels
better.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-28 17:30:13 +01:00
Jan Mulder
97d564e920 filter: prevent assert trap on exit filters
This "bug" is found using Qt 5.10 compiled in developer mode. Access
the filers, click a little around here, close the filters. Almost every
time the following assert is triggered:

ASSERT failure in QPersistentModelIndex::~QPersistentModelIndex:
"persistent model indexes corrupted", file itemmodels/qabstractitemmodel.cpp, line 643

This is relatively deep down in Qt, and it is triggered by clearing the
filters. Trying to force a crash when using the same scenario in Qt 5.10
compiled for production (so no active asserts) did not result in a crash.
So, upto this time, it is unclear if the Qt assert points out a real problem,
or it is some false alarm (for whatever reason).

Further investigation shows that the assert can be solved by changing the
invalidate() to an invalidateFilter(). Indeed, the last variant is a little
more lightweigt, and does seem to do the same job from a functional point
of view (in this case).

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-28 17:30:13 +01:00
Berthold Stoeger
c032006d91 Replace less-or-equal by less-than comparison in lessThan function
DiveLocationFilterProxyModel::lessThan() used less-or-equal instead
of less-than comparison. This can lead to subtle bugs if two elements
compare as equal.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-28 13:22:51 +01:00
Berthold Stoeger
c3b1c64183 Remove unnecessary dynamic_cast<>s in filter code
FilterModelBase is a direct subclass of QAbstractItemModel. Therefore,
dynamic_cast<>ing the former to the latter is unnecessary. Probably
an artifact of previous code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-28 09:11:12 +01:00
Dirk Hohndel
6cc5b601aa Cleanup: avoid dereferencing NULL pointer
Coverity CID 208330
Coverity CID 208301

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-27 22:13:31 -08:00
Dirk Hohndel
e8719413a7 Cleanup: avoid uninitialized members
This is basically to make Coverity happy.

Coverity CID 208300

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-27 22:02:12 -08:00
Dirk Hohndel
db434702be Cleanup: avoid potentially uninitialized members
Realistically this is a false positive as we should never use a second
BTDiscovery instance - but there's nothing wrong with being extra certain.

Coverity CID 208319

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-27 17:24:12 -08:00
Dirk Hohndel
84d7d80451 Cleanup: avoid memory leak
Coverity CID 45078

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-27 17:17:31 -08:00
Dirk Hohndel
ecd8580de9 Cleanup: avoid memory leak
Coverity CID 45121
Coverity CID 45163

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-27 17:14:43 -08:00
Dirk Hohndel
d3118bedd4 Cleanup: correctly prevent memory leak
The previous attempt to fix this in commit 652e382e68 ("Cleanup: avoid a
few memory leaks") was clearly bogus. Oops.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-27 13:18:41 -08:00
Miika Turkia
43c1c0a1d1 Check different sensors on divinglog import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2017-12-27 20:45:24 +01:00
Dirk Hohndel
637210564a Cleanup: avoid dereferencing NULL pointer
Coverity CID 208323

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 16:33:17 -08:00
Dirk Hohndel
260ff50b0a Cleanup: avoid accessing uninitialized variable
Coverity CID 208289

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 16:12:45 -08:00
Dirk Hohndel
76cb4bc841 Cleanup: avoid out of bounds access
sizeof() is clearly the wrong way to get to the size of that array...

Coverity CID 208294

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 16:06:05 -08:00
Dirk Hohndel
04bca45552 Cleanup: avoid out of bounds access
sizeof() is clearly the wrong way to get to the size of that array...

Coverity CID 208290

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 16:06:05 -08:00
Dirk Hohndel
b4b8a9db4e Cleanup: avoid out of bounds access
sizeof() is clearly the wrong way to get to the size of that array...

Coverity CID 208297

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 15:57:45 -08:00
Dirk Hohndel
50571dfab3 Cleanup: avoid memory leak
Coverity CID 208298

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 15:57:45 -08:00
Dirk Hohndel
424e757094 Cleanup: avoid memory leak
Coverity CID 208308

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 15:57:44 -08:00
Dirk Hohndel
169a55d6e8 Cleanup: avoid memory leak
Coverity CID 208314

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 15:57:44 -08:00
Dirk Hohndel
2fed7a9441 Cleanup: avoid memory leak
No point in doing the strdup of the password if we then bail.

Coverity CID 208316
Coverity CID 209293

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 15:57:31 -08:00
Dirk Hohndel
f4237bf843 Cleanup: prevent out of bounds read
Don't access cylinder[MAX_CYLINDERS]

Coverity CID 208324

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 14:25:57 -08:00
Dirk Hohndel
1a46f5eb9b Cleanup: avoid memory leak
Coverity CID 208327

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 14:22:52 -08:00
Dirk Hohndel
42db44510d Cleanup: avoid memory leak
Coverity CID 208333

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 14:17:54 -08:00
Dirk Hohndel
da1d6e97f6 Cleanup: avoid memory leak
Coverity CID 208337

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 14:10:53 -08:00
Dirk Hohndel
0e94c21a55 Cleanup: prevent potential out of bounds write
Since we cannot store tanks / gases past MAX_CYLINDERS (currently 20),
there is no point in analyzing those data.

Coverity CID 208339

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 14:04:10 -08:00
Dirk Hohndel
efb2640fc7 Cleanup: avoid memory leak
The JUMP macro includes a 'goto bail', so we need to free devdata there

Coverity CID 208340

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 13:49:49 -08:00
Dirk Hohndel
2c8614e43e Cleanup: check we have dive before dereferencing
Coverity CID: 208341

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 13:41:58 -08:00
Dirk Hohndel
652e382e68 Cleanup: avoid a few memory leaks
Coverity CID 215199
Coverity CID 215195
Coverity CID 215196
Coverity CID 215198

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 13:41:58 -08:00
Berthold Stoeger
65213f044e Update CHANGELOG.md to reflect new filter features
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-26 13:08:49 -08:00
Berthold Stoeger
b6bf57a13b Introduce negate-toggle buttons to filter lists
Introduce toggle buttons which mean "filter all dives except
those fulfilling the selected criteria".

The old code used to check for rowCount() == 0. This should never happen,
because there is always a row "empty field". This check was moved into
the preamble of the functions to seperate it from the actual logic.

Fixes #435

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-26 13:08:49 -08:00
Berthold Stoeger
b86c70ab2c Turn filter list options into context menu
Let the menu introduced in commit 5e86442bab
pop up on right-click instead of button-click.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-26 13:08:49 -08:00
Berthold Stoeger
931947b852 Remove Q_OBJECT macros and friend declaration from *Filter classes
Since these classes do not possess any signals/slots,
these macro are unnecessary.

Likewise, the friend declaration in TagFilter is useless,
since the corresponding fields are in the base class.

Fallout of commit 1a4e7ad0dd.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-26 13:08:49 -08:00
Jan Mulder
ff3b107a9d mobile: close GPS menu drawer when selected
This is mainly a cosmetic improvement. The GPS menu stayed
visible, when selecting most of the options. This looks weird,
as the close of the menu is also an indication of the selected
action carried out. So, just close it

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-26 13:08:37 -08:00
Dirk Hohndel
702ec37145 Android build: make androiddeployqt less verbose
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 12:32:33 -08:00
Dirk Hohndel
eb95cd02c1 Travis: try another work around
The previous hack got us to see that the error was a write error to
stdout and based on
https://github.com/travis-ci/travis-ci/issues/4704#issuecomment-321777557
setting filter_secrets: false will work around that issue.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 12:32:33 -08:00
Dirk Hohndel
f4c1cef73b Android build: work around odd bug with cmake 3.10
For some reason it suddenly cannot figure out which build program
to use. This seems like a weird hack, but works.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 09:27:02 -08:00
Dirk Hohndel
4346aaa333 Android build: no point making the docs
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-26 09:24:35 -08:00
Jan Mulder
8e9ba7bd7a CHANGELOG.md
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-25 19:47:57 +01:00
Jan Mulder
37e98a8d89 Use correct date format
A very very trival fix, for a mysterious issue. When loading
GPS fix data from the server, the string date was parsed with
the format "yyy-M-d". And no, the "yyy" is no typo here, but
was the reason that data from the read from server got a
1/1/1970 data. And when a user decided to upload that data
to the server again, we ended up with 2 copies of the
GPS fix. One with correct data (as originally saved), and
one new with the bogus date.

In order to het rid of those weird 1/1/1970 GPS fixes, users
will have to remove them by hand.

Fixes: #567

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-25 19:47:57 +01:00
Robert C. Helling
ca38644005 Prevent overflow in effective GF calculation
For deep dives with long deco, the sum of deco stops could
overflow. This is prevent by turning it into long.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-12-25 19:47:45 +01:00
Dirk Hohndel
5eec251be8 Travis: hack around Android build failuers
For some reason accepting the licenses for the SDK appears to fail.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-24 13:50:59 -08:00
Dirk Hohndel
9df88f0145 Android build: reorder downloading Qt vs SDK
Since it's the SDK where things are failing, doing it this way makes the
turnaround time of my attempts to fix this faster. And in the larger
scheme of things, the order is irrelevant.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-24 13:50:59 -08:00
Dirk Hohndel
f067d3b5d6 Fix build for cmake before 3.10
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-24 13:50:59 -08:00
Dirk Hohndel
726e231d64 Update translation source strings
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-24 12:00:52 -08:00
Dirk Hohndel
6a39e3ff20 Update CHANGELOG
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-24 11:45:26 -08:00
Dirk Hohndel
795f6e24ea Silence cmake 3.10 warnings
Explicitly turning of automoc and friends for every single auto
generated file seems a rather dumb approach...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-24 11:34:49 -08:00
Jan Mulder
36c8a7e4ca mapwidget: QtQuick really to 2.5
It shall match the Qt version ... according to Dirk.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-24 11:33:46 -08:00
Berthold Stoeger
130f109442 Remove superfluous QScopedPointer<>s in singletons
There was a curious pattern of singletons being implemented based on
QScopedPointer<>s. This is an unnecessary level of indirection:
The lifetime of the smart pointer is the same as that of the
pointed-to object. Therefore, replace these pointers by the respective
objects.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-24 11:04:10 -08:00
Jan Mulder
4c4222d611 mapwidget: revert QtQuick version to 2.0
In commit f3d978b8a5 the QtQuick version was upgraded
to 2.6 (from 2.0 for the mapwidget). This is, apparently,
too agressive, as there are still mainstream distributions
that are still on Qt 5.5.1 for which 2.6 of QtQuick is too
new. And as a sidenote: Qt 5.5.1 was released in October
2015.

So partially revert commit f3d978b8a5.

Fixes: #978

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-24 10:56:00 -08:00
Dirk Hohndel
eec69de7ab Small whitespace updates
We aren't really consistent. And I don't do this often enough. But based
on a few things that I saw in a recent commit, I wanted to at least fix
those. And then of course fixed everything in those two files.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-24 09:10:12 -08:00