Commit graph

69 commits

Author SHA1 Message Date
Berthold Stoeger
fdde4c23ea cleanup: move pref related structs and functions to pref.c
These were declared in pref.h and defined in subsurfacestartup.c.
pref.c didn't even exist. Create it and move preferences-related
structs and functions there.

setup_system_prefs() is left in subsurfacestartup.c, since it
works with environment variables.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02 10:26:29 -08:00
Berthold Stoeger
91ffa5a59a cleanup: move definition of get_units() to core/unit.c
The function is declared in core/unit.h, therefore it seems logical
to define it in the corresponding source file.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-02 10:26:29 -08:00
Berthold Stoeger
4c85357dcc cleanup: move monthname to time.c
Weirdly, this function was declared in dive.h and defined in
subsurface-startup.c. Let's move declaration and definition to
more appropriate places, viz. subsurface-time.h and time.c.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-29 08:34:09 -08:00
Berthold Stoeger
296a391faa prefs: add option to display only actually used tanks
A user complained about the default cylinders list. Provide
a preferences option to turn this off.

When changing the preferences, the tank-info model will be
completely rebuilt. Currently, this is a bit crude as this
will be done for any preferences change.

Suggested-by: Adolph Weidanz <weidanz.adolph@gmail.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-12-13 11:49:59 -08:00
Robert C. Helling
df9a52d857 downloader: filter possible devices and add mounts, remember last choices
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-12-03 13:26:55 -08:00
Robert C. Helling
b39e77071e downloader: small improvements
Provide supported dive computer list on the command line
and actually call the cli download. Still not functional.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-12-03 13:26:55 -08:00
Dirk Hohndel
25d7c58c07 downloader: first step to get instructions via CLI
This still doesn't do a thing, but at least it seems to get the
information closer to where we want it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-03 13:26:55 -08:00
Dirk Hohndel
057c151fe8 build-system: start adding a headless build
Right now this doesn't do a thing, but it gives us a nice target that
has far fewer dependencies and should contain enough parts to download
stuff from a divecomputer and then sync that with cloud storage.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-03 13:26:55 -08:00
Berthold Stoeger
2b86fe84f9 cleanup: move application flags to core/subsurfacehelper.h
These flags are not dive-related, therefore move their declaration
to the appropriate header file. Likewise, move their definition
from parse-xml.c to subsurfacehelper.c

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Dirk Hohndel
ad66297cfd desktop: remove user survey
We have never made good use of the results. Let's just remove it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-19 14:27:54 -07:00
Dirk Hohndel
97e26fd51b mobile: allow disabling BT support from the command line
This is a quick hack to reduce the noise in the log file when chasing other
bugs. Maybe this should not be enabled on release builds, but right now I don't
think the harm that having this in would do.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-06 10:00:13 +01:00
Berthold Stoeger
8a0eecfd5e cleanup: make version_printed variable static and local to function
The version_printed variable is used to print version information
only once. It was a global variable, but never used outside of
its function. Therefore, move it into the function and make it
static. Since this is a plain old datatype (POD), it makes no
no difference whatsoever whether the static variable is in block
scope or not. Indeed, it is initialized in the data segment). Well,
we are in C mode and therefore everything has to be POD by definition.
I tested this on gcc and clang.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-05 11:07:32 +01:00
Berthold Stoeger
4cff23ef7a mobile: remove filter settings
These are not used anymore.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-01 10:21:44 -08:00
jan Iversen
624bd9e7ec core: add --testqml flag to mobileExecutable
Add flag to subsurface_mobile (only when compiling for desktop)
to allow using qml files from disk instead of resources.

This allows testing qml changes with just restarting subsurface_mobile.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-11-26 09:44:13 -08:00
Robert C. Helling
9c8fbe494d Planner: Add option to treat O2 as narcotic
When computing the best mix for a target depth, for helium, one
can either require that the partial pressure of N2 is the same
as at the target depth or the partial pressure of N2 plus O2.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-10-31 00:30:38 -07:00
Berthold Stoeger
5da09a21bb Cleanup: move error reporting function declarations to errorhelper.h
Move the declarations of the "report_error()" and "set_error_cb()"
functions and the "verbose" variable to errorhelper.h.
Thus, error-reporting translation units don't have to import the
big dive.h header file.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-08-08 16:26:30 -07:00
Robert C. Helling
178eaa9a67 Add UI element for final surface segment in planner
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-03-29 06:51:12 -07:00
Robert C. Helling
c9d8b4f605 Add button to toggle deco info in info box
The info box can get longish. Offer the user to turn
off display of deco information (surface GF and
individual ceilings).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-02-05 14:18:14 +01:00
Lubomir I. Ivanov
a1ffe115cf facebook: remove the featute from the code base
Remove from:
- unit tests
- desktop widgets
- preferences
- core intergration
- cmakefiles
- build scripts
- icons
- docs

Also remove the plugins and social network integration.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2019-02-01 17:16:43 -08:00
Robert C. Helling
2c794348c1 Planner: Add checkbox to force OC bailout
This adds a checkbox for rebreather modes of the planner
that force the ascent to be in OC mode. Before, one had
to add a one minute last segment with the mode change but
this is not practical when manually searching for the
maximal bottom time given gas reserves.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2019-01-13 15:02:07 -08:00
Dirk Hohndel
eedb1ce0ea Mobile/filtering: add two preferences for filtering
With this we can make it configurable if the search should include the notes field
and if the search should be case sensitive or not.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-23 22:45:30 +01:00
Dirk Hohndel
617019bc6b qPref: add mobile_scale preference
We use that in the mobile app to scale the whole app, as all sizes there
are relative to the default font.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-25 15:58:17 +02:00
Jan Mulder
740fcce338 cleanup[6/6]: remove actual preferences
And finnaly, get rid of the definition in the overall struct.
And one usage of the preferences was still around.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-09-11 15:38:20 -07:00
Dirk Hohndel
2b3f6c607b prefs: cloud_new_password is not a preference
It's a mamber of the cloud storage authentication class, used to hold the
proposed new password until the backend has accepted it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-10 16:26:49 -07:00
Dirk Hohndel
ae653703a5 prefs: git_local_only is not a preference
It's the current state of the app, so it should be a global variable, not a
preference.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-09-10 16:26:49 -07:00
Berthold Stoeger
2bd0c2143e Cleanup: constify get_units()
get_units() returns a pointer to the units struct in the preferences.
Callers should not modify the preferences via this struct, therefore
make the return value point to const.

This is a small step in constifying the global preferences structure.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-07 11:03:30 -07:00
Berthold Stoeger
90c7be0772 Cleanup: shrink size of three-letter month name strings to 4
There was a comment reading

/*++GETTEXT: these are three letter months - we allow up to six code bytes*/

but this is not valid (anymore), since the array contains only
untranslated strings, which will be translated on-the-fly.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-02 08:55:08 -07:00
Berthold Stoeger
8c036234e2 Cleanup: move sort_table() from subsurface_startup.c to divelist.c
The function is not only used at startup and arguably belongs
the the file with the rest of the low-level divelist functions.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-08-02 08:55:08 -07:00
Berthold Stoeger
fce42d4858 Dive media: Extract thumbnails from videos with ffmpeg
Extract thumbnails using ffmpeg.
Behavior is controlled by three new preferences fields:
 - extract_video_thumbnails (bool): if true, thumbnails are calculated.
 - extract_video_thumbnail_position (int 0..100): position in video
   where thumbnail is fetched.
 - ffmpeg_executable (string): path of ffmpeg executable.

If ffmpeg refuses to start, extract_video_thumbnails is set to false
to avoid unnecessary churn.

Video thumbnails are marked by an overlay.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-28 15:31:25 -07:00
Berthold Stoeger
f3ef38ca0d Dive pictures: remove hashes
In the last commits, the canonical-to-local filename map was made
independent from the image hashes and the location of moved images
was based on filename not hashes. The hashes are now in principle
unused (except for conversion of old-style local filename lookups).

Therefore, remove the hashes in this commit. This makes addition
of images distinctly faster.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-07-04 02:27:36 +08:00
Anton Lundin
dcb663e407 Revert "cleanup: remove empty function"
This broke our hook to plumb in our usb open function into libusb, so
this broke ftdi based downloads.

This reverts commit e4530cd5ef.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
2018-06-21 06:28:39 +09:00
Berthold Stoeger
308e079ad6 Dive pictures: automatically recalculate thumbnails
If a thumbnail and the original picture can be accessed and the
modification date of the thumbnail is before the modification date
of the picture, recalculate the thumbnail.

This causes more disk access and might give strange effects for
picture files with messed up file timestamps (i.e. lying in the
future) or messed up computer clocks (i.e. running in the past).
Therefore, add a preference option to disable the new behavior.
Default is set to enabled.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-27 23:08:12 +03:00
Dirk Hohndel
d577467f97 Core: introduce new subsurface-string header
First small step to shrinking dive.h.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-05-14 10:13:39 -07:00
Willem Ferguson
81a812539c Plot OC-pO2 graph for SCR dives
This commit allows plotting the OC-equivalent pO2 graph for PSCR
dives. This happens in both the cases where there is no external
O2-monitoring AND when there is external pO2 monitoring. The
calculations are only done for PSCR dives and is achieved as
follows:

1) Within plot-info create a pressure-t called OC_pO2 in
   profile.h and populate this variable with the open-circuit
   pO2 values in profile.c.
2) Create a new partialPressureGasItem ocpo2GasItem in
   profilewidget2.h and, in profilewidget2.cpp, initialise it
   to read the plot-info OC_pO2 values and enable its
   display by using the setVisible method. The
   diveplotdatamodel was also touched in order to achieve
   this.
3) Create a pref button that controls the display of OC-pO2 for SCR dives
4) Change the colour of the OC-pO2 grpah to orange
5) Change the connection of the crr_OC_pO2 signal to be appropriate
6) rename the OC_pO2 attribute to scr_OC-pO2

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-04-28 20:11:22 +03:00
Berthold Stoeger
cd5e17cf79 Cleanup: Unify qthelper.h and qthelperfromc.h
Since all qt-helpers are defined in qthelper.cpp, there seems to be
no reason to have two include files. By unifying the two files,
duplication and inconsistencies are removed. The C++-only part is
simply compiled away with #ifdefs.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-02-26 19:06:02 +02:00
Robert C. Helling
920aa613c9 Add a preference to turn on ICD warnings
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-02-10 10:26:34 +01:00
Berthold Stoeger
e85ecdd925 Introduce helper function empty_string()
There are ca. 50 constructs of the kind
  same_string(s, "")
to test for empty or null strings. Replace them by the new helper
function empty_string().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11 06:07:13 +01:00
Jan Mulder
b2c7a4cf1d Unused code: weekday()
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10 16:45:42 +01:00
Berthold Stoeger
59526e948a Remove cloud_background_sync preferences option
The preferences flag cloud_background_sync used to be used heavily in
the mobile code, but is not used there anymore. Now, it is accessed
only in one place, but does not do what it actually says: If it is off,
the remote storage is not synced on save (but will be synced on next
load).

Syncing on save can also be prevented by unchecking the "Cloud online"
menu checkbox. Since the latter seems more logical and general
(support for non-cloud remote git repositories), remove the cloud_background_sync
option.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-06 10:46:07 -08:00
Berthold Stoeger
734bd6d459 Re-add newlines to help message
The two final newlines in the help message were removed in commit
0c74f7a2c8.
Re-add them.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-12-24 08:28:26 -08:00
Jan Mulder
e4530cd5ef cleanup: remove empty function
subsurface_OS_pref_setup() is not not used. Remove it.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-21 15:11:15 +01:00
Salvador Cuñat
1c2127d232 location service: reduce default thresholds
Current values (1000m, 10 min) may be too long to choose an accurate fix
while automatically applying gpsfixes to dives. They are fine if we are
diving from a static position, but will give wrong positions e.g. while
drift diving.
Reducing the default values to shorter 100m, 5min won't hurt most dives
from shore or static boats, but will make other diving styles get more
accurate gpsfixes.

signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-12-10 11:38:19 -08:00
Berthold Stoeger
7a99d7e5c3 Copy default filename string when assigning to default preferences
This tries to remove subtle ownership issues. When copying preferences
structures, the default filename is copied. But the default preferences
struct simply takes a pointer to a global string which is free()d in main().

Now, this is not strictly a bug because the free()ing of preferences
resources is not implemented. Yet, let's try to make this consistent.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-22 19:22:14 +01:00
Lubomir I. Ivanov
a8fbceac17 subsurface-startup: expose print_version() in the header
The Windows auto-verbose + log file creation if starting
from a non-terminal has the problem that the print_version()
call is never made becase 'verbose' is updated programatically
in windows.c and not by the user (by passing -v).

To work around the issue:
- move the windows console creation call before *everything* else
- then immediatelly install the message handler
- then see if 'verbose' is set and explicitly call print_version()

print_version() now also has a flag (version_printed), to avoid
printing the version multiple times, if the user decided to add
an extra -v to the Desktop shortcut.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-16 14:26:14 +01:00
Dirk Hohndel
f16a488b89 Print version when run in verbose mode
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-09 16:21:46 -08:00
Dirk Hohndel
bcabe6ec9f Add details about key libraries when showing version
Also fixed a spelling error and apparently some whitespace issue.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-11-09 16:21:31 -08:00
Lubomir I. Ivanov
0c74f7a2c8 win32: optimize the console and logging logic
Currently one has to explicitly use --win32console and/or
--win32log to enable a dedicated console (a console window
that opens next to the Subsurface window) or to enable file
logging on Win32.

This patch makes the following changes:
- removes the --win32* command line arguments
- removes the dedicated console window support
- if the app starts from a shortcut and not from a console, always
redirect stderr and stdout to _err & _out log files
- if the app starts from a console redirect stderr and stdout to that
console

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-03 07:49:11 -07:00
Stefan Fuchs
4e320cca5b Remove three obsolete preferences options for geocoding
These options are not used any longer/were never used and can be
removed to not confuse the users.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-29 11:07:52 -07:00
Dirk Hohndel
3b92585a47 Don't show error if cloud credentials aren't set up
This became rather obvious with the change to immediately show errors.

The commit also fixes a small memory leak.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 15:52:58 +02:00
Rick Walsh
1bc5050eff Planner prefs: set all ascent rates to 9m/min
9m/min (or 10m/min) is the ascent rate assumed by Buhlmann and navy tables,
and the default of most other planning software and dive computers.

Setting the default to 9m/min allows the default behaviour to be consistent
with "expected" behaviour, but does not prevent the user from changing the
preference.  There is disagreement between some users whether the final ascent
ascent duration should be considered when determining the length of the final
stop.  This change does not alter that at all, but at 9m/min, the difference
is <1min.

See #592

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
2017-09-28 06:11:51 +02:00