aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/TabDiveSite.cpp
AgeCommit message (Collapse)Author
2019-05-11Filter: add reference counting for dive-site modeGravatar Berthold Stoeger
The dive-site-edit and dive-site-table tabs both put the filter into a special dive-site mode. When switching between both, it could happen that the one got its show befor the other got its hide event. Thus, the first would start dive-site filtering and the second stop it. Now the app was not in filter mode even though it should. To solve this problem, add reference counting for the filter's dive-site mode. In both tabs call the enter/exit functions on show/hide. In the dive-site-table tab, when the selection changes, use a set function that doesn't modify the reference count. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-13Desktop: put dive site table in "row selection mode"Gravatar Berthold Stoeger
This feels more natural than selecting a single cell. Still, the "delete" cell is not visibly selected, which give a strange impression. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive sites: show dives at selected dive sitesGravatar Berthold Stoeger
When in dive site tab and some dive sites are selected, show only dives at those sites. Simply read the selection and pass it to the filter. Start and stop filtering when switching to and from the tab, respectively. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive sites: add fulltext filterGravatar Berthold Stoeger
In the dive site tab, add a fulltext filter. The UI is only a mock up. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive site: implement purge of unused dive sitesGravatar Berthold Stoeger
Add a "purge unused dive sites" button to the dive site list. Connect it to a new PurgeUnusedDiveSites command. Implementation was trivial: simply copy the DeleteDiveSites command. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive sites: stretch name and description columnsGravatar Berthold Stoeger
Stretch the name and description columns in the dive site table, so that they don't start too small. This should only be a temporary solution, as it disables the save column width to preferences feature of TableView. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of dive site location editingGravatar Berthold Stoeger
Simply copy the code of note editing. It's a bit more complex, since we have to parse the Gps coordinates. For consitency, rename the COORD field to LOCATION (the field in the dive_site struct is called LOCATION). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive site: scroll to changed dive siteGravatar Berthold Stoeger
If the name of a dive site is edited, it might wander somewhere else in the table and thus out of view. Hook into the "dive site changed" signal and scroll there. The code is rather subtle as it depends on signals being called in a certain order: First the item is moved in the model, only then can we scroll to the correct place. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive site: on first addition of dive site, edit nameGravatar Berthold Stoeger
When adding a dive site, enter the name field of the new dive site. Thus, when adding a new dive site, the user can immediately edit the name. The code is rather subtle: It hooks into the dive site added signal before executing the command and unhooks afterwards. This only works, because signals are executed in order of connect - thus the model adds the index first and only *then* is the field edited. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of dive site additionGravatar Berthold Stoeger
Implement a dive site addition undo command and connect it to the add dive site button. The added dive site has a default name ("new dive site"). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive site: introduce proxy model DiveSiteSortedModelGravatar Berthold Stoeger
The LocationInformationModel used to sort its entries and was completely rebuilt after every change. This makes it rather complex to support incremental changes. Instead, keep LocationInformationModel sorted by UUID so that indexes are consistent with indices in the core dive site table. Implement sorting by other columns than name and enable sorting in the dive site view. Finally, don't cache the list of dive site names for the mobile app, since that would also need some rather convoluted methods of keeping the list up to date. Calculate it on the fly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive site: add dive site list tabGravatar Berthold Stoeger
Add a very simple tab-widget presenting the list of known dive sites. The table is rendered using our custom "TableView". The (mis)uses the "LocationInformationModel". It moves the items to be displayed (delete, name, description, number of dives) to the front and makes the others hidden. Moreover, it was necessary to limit the geo-tag decoration role to the name to avoid having the icon next to each column. Make the trash-can icon active and the name and description editable. This is modelled after the cylinders-table code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>