aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/filterwidget2.cpp
AgeCommit message (Collapse)Author
2019-11-19Filter: split out filter from modelGravatar Berthold Stoeger
Split out the actual filtering from the MultiFilterSortModel. Create a DiveFilter class that does the actual filtering. Currently, mobile and desktop have their own version of this class, though ultimately we may want to merge them. The idea here is that the trip-model and undo-commands have direct access to the filter-function and thus can take care of keeping track of the number of shown dives, etc. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-11-19Filter: move number of shown dives to coreGravatar Berthold Stoeger
We mark hidden/shown dives in the core but store the number of shown dives in the MultiFilterSortModel. Move this datum to the core for improved locality. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-12Turn application state into enumGravatar Berthold Stoeger
The application state was encoded in a QByteArray. Thus, there was no compile-time checking. Typos would lead to silent failures. Turn the application state into an enum. Use the enum-class construct, so that the values don't polute the global namespace. Moreover, this makes them strongly typed, i.e. they don't auto-convert to integers. A disadvantage is that the enums now have to be cast to int explicitly when used to index an array. Replace two hash-maps in MainWindow to arrays of fixed sizes. Move the application-state details into their own files. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Filter: call update title directly in filter modelGravatar Berthold Stoeger
Instead of sending a signal when counts change, catching them in the filter widget and update the window title there, directly update the window title in the model. This removes a signal/slot pair. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Coding style: remove Java-style function definitionGravatar Berthold Stoeger
Remove a few cases of void fun() { ... } While touching these functions, fix a few other whitespace coding style violations. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-11Cleanup: provide our own qOverload<> implementation.Gravatar Berthold Stoeger
This is only in Qt 5.7 and therefore can't be used in Qt 5.5 and 5.6 builds. Moreover, we can't simply reuse Qt's version owing to licensing concerns. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-28Filter panel: add suit and notes search fieldsGravatar Willem Ferguson
All the field in the Notes Panel of the main window are now supported. This needs some testing especially for the Notes field that may contain markup. It appears ok to me for single term searches. One would like to think about the default search option for the Notes. There is a vertical spacer in the Filter panel that I moved downwards and whose function I am not quite sure of. [Dirk Hohndel: small adjustments] Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-02-19Desktop: show the filter information in the window titleGravatar Dirk Hohndel
Instead of using the filter widget itself to show the information how many dives are displayed, put it in the window title where it's visible even if the filter widget isn't shown. If the filter is not active, simply show the total number of dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-02-19Desktop: don't clear the filter when the widget is hiddenGravatar Dirk Hohndel
Only clear the filter when the user explicitly resets it. This way the user can toggle between the map and the filter widget without losing the filter state. Fixes #1952 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-02-19Desktop: track if the filter widget is activeGravatar Dirk Hohndel
This is not perfect - if you open the filter, set some criterion and then remove it again (without resetting the filter), this variable will give you a false positive). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-02-19Filter: implement any-of modeGravatar Berthold Stoeger
Add an additional mode to the tags, people and location filters: any_of. Replace the original invert-bool by an enum. Move the common code into a distinct function. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-28Desktop: set filter negation textsGravatar Berthold Stoeger
The texts may not be perfect, but this is a start. Replace the buttons by combo-boxes. This will allow potential extension to "any of". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-01-26Coding style: unify connect() calls in filterwidget2.cppGravatar Berthold Stoeger
The connect() calls had different styles. Unify them to the one that was used the most. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-26Filter: quick implementation of negationGravatar Berthold Stoeger
Add negate buttons to the Tags, People, Location and Equipment filters. Currently, if nothing is entered the filter is ignored whether negate is on or off. One might think about filtering all dives without tags, etc. instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-26Filter: implement close & resetGravatar Berthold Stoeger
Implement the close & reset functionality, by reseting the application state to "Default". This is currently the only state from where the fiter can be called. To make it consistent with CTRL^F, clear the filter in the hide() slot, which is called in both cases. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-26Filter: implement reset filterGravatar Berthold Stoeger
Move initialization to a separate function and connect that to the reset button. Two points of note: 1) Reseting the text-fields causes signals. Thus, signals have to be ignored during reset. Do this with a new flag. 2) To make reset of the from-date work, the from-date has to be initialized to a distinct value. Setting a default-constructed QDateTime leaves the widget unchanged. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-26Filter: update counts if dives added / removedGravatar Berthold Stoeger
Update the filter counts if dives were added removed by the undo commands. The undo commands call into the filter model at the right time so that hidden_by_filter is already set. The filter model keeps track of the counts and emits a signal, which is caught by the widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-26Filter: implement "x of y shown" textGravatar Berthold Stoeger
Display the number of dives shown. Copy the UI from the old filter widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-22Filter: extend range of allowed temperaturesGravatar Berthold Stoeger
The temperature range 0-100 was inadequate in both supported scales (Celsius and Fahrenheit). Extend the range to encompass all physically meaningful values in both scales. Use the default-values to set the minimum and maximum of the UI-fields. Thus, these values are configurable in a single place. In the future we should use a scale-independent representation (e.g. mkelvin as in the rest of the code base). But this would mean implementing a custom widget with a conversion function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-22Filter: support imperial unitsGravatar Berthold Stoeger
1) Choose the correct conversion function for comparison. 2) Add a unit suffix to the fields. 3) Update the suffixes on change of preferences. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-21Desktop, Filter UI: make date/time consistentGravatar Jan Mulder
On all (most?) places we use separate date/time fields for the time of a dive, and we follow the setting from the preferences to format those. Make the new filter widget consistent, with respect to the to and from interval. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2019-01-19Filter widget: make Ui class subobject of widgetGravatar Berthold Stoeger
Commit 8e81d3f10087fa7ac600dcb18cfebf27716c4209 changed a bunch of Ui classes to be subobject of the widget. For consistency do the same with the filter widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Filter: update filterData directly without copyingGravatar Berthold Stoeger
In FilterWidget2::updateFilter() a new FilterData object is generated and then copied onto the filterData member variable. Instead, modify filterData directly. This seems also more logical from a semantic point of view: Do we want to reset fields that were not set by the user? Contains trivial whitespace fix. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-19Filter: connect widget and filterGravatar Berthold Stoeger
In the latest version of the new filter-widget the connection between widget and filter was lost. Connect both - but use a simple function call instead of a signal, since it is not immediately obivous where the connection should be made. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-01-08Filter for logged/planned divesGravatar Robert C. Helling
Add filter for dives having a planned dive computer or a logged dive computer. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-12-14Hide unimplemented components from searchGravatar Tomaz Canabrava
Those fields are not ready yet, hide them. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2018-12-14Handle Show / Close of the Filter BoxGravatar Tomaz Canabrava
when you close, remove filter. when you open again, restore. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2018-12-14Struct FilterDataGravatar Tomaz Canabrava
The idea is that this struct will have all the needed data that will be passed to the filter model. Everything that happens on the filterwidget will fill out this struct, then forward it to the model, that in turn will activate the filter hiding some of the dives that matches on your divelist. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2018-12-14Start to implement a simplified version of the filter widgetGravatar Tomaz Canabrava
The idea of this new widget is to be able to filter more types of data, while keeping it simple and extending the feature set to something that was impossible with the old implementation. While the old implementation had 4 panels that you could use to filter specific tags / people / types of dives the new one will let you filter by visibility, temperature people, name, equipment, etc, in a more natural way than the old one. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>