aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2020-03-06Cleanup: Move stringToList to core/qthelper.cppGravatar Berthold Stoeger
The same code was used in desktop and undo commands. Let's unify. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-06Cleanup: use getDiveSelection() for shifting timeGravatar Berthold Stoeger
There are two cases where dive-times are shifted: in an explicit dialog and when editing the date/time of a dive. In each of these cases, the selected dives were collected manually. Instead use the getDiveSelection() function. Since this returns a std::vector, change the argument of Command::ShiftTime() to such a std::vector. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-06Core: don't return invalid cylinders from explicit_first_cylinder()Gravatar Berthold Stoeger
For reasons which I don't yet understand, when plotting a dive whose first cylinder is not cylinder 0 and then plotting a dive with only one cylinder, it can happen that for the latter explicit_first_cylinder() returns an erroneous value. This is due to the way in which we copy the dive to be plotted to displayed_dive. For now, make sure that no invalid cylinder is returned to avoid crashes. This will have to be changed anyway, since this is very fundamentally not thread-safe and inefficient. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-05desktop UI: fix typo in GPS import UIGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-05cleanup: make version_printed variable static and local to functionGravatar Berthold Stoeger
The version_printed variable is used to print version information only once. It was a global variable, but never used outside of its function. Therefore, move it into the function and make it static. Since this is a plain old datatype (POD), it makes no no difference whatsoever whether the static variable is in block scope or not. Indeed, it is initialized in the data segment). Well, we are in C mode and therefore everything has to be POD by definition. I tested this on gcc and clang. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-04Mobile UI: fix typo in disabled planner setupGravatar Dirk Hohndel
While this is disabled and is unlikely to be completed, the typo caused confusion with translators. This shows one of the weaknesses of the way we set up our translations, in that always both desktop and mobile are translated together, and disabled code is also included in those translations, causing unnecessary work for the translators. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-03Update translation source stringsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-01selection: update selection on key-pressesGravatar Berthold Stoeger
Commit 2cea115ddb7528d9e6dd1bf918ebf5c670b82479 "fixed" the selection by hooking into mouseRelease events. An unintended consequence was that scrolling with the cursor keys didn't update the current dive. Therefore, also hook into the corresponding key-press events. This is just horrible, but I'm not aware of any possibility to fix it properly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01mobile/filter: derive numShown from a new Q_PROPERTYGravatar Berthold Stoeger
The number of dives was updated when the model of the list was changed. Since we removed the multi-threading, the model is not disconnected/connected anymore and therefore we don't get the appropriate signal. Instead of introducing a different signal, make the shown-value a Q_PROPERTY. Thus, we can easily send a changed signal if we have to. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01CHANGELOG.md updateGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01mobile: remove filter settingsGravatar Berthold Stoeger
These are not used anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: don't search in background on mobileGravatar Berthold Stoeger
I experienced weird crashes that seemed timing-related when using the filter. Therefore, remove the multi-threading thing. So far no more crashes, but keep a close eye on that. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01mobile/filter: use more appropriate placeholder textGravatar Dirk Hohndel
This way it matches the filter mode. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-01filter: introduce people- and tags-filtering in the mobile UIGravatar Berthold Stoeger
Add a combo-box where the user can switch between "fulltext", "people" and "tags" filtering. Connect the combobox to the already existing filter-code. Dirk: make combo-box smaller by using a smaller font and restricting the width. Setting both maximum and preferred widths gives more consistent results. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-01filter: implement searching for tags and people in mobile filterGravatar Berthold Stoeger
Implement tag- and people-filtering in the mobile version of DiveFilter. As opposed to the desktop version, this has no different modes: it always searches "startswith" and "all of". I.e. all of the search strings must match and a tag / person is considered as matching if it starts with the search term. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: remove diveContainsText()Gravatar Berthold Stoeger
This function checked a dive for a search string. Its functionality was replaced by a fulltext index. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: use DiveFilter on mobileGravatar Berthold Stoeger
Use the DiveFilter class on mobile to update the filter. This is mostly for convergence of the mobile and desktop models. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: implement full-text filtering in mobile version of DiveFilterGravatar Berthold Stoeger
In analogy to the desktop version, use the fulltext index in DiveFilter. This code is not yet executed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: remove DiveFilter::updateDiveStatus from classGravatar Berthold Stoeger
This function did not access any class members and was not used outside the tranlation unit. Let's make it local (i.e. static) to the translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01mobile: remove DiveListSortModel::getFilterString()Gravatar Berthold Stoeger
This member function was never used. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: compile fulltext index on mobileGravatar Berthold Stoeger
The code is not used yet. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: fix tab-order of filter widgetGravatar Berthold Stoeger
This was basically random. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: on show focus on fulltext-fieldGravatar Berthold Stoeger
After pressing CTRL-F let the user immediately enter a search string. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: connect fulltext filter to frontendGravatar Berthold Stoeger
There are now three filter modes: 1) Dive site 2) Fulltext 3) Normal When doing a fulltext search, get the dives that match the fulltext filter and then apply the other filters on that list. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: add fulltext field to filter widgetGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: index/unindex dives on loading or clearing logsGravatar Berthold Stoeger
When loading dive data, populate the fulltext index. When clearing dive data, free the fulltext index. When deleting a dive, remove it from the fulltext index. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: add fulltext filtering codeGravatar Berthold Stoeger
Add code that indexes all words of a dive and provides searching for words. A query is represented by the FullTextQuery class, which can be initialized by assigning a string to it. It is basically a list of words. The result of a search is stored in the FullTextResult class, which is a list of dives. The actual indexing and searching is implemented in the FullText class. However, this class is not exported because the interface is partially accessible to C. Notably, the reloading of the fulltext index is done from the C core. Currently, the indexing and searching is totally unoptimized. In a ~4000 dives test-log searches typically took single-digit ms times. There is ample room for optimization (e.g. when searching for multiple words, chose the words with few dives first and when down to a few dives, check them individually). The words of each dive are tokenized and uppercased and cached with the dive. A pointer to these words is stashed in the dive structure. For now, compile only on desktop. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01filter: move StringMode out of FilterDataGravatar Berthold Stoeger
The FilterData struct has the enum StringMode, which describes how strings are searched (substring, startswith, exact). To make it more generally accessible, remove it from the class. Since it is an "enum class", the values don't pollute the global namespace anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28Update libdivecomputerGravatar Dirk Hohndel
Pull upstream libdivecomputer updates from Jef Driesen: - fix lack of "end of deco" on DiveSystem iDive computers by reporting long NDL values - clean up handling of Oceanic empty logbugger - fix BLE download for Oceanic Pro Plus X that doesn't like the serial number handshake. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-28cleanup: remove preferences-other-iconGravatar Berthold Stoeger
No user of that. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28cleanup: remove advanced.png iconGravatar Berthold Stoeger
No user of that. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28cleanup: remove gaschangeICD iconGravatar Berthold Stoeger
No user of that. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28cleanup: remove scale.svg and scale.png iconsGravatar Berthold Stoeger
No users of those. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28cleanup: remove go-top.svg iconGravatar Berthold Stoeger
No user of that. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28cleanup: remove two unused icon-aliases and one iconGravatar Berthold Stoeger
There were no users of these...? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28cleanup: remove setTabIcon() calls in MainTabGravatar Berthold Stoeger
These were used to remove warning-icons to mark tabs with user changes. However these icons haven't been set since commit a86aca037843167b26726926dbf2aebe0513afba. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28cleanup: simplify string-comparison in CylindersModel::setData()Gravatar Berthold Stoeger
Convert to QString instead of a QByteArray. Use qPrintable() instead of data(). This might do one more UTF16->UTF8 conversion. However, this is completely irrelevant, since we don't change the type of a cylinder in a tight loop. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28cleanup: fix leak in CylindersModel::setData()Gravatar Berthold Stoeger
The C-string cyl->type.description was set without the old data being freed. Free the old string before overwriting the pointer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28cleanup: make CylindersModel::cylinderAt privateGravatar Berthold Stoeger
The last outside use of the function was replaced by calls to data(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-28crash fix: Don't cast to CylindersModel or CylindersModelFilteredGravatar Berthold Stoeger
The tank-info-delegate cast its model to CylindersModelFiltered, since this is what the equipment-tab uses since implementing the filtering of unused cylinders. However, the planner users the same delegate and still uses the unfiltered CylindersModel. This means that the (dynamic) cast returns a null pointer and crashes. One possibility would be to derive CylindersModelFiltered and CylindersModel from the same class that defines virtual functions and cast to that class. This is a different attempt: don't cast (i.e. stay with a QAbstractItemModel and play it via Qt's model-view system. Firstly, replace the passInData function by a role to setData(). Secondly, read the working-pressure and size via new columns using data(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-27documentation: additional explanations around Windows USB driversGravatar Dirk Hohndel
This is adapted from a conversation with Jef. Suggested-by: Jef Driesen <jef@libdivecomputer.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-27cleanup: don't update tabs twice in MainTab::rejectChangesGravatar Berthold Stoeger
The updateDiveInfo() call updates all tabs. No need to do it right afterwards. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-27cleanup: remove weightsystems_equal functionGravatar Berthold Stoeger
This was used to test whether the "really discard changes?" message should be shown. However, we now edit weightsystems directly with undo commands. Therefore, the check is unnecessary and the whole function can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-27cleanup: remove MainTab::modifiedGravatar Berthold Stoeger
This field was not set to true since introducing undo of dive fields. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-25mobile/profile: make the fonts 25% smallerGravatar Dirk Hohndel
This will seem too small to many - it's pushing it, but it leads to a significantly less cluttered profile, and we now have the zoom capability for readability. I think this is a nice improvement. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-25mobile/profile: make the wait before dragging even shorterGravatar Dirk Hohndel
Several users still found the wait too long - this is near instantaneous it just ignores brief taps. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-24CylinderModel: remove unnecessary "Is used" headerGravatar Berthold Stoeger
This header is a rebase artifact and introduces a pointless column in the cylinder tables. It was erroneously introduced in 6622f42aab937e72cc11cb5512012394aa687767. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-23build-system: use working version of Breeze iconsGravatar Dirk Hohndel
As of today some of the icons that we need are no longer in the git repoo but instead created via script. Instead of making this work everywhere, let's just use a working SHA... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-23cleanup: remove CleanerTableModel::warningMessage signalGravatar Berthold Stoeger
Nobody was ever listening to this signal(?) and the last sender was removed in ac52034778bc5c82bb6c689d765b337b6d75b24a. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-22Filter: move actual filtering loop to core/divefilter.cppGravatar Berthold Stoeger
The DiveFilter class defined the showDive() function to test whether a dive should be filtered or not. This was used in DiveTripModel to loop over all dives or all dives affected by an editing action. This restricts us in how we do filtering: We can't use indexes that give us directly the result. To make the filtering more flexible, move the actual loops that do the filtering to the DiveFilter class. The undo-commands likewise called directly the showDive() function to check whether newly added dives are shown. Use the new interface here as well. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>