Replace the uuid argument to MapWidgetHelper::enterEditMode() by a
pointer. Likewise, adapt the only caller prepareForGetDiveCoordinates().
This is a small step in a bigger effort to replace dive-site UUIDs
by pointers.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Replace UUIDs from LocationInformationModel and fix the fallout.
Notably, replace the UUID "column" by a DIVESITE "column".
Getting pointers through Qt's QVariant is horrible, we'll have
to think about a better solution.
RECENTLY_ADDED_DIVESITE now defines to a special pointer to
struct dive_site (defined as ~0).
This fixes an interesting logic bug:
The old code checked the uuid of the LocationInformationModel (currUuid)
for the value "1", which corresponded to RECENTLY_ADDED_DIVESITE.
If equal, currType would be set to NEW_DIVE_SITE. Later, _currType_
was compared against _RECENTLY_ADDED_DIVESITE_. This would only work
because NEW_DIVE_SITE and RECENTLY_ADDED_DIVESITE both were defined
as 1.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The diveSiteSelected signal of DiveLocationLineEdit had the dive-site
UUID as argument. But the receiving slot would not use that argument.
Remove this as a tiny step to remove the UUIDs alltogether.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Access to dive-sites in the LocationInformationModel was via UUID.
Replace this by a direct access to the struct dive_site pointer.
Accordingly, rename the UUID_ROLE to DIVESITE_ROLE.
This is a small step in replacing dive-site UUIDs by pointers
throughout the code base.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Another small step in removing dive-site UUIDs: use a pointer
instead of a UUID in the "uemis_helper" structure.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of passing uuids, pass a pointer to the dive site.
This is small step in an effort to remove uuids.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of passing a uuid, pass a pointer to the dive site.
This is small step in an effort to remove uuids.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of passing a uuid, pass a pointer to the dive site.
This is small step in an effort to remove uuids.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of passing a uuid, pass a pointer to the dive site.
This is small step in an effort to remove uuids.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This changes more of the dive-site interface to return pointers
instead of UUIDs. Currently, most call sites directly extract
UUIDs afterwards. Ultimately, the UUIDs will be generally replaced
by pointers, which will then simplify these callers.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The uemis downloader uses a cache for location to divesite id.
Trivially, the divesite-uuid can be replaced by a pointer. This
is a tiny step to remove divesite UUIDs.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
As a first step in removing dive-site uuids, change the interface
of the get_dive_site_*() functions to return pointers instead
of uuids. This makes code a bit more complicated in places where
the uuid is extracted afterwards (needed NULL check). Nevertheless,
these places should disappear once pointers instead of uuids are
stored in the dive-structures.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Remove three cases of rememberSelection() which did not possess
the corresponding restoreSelection() twins.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The selection was remembered/restored anytime the sort-order
changed. Yet, this is only necessary if the view (tree, list)
changes. Therefore, handle the selection only if this is the
case.
This automatically fixes the problem of the trip-selection
not being remembered if the view doesn't change. If the view
does change, trip selection is lost. But since the list view
doesn't have trips to start with, losing trip-selection seems
like an understandable behavior.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
On desktop, show the a sort indicator to give a visual feedback on changes
of the sort order. This is trivially done by calling the
setSortIndicatorShown() function in DiveListView's constructor.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
On desktop, clicking on a column header sorts the dive-list. This
has the interesting property that every click reverses the sort
order (unless changing from list to tree-mode). The much more
common idiom seems to be to define a default sort order for each
column and switch to that when changing sort-column. Switch order
after clicking the same column again.
Implement this more common behavior. For now, sort # and date
in descending, all other columns in ascending order.
While doing this, use the proper enum (NR) for setting the default
sort-column instead of its integer representation (0).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This accessor was never used. This is a small step in splitting
the DiveTripModel in two (list & tree), which means that the
layout is moved up to the view.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In commit 99c06dec3d ("Mobile/filtering: simple busy indicator") we switched to
Controls 2.4 which requires Qt 5.11. Revert that one line of the commit as it
isn't necessary.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Including ssrf-version.h in an include file that a lot of files depend on
caused a ton of unnecessary recompiles with every commit. This should reduce
that problem.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The last use of the LocationInformation::startEditDiveSite()
signal was removed in ff26ffe0d0.
Remove its declaration.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The reverseGeoLookup() function defined in qthelper.cpp has long
ago moved to its own compilation unit. It is not even defined in
the headers anymore. Remove it and the now unnecessary <QNetwork*>
includes.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Whenever the filter changes, simply walk the filtered dive list and ensure
that we have the correct count for dives that match this filter.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When creating a trip header (as it is used in the mobile app right now), we need
to show the number of dives shown, not the total number of dives in that trip.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We assume that any dive that gets added to a trip initially gets shown. The
filter logic then needs to make sure it adjusts this number (which then makes
it easy to tell the user how many dives of that trip are visible with the
current filter).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This feels a bit like cheating, but if we need to be able to make modifications
to the underlying dive and only have the helper object (for example inside of a
view model), doing everything through the helper object can turn into a real
performance issue.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit 9829e49815 the dive
selection code was moved from the filter to the dive list.
As a consequence of that change, the selectionChanged signal
was not emitted anymore and therefore the map widget was not
informed of the new dive site list. This had funky effects on
the dive-site editing. Notably, changing the location would
move the map, but not update the flag.
Explicitly emit selectionChanged in filterFinished() to fix
dive site editing.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In case of big log files, where MAX_TANK_INFO is reached, tank_info[i] != NULL should be checked after i<MAX_TANK_INFO
Signed-off-by: Simeon Geiger <simeon.geiger@gmail.com>
This will display the dive site coordinates after the Location label if
there are no associated tags from reverse geolookup. Thus it'll be
clearer for users that we do have GPS location stored for the dive, and
might be able to see more easily if the recorded coordinates are
correct.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Otherwise we start showing an illogical '0' there when first opening the filter
dialog, and the equally wrong previous count when closing and then re-opening
the filter dialog.
Reported-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The regular expression based generic filtering made things very slow on a cell
phone or other, slower device. With this the results seem more reasonable.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It's important to disconnect the model from the ListView, otherwise the update in a
different thread will fail.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Simply make it always reset the filter. There's no point remembering the last
filter pattern and explicitly setting it, if the last thing we do is to reset
this pattern.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This one does nothing but whitespace - separating it into two commits makes the
previous one a lot easier to read.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We are still trying to ensure that the filter is indeed shown in front of the
dive list. This is working when running on the desktop without the rectangle,
but on Android this appears to be needed.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We don't need to toggle visibility, toggling height is sufficient. This
dramatically simplifies the transitions. But as a result we need to use the
'enabled' property to reset the filter.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>