Commit graph

17571 commits

Author SHA1 Message Date
Berthold Stoeger
33b4ecf055 cleanup: move the inertgas enum from qthelper.hpp to deco.c
There are no outside users.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-06 00:22:31 +02:00
Berthold Stoeger
123937901f planner: remove Bühlmann factor cache
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>
2020-05-06 00:22:31 +02:00
Monty Taylor
f37f428762 cleanup: capitalize use dc
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>
2020-05-05 10:23:18 -07:00
Robert C. Helling
786963aba9 Changelog for variations checkbox
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-05-05 08:56:33 -07:00
Robert C. Helling
f55925db60 Explanatory comment in testprofile.cpp
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-05-05 08:56:33 -07:00
Monty Taylor
7a9214575e cleanup: Change Salty to Brackish
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.
2020-05-05 08:25:21 -07:00
Monty Taylor
95e6792c4f Grantlee: Add salinity and water type to grantlee variables
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>
2020-05-05 17:31:47 +03:00
Robert C. Helling
b3270222fd Add test for profile data
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>
2020-05-04 13:39:18 -07:00
willemferguson
6066ead0d5 Mobile user manual update
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>
2020-05-04 13:38:31 -07:00
Dirk Hohndel
744bad833a update README to reflect discontinued ci-release on GitHub
The previous commit ended publishing current test binaries on GitHub.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-04 10:48:31 -07:00
Dirk Hohndel
d49647d288 GitHub Actions: stop creating CI releases
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>
2020-05-04 08:51:49 -07:00
Robert C. Helling
36748fef0d Add conneciton for display variations checkbox
...this gat lost at some point.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-05-04 13:22:08 +02:00
Miika Turkia
977b50ba22 Update changelog
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-04 10:43:40 +02:00
Miika Turkia
435778b162 CSV import/export test: Add support for dive mode
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-04 10:43:40 +02:00
Miika Turkia
05177cfc14 CSV export: include dive mode field
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-04 10:43:40 +02:00
Miika Turkia
e1c3f29b88 CSV export: Add dive mode
Include dive mode to exported dive detail CSV

Closes #1588

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-05-04 10:43:40 +02:00
Berthold Stoeger
4d0a200cfd planner: on printing, restore textual plan using a saved string
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>
2020-05-04 10:42:07 +02:00
Berthold Stoeger
acfcd866bd planner: remove conditional command-calls for mobile
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>
2020-05-04 10:42:07 +02:00
Berthold Stoeger
9bbd8b8169 desktop: remove unused if-branch in MainWindow::editCurrentDive()
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>
2020-05-04 10:42:07 +02:00
Berthold Stoeger
4f5621c4c6 Planner: fold MainWindow::setupForAddAndPlan into createSimpleDive()
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>
2020-05-04 10:42:07 +02:00
Berthold Stoeger
62cbf26cc8 planner: send plan in calculatedPlanNotes
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>
2020-05-04 10:42:07 +02:00
Berthold Stoeger
f123972dbf planner: update variations in planner not mainwindow
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>
2020-05-04 10:42:07 +02:00
Berthold Stoeger
769915f3fe selection: create global single_selected_trip() function
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>
2020-05-03 15:02:21 -07:00
Berthold Stoeger
5147131701 selection: inform core of trip selection in DiveListView
When selecting / deselecting trips, keep the core updated.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-03 15:02:21 -07:00
Berthold Stoeger
f961ec7a8b selection: introduce clear_selection() function
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>
2020-05-03 15:02:21 -07:00
Berthold Stoeger
09b7fcbcf4 selection: add selection flag for trips
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>
2020-05-03 15:02:21 -07:00
Berthold Stoeger
649b2f2a9e cleanup: don't explicitly clear tabs in MainWindow::selectionChanged()
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>
2020-05-03 14:47:49 -07:00
Berthold Stoeger
17556cc66c profile: don't interpret NULL as current_dive in plotDive()
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>
2020-05-03 14:47:49 -07:00
Berthold Stoeger
c1963fd5dd profile: use member-to-function style connect() statements
This makes things compile-time instead of run-time checked.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-03 14:47:49 -07:00
Berthold Stoeger
2829909376 profile: remove outside callers of ProfileWidget2::replot()
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>
2020-05-03 14:47:49 -07:00
Berthold Stoeger
d520ac2286 cleanup: remove parameter to ProfleWidget2::replot()
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>
2020-05-03 14:47:49 -07:00
Berthold Stoeger
8f8457ebe4 desktop: ask user when quitting application while planning
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>
2020-05-03 14:17:47 -07:00
Dirk Hohndel
2a31203221 mobile: update version to 3.0.6
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>
2020-05-03 08:40:05 -07:00
Dirk Hohndel
77aa0240b1 pull latest translations from Transifex
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-02 14:24:16 -07:00
Dirk Hohndel
e9e72fa237 add random helper scripts
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>
2020-05-02 14:24:10 -07:00
Dirk Hohndel
f16738c3a1 update README for 4.9.4
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>
2020-05-02 10:26:17 -07:00
Dirk Hohndel
389bfcc671 ReleaseNotes for 4.9.4
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-02 10:26:17 -07:00
Dirk Hohndel
1b6b337a41 documentation: update list of supported dive computers
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-02 10:26:17 -07:00
Dirk Hohndel
ec5ff772a9 Update translation source strings
Also pull latest translations from Transifex.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-02 10:26:17 -07:00
Berthold Stoeger
32d87db8b3 cleanup: remove unused function append_dive()
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-02 14:52:51 +02:00
Berthold Stoeger
a8130f0fa1 desktop: fix editing of trips
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>
2020-05-02 14:52:51 +02:00
Berthold Stoeger
e535ac90f9 cleanup: remove unnecessary include in command_divelist.cpp
"code/display.h" needs not be included anymore for selection
things.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-02 14:52:51 +02:00
Berthold Stoeger
f4b948e80d profile: properly update lastgasmix when populating events
When populating the events of a profile, a pointer to the current
gasmix was passed around to properly calculate isobaric_counterdiffusion.
The DiveEventItem::setupToolTipString() function updated this gasmix
when processing gas change events.

I inadvertently broke the code when replacing gasmix-pointers by
values. We could of course simply revert this part of the commit.
However, the data flow was horrible anyway: for example is supposed
that the setup functions were called in the correct order (i.e.
DiveEventItem::setupToolTipString() is called after all other
functions using the gasmix). Not exactly easy to follow.

Therefore, keep passing around the gasmix as value to make it clear
that the functions don't modify it. Keep the gasmix up-to-date at
the caller's site in ProfileWidget2::plotDive().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 21:44:50 +02:00
Berthold Stoeger
9c70261c0e cleanup: move declaration of utc_mk* functions to new subsurface-time.h header
No point in slurping in all of dive.h for translation units that only
want to do some time manipulation without ever touching a dive.

Don't call the header "time.h", because we don't want to end up in a
confusion with the system header of the same name.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 09:42:31 -07:00
Berthold Stoeger
50b195142b cleanup: remove includes from desktop-widgets/locationinformation.h
Notably, there was a circular include

locationinformation.h <-> importgps.h

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 09:42:31 -07:00
Berthold Stoeger
46cdf24e11 cleanup: only include QString in desktop-widgets/importgps.h
This included QFile, which is fatter and not needed here. Include
QFile only in the actual translation unit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 09:42:31 -07:00
Berthold Stoeger
95284c026e cleanup: move dive_table from dive.h to divelist.h
This allows us to decouple dive.h and divelist.h, a small step in
include disentangling.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 09:42:31 -07:00
Berthold Stoeger
c13040798c cleanup: move FRACTION macro from dive.h to units.h
There appears to be no reason to slurp in all dive.h when compiling
membuffer.c. units.h might not seem like the perfect place, but it
is the most fitting I found.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 09:42:31 -07:00
Berthold Stoeger
8ce7c4664a cleanup: move DECOTIMESTEP from dive.h to planner.h
Long-term project: reduce the size of dive.h

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 09:42:31 -07:00
Berthold Stoeger
44132e44a9 cleanup: make enumerate_devices of external linkage
For consistency: declare enumerate_dives as extern, since we do that
for all other C-functions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 08:53:45 -07:00