aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets
AgeCommit message (Collapse)Author
2019-08-08Cleanup: move error reporting function declarations to errorhelper.hGravatar Berthold Stoeger
Move the declarations of the "report_error()" and "set_error_cb()" functions and the "verbose" variable to errorhelper.h. Thus, error-reporting translation units don't have to import the big dive.h header file. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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-07-27Desktop: fix index in weightsystems_equal()Gravatar Berthold Stoeger
The weightsystem_equal() function compares weightsystems of two dives to decide whether the "commit changes" message should be shown and to decide which dives are edited when changing multiple dives. Due to an index mixup the function returned wrong results for more than two weightsystems. Fix it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Core: dynamically resize weight tableGravatar Berthold Stoeger
Replace the fixed-size weightsystem table by a dynamically relocated table. Reuse the table-macros used in other parts of the code. The table stores weightsystem entries, not pointers to weightsystems. Thus, ownership of the description string is taken when adding a weightsystem. An extra function adds a cloned weightsystem at the end of the table. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: Remove unused function calls in main tabGravatar Berthold Stoeger
per_cylinder_mean_depth() and selected_dives_gas_parts() are used in the dive-information and statistics tab, respectively. Nevertheless, these functions are called on the main tab as well and the result is trashed. Therefore remove the calls. Must have been an artifact. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-18Cleanup: remove includes from qthelper.hGravatar Berthold Stoeger
To reduce interdependencies, remove the dive.h and divelist.h includes in qthelper.h Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-11Desktop: clear notes on empty diveGravatar Berthold Stoeger
If no dive is set, all fields except the note field were cleared. Also clear notes. Fixes #2172 Reported-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-07-04Desktop: enable clearing of dive siteGravatar Berthold Stoeger
Clearing dive site did not work for two reasons: 1) We didn't get a signal when editing was finished. 2) When clearing the dive site, the "add new dive site" site was set. Thus, connect to the editingFinished signal and in DiveLocationLineEdit::currDiveSite() return a null pointer if the string is empty. This means that it is not possible to have a dive site with an empty string, but that shouldn't be a problem, right? Fixes #2148 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-24Desktop: fix time editingGravatar Dirk Hohndel
We were shifting in the wrong direction. Which caused the field to be marked as 'edited' again, which meant we shifted the wrong way and twice the distance. This seems to fix the problem for both date and time editing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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: remove unnecessary get_gas_used() callGravatar Berthold Stoeger
The result was not used anywhere, so why bother? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: use quotation marks for non-system includesGravatar Berthold Stoeger
That's common practice, so lets do it that way. 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: add undo button to multi-dive-edited warning messageGravatar Berthold Stoeger
Simply connect the button the the undo-action and the hide-message action. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-15Undo: hide multi-dive-edit warning message on subsequent editGravatar Berthold Stoeger
When a different field is edited, hide any old multi-dive-edit warning message. The reason is that we might want to add an "undo" button to the message. But this will undo the wrong command if we don't hide the message. Sadly, this means that we can't use animated show / hide, because an animatedHide() followed immediately by an animatedShow() does not necessarily show the message. In other words, and animatedShow() does not interupt a started animatedHide()!? 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-06-15Undo: don't create spurious undo commands for temperature fieldsGravatar Berthold Stoeger
When tabbing through the dive-info fields we get *EditingFinished signals. This would create undo commands. The undo commands should recognize if nothing changed. But for the temperature fields, owing to rounding, an unchanged text could actually represent a different value. This would lead to very confusing situations: 1) Edit air temperature 2) Press tab to finish editing 3) Focus goes to water temperature 4) Try to undo change in menu 5) When opening the menu water temperature loses focus 6) Water temperature is edited 7) Undo undos the water temperature, not the air temperature 8) Goto 4 Fortunately, QLineEdit fields have the isModified() member function that returns true if the field was changed by the user. Use this to prevent this case. This is not a general method, i.e. it has to applied to every field with that problem. But it is less intrusive than subclassing the QLineEdit class. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-07Desktop: invalidate dive cache on equipment editGravatar Berthold Stoeger
Owing to the recent undo-changes, the git id was not invalidated when accepting changes to cylinders and weights. Do this in the MODIFY_DIVES macro for now. Reported-by: Jan Iversen <jani@apache.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-07Desktop: don't show location-popup button in trip-edit modeGravatar Berthold Stoeger
The location fields are hidden in trip mode. Only the location-popup button was shown. Hide it as well. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-05-15Cleanup: small coding style fixesGravatar Dirk Hohndel
And addressing a cut and paste error in a comment. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-05-15Convert the atmospheric pressure in the Information Tab to an editable fieldGravatar willemferguson
The Information tab shows the atmospheric pressure. Make this value editable and also ensure that changes to it are undo-able. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
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-11Dive site: sort by distance to current diveGravatar Berthold Stoeger
When presenting the list of dive sites on the dive-info tab, sort the dive sites by distance to the current dive. The idea is that when the user wants to select a dive site, close dive sites should be prioritized. The location of the dive is determined with the dive_get_gps_location() function introduced in the previous commit. This actual GPS data get precedence over the currently set dive site for that dive. On change of dive, the current location is updated in the DiveLocationFilterProxyModel so that a potentially expensive search for GPS data is not repeated for every comparison. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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-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-05-05Desktop: fix crash on dive site tabGravatar Berthold Stoeger
An interesting crash: 1) On the dive site tab select a dive site such that only one trip is shown. 2) Unselect all dives. 3) Press CTRL-A while the dive list has focus. 4) This will select a trip. 5) In MainTab::updateDiveInfo() this will switch to the previous tab active when in trip mode. 6) This will reset the filter. 7) This will reset the currentTrip field which we just set. 8) Since we just set the currentTrip field, we don't expect it to change and reference a null pointer. To fix, don't switch tabs when on the dive site tab. This also improves user experience as there seems to be no reason to switch away from the dive site tab. Currently the index of the dive site tab is hard-coded - this should be changed! Fixes #2077 Reported-by: Doug Junkins <junkins@foghead.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Cleanup: remove redundant string clearingGravatar Berthold Stoeger
The default QString constructor generates an empty string. No point in assigning the empty string to such a thing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Desktop: automatically update dive information tabGravatar Berthold Stoeger
Currently, the dive information tab was not updated when the user edited fields. The fields were only updated when switching between dives. Therefore, hook into the "divesChanged" signal and update the fields accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Desktop: use current_dive in information tabGravatar Berthold Stoeger
The information tab used displayed_dive to fill out its field. For consistency with the main tab and in a bigger effort to remove displayed_dive, use current_dive instead. Only clear the fields if no current_dive is set. The code used to clear the fields and overwrite them later. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-29Desktop: set dive fields only when not in trip modeGravatar Berthold Stoeger
On the main-tab, when looking at a trip, the fields were filled out with dive-data and then either hidden or overwritten with trip data. Move the update of the fields into the corresponding if-branch that is only active if on dive-mode. This means removing the UPDATE_* macros, which updated or cleared dive-fields depending on whether a current dive was set. These operations are now performed explicitly in the corresponding if-branches. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-16Write dive data as video subtitlesGravatar Robert C. Helling
This commit adds an entry to the dive media context menu which offers to write a subtitle file. This creates an .ass file for the selected videos. In an attempt to to clutter the screen too much, don't show irrelevant entries (zero temperature or NDL and show TTS only for dives with stops). VLC is able to show these subtitles directly, they can be integrated into the video file with ffmpeg. Signed-off-by: Robert C. Helling <helling@atdotde.de>
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-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-13Dive sites: dont't disable all tabs when creating new dive siteGravatar Berthold Stoeger
The dive tabs are disabled, when no dive is shown. The dive site tab is implemented as a dive tab, which is of course conceptually wrong. Moreover it has the nasty side effect that when adding an empty dive site, no dives are shown and the tab is disabled, leading to a UI dead lock. Therefore, disable all tabs but the dive site tab. The proper fix will be a refactoring of the UI. Reported-by: Doug Junkins <junkins@foghead.com> 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-12Cleanup: replace QString("") by QString()Gravatar Berthold Stoeger
That should be more effective. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-04-12Map: reload map when editing dive site of a diveGravatar Berthold Stoeger
Editing the dive site of a dive may make a dive site appear (first dive of that site) or disappear (the last dive of that site was removed). Therefore, we have to reload the dive site markers on editing the site of a dive. This should be made smarter by only reloading the markers if the dive site status actually changed. 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-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: 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-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>