summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
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-12Undo: update filter flag when dives changeGravatar Berthold Stoeger
The filter code is strange: it actually only checks the dive->hidden_by_filter flag. Thus, before propagating the dive changed signal, this flag has to be updated. Do this in the DiveTripModel. Ultimately, this should be refactored. Moreover, if the filter-flag changed notify the frontend of a changed trip so that the trip is hidden / unhidden. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: update dive list if trip changedGravatar Berthold Stoeger
In tree-mode, the trip locations are displayed. Update the corresponding entries if the trip changed, by hooking into the tripChanged() signal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: switch to edited tripGravatar Berthold Stoeger
If fields in a trip are edited, select that trip, which will display the trip in the notes-box. This is realized by hooking into the tripChanged signal in the dive-list. A layering-violation, perhaps? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: move temperature update from MainTab to EditWaterTempGravatar Berthold Stoeger
The code in maintab is not called anymore (unless cylinders or weightsystems are changed). Move the code to the command that edits water temperature. This should be audited as it is unclear weather this is necessary. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Cleanup: remove field-coloring code in MainTabGravatar Berthold Stoeger
Since all fields on the maintab are now directly edited, there is no point in marking fields as changed. Remove unused functions MainTab::markChangedWidget() and MainTab::resetPalette(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of dive trip editingGravatar Berthold Stoeger
This is copying the dive editing code. It uses an OO design with virtual functions for getting and setting the values. It doesn't use templates though, as both fields of strig type. This feels a bit over-engineered, but it is 1) consistent with the dive edit code and 2) the number / types of dive trip fields might increase. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: update cylinder and weight models on pasteGravatar Berthold Stoeger
When pasting (or undoing paste) the cylinders or weights may change. Send the appropriate signals and update the models accordingly. Currently, this means copying from current dive to displayed dive, but hopefully we can get rid of "displayed_dive" in the not so distant future. 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-12Cleanup: remove EDIT_TEXT and EDIT_VALUE macros in maintab.cppGravatar Berthold Stoeger
These functions are now performed by the edit commands and the macros have no users. Remove them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Core: introduce taglist_copy() functionGravatar Berthold Stoeger
Taglists were only copied in dive.c using the STRUCTURED_LIST_COPY macro. Export that functionality in a function. This will be needed for undo of dive-pasting. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: remove MainTab::*TaggedStrings() functionsGravatar Berthold Stoeger
Moving the tagged-string edit functions into the undo-system made the MainTab::saveTaggedStrings() and MainTab::diffTaggedStrings() functions unnecessary. Remove them. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: select dives on undo of editing commandsGravatar Berthold Stoeger
Save selected dives when generating an edit-command. Restore the selection and current dive in undo()/redo(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: move selection function into command_private.cpp fileGravatar Berthold Stoeger
Undo of editing should probably also restore the old selection and current dive. Therefore, move the functions that set and restore the selection and the current dive from the command_divelist.cpp into the command_private.cpp translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: move dive-list logic into edit commandsGravatar Berthold Stoeger
The edit-commands were called with a list of selected dives and the original value. Move the creation of the list and extraction of the original value into the edit-commmands. This removes the "current is last" rule and allows for more flexibility. Since the depth- and duration editing applies only to the current dive and not all selected dives, add a parameter to the edit-commands controlling whether only the current or all selected dives are edited. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: update dive list after edit commandGravatar Berthold Stoeger
The dive list was not updated automatically when an edit command was executed. There was already a signal to do that, viz. divesChanged(). But that signal worked by-trip and didn't have a dive-field specifier. The edit-commands used the divesEdited() signal that isn't by-trip but has a dive-field specifier. Unify these two signals to be by-trip and with dive-field specifier. This needs common code to generate the by-trip list that is moved to a command_private.h header. Since there might now be multiple signals (one per trip) actually check in the main-tab whether the current trip is affected to avoid multiple update of fields. This has the positive(?) effect of not doing any update if the current dive isn't changed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Cleanup: remove MainTab::acceptingEditGravatar Berthold Stoeger
The acceptingEdit field was used to ignore edit-signals in MainTab::acceptEdit(). But an equivalent mechanism already exists: setting editMode to IGNORE. For consistency, replace the former by the latter. acceptEdit() resets the editMode in all cases anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of depth and duration editingGravatar Berthold Stoeger
This was a bit different from the other editing commands: 1) Only the current dive is edited not all selected dives. Therefore, create a function that turns the current dive into a one-element list. 2) The profile has to be replot. Here, likewise, create a function to do that. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of divemaster editingGravatar Berthold Stoeger
This is mostly a trivial copy of the buddies code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of buddy editingGravatar Berthold Stoeger
This was mostly trivial by reusing the code for tag-editing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of tag editingGravatar Berthold Stoeger
The code follows the other edit-commands, but uses its own base class, because it is distinctly different. Editing the tag field does not simply mean setting the tag for all dives, but rather adding and removing individual tags. This class will be reused for editing of dive buddies and masters. Modify the tag widget thus that it sends an editingFinished() signal when it goes out of focus. The editingFinished() signal was prevented by hooking into the return, enter and tab key-events. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Desktop: on ESC, remove focus when editing dive fieldsGravatar Berthold Stoeger
Give the user a way to accept the changes made to a dive-field by pressing ESC. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: send dive-changed signal on dive site mergingGravatar Berthold Stoeger
Now that we have dive-changed signal, send it on merging dive sites so that the notes tab can be updated accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of dive site editingGravatar Berthold Stoeger
This one is a bit more tricky. There are two modes: set dive site and set newly created dive site. This is realized using an OO model with derived classed. Quite convoluted - but it seems to work. Moreover, editing a dive site is not simply setting a value, but the list of dives in a dive site has to be kept up to date. Finally, we have to inform the dive site list of the changed number of dives. Therefore add a new signal diveSiteDivesChanged. To send only one signal per dive site, hook into the undo() and redo() functions and call the functions of the base class there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of dive date- and time-editingGravatar Berthold Stoeger
This is different from the other editing commands, because date and time editing may change the order of the dive list. Therefore, this uses an already implemented dive list command. The command is extended to send a divesEdited() signal. This signal and the divesChanged() signal, which is used by the dive list, will be unified in a later commit. Update of the graphics is now not done via signals, a direct call is performed in MainTab::divesEdited(). This simplifies things. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of air and water temperature editingGravatar Berthold Stoeger
Mostly trivial. Since now on editing the field is re-set, the validation function becomes unnecessary. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Pedantic: K are an absolute scale, which are not given in degreesGravatar Berthold Stoeger
Since somewhere in the 1960s. "Fix" a few comments. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of rating and visibility ratingGravatar Berthold Stoeger
This was rather trivial and modeled after the previous edit UndoCommands. Since this is the first time we're editing integers a new constructor instantiation had to be added. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of suit editingGravatar Berthold Stoeger
This one was trivially modelled after notes editing. Only difference: the textChanged() signal was replaced by the editingFinished() signal so that we're not generating undo-commands on every key-press. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of dive mode editingGravatar Berthold Stoeger
Add a new UndoCommand for dive mode editing. This one is a bit special, as the mode is associated with a dive computer (DC), not a dive. Thus the edit command has an additional parameter, viz. the index of the DC. This does not fit properly to the EditBase class, as this class isn't aware of additional parameters and therefore this parameter is not sent via signals. At the moment this doesn't matter. In any case, the semantics of editing are weird and therefore let's do the simple thing (derive from EditBase) and let's see what the future brings. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: update notes field if changed by undo commandsGravatar Berthold Stoeger
To keep the UI in a consistent state, update the notes field if it is changed by an undo command. To that purpose, add a new signal to diveListNotifier with a list of dives and a field-id as payload. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement rudimentary undo of dive-notes editingGravatar Berthold Stoeger
Implement a first rudimentary dive-editing command. The main code resides in a base class Command::Edit, which calls virtual functions to read / set the fields and extract the field name. Implement an example: editing of dive notes. This dose not yet update the UI on undo / redo. 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-12Cleanup: remove unnecessary signalGravatar Berthold Stoeger
The edit dive site button was connected to a *signal* of MainWindow, which was connected to a slot of MainWindow. Remove the unnecessary intermediate signal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive site: add edit field to dive site tableGravatar Berthold Stoeger
Add an edit column that calls the new editDiveSite() function of MainWindow. The calling code is in DiveSiteSortedModel. Quite illogical, but that's how TableView works, for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Icons: cache small edit iconGravatar Berthold Stoeger
In analogy to the trash-icons, cache a small rendered version of the edit icon. This will be used in the dive-site table. Rename the icon alias from "duplicate-edit-icon" to "edit-icon", as it actually is not a duplicated. The other "edit" icon is an "undo" icon! Move the accessor functions to cleanertablemode.cpp. This is not the ideal place, but since the functions are declared in cleanertablemodel.h it's certainly better than the old place (models.cpp)! Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Desktop: Dive site editing: give up focus on ESCGravatar Berthold Stoeger
As long as a text field is active, CTRL-Z only affects this field. Thus it is suprisingly hard to undo edits. There seems to be a fundamental problem with CTRL-Z handling. To make it somewhat easier, catch any ESC-key event and move the focus to the MainWindow. This effectively removes the focus from any text field. This all appears very wrong, but so far I wasn't able to find the root cause of the problem. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Cleanup: remove LocationInformationWidget::endEditDiveSite signalGravatar Berthold Stoeger
The signal was caught by the MainWindow to: 1) call setDefaultState() 2) call refreshDisplay() 3) call refreshDisplayedDiveSite() 1) Let's call that directly from the widget. The reason is that in the future there might be multiple way to get into the widget and therefore the widget needs finer control. 2) Remove this call as it produces an unsteady UI. 3) This should be done by undo commands, not only when finishing dive site editing. Thus, the signal becomes unnecessary and can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: make dive site merging undoableGravatar Berthold Stoeger
This one was rather trivial, as there is no actual merging done. Quite simply, a number of dive sites are removed and their dive added to a different dive site. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of geo lookupGravatar Berthold Stoeger
Simply copy code of the other edit dive site functions. Here though introduce a destructor in the undo command to free the taxonomy data. Remove the taxonomy member of the LocationInformationWidget class, because it is not needed anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive site: remove edit mode from dive location widgetGravatar Berthold Stoeger
Since no dive site field editing enters edit mode anymore, the whole edit mode state and code can be removed from the widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: update map when dive site location is changed by undo commandGravatar Berthold Stoeger
Simply hook into the appropriate signal. Thus, the "update dive site location" button can be removed. 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-12Cleanup: remove LATITUDE and LONGITUDE columns in DiveLocationModelGravatar Berthold Stoeger
These were never used and it's hard to imagine when one of these would be used. Typically users are more interested in the coordinates than just one component, no? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of dive site country editingGravatar Berthold Stoeger
Simply copy the code of notes editing, but use the taxonomy_* functions to read and set the value. Moreover, replace the three TAXONOMY_n field ids by a single TAXONOMY id. We will probably never show one column per taxonomy field, but rather a single column with a string derived from all taxonomy fields. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: implement undo of dive site notes editingGravatar Berthold Stoeger
Simply copy the code of description editing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Desktop: create new custom TextEdit widget for notes-fieldGravatar Berthold Stoeger
Currently, the notes field uses a QTextEdit, which doesn't send a signal if it goes out of focus. But for undo of dive-editing we don't want to create an undo object for *every* text change. Thus, create a custom TextEdit widget that derives from QTextEdit and turns the focusOutEvent into a editingFinished signal. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: use undo commands for name and description editing in widgetGravatar Berthold Stoeger
In the dive site widget, use the undo commands instead of editing only on accept. This introduces an inconsistency betwee the name and description and the other fields. This will be fixed in follow-up commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Dive site: remove LocationInformation::nameChanged signalGravatar Berthold Stoeger
This signal was used by the old filter and the last user was removed in e0f473fcb49c8121a0a9c52bf0536049b0f342ed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>