aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2020-04-10Merge pull request #2736 from Subsurface-divelog/removeCloudOverrideGravatar Dirk Hohndel
core: remove cloud certificate override
2020-04-10Merge pull request #2737 from Subsurface-divelog/libgitCleanupGravatar Dirk Hohndel
Libgit cleanup
2020-04-10Update CHANGELOGGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-10code cleanup: once we find a match, stop checkingGravatar Dirk Hohndel
This isn't really a useful performance improvement, but it's still better, IMHO, because we don't have a less specific match later on potentially change an already executed match. Because of our coding style the comment covering multiple cases of Pelagic dive computers now is associated just with the first of those entries. I don't see a way to do this differently without being in violation of our coding style, so I'll just keep it like this. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-10BLE dive computer detectionGravatar Dirk Hohndel
Both Shearwater Petrel and Petrel 2 identify as 'Petrel' as their BT and BLE names. But only the Petrel 2 supports BLE, thus only the Petrel 2 shows up in the list of known dive computers on iOS (which supports only BLE but not BT-only). By switching this around to always pick Petrel 2 we now correctly detect such a dive computer on iOS. Fixes #2739 Reported-by: Rick Holcombe <wrh@nc.rr.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-10mobile/models: correctly reset the connection modelGravatar Dirk Hohndel
Qt hates empty ranges, and even for a non-empty range, this is better implemented as a reset than a remove. This fixes a crash that I have been able to create on iOS by rescanning for devices on the download page. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-10cleanup: directly return from DivePictureModel::data()Gravatar Berthold Stoeger
Instead of assigning to a QVariant ret and returning at the end, return directly in the various switch-cases. This makes the code more readable, and is more idiomatic C++, as it avoids unnecessary copies. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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-10cleanup: remove picture_free()Gravatar Berthold Stoeger
There is the free_picture() function with the same functionality. The compiler/linker should recognize that and remove the duplicate code, but still... Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-10cleanup: remove dive_get_picture_count() functionGravatar Berthold Stoeger
The last user was removed in 5b7e4c57f78c9ec2087726ecad89797132a32d08. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-10cloud-storage: create consistent commit message for mergesGravatar Dirk Hohndel
This never made sense and I think I just forgot to complete this code when I first worked on it. Now we can see which version of Subsurface or Subsurface-mobile created a merge. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-10undo: refine pasting of cylindersGravatar Berthold Stoeger
When pasting cylinders, the destination dive got a verbatim copy of the cylinders of the source dive. This is not what users want: for example, the start and stop pressures from the dive computer as well as the gas mix may be overwritten. There seems to be no perfect solution, since some times users may want to paste the gas-mix. Therefore, let's choose a heuristic approach for now (in the future we might implement a UI-flag): When copying over existing cylinders, only copy type and maximum pressure. When adding new cylinders (i.e. from-dive has more cylinders than to-dive), copy everything, but reset start- and top-pressure to 0, which represents unkown. Moroever, in the latter case, set "manually added" to true, since obviously this wasn't added by a dive computer. Fixes #2676 Reported-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-09cloud-storage: simplify creation of git authorshipGravatar Dirk Hohndel
While having the local user information in the repo on Linux seemed clever when we implemented it, it's inconsistent with all the other platforms. Let's just not do that unless the user has indeed set a global name/email pair for git. Instead indicate if this was Subsurface or Subsurface-mobile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-09cleanup: remove support for ancient versions of libgit2Gravatar Dirk Hohndel
We require a minimum of libgit2 0.26. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-09build-system: remove references to long gone support for libgit2 < 0.23Gravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-09build-system: deal with libgit2 versions 1 and laterGravatar Dirk Hohndel
We assumed everywhere that libgit would always have a 0.xx version number. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-09core: remove cloud certificate overrideGravatar Dirk Hohndel
This code stopped being useful a long time ago. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-08fulltext: don't call words.clear() in FullText::populate()Gravatar Berthold Stoeger
This function was not meant to be called with already existing data. However, if it was, it cleared the words without clearing the fulltext caches of the dives. This lead to crashes. Be more resilient by not clearing the words: Already existing dives are unregistered during the process of populating anyway. So this now *should* work if new dives are added to the dive list and then this function is called. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-08fulltext: rename fulltext_reload() to fulltext_populate()Gravatar Berthold Stoeger
This function was named improperly: it was only used on freshly loaded data. Indeed, attempts to use it to actually reload lead to crashes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07git: don't check for git sha in parse_file()Gravatar Berthold Stoeger
parse_file() refused to load from a git repository if we already had that repository and there were no changes. However, this only checked the global divelist_changed flag, which does not track undo-commands. Thus, after editing dives the user couldn't reload from git. Remove this check. It is somewhat questionable that the io layer refuses to load from a repository anyway. Let the caller decide. There appears to be a check_git_sha function for that purpose(?). 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: remove conditional compilation in cylindermodel.cppGravatar Berthold Stoeger
Parts of the code were not compiled on mobile, because they used the undo-command infrastructure. However, since mobile now also compiles that, we might as well remove the conditional compilation. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: call invalidate_dive_cache() when editing cylindersGravatar Berthold Stoeger
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-07undo: more fine-grained editing of cylinderGravatar Berthold Stoeger
Don't overwrite the full cylinder when editing a single field. Implement three "modes": editing of type, pressure and gasmix. Don't consider individual fields, because some of them are related. E.g. you can change the gasmix by setting the MOD. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: store all cylinders in EditCylinderBaseGravatar Berthold Stoeger
We stored only one cylinder in EditCylinderBase, which is the base class of RemoveCylinder and EditCylinder. This turns out to be too crude: when removing the "same" cylinder from multiple dives, there are some "hidden variables" such as bestmix_o2 or manually_added, which might actually be different. We don't want to overwrite those on undo of delete. Moreover, the cylinder edit is way too crude at the moment, as it overwrites the whole cylinder even when the user edited only a single field. To enable a more refined edit, we have to store each changed cylinder. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove same_cylinderGravatar Berthold Stoeger
The last user was uses a more general function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: be more flexible about which cylinders to editGravatar Berthold Stoeger
Currently we use the same_cylinder() function to determine which cylinders should be edited in a multi-dive edit. Make this more flexible by introducing a flag-set, such that the undo-command can select which cylinders are considered as equal: - same type - same pressure - same gas mix - same size Currently both undo commands use same type, pressure and gas so that the behavior stays unchanged. The future goal is to split the cylinder-edit undo command into different commands so that when, for example, editing the type only the type is considered by not the gas mix. 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-07cylinders: use preferences modpO2 preferences valueGravatar Berthold Stoeger
Use the user-editable MOD-pO2 preferences value when creating a default cylinder. It is not clear to me, when that even has a consequence, but it looks like the right thing to do. Reported-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: reload dive on removal of gas-switchGravatar Berthold Stoeger
If a gas-switch is removed we have to perform the same action as if a gas-switch is added: fixup the dive and signal the changed cylinder and stats. Adapt the RemoveEvent command accordingly. Copy the code of the AddGasSwitch command and simplify for the fact that only ony cylinder can be affected. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: switch to affected dive on undo/redo of event-changesGravatar Berthold Stoeger
Select and make current the affected dive. And also switch to the divecomputer that was affected. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove commented-out evn_foreach() functionGravatar Berthold Stoeger
Apparently this was used to hide events in pre-Qt times. However, that has already been reimplemented in different ways. Let's remove that commented-out code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove remove_event() functionGravatar Berthold Stoeger
No user left. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: implement gas switchGravatar Berthold Stoeger
This is a bit hairy as - in theory - one gas switch can remove other gas switch(es) at the same timestamp. However, I did not find a way to test it. Moreover, it is not clear whether the dive-tabs are properly updated on undo/redo. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: remove vintage report_error() function declarationGravatar Berthold Stoeger
Remove an old commented-out declaration. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07core: split out create_gas_change_event() from add_gas_change_event()Gravatar Berthold Stoeger
For undo, we want to create gas change events without adding them immediately to the dive computer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07cleanup: move add_gas_switch_event to dive.cGravatar Berthold Stoeger
Since all the other event-functions are also defined there. Ultimately, we should probably move them to their own event.c translation unit. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: add event removal undo commandGravatar Berthold Stoeger
This was a trivial copy & past of the event-adding undo command with a switch of the undo() and redo() actions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: implement renaming of eventsGravatar Berthold Stoeger
There is a slight complexity here owing to the fact that the profile works on a copy of the current dive: We get a copy of the event and have to search for the original event in the current dive. This could be done in the undo command. Nevertheless, here we do it in the profile so that when in the future the profile can work on a non-copied dive we can simply remove this function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-07undo: split out EventBase classGravatar Berthold Stoeger
All event-based commands will work on a dive computer and need to replot the profile, etc. Therefore, in analogy to the dive-list commands create a base class with two virtual functions undoit() and redoit() that must be defined in the derived classes that do the actual work. 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>