Commit graph

8369 commits

Author SHA1 Message Date
Gehad elrobey
fcde03e849 Printing: choose printing color mode 'color/greyscale'
We can have color printouts only if the printer supports color
prints, the user selected 'print in colors' from the print dialog and
the default printer settings (Operating system wise) is to print in
colors, Otherwise the prints will be in greyscale.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-05 20:58:33 +03:00
Gehad elrobey
5981cf170f Printing: make dive profile scale dependant on the page size and DPI
Use setFontPrintScale() to change the font scale of the dive profile as a ratio of
the full resolution, font = (pageWidth * dpi) / fontvalue

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-05 20:58:29 +03:00
Gehad elrobey
1faa198020 Printing: print all dives if 'print selected' is unchecked
User can choose either to print all dives or print selected dives only.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-05 20:58:24 +03:00
Gehad elrobey
bc0b443afd Printing: add QPrintPreviewDialog to main dialog
Add preview dialog that shows the printer contents before printing.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-05 20:58:16 +03:00
Dirk Hohndel
35dc814105 Add simple test for the dive planner
This sets up a standard dive scenario (30 minutes at 260ft/79m, EAN36 and
Oxygen as deco gases, last stop at 20ft/6m) and calls the planner to set
up a dive plan given certain standard gases.

Instead of trying to verify the complete plans it checks that we switch to
the deco gases at the right depth and the complete duration of the dive
matches our expectation.

The test intentionally fails right now for imperial as we have the wrong
switch depth for Oxygen. See how useful tests are?

On the downside, the test does NOT produce the same plan as Subsurface
when I try to create a consistent setup for both - and I have not been
able to figure out why. There must be some other parameters that I'm not
setting, but I haven't identified them, yet. It's very small differences,
for example in the metric case the stops at 21m, 9m, and 6m are each one
minute shorter in the test than it what Subsurface calculates.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05 09:42:38 -07:00
Rick Walsh
17ef6774e0 Planner deco stops are at 10ft increments when measured in feet
When using feet as depth unit, deco stop levels should be at 10 ft rather
than 3 m increments.

For shallow stops, rounding means the difference is not apparent. However,
with stops deeper than 30 feet, using 3 m increments leads stops at 39ft,
49ft, ..., 98ft, etc.

Apart from making plans look messy, the old behaviour makes it harder to
benchmark the planner against published profiles in imperial units.

This revised patch uses the help macro M_OR_FT(6, 20) to set the last stop
at the correct depth.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05 06:50:48 -07:00
Rick Walsh
8c4e1e6bfa Read planner preferences when we use them
Read and use the last_stop preference in the plan function.
Read the plan notes preferences and set variables (plan_verbatim,
plan_display_runtime, plan_display_duration, and plan_display_transitions)
in the add_plan_to_notes function. Don't read the preferences and set
variables otherwise. Both plan and add_plan_to_notes functions are called
on data change.

Previous behaviour was:
- Set variables on declaration
- Reset variables in plan function (even variables that only relate to
  planner notes output)
- Changing a preference triggered set_xxx function which sets variable,
  then plan function, which sets variable again.

Apart from being inefficient, the previous behaviour made it difficult to
track down where and when variables were set.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-05 06:37:01 -07:00
Dirk Hohndel
896b7a5e74 Merge branch 'new-vpm' of https://github.com/Slagvi/subsurface 2015-07-05 06:32:23 -07:00
Dirk Hohndel
74e2956986 INSTALL file: a few more changes
- Qt4 is no longer supported
- Make the Kubuntu comments more generic
- Mention command to add user to dialout group

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-04 09:20:36 -07:00
Pedro Neves
54af724f17 INSTALL file: add notes for Ubuntu/Kubuntu 15.04
Update the install instructions when compiling Subsurface from source on
Ubuntu/Kubuntu machines.

Signed-off-by: Pedro Neves <nevesdiver@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-04 09:20:08 -07:00
Jan Darowski
ddfd046c8d VPM-B: add CVA to the deco planner.
Added keeping bottom dive state and every deco's time, so we can
run multiple deco simulations with different gradients until they
converge to some optimal value.

Some improvements on the deco time calculation may be needed.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-04 00:13:34 +02:00
Jan Darowski
bfb9f19080 VPM-B: add next gradient calculation.
It improves (increases) gradients for all the compartments,
so more free gas can be created in the divers body. Next gradients
will converge, so the volume won't exceed the safe limit, indicated
by the crit_volume_lambda parameter.

Function takes time of the last deco in seconds.
Requires vpmb_start_gradient() to be run before.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 23:59:22 +02:00
Jan Darowski
02f1339917 VPM-B: vpm without CVA working.
Add call of initial calculation of critical radius and start gradient,
so the VPM could work.
Currently without CVA, so the gradient isn't improved.
Only one iteration is run.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 23:54:57 +02:00
Jan Darowski
e7aa686f16 VPM-B: add vpm-b based deco checking.
Check during the trial_ascent() if existing pressure gradient is
smaller than previously calculated max gradient. If not, ascent
is impossible from the vpm-b's point of view.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 23:24:20 +02:00
Jan Darowski
fad592e43a VPM-B: add initial gradient calculation.
Calculate the max difference between tissue saturation and ambient
pressure that can be accepted during the ascent.
Partial results are kept for later improving in next CVA iterations

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 23:19:57 +02:00
Jan Darowski
500fbe4994 VPM-B: add deco choice to the ui.
Removed recreational mode from ui and pref and replaced it with
new deco_mode enum.
Added radio button ui selection.
Set default deco_mode to Buehlmann algorithm.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 23:07:58 +02:00
Jan Darowski
2435d79c0e VPM-B: add nuclei size calculation and nuclear regeneration.
This function calculates the size of nuclei at the end of deco,
then simulates their regeneration, to the moment before the deco.
This is redundant as nuclear regeneration is a very slow process.

Function should be called with time in seconds, just before the ascent.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 22:45:29 +02:00
Robert C. Helling
0180d2eb1e VPM-B: use an analytic solution for nucleon inner pressure instead of binary root search
According to mathematica

In[4]:= f[x_] := x^3 - b x^2 - c

In[18]:= Solve[f[x] == 0, x]

Out[18]= {{x ->
   1/3 (b + (
      2^(1/3) b^2)/(2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(
      1/3) + (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3)/
      2^(1/3))}, {x ->
   b/3 - ((1 + I Sqrt[3]) b^2)/(
    3 2^(2/3) (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(
     1/3)) - ((1 - I Sqrt[3]) (2 b^3 + 27 c +
       3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3))/(6 2^(1/3))}, {x ->
   b/3 - ((1 - I Sqrt[3]) b^2)/(
    3 2^(2/3) (2 b^3 + 27 c + 3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(
     1/3)) - ((1 + I Sqrt[3]) (2 b^3 + 27 c +
       3 Sqrt[3] Sqrt[4 b^3 c + 27 c^2])^(1/3))/(6 2^(1/3))}}

For the values of b and c encounterd in the algorithm, the first solution is in fact the
only real one that we are after. So we can use this solution instead of doing a binary
search for the root of the cubic.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 22:36:59 +02:00
Jan Darowski
ecd0e3e170 VPM-B: add initial values for crushing pressure variables.
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 22:18:41 +02:00
Jan Darowski
bed3b9eea3 VPM-B: add crushin pressure calculation.
Add new structures holding vpm-b state.
Add function calculating current crushing pressure.
Call it from add_segment() on every ambient pressure change.
It determines what pressure acts on nuclei during the descent
and thus their size at the beggining of the deco.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 22:10:12 +02:00
Jan Darowski
94f3fc8542 VPM-B: add calculating nucleons inner pressure.
This function calculates the pressure inside the nucleon
during the impermeable phase.
In the original code, Newton's method is used, for simplicity, we
use binary search for finding cubic equations root.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 21:50:39 +02:00
Jan Darowski
1147100930 VPM-B: add basic algorithm settings.
Created vpmb_config structure based on buehlmann_config.
Set it's default values to ones taken from the existing C implementation.

Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03 21:30:53 +02:00
Dirk Hohndel
5ae5aedab3 Add FAQ item about creating a udev rule for Cobalt under Linux
This should work under most Linux flavors.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 12:26:14 -07:00
Dirk Hohndel
08a451d24a More debug message cleanup
Remove several very noise messages on dive site handling (this seems to
work well now, so I think we can remove most of them - a couple were left
that indicate actual issues).

And also remove all the calls to "translate" when outputting data to
stderr. Error messages that indicate issues where the user will basically
have to come and ask the developers for help shouldn't be localized. They
should be in English to make it easier for us to figure out what's going
on.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 11:22:22 -07:00
Dirk Hohndel
898d82e647 Notes pane: don't show empty taxonomy tags
No point in searching for the right tag if the user picked no taxonomy to
be shown. And no point in showing an empty value, either.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 10:23:16 -07:00
Dirk Hohndel
bc8c54f1ee Rename enum values for taxonomy
This avoids confusion and namespace collisions.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 10:22:31 -07:00
Dirk Hohndel
08f8eb6eb5 Don't try to pass QString to report_error()
No idea why the compiler on my system didn't complain about this.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 07:17:51 -07:00
Dirk Hohndel
f554c2d16c Merge branch 'taxonomy' 2015-07-02 07:03:03 -07:00
Dirk Hohndel
0a0a6f07d5 Remove a few more debug messages
Yes, I could go back and try to fix the earlier commits.
This is easier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 06:59:08 -07:00
Dirk Hohndel
d966fd2606 Trigger reverse geo lookup by pressing the button
This may not be the best UI, but for now it works.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 06:50:50 -07:00
Dirk Hohndel
baf68868f5 Notes pane: add geo code button
This still needs to be hooked up.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 06:50:50 -07:00
Dirk Hohndel
92722adeba Notes pane: don't show taxonomy info for trip location
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 06:50:50 -07:00
Dirk Hohndel
c3e38b6da3 Notes pane: once again fix the layout
It seems nearly impossible to keep all these margins consistent.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 06:50:50 -07:00
Dirk Hohndel
80f26912b0 Notes pane: move the location taxonomy to a better spot
And display it smaller, marked as "tags".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 06:50:50 -07:00
Dirk Hohndel
b42bae2ce8 Geo taxonomy: download the taxonomy data from geonames.org
There are a number of web servies we could use. All have their drawbacks.
This one is free with free data. It's daily limits are reasonably high.
For many coordinates I tested the results were good, for others at least
not terrible.

We can always consider supporting multiple such services. But for now this
seems like a reasonable choice.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 06:50:49 -07:00
Dirk Hohndel
1d59b028c9 Use tank pressure data from libdivecomputer's DC_FIELD_TANK
When libdivecomputer switched to the DC_FIELD_TANK API it apparently
stopped creating fake pressure samples at the start and end of a dive for
dive computers that don't have continuous pressure reporting but that
instead only report those two values.

This updates our code to take those values into account.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-02 06:21:00 -07:00
Tomaz Canabrava
4059f5d995 Correctly display the data on the delegate
A bit more complex than I tought it would be (and a ton of trial
and error to find the right spot on the delegate to draw stuff)
this delegate follows the current style (so it should be okaish
on a dark and on a light theme)

This is supposed to work on a QCompleter, but it doesn't (I really don't
know why, so maybe I'll remove that completer. sigh.)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 19:25:14 -07:00
Tomaz Canabrava
3b0936eca3 Create a delegate to display custom data
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 19:24:52 -07:00
Tomaz Canabrava
1b8f7f53f2 Added again a QCompleter to show the possibilities
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 19:23:01 -07:00
Tomaz Canabrava
43bb8881fd Correctly removes the Location Completion Model
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 19:21:50 -07:00
Tomaz Canabrava
db8b140c52 More information on dive site model
All of dive site information is now exposed to the model

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 19:21:23 -07:00
Tomaz Canabrava
324b6182aa Remove location completion model
This is a functional but hard to expand model for the dive sites.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 18:54:19 -07:00
Dirk Hohndel
3055f4ac22 Geo taxonomy: show the chosen taxonomy entries in the notes pane
This isn't perfect - I'd like to have them show behind the word Location
instead as what we have now creates movement in the position of the fields
on the screen which I think is distracting.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 12:38:40 -07:00
Dirk Hohndel
a413141b33 Geo taxonomy: adjust the preferences to the new data structures
This allows us to pick which three categories of geo taxonomy will be
shown in the UI.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 12:38:40 -07:00
Dirk Hohndel
f7b7d4c2df Geo taxonomy: save and load the taxonomy data with XML
If taxonomy data are available we are switching a dive site entry from
single item with attributes to an item that has children. This is
backwards compatible and older versions will simply ignore the children.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 12:38:40 -07:00
Dirk Hohndel
6e81677d89 Geo taxonomy: save and load the geo taxonomy data with git
This also supports the cloud storage, of course.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 12:29:32 -07:00
Dirk Hohndel
53b805131e Geo taxonomy: add the taxonomy information to dive sites
Make the helper functions handle it as well

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 12:28:15 -07:00
Dirk Hohndel
36657c019b Geo taxonomy: create some data structures and helper functions
This is designed to store taxonomy information for dive sites, including
information where the data came from.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 12:25:47 -07:00
Dirk Hohndel
b8ae4c50b4 Cmake support: remove a clearly broken line
This was intended to help us fine libssh2, but since it works as is now,
and the typo makes the entry pointless, I'm pretty sure that this isn't
needed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 10:27:02 -07:00
Anton Lundin
4c0f6a0ac0 Update android build script for CMake
This updates the android build script to something that uses CMake.

This can't produce a working APK yet, but it at least builds the shared
object which should be wrapped into the APK.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-01 09:01:04 -07:00