Commit graph

17545 commits

Author SHA1 Message Date
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
Berthold Stoeger
c8334ad11b cleanup: make analyze_plot_info local to profile.c
No external caller of this function exists. Moreover, turn the return
type to void, as it only returned the passed-in plot_info and no
caller used that.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 08:53:45 -07:00
Berthold Stoeger
21e2488d2d cleanup: const-ify a few functions in planner.c
It make debugging much easier if the function signature tells you
that a parameter is not altered.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 08:53:45 -07:00
Berthold Stoeger
d787e8812c profile: for maxtime calculation include the sample after the last event
When plotting profiles with surface segments, there were strange
artifacts. As we found out with Robert, these were due to the fact
that the calculated maxtime was set to the last event which is just one
second inside the surface segment. This terribly confused the profile
code. For example, it didn't properly allocate samples for the surface
segment.

Thus, when calculating maxtime, consider the last sample beyond the
last event.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 12:36:28 +02:00
Berthold Stoeger
8bc4233add profile: return air for one-past last cylinder
This is the code for "surface air".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 12:36:28 +02:00
Berthold Stoeger
ffc3e598fa core: create fake cylinder at end of cylinder table (hack!)
When we had fixed-sized cylinder arrays, the planner used the last
empty cylinder for "surface air". This was not recognized by the UI
as a separate cylinder, because "empty cylinder" was the sentinel for
the end of the table. The conversion to dynamically sized cylinder
tables broke this code: everytime the surface segment is changed,
a new dummy cylinder is added, which is visible in the UI.

As a very temporary stop-gap fix, emulate the old code by creating
a cylinder and then setting the end-of-table to before that cylinder.
This means that we have to loosen the out-of-bound checks.

That's all very scary and should be removed as soon as possible.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 12:36:28 +02:00
Berthold Stoeger
b949bad026 core: always keep an empty cylinder at the end of the cylinder array
This will be temporarilly used by the planner to mark consumption of
air at the surface. Do this by creating a new function add_cylinder,
which replaces add_to_cylinder_table() and takes care of always adding
a dummy cylinder at the end of the table. Make the original
add_to_cylinder_table() local, so that it cannot be accessed anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01 12:36:28 +02:00
Berthold Stoeger
0c28821d28 cleanup: replace Q_ASSERT by qWarning
These two Q_ASSERTs made no sense - their expression (a string
literal) always evaluated to true. A qWarning() was intended here.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-30 16:55:19 -07:00
Berthold Stoeger
3ed36b2ab5 cleanup: remove DivePlotDataModel::diveId
Nobody was using that member variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-30 14:14:13 -07:00
Berthold Stoeger
60b00162a9 desktop: don't replot profile when populating dive information tab
When the dive mode is changed, the profile has to be replot. This
is by a function of the TabDiveInformation. However, that function
was also executed when populating the tab. Thus, when changing dive,
the profile was plot twice.

Move the profile plotting out of the function. Ultimately, the profile
should listen to the appropriate signals itself.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-30 14:14:13 -07:00
Dirk Hohndel
ff0438a3fd Github Actions: don't bundle mac app
There's no point in doing that since the app directory this creates is broken
on older macOS versions, anyway (and we create a working DMG through a
webhook).

Additionally, lately this has started to fail on GitHub, so let's just rip this
out.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-30 14:06:48 -07:00
Lubomir I. Ivanov
8e1771cb4c README.md: fix typo in system requirements
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2020-04-27 22:50:18 +02:00
Berthold Stoeger
142dc6f96f profile: set empty state when there is no current dive to show
The profile data was not properly cleared when not showing a
dive.

Fixes #2787

Reported-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-27 22:19:31 +02:00
Berthold Stoeger
5ba7c68433 cleanup: remove unused function get_divepoint_gas_string()
The last user was removed way back in commit
9fbd11744f.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-27 22:48:15 +03:00
Dirk Hohndel
006d630142 build-system/Android: add missing install-qt.sh
This file is copied from the QBS project. It's under LGPL and therefore
compatible with our licensing. While it would be possible to retrieve
this file at build time from the original project, for now it seemed
easier to include it in our repo.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-27 11:04:29 -07:00
Dirk Hohndel
0c0d65e2cb GitHub Actions: we can't have an action with no on: clause
So in order to disable an action, I'll just use an unused
repository_dispatch.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-27 09:34:07 -07:00
Jan Mulder
906762027b Revert "map: remove selectedDivesChanged"
This reverts commit cd47499694.

The signal removed in the reverted commit was used in Subsurface-mobile.
So removing it, caused a not running app.

Signed-off-by: Jan Mulder <jan@jlmulder.nl>
2020-04-27 14:48:37 +02:00
Dirk Hohndel
da953fa18a move GitHub url to the Subsurface org
Instead of using the Subsurface-divelog user on GitHub, we now use an org that
was generously donated to us.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-26 16:36:30 -07:00
Berthold Stoeger
2021035cfc selection: replace selectedTrips() by singleSelectedTrip() function
To check wether the tab widgets should show the trip view, they called
the selectedTrips() function. The trip view was shown if that contained
only one trip. However, the selectedTrips() function was very slow,
because it has to query to core models.

Change the function to singleSelectedTrip(), which returns a trip
if there is exactly one trip selected. The function returns early
if there is more than one trip selected. This makes the select-all
case much faster.

There are two cases which are still very slow:
- List mode, because here all top-level items are queried.
- Dive log with many only top-level items.

Ultimately, we will have to cache the trip selection because
querying the model is too slow.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-26 13:54:59 -07:00
Berthold Stoeger
6e83135fba desktop: select dives at once
The old code would call QItemSelectionModel::select() once for every dive.
Instead collect the selection in a QItemSelection and only call
QItemSelectionModel::select() once. This makes selecting multiple dives
significantly faster.

The loop also expanded the trips with selections. This has now to be
done in an extra loop.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-26 13:54:59 -07:00
Berthold Stoeger
4f438d1e32 dive list: don't access selected dives via indices
When determining the selected dive sites to highlight them on the
map, the DiveListView code used the local indices of the selected
dives. However, that was unreasonably slow. Even though a layering
violation, let's access the core data structures directly. In my
tests this improved from 700 ms to 0 ms!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-26 13:54:59 -07:00
Berthold Stoeger
f43b3f56b2 cleanup: remove Command::inCommand()
This was used by the divelist to check wether a selection change is
programmatical or user-initiated. However, since there is only one
entry point for programmatical selection changes, this is not needed
anymore. Remove it - this removes an inter-module dependency.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-26 13:54:59 -07:00
Berthold Stoeger
2ad3696230 cleanup: make DiveListView slots private
It makes reasoning about code so much easier when one knows that
functions cannot be accessed from the outside. Therefore, make
a number of DiveListView slots private. Moreover, unslotize
functions that never were used in connect calls.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-26 13:54:59 -07:00
Berthold Stoeger
5d49da5d6b selection: move test for programmatical selection changes to widget
The DiveListView widget has to differentiate between programmatical
und user-initiated selection changes. It did so by using the
DiveListNotifier::inCommand() flag.

However,
1) There is only one point of entry for such selection changes,
   viz. the MultiFilterSortModel::selectionChanged() signal
2) This signal is not only emitted in command-context.
   Another source is for example dive-map selection changes.

Therefore, move the programmatical-selection-change status down
to the widget and set/reset it in the diveSelectionChanged() slot.
This makes "select all visible dive sites" somewhat faster. Sadly,
not as much as expected.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-26 13:54:59 -07:00
Berthold Stoeger
aaecc6e98e cleanup: make various functions in DiveListView private
Outside callers had no business calling these functions.
Especially some functions that were simply there to override
default DiveListView behavior. Mark these as overridden.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-25 13:20:25 -07:00
Berthold Stoeger
b8e7a600d2 cleanup: remove DiveListView::selectDives()
This was used by the map to select dives. However, the map now calls
the core function directly, so this can be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-25 13:20:25 -07:00
Berthold Stoeger
75ef8b68a1 map: call set_selection() core function to select dives
The map widget called the dive list to select dives. This is
inconsistent and complex. The dive list has to call down to
the core anyway. Therefore, change the code to call the common
core function.

This means that we have to transform integer ids into dive-pointers.
That is a bit sad, because the dives were just transformed into
indices. Let's address that in a future commit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-25 13:20:25 -07:00