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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The two final newlines in the help message were removed in commit
0c74f7a2c8.
Re-add them.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Found while compiled against Qt 5.10 build from source. The assert
Q_ASSERT(last >= first) is trapped by this beginInsertRows in
case there are no pictures. Just do not call this when there are
no pictures.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
To every filter list add a menu button that allows selection of all,
selection of none or inversion of selection.
Implements #435.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The *FilterModels had a number of of virtual functions, which only
accessed members of the base class. Moreover, these functions were
identical and generated with macros. Therefore, move these functions
to the base class.
The one excption is data(), which uses different count functions
(passed as a macro parameter). Thus, introduce a virtual countDives()
function and likewise move data() to the base class. A function pointer
might be even more clear, but since the rest of the code/Qt relies
heavily on runtime polymorphism, let's do the same here.
The only macros left are those creating the singleton accessors.
This could be more clearly realized by templates, but let's
likewise keep it the way is.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
There were two classes, MultiFilterInterface and FiterModelBase.
The latter derives from the former and from QStringListModel.
The former was not used anywhere else. Moreover, in contradiction
to its name, MultiFilterInterface is not an interface (in the Java
sense), because it actually has (non-virtual) data members. All in
all, the data model is very weird.
Merge these two classes, since there seems to be no gain whatsoever
from keeping MultiFilterInterface separate.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The TagFilter, BuddyFilter, SuitFilter and LocationFilter classes
all did essentially the same thing. Therefore, factor out common
code / objects into a base class FilterBase.
The new base class stores a pointer to the filter model. It was
felt that this is simpler than introducing virtual methods.
The only thing the *Filter classes now do is setting a label and
in one case a tooltip. Thus, in principle, they could be removed
completely, but let's keep them for now.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The more complex handling is no longer needed because:
- Keyboard tracking for gfhigh/low UI fields was switched off here:
030c094854
- GFhigh was limited to 40 here:
53fffe0ce3
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
And why this one? Well, while this include is renamed in Qt 5.10
and gives deprecated compile warnings. And as it unused anyway, just
remove it.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Commit 6343515fed introduced equality
instead of substring comparison for filters. This broke the buddy
filter in the case of more than one buddy, because in such a case
the buddy list is a comma-separated string.
Fix this by splitting the buddy string, trimming the individual
strings and search in the list.
Fixes#969
Reported-by: <yrevawerd@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
To access a QMap<> entry, the value() function is used with a sentinel
as default value. If the sentinel is returned, the code assumes that
the searched for entry doesn't exist.
Make this code more idiomatic by using an iterator and testing for
end().
This fixes a compiler warning, because only one of the elements of
the sentinel was initialized, but the remaining elements were
copied. Harmless, because the code would exit early if it found
the sentinel. Still not nice.
While redoing this function, the entry-not-found message was improved
(adding of function name, space between massage and timestamp) and
elevated from debug to warning level.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
plot_info->nr should always be > 0. If this is not the case, write a
message to stderr instead of crashing in add_plot_pressure(). This
silences an use-of-uninitialized-variable warning.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>