aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
AgeCommit message (Collapse)Author
2020-04-25desktop: don't select current dive after collapsing tripsGravatar Berthold Stoeger
This appears to be an artifact. Collapsing does not unselect the current dive, so reselecting it appears pointless. Also it is unclear why the selection should be restricted to a single dive after collapsing. Probably that was originally meant to expand only the trip with the current dive in it? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-25desktop: make DiveListView::selectDive() privateGravatar Berthold Stoeger
Thus, it is made clear that these member functions can only be accessed from DiveListView itself. This should make debugging easier. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-24cleanup: move clearing of event names to clear_dive_file_data()Gravatar Berthold Stoeger
Move this to the core so that desktop and mobile don't have to call this explicitly. Matter of fact, mobile didn't call this. It is unclear, whether that was even used on mobile, though. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-24cleanup: move clearing of device nodes to clear_dive_file_data()Gravatar Berthold Stoeger
It makes no sense to keep the device nodes if all the other data is cleared. Let's do this automatically and not explicitly. This ensures that the function is also called on mobile. Currently it was only called on desktop. Weirdly, the parser-tests were expecting that the device nodes were not reset by clear_dive_file_data() and therefore divecomputers were accumulating in the test results. Thus, the additional computers had to be removed from the expected test results. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-24filter: implement filtering for divemodeGravatar Berthold Stoeger
This only checks the first divecomputer as the semantics for multiple dive computers with different dive modes are not clear. Should we check them all? The implementation is a bit hackish: the indexes [0...n] of the combobox are mapped onto [-1...n-1], where -1 means don't filter and n-1 is the last valid dive mode. Implements #2329 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-21cleanup: replace constructs of the type &vector[0] by vector.data()Gravatar Berthold Stoeger
It appears that some misguided compiler / library combinations crash on &vector[0] for empty vectors. Even though very unfriendly, they are technically correct, so let's remove these constructs. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-21desktop: don't access first data element if no cylindersGravatar Berthold Stoeger
TabDiveInformation::updateProfile() does some statistics via the per_cylinder_mean_depth function. It passes down arrays with one entry per cylinder, which are allocated by means std::vector. To pass the array, the expression "&vector[0]" is used. It seems like some compilers through an assertion violation if vector has no elements. They are technically correct in that this is undefined, but still this appears like very unfriendly behavior. After all, std::vector should behave just like a dynamic C-array that is automatically freed, when going out of scope. Replace the "&vector[0]" by "vector.data()" and don't do the call if there aren't any cylinders for good measure. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-20desktop: rearrange widgets on the dive site tabGravatar Berthold Stoeger
Move the more commonly used filter to the left and the less commonly used "purge unused sites" button to the right. Add a spacer so that the filter-textbox doesn't extend over the whole free space. With apologies to sinistroverse users (is there an option to make the layout direction depend on the locale?). Suggested-by: Hartley Horwitz <hhrwtz@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-19desktop: remove user surveyGravatar Dirk Hohndel
We have never made good use of the results. Let's just remove it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-18Reorganise and reword divelog export panelGravatar willemferguson
Perform slight reorganisation and rewording of the divelog export panel. Specifically the wording is changed and expanded to make clear the 2 types of export of profile data. All the CSV export options are grouped together. With respect to profile export to CSV format, it is made clear that one option concerns export of dive computer-related profile data, whereas the other option involves export of computed dive profile data from the Dive Profile panel. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-04-13desktop: remove special QGroupBox stylesheet for non-Windows systemsGravatar Berthold Stoeger
That style-sheet made things look really ugly on most Linux themes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-12delegates: remove TankInfoDelegate::createEditor()Gravatar Berthold Stoeger
When creating a TankInfoDelegate editor, reploting of the profile was disabled to avoid replotting when the user scrolls through the tank-info list. Since the code was changed to only set the tank-info when the editor is closed, this became unnecessary (hopefully). Indeed the clearing of the flag was removed in a previous commit. This means that we also have to remove the setting of the flag. Since this is all the TankInfoDelegate::createEditor() function was doing, we can remove the whole function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-12cleanup: remove unnecessary profile update after adding new diveGravatar Berthold Stoeger
MainWindow::on_actionAddDive_triggered() updated the profile after calling Command::addDive(). However, that is redundant because the undo-machinery does the profile reload. Remove the call. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-11Merge pull request #2643 from bstoeger/cylinder4Gravatar Dirk Hohndel
First steps of cylinder-editing undo
2020-04-10media: move picture function from dive.c to picture.cGravatar Berthold Stoeger
Currently, move only those functions that do not access dive structures. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07delegates: remove ComboBoxTemplate::fixTabBehaviorGravatar Berthold Stoeger
The comment states that Qt treats TAB as cancel when in the combobox. However, testing shows that this use-case works without this hack. Since it caused weird behavior (the data was set *after* the editor was closed, leading to inconsistent state), remove it. Note: this overrides the previous commit, which is therefore redundant from a history point of view. However, I'll leave the previous commit in so that if something turns out to break, we can figure out which of the two changes it was. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07delegates: call fixTabBehavior *before* closing the editorGravatar Berthold Stoeger
fixTabBehavior() set the editor text *after* closing the editor. This left us in an inconsistent state where we thought that the editor is active. By reversing two connects, this problem is resolved. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: make static fields local to ComboBoxDelegateGravatar Berthold Stoeger
All combobox-delegates shared a number of static status fields. In a quest to make the code more reentrant, move that to the actual object. The fields have to be defined as mutable, since they are set in const member functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove TankInfoDelegate::reenableReplotGravatar Berthold Stoeger
Update of the profile is now done by the undo-commands. If the planner needs this, it is probably better to connect directly to the model, not the delegate. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove unneeded includes from TabDiveEquipment.cppGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: show multiple dive warning when editing equipmentGravatar Berthold Stoeger
When editing cylinders or weights directly in the table widgets, no warning was shown if multiple dives were affected. To solve this, emit signals from the respective models and catch them in dive equipment tab. Not very nice, but it works for now. 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-07desktop: properly initialize activeText of model-delegatesGravatar Berthold Stoeger
For reasons that I don't understand, we keep track of the current combo-box text for our model-delegates. However, that text was not initialized when the editor was generated, leading to a UI bug in the cylinder and weight widgets: Activate a field, click somewhere else -> either the empty string or the previous string was set. Reported-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: implement set point change undo commandGravatar Berthold Stoeger
This is a simple copy of the other add-event commands. It could be made more friendly by stating the pO2 value in the text. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: switch SetpointDialog from divecomputer to dive + dc-numberGravatar Berthold Stoeger
Since pointers to divecomputers may not be stable, the undo commands take a dive + a divecomputer number. Update the SetpointDialog accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: use pointer-to-member version of connect in SetpointDialogGravatar Berthold Stoeger
While touching this dialog, might as well change away from the MOC version of the connect() statements. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: un-singletonify SetpointDialogGravatar Berthold Stoeger
We have too many global objects. There is no reason why this dialog should be a persistent global object. 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-04-07desktop: remove EDIT modeGravatar Berthold Stoeger
The only way to enter edit mode is to edit the profile. However, that means that the profile is already visible, so there is no need to change the mode. Simply remove the EDIT mode. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07desktop: move undo-disabling from enterEditState to disableShortcutsGravatar Berthold Stoeger
When entering the edit state, we don't want the user to be able to undo/redo lest things become inconsistent. Since the only way to enter edit state is to edit the profile, we can simply use the disableShortcuts() function that is used by the profile when it goes into edit state. This has one desirable side-effect: Undo is now also disabled in the planner. Undo during planning likewise can lead to inconsistent state. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo/cylinders: Implement editing of the typeGravatar Berthold Stoeger
This one is tricky, as when browsing through the types-combobox, the user is presented with presets without actually changing the dive. We do not want an undo-command for every change-event in the combo-box. Therefore, implement a scheme analoguous to the weight-editing: A temporary row can be set / committed or reset. Sadly, the code is more complex because we have to consider the planner, which is not included in the undo system. Firstly, the planner uses a different model, therefore all interactions are channeled through setData() with special roles. Secondly, in the planner we shouldn't place an undo command, but simply overwrite the dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove default-code for editCurrentDiveGravatar Berthold Stoeger
The profile can only be edited for manually added or planned dives. No point in keeping code for other kinds of dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07desktop: don't disable tabs in edit stateGravatar Berthold Stoeger
The edit state is now only used to edit the profile. There is no reason to disable random tabs. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: don't center map on rejecting editGravatar Berthold Stoeger
The editing of the dive site is controlled via an undo command. No point in centering the map when cancelling a profile-edit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove lastMode variable in MainTab::rejectChanges()Gravatar Berthold Stoeger
This stored the old editMode. However, it was not read after editMode was changed, so there is no point to it. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07edit: remove multi-dive version of edit informationGravatar Berthold Stoeger
The "dive is currently" edited is only shown when the profile is edited. This affects only the current dive and therefore a message saying that multiple dives are edited makes no sense. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove strange recursive code in MainTab::enableEditionGravatar Berthold Stoeger
When enableEdition() was called with mode == NONE and the dive was a manually added dive, it would call into MainWindow:: editCurrentDive(), which would in turn call enableEdition(), however with another mode. Since the only caller of enableEdition() is now editCurrentDive() anyway, we can remove that weird code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove cylinders_equal check in MainTab::rejectChanges()Gravatar Berthold Stoeger
This check make no more sense since cylinder editing is now treated by undo commands. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: add cylinders via undoGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: remove TabDiveWidget::acceptChanges and rejectChangesGravatar Berthold Stoeger
Since cylinders are now edited using the undo system, these functions are not needed anymore. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: call removeCylinder undo command in equipment tabGravatar Berthold Stoeger
Instead of connecting to the remove() function of the model, call the removeCylinder undo command. Take care to translate the index into the source index, should cylinders be hidden! Apart from the map-to-source call, this copies the weightsystem code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07CylinderModel: make dive dynamicGravatar Berthold Stoeger
The CylinderModel always accessed the global "displayed_dive" and in some special cases also "current_dive". To implement cylinder undo, the model should work on an arbitrary dive. Therefore, in analogy to the weight model, make the dive dynamic. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-06delegate: don't add WSInfo entry in delegateGravatar Berthold Stoeger
The weightsystem info for new weightsystem types is added by the undo command. Remove this redundant code. Use the lookup only to determine the weight and the canonical name (i.e. use the capitalization according to the saved entry, in analogy to tanks). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-06delegates: don't use starts-with search to fetch cylinder/weight dataGravatar Berthold Stoeger
In the wightsystem-type and cylinder-type delegates, when entering data, when entering known weight- or cylinder-types, some ui fields (notably weight, size and working-pressure) are automatically filled out. The search was using the default flags provided by Qt: starts-with and case-insensitive. This had a few strange effects, when entering a string that is the beginning of a known string (e.g. "AL6" when "AL63" already exists): 1) The wrong data was used if the new string didn't exist. 2) For cylinders it was impossible to create new cylinder types whose name is the starting string of a different type. 3) For weights, the new type was not added to the list of known types. This, however, is no problem, because it will be added by the undo command anyway. A future commit will address that redundancy. Therefore use only the case-insensitive flag (which has to be performed by passing the MatchFixedString flag - very weird). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-04cleanup: update all copyright dates to 2020Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-01cleanup: explicitly cast to int to silence a compiler warningGravatar Berthold Stoeger
In DivelogsDeWebServices::updateProgress() QProgressBar::setRange() and QProgressBar::setValue() were passed floats even though they expect ints. To silence a compiler warning, cast by hand. Use the lrint() function, since we generally do it this way. However, it is not clear whether this is necessary here. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-22Typo fix: Programm to programGravatar Johan Hansson
Signed-off-by: Johan Hansson <reply.johan@gmail.com>
2020-03-22cleanup: remove unnecessary <QDebug> includeGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>