aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-11-04Dive list: use proper comparison when comparing dive to tripGravatar Berthold Stoeger
The DiveTripModels are sorted in *reverse* chronological order. Therefore, when comparing a dive against a trip, the dive has to be inserted if the dive has a *later* date. Change the comparison accordingly. Reported-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-04Undo: fix addition of multiple divesGravatar Berthold Stoeger
The generic addInBatches() function is used to add batches of contiguous sets of dives to the dive-list models. The loop searching for the end of the batch used the wrong index and would therefore not properly cut the batches. Fix this. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-02Dive list: invert default sort order for sort by date / numberGravatar Berthold Stoeger
Commit 6dc1d239f81f16133d5954bd2b21ffa0c2dcc755 introduced a well-defined sort order in the case of equal contents. It changed the code for sorting by date to simply use the order of the source model. BUT: The source-model was already sorted in descending order on date. Thus setting the default order on descening by date, the data was then presented as *ascending* by date. Change this back to descending by always using default-ascending in the filter model. Ultimately, the source model should simply reflect the ordering of the core-data (ascending on date), but such a change is too invasive shortly before release. Reported-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-01CHANGELOG.md: add entry about experimental BTLE supportGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-11-01user-manual: add notes about state of BTLE on WindowsGravatar Lubomir I. Ivanov
Add an "important" message that the support is experimental and that the latest version of Windows 10 and drivers is needed. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-11-01Core: use British translations in South AfricaGravatar Dirk Hohndel
For unrecognized locales we use en_US by default. It makes much more sense for South Africa to use en_GB. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-01Update translationsGravatar Dirk Hohndel
Pull current translations from Transifex and add the new numerus cases to the en_US 'translation'. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-01Update translation source stringsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-11-01CHANGELOG.md updateGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-01Dive list: implement custom lessThan functionGravatar Berthold Stoeger
The dive list was sorted using the default-sorter of QSortFilterProxy model. This is mighty inflexible as it considers only one column. This has the funky effect that for rows with identical elements, the sort order depends on the previous sorting. Implement a lessThan() function in the MultiFilterSortModel, which simply hands the sorting down to the actual model. This might be considered a layering violation, but it makes things so much easier. Sadly, it seems like the column-to-be-sorted is transported in the provided indices. Therefore, the comparison is chosen using a switch for *every* comparison. It would seem much more logical to set a function pointer once and use that. Further investigations are necessary. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-01Dive list: remove forceSort parameter from DiveListView::reload()Gravatar Berthold Stoeger
DiveListView::reload() was called for full reset of the dive list and for changing the view (tree vs. lis) in DiveListView::headerClicked(). Since the latter does sorting by itself, a parameter "forceSort" was introduced, which defaulted to true, but was set to false by DiveListView::headerClicked(). To remove complexity, simply let DiveListView::headerClicked() set the view by itself and remove tha parameter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-01Dive list: connect header-signal in constructorGravatar Berthold Stoeger
The QHeaderView::sectionPressed() signal was connected everytime the list-view was reset. Likewise, setSectionsClickable() was set to true everythime the list-view was reset. Once in the constructor is enough. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-11-01Dive list: make filter model aware of its sourceGravatar Berthold Stoeger
The data-flow from C-core to list-view is as follows: C-core --> DiveTripModel --> MultiSortFilterModel --> DiveListView The control-flow, on the other hand, differs as DiveListView accesses both MultiSortFilterModel and DiveTripModel, whereas MultiSortFilterModel is mostly unaware of its source model. This is in principle legitimate, as the MultiSortFilterModel might be used for different sources. In our particular case, this is not so. MultiSortFilterModel is written for a particular use case. Therefore, model control-flow follow after data-flow: Let MultiSortFilterModel set its own source model and DiveListView access the MultiSortFilterModel, which then manages its source model. This is not bike-shedding, but will enable a more flexible and higher-performance sorting. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-31Mobile/filtering: don't show the filter line when pulling divelist downGravatar Dirk Hohndel
Even though the height was zero, when pulling down the dive list for refresh, the filter input line would still be visible. With this fix it no longer is. Also remove unused property. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-31Core: Do not crash on save dives with no dive site (git storage)Gravatar Jan Mulder
And fix a crash very similar to the previous commit. When trying to save (to git) with an empty dive site, ssrf crashes. Again, add a simple guard to prevent this. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-31Desktop: do not crash in verbose mode on empty dive siteGravatar Jan Mulder
Import dives from a DC, and have ssrf started in verbose mode. After downloading dives, hit ok, to add them to the dive list. This crashes as we cannot get the uuid from the null dive site. Added a simple guard to fix this. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-10-30Dive site: fix oversight in 920eb7576fGravatar Berthold Stoeger
In commit 920eb7576ff3c5fab19c12b7b291042817422ac5 "dive_site *" was included in Qt's "metatype" system to be able to pass it through QVariants. One instance was forgotten and a "void *" was passed in. On readout NULL was returned, which made it impossible to add new dive-sites under certain circumstances. Convert this one instance to a proper "dive_site *" QVariant. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-30Mobile: update versionGravatar Dirk Hohndel
Required to be able to push test builds to TestFlight. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-30Fix gasmix for OTU calculationGravatar Robert C. Helling
With the fixed sematics of get_gasmix to return the new gasmix for the time of a gas switch (added comments to make this clear), in the OTU calculation we need the previous gasmix for the interval up to the current time. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-10-30A test for gases used in the plannerGravatar Robert C. Helling
This tests for the planner getting the gases in the manually entered part of the dive wrong (as here: from incorrect value returned by get_gasmix_at_time. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-10-30Fixed get_gas_at_time for equal timesGravatar Robert C. Helling
This fixes a subtle bug introduced in 5c4569247a31c which unified two functions finding the gasmix at a given time during the dive. There was a slight difference, though: Does a gaschange exactly at that time count or not? For the planner to work, the answer has to be in the affirmative. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-10-29Dive list: don't pass dive_site via uintptr_t through QMLGravatar Berthold Stoeger
Now that struct dive_site * is a proper Q_METATYPE it is not necessary anymore to pass dive-sites as opaque uintptr_t types. Simply pass a QVariants or directly via dive_site *. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive list: take pointer-to-dive_site instead of QVariantGravatar Berthold Stoeger
Since "struct dive_site *" is now a Q_METATYPE, the functions MapWidgetHelper::centerOnDiveSite() and ::getCoordinates() can directly get such a pointer instead of a QVariant. This makes the code nicer to read. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: pass pointer-to-dive_site via QVariantGravatar Berthold Stoeger
There was this ugly pattern of passing pointers-to-dive_site via a QVariant of void * type. This is of course inherently unsafe. Pass these pointers using their proper types instead. This makes it necessary to register them in Qt's meta-type system. Doing so, fixes a bug: QML couldn't call into updateDiveSiteCoordinates() because it didn't know the type and thus the coordinates of the moved flag were not reflected in the divesite-dialog. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: compare pointers in MultiFilterSortModel::showDive()Gravatar Berthold Stoeger
To test whether to show a dive, the UUIDs of the filtered-by location and the dive-site of a dive were compared. Since UUIDs are unique (as the name implies), directly compare pointers. Note: this code comes from a time when the filtered-by location was not a pointer, but a copy. Moreover, the if tested first for the same name, then (logical-or) for the same uuid. This makes no sense, as the same dive-site implies the same name. This code likewise can be explained by historic reasons: the filtered-by location may have contained a different name. Swap the order of the conditions: first test for the same object and only of the objects differ, test for the same same. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: replace dive->dive_site_uuid by dive_siteGravatar Berthold Stoeger
Replace the UUID reference of struct dive by a pointer to dive_site. This commit is rather large in lines, but nevertheless quite simple since most of the UUID->pointer work was done in previous commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: remove [start|stop]FilterDiveSite signalsGravatar Berthold Stoeger
This is another case of a weird pattern where an object would connect it's own signal to the slot of a different object. There seems to be no reason why the former couldn't simply call the latter. Remove the [start|stop]FilterDiveSite signals of LocationInformationWidget and call the corresponding functions of MultiFilterSortModel directly. While doing so, replace the UUID argument by a pointer-to-divesite. It will be converted anyway right at the beginning of the function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: use an array of pointers in reloadMapLocations()Gravatar Berthold Stoeger
MapWidgetHelper::reloadMapLocations() used an array of uuids to add dive sites to the map only once. Replace this by an array of pointers. This is a small piece of a larger effort to remove dive site UUIDs. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: replace UUID by pointer in mobile codeGravatar Berthold Stoeger
Replace UUIDs by pointers to dive-site in mobile code. In both cases, the value is transported via a QVariant. The function getCoordinatesForUUID(), which was only used from mobile, can be replaced by a getCoordinatesFor() function taking a variant supposed to contain a dive-site pointer. Likewise, the variant of the centerOnDiveSite function is now supposed to wrap a pointer-to-divesite. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: pass pointer to updateDiveSiteCoordinates()Gravatar Berthold Stoeger
There are two updateDiveSiteCoordinates() member-functions, viz. in MapWidget and MapWidgetHelper. Adapt them to take a pointer to dive_site instead of a UUID. This is part of an effort to replace UUIDs by pointers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: Pass dive-site pointer to MapWidgetHelper::enterEditMode()Gravatar Berthold Stoeger
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>
2018-10-29Dive site: remove UUIDs from LocationInformationModelGravatar Berthold Stoeger
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>
2018-10-29Dive site: remove argument from diveSiteSelected signalGravatar Berthold Stoeger
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>
2018-10-29Dive site: replace UUID_ROLE by DIVESITE_ROLEGravatar Berthold Stoeger
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>
2018-10-29Dive site: use pointer instead of uuid in uemis_helperGravatar Berthold Stoeger
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>
2018-10-29Dive site: pass dive-site pointers to merge_dive_sites()Gravatar Berthold Stoeger
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>
2018-10-29Dive site: pass dive-site pointer to delete_dive_site()Gravatar Berthold Stoeger
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>
2018-10-29Dive site: pass dive-site pointer to is_dive_site_used()Gravatar Berthold Stoeger
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>
2018-10-29Dive site: pass dive-site pointer to nr_of_dives_at_dive_site()Gravatar Berthold Stoeger
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>
2018-10-29Dive site: return pointer to dive_site in create_dive_site_*()Gravatar Berthold Stoeger
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>
2018-10-29Dive site: remove uuid in Uemis' divesite-mapGravatar Berthold Stoeger
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>
2018-10-29Dive site: return pointer to dive_site in get_dive_site_*()Gravatar Berthold Stoeger
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>
2018-10-28std99 does not make sense for C++Gravatar Robert C. Helling
... and makes Qt Creator fail to parse files. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-10-28Dive list: remove rememberSelection() without restoreSelection()Gravatar Berthold Stoeger
Remove three cases of rememberSelection() which did not possess the corresponding restoreSelection() twins. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-28Dive list: remember/restore selection only on view changeGravatar Berthold Stoeger
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>
2018-10-28Dive list: show sort indicatorGravatar Berthold Stoeger
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>
2018-10-28Dive list: switch to a default sort order on column-header clickGravatar Berthold Stoeger
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>
2018-10-28Cleanup: remove DiveTripModel::layout() functionGravatar Berthold Stoeger
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>
2018-10-27build-system: switch back to upstream qt-android-cmakeGravatar Dirk Hohndel
And in the process use our script to do the work. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-27QML UI: we don't need Controls 2.4Gravatar Dirk Hohndel
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>