Commit graph

109 commits

Author SHA1 Message Date
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
Willem Ferguson
e2a6b96db8 Move icd preference setting
Move the icd preference setting to the preference group that deals
with gas pressures.

I also reorganised the existing items so that the items within the
pressure widget are logically arranged according to the grid layout.
The order of items was very haphazard. No change of code at all in
this reorganisation.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-02-26 19:05:26 +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
Jan Mulder
e592dfe17c Whitespace only
Now that we properly return when raising an error, do not
if () else if(). Useles.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-18 09:44:08 +01:00
Jan Mulder
d28f48a793 Fix preferences handling with invalid passwords
This fixes 2 problems related to entering passwords with
illegal characters in it:
1) Do not save an invalid password in the preferences, but keep the old
one.
2) On password change, check both old and new password for format
validity instead of pushing an invalid password to the server that
has to ignore it.

Fixes: #1048

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-18 09:44:08 +01:00
Berthold Stoeger
ff9bdfd0df Fix PreferencesNetwork::passwordUpdateSuccessful slot
In preferences_network.cpp, the CloudStorageAuthenticate::passwordChangeSuccessful
signal was connected to the PreferencesNetwork::passwordUpdateSuccessful
slot. This never worked, because passwordUpdateSuccessful() was declared
as a normal member function, not a slot (hooray for Qt's weird runtime-checked
signal system).

While touching this code, change the weird SIGNAL/SLOT macros to
actual member function, to at least get *some* compile-time checks.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18 08:56:27 +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
Stefan Fuchs
b7494bfb2e Cleanup: Rename preferences ui file names according the standard
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-02 09:12:31 -08:00
Jan Mulder
75142b0a63 cleanup: less than operators shall not use equal
See also commit c032006d91. Compare functions passed
to sort functions need to compare for less-than and not
less-or-equal.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-12-29 13:16:58 -08:00
Berthold Stoeger
a748e7f239 Unify float calulations: use double
Internal floating point (FP) calculations should be performed using double
unless there is a very good reason. This avoids headaches with conversions.
Indeed, the vast majority of FP calculations were already done using double.
This patch adapts most remaining calculations. Not converted where things
that were based on binary representations and variables which weren't used
anyway.

An analysis of all instances follows:

core/plannernotes.c, l.404:

This was a comparison between two floats. On the left side, first an integer
was cast to float then multiplied with and integer and divided by a constant
double. The right hand side was an integer cast to a float. Simply divide by
1000.0 first to convert to double and continue with calculations. On the right
hand side, remove the cast, because the integer will be implicitely cast to
double for comparison. This conversion actually emits less instructions,
because no conversion to double and back is performed.

core/planner.c, l.613:

Same analysis as previous case.

subsurface-desktop-main.cpp, l.155:

A local variable representing the version OpenGL version. Turn this into
integer logic. Not only does this avoid dreaded FP rounding issues, it also
works correctly for minor version > 10 (not that such a thing is to be
expected anytime soon).

abstractpreferenceswidget.[h/cpp]:

A widget where the position is described as a float. Turn into double.

desktop-widgets/divelogexportdialog.cpp, l.313:

total_weight is described as float. Use double arithmetics instead. This
instance fixes a truncation warning emitted by gcc.
2017-12-17 09:02:44 -08:00
Martin Měřinský
8ef87e618a Use better aliases for icons.
Icon aliases were complete mess.
Some icons had alias some didn't.
Named with underscores vs. hyphens vs. camelCase.
Lower vs. upper case.
"ICON" prefix vs. suffix vs. nothing.
With vs. without filename suffix.
Some didn't make sence. Eg. mapwidget-marker-gray
(I can see, it's grey, but what does it represent?)
Some were duplicated, eg warning vs. warning-icon.
Some were name after widget, which is wrong.

Do not reinvent wheel. Use widely used naming scheme
close to Freedesktop Icon Naming Specification. This
will enable usage of common icons from current set in
the future. Thus Subsurface will fit nicely to GUI.

This changes icon aliases to one, easy grep-able style.

Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-30 23:14:46 -08:00
Martin Měřinský
0855f6f315 Use icons relative path.
Icon paths are defined in one place only - application's embedded resources.

Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-30 23:14:46 -08:00
Dirk Hohndel
fd9c905ba3 Revert "Use icons relative path."
This reverts commit b0d98f6e26.
2017-11-29 14:05:07 -08:00
Dirk Hohndel
2747056889 Revert "Use consistent aliases for all icons."
This reverts commit 92e9c6606f.
2017-11-29 14:05:07 -08:00
Martin Měřinský
92e9c6606f Use consistent aliases for all icons.
Icon aliases were inconsistent mess. Underscores vs. hyphens vs. camelCase.
With vs. without filename suffix. Lower vs. upper case. "icon" suffix vs.
prefix vs. nothing. Some were duplicated, eg warning vs. warning-icon. Some
icons didn't have alias at all.

This changes all icon aliases to one, easy grep-able style which complies
to Freedesktop Icon Naming Specification (Guidelines).

Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-29 11:46:35 +01:00
Martin Měřinský
b0d98f6e26 Use icons relative path.
Icon paths are defined in one place only - application's embedded resources.

Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-29 11:46:35 +01:00
Berthold Stoeger
4fb01dd766 Fix ownership issues in preferences code
Each preferences object owns its string members. In three cases, pointers
were copied instead of strings, leading to (in the best case) dangling
pointers if the user edited values:
1) In the GET_TXT macro in core/prefs-macros.h
2) In the PreferencesDialog::defaultsRequested() method
3) In main() of the mobile version

This patch fixes these issues, by using copy_string() or copy_prefs()
as appropriate.

The only reason that the old code didn't crash regularly is that the
default_prefs object was only used at startup and defaultsRequested()
is (at the moment?) dead code.

This patch also aligns the backslashes in core/pref.h and fixes a typo.
The declaration of copy_prefs() is moved to the core/prefs.h header.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-25 07:41:09 -08:00
Berthold Stoeger
e762fd2d41 Fix typo: successfull -> successful and succesfully -> successfully
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-20 10:01:15 +01:00
Stefan Fuchs
d0e5653e39 Planner and profile limit minimum GFlow to 10 and minimum GFhigh to 40
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-13 11:53:55 +01:00
Berthold Stoeger
b32251a5a8 Typo: modp02 -> modpO2
Fixes two function names, where O2 was written as 02.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-12 15:11:30 +01:00
Lubomir I. Ivanov
513f5a0230 preferences: support a pre-defined list of time formats
Add a combo-box that holds a list of pre-defined time formats
in the Language preferences.

The user is still allowed to enter a custom time format.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-10 09:21:47 -08:00
Lubomir I. Ivanov
4fde26fb2c preferences: re-use a tr() string in _language.cpp
Also, tell "in date format" instead of "in time format"
for dates.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-10 09:21:47 -08:00
Lubomir I. Ivanov
2c06cb027f preferences: support a pre-defined list of date formats
Add a combo-box in place of the single line text field and
support some pre-defined date formats, such as:
MM/dd/yyyy

Each long format has a corresponding short variant stored in the
QMap dateFormatShortMap and it's updated automatically once
the user selects a combo box item for the long format.

The regex for dates is slighly modified:
[^dMy/\\s:;\\.,\\-]

The user is still allowed to enter custom long / short date foramats.

Fixes #276

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-10 09:21:47 -08:00
Stefan Fuchs
8b56dc30d7 Correct, cleanup, translate and unify file filters
Correct spelling and typos in file filters.
Unify and translate file filter names.

Don't pass a file filter to a directory open dialog - not needed.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-04 14:27:00 +01: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
9c4782fa5c cloudstorage: better member name when updating authentication state
This isn't just about showing the PIN or not.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-26 20:44:02 +02:00
Stefan Fuchs
ac7830ea91 Correct spelling for text in prefs georeferences
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-17 06:12:07 -04:00
Stefan Fuchs
f5f2754b81 Preferences units dialog: Tab order and silence warnings
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-09 11:49:29 +03:00
Stefan Fuchs
78cda85444 Display units in dive list table based on prefs option
Add a preferences option which enables or disables display of units in the
main dive liste table.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-09 11:49:29 +03:00
Lubomir I. Ivanov
2cb5d45231 preferences: add missing dialog icon
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-10-08 16:01:03 -07:00
Robert C. Helling
5b080bedde Remove option to apply GFlow at maxdepth
This option should have never been there. This is not how
gradient factors are supposed to work. It would only trick
users to use the wrong value..

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-09-20 08:54:41 -07:00
Stefan Fuchs
19df57d7d3 Remove some very small marble leftovers
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-09-16 08:36:30 -07:00
Lubomir I. Ivanov
a7d8e0d187 googlemaps: clear the cache folder on language change
Open the cache folder via QDir and call removeRecursively().
At that point the user needs to restart Subsurface to be able to
use the map in another language properly.

This change is triggered by the fact that the user might want to see
the street map in his preferred language after he/she picks another
language from Settings. But one problem here is that the cached files
do not carry a language flag - e.g. they are in the lines of:
    googlemaps_100-1-9-445-245.png

Which means that the only way to not mix tiles in different languages
is to clear the cache and start downloading the new tiles in the newly
picked language after Subsurface has restarted.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-09-04 07:41:21 -07:00
Dirk Hohndel
876b479d69 Wire up duration units preference UI
Now we track the preference, but we don't act on it, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-06 13:49:36 -07:00
Dirk Hohndel
38b9185974 Add UI for duration preference
This isn't hooked up, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-06 13:11:04 -07:00
Dirk Hohndel
9021a44ccc Add SPDX header to desktop widgets
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29 13:32:55 -07:00
Jan Mulder
3b9c32a050 UI: preferences-profile screen beautify
Stefan suggested "Maybe it would be nicer to move the 3 fields for the
maximum pressure for N2, He, O2 for MOD to the right in the UI window
exactly below the maximum field for the O2 (where we now have
minimum + maximum)."

And I agree, so this is the change.

At the same time, reset the tab-order to a logical one.

Reported-by: Stefan Fuchs <sfuchs@gmx.de>
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-29 13:21:50 +02:00
Jan Mulder
bb31c77597 minimal pO2 threshold: split max threshold into min and max
Nothing really special here. Just a split of the only p02 max threshold into
a min threshold and max threshold, and the adaptation of the UI. Change of
translatable strings included.

ref: https://github.com/Subsurface-divelog/subsurface/issues/259

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-28 11:17:03 -07:00
Stefan Fuchs
2e2ccc1c52 Prefix and suffix changes in preferences and planner preferences
In preferences->profile:
Move "bar" from text description to entry field (5x)
Move "l/min" from text description to entry field
Add suffix "%" to GF values
Rename VPM-B conservatism

In planner preferences:
Add prefix "+" to VPM-B conservatism

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-18 08:34:04 -07:00
Martin Měřinský
6305361d14 Settings Graph is about dive Profile. 2017-03-13 10:28:06 -07:00
Martin Měřinský
25dcee139e Settings Defaults > General
These are more general options, than default values.
2017-03-13 10:28:06 -07:00
Martin Měřinský
71d48142ac Planner uses "Conservatism level", do the same for Settings. 2017-03-13 10:28:06 -07:00
Dirk Hohndel
08284275e7 Merge branch 'master' of https://github.com/dje29/subsurface 2017-03-11 08:41:41 -08:00
Martin Měřinský
dcf2542215 Use abbreviations with dots. 2017-03-11 08:09:07 -08:00
Jeremie Guichard
406e4287eb Change calls to rint into lrint avoiding conversion warnings
Using gcc option "-Wfloat-conversion" is useful to catch
potential conversion errors (where lrint should be used).
rint returns double and still raises the same warning,
this is why this change updates all rint calls to lrint.
In few places, where input type is a float, corresponding
lrinf is used.

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-08 14:04:17 +07:00
Martin Měřinský
67bba5d1c2 cu ft > cuft 2017-03-04 12:08:17 -08:00
Robert C. Helling
c25ca184ec Also grey out labels when not relevant for current deco mode
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-02 05:06:20 -07:00
Robert C. Helling
f01033f6a0 Actually turn on the vpmb radio button in VPM-B mode
this fixes a typo.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-02 05:05:55 -07:00
Willem Ferguson
7a863dc4c0 Reorganise Preferences->Graph
Remove one last leading space character that I missed.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 19:26:47 -07:00
Dirk Hohndel
c2735cba8e Fix duplicate labels in ui file
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:58:28 -07:00