Commit graph

57 commits

Author SHA1 Message Date
Robert C. Helling
187f7dab9f Add option to display GPS coordinates as decimals
This adds a field to the units preferences to have GPS coordinates
show as decimals (as for example Google maps does it).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-20 10:34:10 -07:00
Joakim Bygdell
afea30fd8a Recmode: Allow the user to specify gas reserve.
Since most regulators have an intermediate pressure of 10bar
the minimum value is 10 while the max is 99.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-09 14:36:17 -07:00
Robert C. Helling
cc8d601422 Checkbox and preference for safety stop
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-02 09:46:10 -07:00
Robert C. Helling
8571dcf967 Introduce recreational planner mode
This adopts the planner to the needs of the recreational diver. Rather than immediately
starting to ascent doing deco stops this mode, this mode stays at the last manually
entered depth for the maximal time before mandantory stops appear (NDL). It does not
change gas but keeps using the last used cylinder.

TODO: * Grey out unused UI elements of the planner in this mode
      * Start ascent before gas runs out (or into reserve)
      * Do a 3min @ 5m safety stop.

Fixes #840

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-02 09:45:50 -07:00
Gaetan Bisson
5bf23381e0 Save more planner settings into prefs
This adds to the prefs struct the variables last_stop, verbatim_plan,
display_runtime, display_duration, and display_transitions from the
planner so their values are saved from one session to the next.

The widgets for some of those settings had default values in
plannerSettings.ui; remove them since the new code in
subsurfacestartup.c takes care of initializing them.

Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-25 09:45:46 -07:00
Lubomir I. Ivanov
c45768a09f add and use a version.c / version.h pair
version.c is now object code which is recompiled each time
ssrf-version.h changes, while the interface file version.h
remains that same at all times and files which include it
will not need to be recompiled.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-15 13:26:51 -08:00
willem ferguson
a700be3207 CCR option: display o2 sensor data
This patch creates the possibility of viewing the individual sensor
values when the po2 button on the profile toolbar is activated. This
follows exactly the procedure for optionally displaying the setpoint
values while viewing po2. A checkbox in the preferences panel determines
whether sensor information is shown. By default it is set to OFF. When
checked, and the po2 button is activated, sensor1 values are shown in
grey, sensor2 in blue and sensor3 in brown.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-21 17:00:18 +12:00
Robert C. Helling
f2939dd991 Minor PSCR fixes
Update O2 metabolsim rate and adopt default gas switch depths to
pSCR oxygen drop.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-17 08:17:29 +13:00
Robert C. Helling
e219bc70f8 Refactor dctype -> divemode
... and repair a failed rebase (sorry).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:25 -08:00
Robert C. Helling
a478eb5711 Maintab combobox to set dive type
still needs some work

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-10 17:27:24 -08:00
Willem Ferguson
0de3bc8452 Display CCR setpoint values on the po2 graph
When a CCR dive is viewed and the toolbar button for PO2 is activated,
both the PO2 (green line) and the O2 setpoint (red line) are shown.
This allows evaluation of the PO2 in the CCR loop with respect to the
pre-configured O2 setpoint.

The setpoint graph can be disabled from the Preferences/Graphs tab
by checking the appropriate checkbox.

Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-05 09:18:06 -08:00
Dirk Hohndel
3e6a721771 Always show the full git version when called with --version
This way we finally get the right version shown on Mac and Windows.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-01 12:00:48 -08:00
Tomaz Canabrava
ee5d93e155 Changed Facebook stuff to socialnetworks.h/cpp
All Facebook related stuff now is on SocialNetworks.h/cpp
this makes it much easier to implement things and looking
for bugs.

working:
- logging in
- getting user id
- getting album id ( or creating it )

*much* more testing is needed, of course.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-24 15:54:28 -08:00
Tomaz Canabrava
14a858cf2a Save and restore Facebook Prefs.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-24 06:38:12 -08:00
Anton Lundin
da154222cc Free strduped prefs before exit
This plugs a leak detected by valgrind.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-18 07:20:10 -08:00
Miika Turkia
4875de45e6 Default some graphs to false
These values are treated as false upon starting Subsurface. Thus they
should be set to false as well. Otherwise extra graphs are drawn to the
profile when exiting the preferences dialog.

Fixes #783

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-14 11:42:29 -08:00
Robert C. Helling
06ddfc0122 Prepare for PSCR calculations
Calculations for passive semi-closed rebreathers are pretty much like OC
except the pO2 is lower bey a certain (SAC dependent) factor. This patch
introduces the corresponding calculations in case dctype == PSCR which is
so far never set and there is currently no UI for these calculations. As
pO2 is SAC dependent it takes a certain attempt at getting it and drops to
defaults from the prefs otherwise.

As there is no UI at this point and I also don't have any dives, this has
not received much testing, yet, but it compiles. At least.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-04 07:13:04 -08:00
Robert C. Helling
3fc9c1e005 Tissue saturation plot a la Sherwater Pretel
This adds a toolbox icon to turn on a tissue plot inspired by the bar
graph of the Sherwater Petrel,

It shows the inert gas partial pressures for individual compartments. If
they are below the ambient pressure (grey line) they are shown in units of
the ambient pressure, if they are above, the excess is shown as a
percentage of the allowed overpressure for plain Buehlmann. So it has the
same units as a gradient factor. Thus also the a gradient factor line (for
the current depth) is shown.

The different tissues get different colors, greener for the faster ones and bluer
for the slower ones.

Positioning and on/off icon action still need some tender loving care.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-09-19 21:46:30 -07:00
Dirk Hohndel
e893f6bd9d Use the Windows default font on Windows 7 and 8/8.1
It contains the characters we need and will make the application look more
"native".

See #712

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-22 15:56:57 -07:00
Dirk Hohndel
e8d430341c TankBar: hook into prefs and make ppGraphs resize accordingly
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-08-15 08:11:14 -06:00
Tomaz Canabrava
65eefe7b59 Animation speed is a value, not a boolean
This breaks compatibility with old preferences, but it's a single
key and not that very important so I don't think it's a bigger issue
I've renamed prefs.animation to prefs.animation_speed to denote
that it's a value, and not a state.

Also, fixed the places that were treating it as a state (on/off)
to treat it like a correct value.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23 07:50:03 -07:00
Anton Lundin
60c4587be6 De-duplicate planner default settings
All other default settings we get from subsurfacestartup.c's
initialization of the prefs struct. The planner had its defaults there
and in the retrieve of the settings from QSettings.

This changes so the defaults for planner settings will be read from the
defaults prefs struct as all other settings.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-19 10:24:07 -07:00
Gaetan Bisson
e69bb1879e Store drop_stone_mode, bottomsac, decosac in prefs
The values for drop_stone_mode, bottomsac, and decosac are typically the
kind of personal data specific to a diver that is unlikely to change
from one dive plan to the next.

This patch stores/restores them to/from the preferences file. For this,
it adds bottomsac and decosac to the prefs structure; drop_stone_mode
was already there, though not stored/restored.

Signed-off-by: Gaetan Bisson <bisson@archlinux.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-16 23:09:56 -07:00
Tomaz Canabrava
503a150af0 Added the toggle picture button and hoocked it up
This patch adds the toggle picture button and hoocks
it up with the rest of the code. I'v also changed a call
from ProfileWidget because it caused errors on the ui
generated code, where it would try to call an still-to-be
instantiated object.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 19:59:23 -07:00
Anton Lundin
2ff2daebd7 Move drop_stone_mode setting to prefs
There is no reason to treat drop_stone_mode different from the rest of
the planner settings, so move it to our prefs structure.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 14:40:36 -07:00
Robert C. Helling
5db706d291 Planner: Add backgas breaks
If the corresponding checkbox is checked the planner does interrupt
pure O2 deco after 12min for 6min on cylinder 0.

To make this work for air I removed the gasmix_is_null logic.

I guess that makes the planner feature complete for the next release.

[Dirk Hohndel: trivial merge into latest master]

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-03 16:33:19 -07:00
Robert C. Helling
65c5d6815c Make pO2 settings functional in planner
Spin boxes for pO2 are now hooked up to preference values. Adding new
cylinders (or changing their fo2) computes the MOD accordin to the current
value of decopo2. Note that chaning the limits for deco pO2 does _not_
automatically update the switch depth of all cylinders as those might have
been manually entered.

Furthermore, MOD has now to option of rounding to multiples of a given
depth. That is used for the automatic switch depth which are now always
multiples of 3m (so that EAN50 is switched to at 21m rather than 22m).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-25 21:07:10 +08:00
Robert C. Helling
772727fc7f Hook up UI elements for ascent rates to planner
That provides some UI elements that were recently introduced with function
of allowing the ascent rates of the planner to be configured by the user.

I tried to make it work both with senisble as well as with imperial units.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-25 13:48:44 +08:00
Henrik Brautaset Aronsen
630ec88dd4 Be more consistent in partial pressure naming
Lets just use pO₂ instead of PO2, ppO2, ppO₂, PO₂.
They all mean the same, but it's better to be
consistent

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-23 06:48:54 +08:00
Dirk Hohndel
8bd535d092 User survey: force running the survey from command line
This way people can test the dialog much easier.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-06-14 14:45:42 -07:00
Dirk Hohndel
b303f217a9 Dive list: add context menu function to renumber dive(s)
No attempt is made to ensure that what the user does is sane. So this can
result in duplicate numbers, non-consecutive numbers, non-monotonous
numbers, whatever floats the users boat.

You can renumber a single dive or all selected dives (with a starting
number given that is applied to the oldest selected dive and then for each
newer selected dive that number is incremented by one).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-05-20 06:11:32 +09:00
Gehad Elrobey
8380f09619 Renaming the prefs struct members to be consistent with the QSettings.
-Renaming prefs members for consistency.
-Changing references of QSettings to the prefs structure instead.
-Removing unused functions in pref.h were left over from an old version.
-Changing the data-type of bool members to short for consistency with other members.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-16 13:09:55 -07:00
Gehad elrobey
cdf83f5ef6 Change some references of QSettings to the pref struct.
After adding the animation member in the preference struct, it is
very resonable to change these references of QSettings to the
preference structure instead.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-11 07:21:15 -07:00
Lakshman
6a8d929876 Feature to show or hide heart rate graph
Adds new push button "HR" to the button bar on the dive profile to
toggle display of heart rate.

TODO: New icon for the heart rate button is needed.

Fixes #485

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-10 09:21:43 -07:00
Lakshman
ecc8c1d995 Remove check option to show units in text label
Currently the feature to show temperature units while adding dive is
provided through checkbox in preferences->units section. This patch
disables this checkbox and always enables this feature.

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-05 13:27:53 -07:00
Lakshman
7696fbf9cd Toggle showing average depth
Add additional check box in "preferences->graph" section that allows
users to hide average depth on dive profile.
By default this option is checked to show average depth.

Fixes #475

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-28 09:38:08 -07:00
Lubomir I. Ivanov
74ed786d75 Add optional Win32 console allocation
This patch adds the optional --win32console command line option.
It does nothing on OSx and Linux, while is only useable on Win32.

On Win32 if the application was built as GUI (not console),
there is no way to view stdout and stderr. With windows.c's
subsurface_console_init() we are able to either redirect
stdout and stderr to the terminal from which subsurface.exe
was started (always happens; --win32console does nothing in
this case) or if --win32console is explicitly added to
a shortcut, create a dedicated console window and monitor
the output there.

if set, WIN32_CONSOLE_APP is a condition that will make the
subsurface_console_init() and subsurface_console_exit()
functions NOP on Windows. The definition will be created if
the user passes 'CONFIG += console' to qmake.

Fixes #436

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-25 07:57:27 -07:00
Anton Lundin
9cfc585563 Fix system default font handling
We didn't care about system default fonts and sizes, we just used the Qt
default font.

Due to how QFont is constructed, there was need to split font and font
size.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-21 21:30:39 -07:00
Lakshman
6e4466aa0a Show temperature units in the label when editing dive
Currently when user wants to add a new dive information,
the ways to know what unit system is being used are

 - Through preferences panel.
 - Save the dive information, which displays units in
   the text field.

This patch provides an option to the user to show current
unit system by displaying the unit on the side of the label
when the user is editing the fields.

This feature can be enabled or disabled by using the new
checkbox option i.e. `Show units in text labels` included
in `preferences->units` section.

Signed-off-by: Lakshman Anumolu <acrlakshman@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-10 21:10:27 -07:00
Dirk Hohndel
76e6420f6b Massive automated whitespace cleanup
I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-27 20:09:57 -08:00
Danilo Cesar Lemes de Paula
5846ff972d Fixing default font on preference window
Default font was hardcoded as 14.
What happen if you change any other preference value is that the
application would start to use fontSize=14.

This commit loads the right value in the QDoubleSpinBox

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-26 11:51:33 -08:00
Anton Lundin
33391a77e9 Convert the C code to using stdbool and true/false
Earlier we converted the C++ code to using true/false, and this converts
the C code to using the same style.

We already depended on stdbool.h in subsurfacestartup.[ch], and we build
with -std=gnu99 so nobody could build subsurface without a c99 compiler.

[Dirk Hohndel: small change suggested by Thiago Macieira: don't include
               stdbool.h for C++]

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-16 09:34:50 +07:00
Dirk Hohndel
23973e8abd Don't show tanks that aren't used during a dive
Some dive computers will always download all tanks that they store, not
just the ones used in a dive. Most people only want to see the tanks that
they actually used during the dive (and for the others there's an option
to go back to the old behavior, just in case).

All this is only in memory / during runtime. If the dive computer provided
the extra data we will not throw it away.

Fixes #373

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-11 22:02:35 +07:00
Patrick Valsecchi
fe2eabf375 Added a configuration option to have gf_low apply at max depth instead of at deepest ceiling.
Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Patrick Valsecchi
4c4a7a6d96 Refactoring of the configuration handling.
Before, when clicking the OK button on the preferences GUI, we were
updating in-memory preferences from the GUI, saving them to the
configuration file from the GUI, reloading from the file to the
in-memory preferences. Then, to add to the ducplication, when the
application was exiting, some fields were saved again.
Basically the first step and the last step were useless appart from
the fact the the other steps where missing a few fields here and there.

This patch removes the first step and fixes the missing fields.

Signed-off-by: Patrick Valsecchi <patrick@thus.ch>
ACKed-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-21 08:11:40 -08:00
Anton Lundin
2d8cd44370 Make the info box look as it did in 3.1
In the Gtk version there were no option to disable the showing of time
in the mouse over, so this removes that option to limit the amount of
clutter in the settings panel.

This also renames the time and temperature to match the names they used
to have. T -> @, Temp -> T

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-15 06:06:57 +09:00
Anton Lundin
4bb8368a20 Introduce an on/off switch for calculating ndl/tts
Let the user choose if the calculation of ndl and tts is worth the time
it takes.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-13 11:55:19 +09:00
Linus Torvalds
58fa613236 Speed up XML loading
This tries to speed up XML loading for large XML files (and thus
subsurface startup times) by trimming the fat off our own matching code.

The actual libxml overhead (particularly string allocation) tends to be
the dominant part, so this only speeds up a big load by about 12% for me,
but hey, it can be noticeable. Dirk's example nasty 175MB xml file with
~5200 dives takes "only' 7.7 seconds to load, when it used to take 8.8s.
And that's on a fast machine.

For smaller xml files, the dynamic loading costs etc startup costs tend to
be big enough that the xml parsing costs aren't as noticeable.

Aside from switching the node names around to "little endian" (ie least
significant name first) format to avoid some unnecessary strlen() calls,
this makes the nodename generation use a non-locale 'tolower()', and only
decodes up to two levels of names (since that's the maximum we ever match
against anyway).

It also introduces a "-q" argument to make startup timing easier. Passing
in "-q" just makes subsurface quit imediately after doing all necessary
startup code.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-11-02 12:51:32 -07:00
Anton Lundin
579d1cb915 Show SAC in the mouseover.
This is really nice to have when looking at specific parts of a dive.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 14:56:52 -07:00
Dirk Hohndel
f96299ea94 Dependencies are too aggressive for version.h
Apparently qmake can't tell that #include "version.h" and #include
"libdivecomputer/version.h" are not the same thing. Instead of spending
another bunch of hours on fixing the buildsystem I decided to just cleanup
the spots where we actually use the version file and rename it to
ssrf-version.h.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-15 19:54:15 -07:00