Commit graph

18622 commits

Author SHA1 Message Date
Robert C. Helling
2064ce06cc Fix pO2 for CCR at shallow depths
Even when diving a CCR, the pO2 cannot exceed ambient
pressure. This only makes a difference at shallow depths.

Fix this in the calculation of OTUs and CNS.

This affects some tests that now have slightly different CNS and OTU values.

Suggested-by: Justin Ashworth
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-02-26 08:42:30 -08:00
Robert C. Helling
6b8a07f0d9 Planner: Depth dependent setpoint changes in CCR mode
We had a user request to allow for setpoint changes
at certain depths for CCR deco.

You can now enter a cylinder with name like
"SP 1.4" ('S' and 'P' and ' ' and a float) with
a switch depth and that cylinder is interpreted as
a depth dependent setpoint switch.

This user interface is a hack. But I believe that such
setpoint changes are similar enough to gas switches during
deco and should thus be handled in a simiar manner.

I would be happy to hear ideas how this could be made
less easter eggish.

Suggested-by: Justin Ashworth
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2021-02-26 08:42:30 -08:00
Dirk Hohndel
5595a70bd5 documentation: automate creation of web facing manuals
We already had the script to post-process the HTML files in the repo,
but we didn't automate use of that script in the Makefile. The .wp
suffix is misleading and historical (we no longer us WordPress), but
it's what I am used to and I didn't come up with something more obvious
or better.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-24 12:23:05 -08:00
Willem Ferguson
a651bb4550 mobile/manual: small changes to improve mobile manual
Better image placement, other small changes.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-24 10:03:12 -08:00
Willem Ferguson
cd8eb274e3 mobile/manual: tuning of header sizes
This makes all the font sizes relative and avoids odd effects on some browsers.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-24 09:54:43 -08:00
Dirk Hohndel
68c56751c4 mobile/manual: small style change to fit pictures
This way they don't exceed the page size.

This also removes execute bits from a couple of pictures. That's just wrong...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-21 12:42:10 -08:00
Dirk Hohndel
74021afd97 build-system: don't check dependencies when creating Ubuntu package
There is no reason to check that on the system that is simply used to
submit the package to Launchpad.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-17 09:07:20 -08:00
Berthold Stoeger
5b3cb5898f desktop: fold ApplicationState into MainWindow
The application state is a desktop-only thing. The mobile UI
also has its application state, but that is something completely
different.

The last remaining user of the application state was to flag
whether the planner is active. Since this has all been
unglobalized, the ApplicationState structure can be moved
from core to the desktop UI. And there it can be made local
to the MainWindow class.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00
Berthold Stoeger
80c92acc33 cleanup: remove setAppState from TestPlan
This is not needed anymore, since the planner passes down the
in_planner flag to the appropriate functions. The planner state
is not queried via a global anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00
Berthold Stoeger
42cff9b3a5 planner: pass in_planner down to TemplateLayout
The TemplateLayout prints different dives depending on
whether the planner is active. Instead of accessing a
global variable, pass the status down from the MainWindow.
That's all quite convoluted, since there are multiple
layers involved.

On the positive side, the in_planner() function has now
no users an can be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00
Berthold Stoeger
18049bc8d0 cleanup: remove unused includes in mainwindow.cpp
The printing code moved elsewhere, so these includes are not
needed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00
Berthold Stoeger
c6d78bc134 planner: pass in_planner argument to replot()
To remove reliance on global state, pass an "in_planner" argument
to AbstractProfilePolygonItem::replot(). Thus, calls to in_planner()
can be removed.

This is a bit sad, since the in_planner argument is now passed
to numerous replot() reimplementations of classes derived
from AbstractProfilePolygonItem. However, it is only needed
for one, viz. DiveGasPressureItem. Well, perhaps in the future
more features will depend on the planner mode...

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00
Berthold Stoeger
65720d2fce cleanup: remove function declaration
AbstractProfilePolygonItem::shouldCalculateStuff()'s definition
has been removed some time ago. Therefore, remove its declaration.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00
Berthold Stoeger
642d9c80b3 planner: pass in_planner argument to decoMode()
To remove reliance on global state, pass an "in_planner" argument
to decoMode(). Thus, calls to in_planner() can be removed.

This is a more-or-less automated change. Ultimately it would
probably be better to pass the current deco-mode to the affected
functions instead of calling decoMode() with an in_planner
parameter.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00
Berthold Stoeger
03a7e65cf0 planner: pass in_planner argument to clear_deco()
To remove reliance on global state, pass an "in_planner" argument
to clear_deco(). Thus, calls to in_planner() can be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00
Berthold Stoeger
8103e947aa planner: pass in_planner argument to vpmb_next_gradient()
To remove reliance on global state, pass an "in_planner" argument
to vpmb_next_gradient(). Thus, calls to in_planner() can be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00
Berthold Stoeger
93ecad1b04 planner: pass in_planner argument to add_segment()
To remove reliance on global state, pass an "in_planner" argument
to add_segment(). Thus, calls to in_planner() can be removed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00
Berthold Stoeger
9fb37ea27f planner: remove print_mode parameter from calculate_deco_information()
Only 'false' was ever passed as value.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00
willemferguson
9da9133372 Mobile user manual update: statistics
As the title says. This is a first pass because I cannot see what it looks like
on the mobile device if it has not been pulled into master. I need to see what
size the images have on the mobile screen and how the organisation of text above
and below the images is rendered. There will definitely be a second PR to refine
the content for the mobile screen and to ensure proper integration of the
statistics section with the overall user manual..

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2021-02-17 07:21:01 -08:00
Miika Turkia
baee988d75 As last resort, use the site name as location
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2021-02-17 07:04:25 -08:00
Miika Turkia
2936aa6aa0 Use country for divelogs.de export
This will use only the country name for the location field in
divelogs.de export. The old version concatenated all the fields
together. This is inline with Rainer's new import functionality.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2021-02-17 07:04:25 -08:00
Berthold Stoeger
5a8d7617ce statistics: implement primitive "restrict to selection" feature
Allow the user to restrict the analyzed dives based on the
current selection. One button restricts to the current selection
and one button resets the restriction.

Thus, the user can for example select bars in the bar chart
or a range in the scatter plot and perform statistics on
these sets.

The restriction works on top of the filter.

The UI can certainly be improved, but it is a start.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
2943b1cbde statistics: implement shift-selection of ranges
For all the series but the scatter series (which supports
lasso selection), implement a range-selection using shift.

The code is fairly similar for all series and one might
think about factoring it out. But why bother?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
43b0ccca3e statistics: support ctrl-selection for all series
Multiple selection using ctrl was only supported for
scatter series. Factor out the corresponding code and
use it in all series.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
64b82b16a2 statistics: make selection keyboard modifiers more general
Up to now, we passed a "shiftPressed" flag to the individual
selection functions. To be more general replace by a struct
with "shift" and "ctrl" flags.

While doing this:
1) Move the struct into a new statsselection file for better
   encapsulation.
2) Change shift to control in the scatter series, since individual
   selection of items is usually done with control, not shift.
   Shift usually means "select range".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
21b8cded56 statistics: highlight selected pie slices
In analogy to the other charts, highlight selected pie slices.
Overlay them with a checkerboard pattern, like in the bar charts.

Since all charts now support highlighting, the divesSelected()
virtual function now doesn't need a default implementation
anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
bd252fc820 statistics: highlight selected boxes in box plot
In analogy to bar plots, highlight selected boxes in box plots.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
91d371374b statistics: remove horizontal flag from bar chart items
This flag existed for historical reasons: The base of bar items
had no line and therefore the lines had to be draw differently
for horizontal (base to the left) and vertical (base on the bottom)
item.

This did not work properly and therefore has been removed. Thus,
the flag became pointless.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
06a091643e statistics: highlight selected bar
When all items of a bar in a bar chart are selected, highlight them
by overlaying with a checkerboard pattern. A gray checkerboard seems to
work reasonably well, regardless of base color.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
d63d4cd3c3 statistics: implement rectangle selection in scatter plot
Allow the user to select regions of the scatter plot using
a rectangular selection. When shift is pressed, do an
incremental selection.

Unfortunately, the list-selection code is so slow that this
becomes unusable for a large number of selected dives.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
e38b78b2aa statistics: select multiple dives in scatter-plot by shift-clicking
Somewhat improve selection mechanics in the scatter-plot by
allowing additional selections with shift-clicking. When the
dives under the mouse are already selected, then deselect them.
This appears to be a rather common UI idiom in desktop
applications.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
d85b321784 statistics: show selected dives in scatter plot
As a visual feedback, show the selected dives in the scatter
plot. React to application-wide selection changes. Currently,
the dive list is deactivated while in statistics mode, but
that may change.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Robert C. Helling
5c098eea29 statistics: select dives from Scatter Plot
When clicking on items in a plot, select the corresponding
dives. This can be useful for data validation.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
1797b59c10 statistics: replot stats if dives added / removed
It is crucial to replot the statistics when dives are
added / removed, to avoid stale pointers.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
b7e62307c5 statistics: save dive list with quartiles
To make box-and-whiskers charts selectable (select corresponding
dives when clicking on box), save the dive list with the quartile
data.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
18a5b5b593 statistics: use dive instead of count bins
If we want to make bar charts selectable (when clicking on a
bar select the dives the bar represents), then we must store
the dives behind bars. Therefore, use dive-based bins instead
of count based bins in bar charts and pie charts. This gave
some churn because every structure where a count is stored
has to be changed to store a vector of dives. Try to use
move semantics where possible to avoid duplication of dive
lists.

On a positive note, the count_dives() function of the
binners can now be removed, since it is unused.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 13:02:54 -08:00
Berthold Stoeger
622e9ba373 printing: "fix" progress indicator
In TemplateLayout, there was a progress indication, which reported
the progress - not of the actual rendering - but of adding the
dives to the "to render" list. Which is of course done in less than
a ms, making the whole thing completely pointless.

Instead, emit progress when actually looping over the dives or
statistics.

Nobody ever noticed the problem because even rendering is done in
fractions of a second and indeed is accounted to only one fifth
of the total progress.

The real purpose of this "fix" is to get rid of the getTotalWork()
function, which was just insane. Instead of asking the TemplateLayout
how many dives it rendered, this number was extracted from
global state. Simply store the number of dives in the TemplateLayout
object instead.

Moreover, fix two coding style issues:
 - "Page" variable identifier starting with a capital
 - The Printer::render() being defined (as opposed to declared) with
   a default parameter. This is not how C++'s default parameters work,
   sorry.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-13 12:20:25 -08:00
Berthold Stoeger
6ef4f377f0 cleanup: remove dead code from ToolTipItem::addToolTip()
There was never an icon passed to this function. Therefore,
remove the parameter and the code that depends on it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-12 11:27:01 -08:00
Berthold Stoeger
b9cd9e17d1 cleanup: make ToolTipItem::addToolTip() private
This was not called from anywhere else.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-12 11:27:01 -08:00
Berthold Stoeger
d66d1e2a3b cleanup: whitespace fixes in profile-widget/divetooltipitem.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-12 11:27:01 -08:00
Berthold Stoeger
646aead629 desktop: disable animation when selecting multiple dives
Selecting many dives when the animation was active
was increadibly slow, so disable it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-10 14:33:15 -08:00
Berthold Stoeger
b3e4c9c8da desktop: cache photo and geo icons
The icons shown in the dive list were rendered for every single
access. Render them only once. This supposes that the
defaultIconMetrics structure does not change once the icons are
rendered!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-10 14:33:15 -08:00
Dirk Hohndel
41df39fdbe user manual: make the style more personal
Style is always tricky. This is really complex material. This attempts
to slightly personalize the language and make it less academic sounding,
while not removing any of the attention to detail and actual content of
this manual section.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-09 08:10:47 -08:00
Dirk Hohndel
b923526f04 user manual: fix typo in manual text
This isn't about 'depth variables', but about continuous vs categorical variables.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-09 08:10:47 -08:00
Dirk Hohndel
7a188cf7fe user manual: introduce the two variables as 'base' and 'data'
Instead of adding these names later, use them right from the start.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-09 08:10:47 -08:00
Dirk Hohndel
9ab481e927 user manual: get ready for 5.0
While version numbers are really rather random, we decided that with the
new statistics feature we will change the version number to 5.0.
Reflect that in the manual.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-02-09 08:10:47 -08:00
willemferguson
a0f740763b Subsurface Desktop user manual: Statistics panel
Update the user manual to take into account the statistics tool.
This is a first attempt.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2021-02-08 08:23:01 -08:00
Berthold Stoeger
60a6b61fb6 statistics: fix placement of horizontal labels in bar charts
The subtraction of half the label width, needed for centered
labels, must have been lost somewhere.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-08 08:19:48 -08:00
Berthold Stoeger
5b6f468547 statistics: don't place labels at half-integer values
Placing labels at half-integer values gives horrible
rendering artifacts. Therefore, always round to integer
values. The easiest way to do this is right before setting
the position. Introduce a helper function to round QPointF
in such scenarios.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-06 10:05:41 -08:00
Berthold Stoeger
f1203d365a desktop: improve splitter defaults
On first startup, use the splitter values suggested by Dirk:
Top/Bottom: 60/40
Info/Profile: 50/50
List/Map: 60/40

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-02-06 10:00:39 -08:00