The cylinder-based statistics where not updated when an undo
command edited cylinder data. Do so.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The SAC rate, etc were only updated when switching between dives.
They should always be updated when an undo command changes (adds,
edits, removes) the cylinders of a dive.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
To display changed SAC values it is necessary that the models
emit changed signals when cylinders are edited. An alternative
might be that the undo commands emit dive-changed signals themselves.
Fixes#2814.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
We have to call update_cylinder_related_info() when adding /
editing / removing cylinders. This could be done in a common
base class of the commands. For simplicity, let's call
the function in the respective undo()/redo() functions.
Partially fixes#2814.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
While this worked well on Mac, it creates odd errors on Linux. This
doesn't seem worth spending too much effort on - so let's just go back
to asciidoc.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Unintentionally two versions of the mobile manual were created. This brings all
of Willem's changes into the version for Subsurface-mobile v3, and restores the
last version of the v2 mobile manual.
This commit was manually created from a pull request that was signed off by
Willem, given that he wrote most of the text I am copying that SOB into this
commit and will assign authorship to him.
To avoid further confusion, we now have a v2 and a v3 manual, explicitly named.
The corresponding .html.git files were also updated (reflecting our switch to
asciidoctor).
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Bühlmann factors were cached in a thread-safe hashmap. It seemed
somewhat dubious that entering a critical section and doing a hash-lookup
would be significantly faster than a simple exp() call.
Indeed, in a very cache friendly test (16 entries, tight loop) calling the
factor() function 32 000 000 times from a different translation units we get:
- with cache: 604 ms
- without cache: 266 ms
Therefore, remove the cache. Given that 32 000 000 calls take only 266 ms,
it appears not sensible to try to optimize this function anyway.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
It was suggested in a review of a previous patchset that we should
capitalize the use of "use dc" to "Use DC" - but if we were going
to do that we should do it everywhere, not just in the one place.
This is the followup to do that.
Signed-off-by: Monty Taylor <mordred@inaugust.com>
In the code, the difference between SALTYWATER and SALTWATER is hard
to see. More importantly, in the UI - Brackish is the word for water
that has more salt that freshwater but less salt that seawater. The
docs already use the word to clarify what is meant.
These can be useful in a printed divelog, especially if the
log entry is also showing weight and exposure suit.
Signed-off-by: Monty Taylor <mordred@inaugust.com>
There was a TestProfile but that was a stub that did not test anything.
We have an export function that serialises the profile data
(including lots of derived data like deco information and
cylinder pressure interpolation). So here is now a simple
tests that can detect regressions in the profle.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
As the heading above says. two images changed.
Short table of contents added.
Add section on dive trip editing and dive list structure.
Added links to video tutorials.
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Net net this has caused more problems than it solved. Too often binaries
were missing or broken. Instead 'release equivalent' binaries are now
consistently posted to downloads/test via a Webhook.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When printing, the dive plan was prepended with a logo, a disclaimer
and the profile. Then it was restored by setting the plan of
displayed_dive.
Instead, simply save the original plan in a QString and restore that.
This removes a further dependency on displayed_dive, which I'd like
to make local to the planner.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In the planner the undo commands for adding / editing dives were
only called if not on mobile. This is from days were mobile didn't
have undo commands. We can remove these now.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
MainWindow::editCurrentDive() used to be a general function to enter
edit mode. Nowadays, this is only called for one very specific case,
namely editing the profile of a manually added dive. Therefore, we
can remove the if-branch that dealt with planned dives.
Moreover, we can do the test right at the beginning and remove
a warning message for duplicate "edition", as this is not
possible anymore.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
There was only one caller of MainWindow::setupForAddAndPlan() left
and that caller immediately called DivePlannerPointsModel::createSimpleDive().
Thus, we might just as fold the former in the latter and thus
concentrate all the prepare-dive-for-plan business in one place.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Thus, the MainWindow doesn't have to extract the plan from
displayed_dive. This is a tiny step in an attempt to detangle
the interfaces. The bigger goal will be to make displayed_dive
local to the planner.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When calculating variations, they were sent to the mainwindow,
which updated displayed_dive accordingly. Do this directly
in the planner-model.
The idea is to detangle interdependencies and to make the
code reusable (planner on mobile?).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The DiveListView had a singleSelectedTrip function that
returns the selected trip if exactly one trip is selected.
This could be very slow if numerous non-trip items were
selected, because all the selection indices were back-
translated by the proxy model.
This could make selection changes very slow, because the
MainTab used said function to determine whether it should
show trip or dive data.. Indeed, with a 3500 dive test log,
when selecting all dives in tree mode, the updating of the
TabWidgets is sped up from 130 ms to 5 ms this commit.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The DiveListView would touch the selection-innards directly.
Let's encapsulate that. Moreover, take care to reset the trip
selection when resetting the core data.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
In analogy to dives add a selection flag for trips. The reason
being that search for a selected trip can be painfully slow when
we do it through Qt's proxy model.
Make sure to deselect trips when they are removed from the core.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When there is no current dive, mainTab->updateDiveInfo() implicitly
clears the tabs. There is no need to call this explicitly.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
ProfileWidget2::plotDive() had this weird interface, where passing
in NULL as dive would mean "show current_dive". However, most callers
would already pass in current_dive. Therefore, unify and always pass
in current_dive if the caller wants to draw the current dive.
This allows us to interpret NULL as "show empty profile". Thus,
passing in current_dive when there is no current_dive simply shows
an empty profile. This makes the calling code in
MainWindow::selectionChanged() simpler.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
There was a mix of ProfileWidget2::replot() and
ProfileWidget2::plotDive(current_dive, true), which is equivalent.
Since there was more of the latter and it is more flexible, unify on
that.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Firstly, the parameter appears conceptually wrong, as replot suggests
that the currently shown dive is replot. Secondly, the only caller that
passed a parameter was passing in current_dive, which is just what happens
if one doesn't pass a parameter. Therefore, change that caller (call
plotDive directly) and remove the parameter.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
We used to cancel a plan (or profile edit) when the user quit
the application while planning. This is inconsistent with
respect to closing or opening a different log, where the user
was asked for confirmation.
Thus, for consistency and to avoid loss of a planned dive,
use the okToClose() function in on_actionClose_triggered() of
MainWindow. As an added bonus, this saves a few SLOC.
Fixes#1078
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This is needed to be able to push new betas into the AppStores.
I keep forgetting to do that after I do a mobile release.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
These are all kinda weird but I use them when creating releases, so it
seems to make sense to add them to the repo. I don't think they are
useful to anyone but me, but in the event someone else takes over, they
might be a useful starting point.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This tweaks the language about where to find the latest binaries,
as some of them are also under downloads/test and in the OBS repos.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In 2021035cfc a bug was introduced:
currentTrip of MainTab was not set in trip mode. Thus, when editing
the trip notes, the notes of all selected dives were edited instead.
Set the member variable and not a local variable.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>