aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/maintab.h
AgeCommit message (Collapse)Author
2020-11-14cleanup: remove empty function MainTab::reload()Gravatar Berthold Stoeger
This used to reload the completion models. Moreover, remove two obsolete member-function declarations. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-11-04desktop: automatically pick a good theme title colorGravatar Dirk Hohndel
The preference setting seemed far too strange to do this. And not very user friendly. So instead we figure out if this is a dark theme or not by looking at text and background colors in the palette, and make sure we get notified if that changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-03desktop: allow update of tab widget colors at run timeGravatar Dirk Hohndel
Adding a new virtual function to all of these classes may seem like overkill, but of course the idea is that likely we'd allow similar changes to all of them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-10-28cleanup: remove unnecessary includes from maintabGravatar Berthold Stoeger
These are artifacts from when the maintab contained more stuff. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-22desktop: update date and time fields if user changes formatGravatar Berthold Stoeger
This was more painful than expected, because we get the "preferences" changed signal too early when the user switches to system format. The correct format is set by the preferences-widget, not the preferences subsystem. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-07cleanup: free tab-widgets when exiting the applicationGravatar Berthold Stoeger
This is completely irrelevant, however out of principle, let's free the tab-widgets at the end of the application. To do so, use Qt's object hierarchy. I'm not a fan of this kind of memory management, but it is how it is. Moreover, remove the explicit constructor of MainTab, since it doesn't differ from the default constructor anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-06desktop: avoid spurious undo commands for date/time editingGravatar Berthold Stoeger
The date and time fields of the main tab posted undo events for every date/timeChanged signal. Thus, when changing the day of the month to e.g. 21, this would result in two date change events: one to the 2nd and one to the 21st. This is very irritating. Instead listen to editingFinished() events, which thankfully exist for these widgets. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07desktop/tabwidgets: replace editMode by booleanGravatar Berthold Stoeger
There was only one editMode left (MANUALLY_ADDED_DIVE). Therefore replace by a flag. This makes the code more consistent, because the conditions "editMode != NONE" and "editMode == MANUALLY_ADDED_DIVE) actually meant the same thing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07desktop/tabwidgets: replace IGNORE_MODE by flagGravatar Berthold Stoeger
The editMode was set to IGNORE_MODE when programatically setting fields so that we can ignore changed-signals. That seems to be orthogonal to whether we are in edit mode and indeed when setting IGNORE_MODE the edit mode was saved and restored. Therefore, replace the IGNORE_MODE by an independent ignoreInput flag. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove DIVE EditMode in MainTabGravatar Berthold Stoeger
That mode is not used anymore, since only the editing of profiles of manually added dives enters editing mode. For that case we have the MANUALLY_ADDED_DIVE edit mode. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove parameter to MainTab::enableEditionGravatar Berthold Stoeger
All remaining callers were passing MANUALLY_ADDED_DIVE as a new mode, so we may just as well remove the parameter and thus simplify the logic. 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-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-11-11 Notes tab: Use top RH for depth and duretion fieldsGravatar willemferguson
Currently the top righthand part of the notes tab is used for showing and editing air teperature and water temperature. But these fields were moved over to the Information tab and are not required in the Notes tab any more. Rather use this space for the depth and duration data for manually-entered dives. Currently extra vertical space is created in the Notes tab for showing this field, resulting in inefficient use of screen space and inelegant layout. This code moves the Duration and Depth fields into the top righthand of the Notes tab. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-11-10Reorganise the Information tab of the Info panelGravatar Willem Ferguson
1) Reorganise the existing widgets in the Information tab 2) Move divemode widget and visibility widget from Notes tab to Information tab 3) Translate water density to a word indicating water type 4) Reorganise the Notes tab to compensate for the moving the divemode and visibility widgets to the Information tab 5) Remove the problems in showing a QGroupBox in Qt Windows. I do this by removing the CSS specifying border characteristics Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-08-29 Fix broken windows build with latest MXEGravatar Paul Buxton
Replaces some enums with names that do not clash with windows #defines. Specifically: ERROR -> ERRORED, PASCAL->PASCALS, IGNORE->IGNORED,FLOAT->FLOATVAL Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
2019-08-08Move the Suit text box from the Notes tab to the Equipment tabGravatar willemferguson
Sqash latest commit with previous one. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2019-08-08Desktop: display trip time on main-tabGravatar Berthold Stoeger
On the main tab, the trip time was not shown when switching to a trip. Implement showing of the trip date in a function, as the undo-code will also have to update the trip date in certain circumstances. Fixes #2207 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-23Undo: don't send signals batched by tripGravatar Berthold Stoeger
Since the default view is batched by trips, signals were sent trip-wise. This seemed like a good idea at first, but when more and more parts used these signals, it became a burden. Therefore push the batching to the part of the code where it is needed: the trip view. The divesAdded and divesDeleted are not yet converted, because these are combined with trip addition/deletion. This should also be detangled, but not now. Since the dive-lists were sorted in the processByTrip function, the dive-list model now does its own sorting. This will have to be audited. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: move trip-related functions into own translation unitGravatar Berthold Stoeger
These functions were spread out over dive.c and divelist.c. Move them into their own file to make all this a bit less monolithic. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-15Undo: show warning message if more than one dive editedGravatar Berthold Stoeger
On the MainTab, warn if more than one dive was edited. To this purpose, add a new KMessageWidget with an "OK" button that closes the message. Code is mostly a copy of the already existing "Editing dive" message. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-15Cleanup: remove MainTab::addMessageAction() functionGravatar Berthold Stoeger
This is a pointless one-liner function. Let's remove it. The message it shows will probably be moved to the profile in the not-so-distant future anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Dive site: Add button to display all dive sitesGravatar Berthold Stoeger
On the main dive tab, add a button that opens the dive-site selection widget showing all dive sites. This is done by setting the "temporary dive site name" to the empty string. Thus no dive sites are filtered and the "add new dive site" entries are not shown. Moreover, the text is selected. The user can therefore immediately start typing to activate the filter or enter the name of a new dive site. The idea is that after downloading dives with GPS information the user can select one of the close dive sites. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-11Map: reload on selection change directlyGravatar Berthold Stoeger
When changing the dive selection, we have to reload the map to show the correctly highlighted flags. Do this directly by hooking into the DiveListNotifier::divesChanged signal instead of indirectly via the MainTab. Moreover, on reload center on the highlighted dive sites. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-15Cleanup: remove completers from MainTab objectGravatar Berthold Stoeger
This struct is used to store the completers during construction of the object. But it is never accessed afterwards. Therefore, remove it from the object and remove the structure definition from the header file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-15Cleanup: Move dive-equipment tab into own translation unitsGravatar Berthold Stoeger
Most tabs in the dive-information widget have there own translation units and ui-files. Only the equipment tab was married with the main tab. Move it out to get more reasonably sized translation units and some isolation. Currently, this needs ugly hacks when entering / checking for edit mode: Access to MainTab is via the MainWindow. And vice/versa, when accessing the DiveEquipmentTab from the MainTab, the former is hardcoded as the first item of an array. These hacks will soon be removed though, when making equipment editing undoable. The tabs will then be independent. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-15Cleanup: Remove MainTab::getEditMode() functionGravatar Berthold Stoeger
The only caller of said function used to check whether MainTab is in edit mode. For this case there is already a function - use that instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: on save remove focus from active fieldsGravatar Berthold Stoeger
The editing of a dive field is only performed when focus is removed from the field. On pressing CTRL-s, the changes in the currently active field were therefore not saved. Remove the focus from all fields to trigger an edit command yand thus ensure that all changes are saved. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Desktop: read tab-items from current_dive, not displayed_diveGravatar Berthold Stoeger
The whole edit logic moved from displayed_dive to current_dive and it became more and more tedious to keep these in sync. Therefore, simply always display current_dive. The only exceptions are the equipment tab and the planner, as these are not yet integrated in the undo system. Once this is done, displayed_dive can be removed. Moreover, remove the clear parameter from updateDiveInfo(). Instead simply clear of there is no current_dive set. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: inform maintab if dive site changedGravatar Berthold Stoeger
If a dive site was edited, the location field should be updated. Do this by hooking into the diveSiteChanged signal of DiveListNotifier. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Undo: remove ADD mode from main tabGravatar Berthold Stoeger
Instead of letting the user edit the fields before adding a dive, simply add an empty dive. Thus, the ADD mode of the main tab can be removed. Constructing a new dive with default-depth and making sure that the dive is displayed correctly is very subtle. This all needs to be detangled in due course. 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-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-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: 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-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-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-02-02Cleanup: remove unused function MainTab::setCurrentLocationIndexGravatar Berthold Stoeger
The last caller was removed in ce8199cdfdef97437ad85178c7104f307baf018b. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-10-29Dive site: remove UUIDs from LocationInformationModelGravatar Berthold Stoeger
Replace UUIDs from LocationInformationModel and fix the fallout. Notably, replace the UUID "column" by a DIVESITE "column". Getting pointers through Qt's QVariant is horrible, we'll have to think about a better solution. RECENTLY_ADDED_DIVESITE now defines to a special pointer to struct dive_site (defined as ~0). This fixes an interesting logic bug: The old code checked the uuid of the LocationInformationModel (currUuid) for the value "1", which corresponded to RECENTLY_ADDED_DIVESITE. If equal, currType would be set to NEW_DIVE_SITE. Later, _currType_ was compared against _RECENTLY_ADDED_DIVESITE_. This would only work because NEW_DIVE_SITE and RECENTLY_ADDED_DIVESITE both were defined as 1. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>