aboutsummaryrefslogtreecommitdiffstats
path: root/core/selection.cpp
AgeCommit message (Collapse)Author
2020-09-20selection: when changing current dive make sure it is selectedGravatar Berthold Stoeger
When an undo command selected invisible dives, a current dive outside of the list of selected dives was chosen. This could have the very unfortunate effect that the current dive was set, though not selected. From an UI point of view this meant that the dive was displayed, but edits would not be registered. Change the setClosestCurrentDive function to select the current dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-03selection: create global single_selected_trip() functionGravatar Berthold Stoeger
The DiveListView had a singleSelectedTrip function that returns the selected trip if exactly one trip is selected. This could be very slow if numerous non-trip items were selected, because all the selection indices were back- translated by the proxy model. This could make selection changes very slow, because the MainTab used said function to determine whether it should show trip or dive data.. Indeed, with a 3500 dive test log, when selecting all dives in tree mode, the updating of the TabWidgets is sped up from 130 ms to 5 ms this commit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-03selection: introduce clear_selection() functionGravatar Berthold Stoeger
The DiveListView would touch the selection-innards directly. Let's encapsulate that. Moreover, take care to reset the trip selection when resetting the core data. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-03selection: add selection flag for tripsGravatar Berthold Stoeger
In analogy to dives add a selection flag for trips. The reason being that search for a selected trip can be painfully slow when we do it through Qt's proxy model. Make sure to deselect trips when they are removed from the core. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-12cleanup: remove current_dive parameter from divesSelected signalGravatar Berthold Stoeger
The diveListNotifier.divesSelected() signal is used to inform the models of a selection change. It sent the current dive as a second parameter. This is redundant, because the only sender of the signal sets current_dive just before sending the signal. Remove the parameter, which appears to be an artifact. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04Cleanup: lower-case filenames in core/subsurface-qt/Gravatar Berthold Stoeger
We tend to use lower-case filenames. Let's do it for these files as well. Simple search & replace. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-07Selection: provide convenience function for single-dive selectionGravatar Berthold Stoeger
Currently, selecting a single dive or deselecting all dives was quite awkward: One had to pass in a single-dive vector and the dive itself (as current dive). Provide a convenience function that selects a single dive or deselects all dives if null is passed in. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Selection: move selection of "first" dive to coreGravatar Berthold Stoeger
The DiveListView has a function to select the first dive. Move this to the core to be able to call it from all parts (not only desktop) of the code. Currently, this has a (small?) UI regression: when filtering dives and no selected dive is visible anymore, the old code would select the first dive in the list. The new code selects the newest dive, which might not be the first if some sort-criterion is active. To revert to the old behavior, it will be necessary to move the sorting function likewise to the core. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Selection: move selection functions from divelist.c to selection.cGravatar Berthold Stoeger
Since we now have a selection.c translation unit, put the selection- related functions there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-04Selection: move commands/command_private.* to core/selection.*Gravatar Berthold Stoeger
The file command_private.cpp had functions concerning selections only. To make these functions accessible from outside the undo machinery, turn it into a part of the core-library. Currently, only C++ functions are exported. We might think about also exporting a C interface. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>