aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/preferences
AgeCommit message (Collapse)Author
2018-07-04core: remove double definition of enum cloud_storage_statusGravatar jan Iversen
Remove cloud_storage_status from qmlprefs.h. usage to qPref:: enum cloud_storage_status is not used from C, but only from C++, and having the same structure defined multiple times is a maintenance challenge. Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-01core: remove prefs-macros.h where unusedGravatar jan Iversen
move #include prefs-macros from SettingsObjectWrapper.h to SettingsObjectWrapper.cpp include dive.h directly (only part of prefs-macros.h used) in preference classes Signed-off-by: Jan Iversen <jani@apache.org>
2018-06-20equipment: sanitize 'tank_info' loop limitsGravatar Lubomir I. Ivanov
In a number of places the global 'tank_info' array is being iterated based on a 'tank_info[idx].name != NULL' condition. This is dangerous because if the user has added a lot of tanks, such loops can reach 'tank_info[MAX_TANK_INFO]'. This is an out of bounds read and if the 'name' pointer there happens to be non-NULL, passing that address to a peace of code that tries to read it (like strlen()) would either SIGSEGV or have undefined behavior. Clamp all loops that iterate 'tank_info' to MAX_TANK_INFO. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2018-06-04Cleanup: fold core/helpers.h into core/qthelper.hGravatar Berthold Stoeger
helpers.h included qthelper.h and all functions declared in helpers.h were defined in qthelper.h. Therefore fold the former into the latter, since the split seems completely arbitrary. While doing so, change the return-type of get_dc_nichname from "const QString" to "QString". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-05-27Dive pictures: automatically recalculate thumbnailsGravatar Berthold Stoeger
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-14Core: remove dive.h from files that don't need itGravatar Dirk Hohndel
Of course, quite a few of them indirectly get it through other header files. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-04-28Plot OC-pO2 graph for SCR divesGravatar Willem Ferguson
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-02-26Move icd preference settingGravatar Willem Ferguson
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-10Add a preference to turn on ICD warningsGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-18Whitespace onlyGravatar Jan Mulder
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-18Fix preferences handling with invalid passwordsGravatar Jan Mulder
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-18Fix PreferencesNetwork::passwordUpdateSuccessful slotGravatar Berthold Stoeger
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-06Remove cloud_background_sync preferences optionGravatar Berthold Stoeger
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-02Cleanup: Rename preferences ui file names according the standardGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-12-29cleanup: less than operators shall not use equalGravatar Jan Mulder
See also commit c032006d91ee3c. 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-17Unify float calulations: use doubleGravatar Berthold Stoeger
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-11-30Use better aliases for icons.Gravatar Martin Měřinský
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-30Use icons relative path.Gravatar Martin Měřinský
Icon paths are defined in one place only - application's embedded resources. Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-29Revert "Use icons relative path."Gravatar Dirk Hohndel
This reverts commit b0d98f6e269be9560de1b9c140855c85fecf1dd1.
2017-11-29Revert "Use consistent aliases for all icons."Gravatar Dirk Hohndel
This reverts commit 92e9c6606f6ef3ad16d2e31f9f9a8f5fa14f2c1a.
2017-11-29Use consistent aliases for all icons.Gravatar Martin Měřinský
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-29Use icons relative path.Gravatar Martin Měřinský
Icon paths are defined in one place only - application's embedded resources. Signed-off-by: Martin Měřinský <mermar@centrum.cz>
2017-11-25Fix ownership issues in preferences codeGravatar Berthold Stoeger
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-20Fix typo: successfull -> successful and succesfully -> successfullyGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-13Planner and profile limit minimum GFlow to 10 and minimum GFhigh to 40Gravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-11-12Typo: modp02 -> modpO2Gravatar Berthold Stoeger
Fixes two function names, where O2 was written as 02. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-11-10preferences: support a pre-defined list of time formatsGravatar Lubomir I. Ivanov
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-10preferences: re-use a tr() string in _language.cppGravatar Lubomir I. Ivanov
Also, tell "in date format" instead of "in time format" for dates. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-11-10preferences: support a pre-defined list of date formatsGravatar Lubomir I. Ivanov
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-04Correct, cleanup, translate and unify file filtersGravatar Stefan Fuchs
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-10-29Remove three obsolete preferences options for geocodingGravatar Stefan Fuchs
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-26cloudstorage: better member name when updating authentication stateGravatar Dirk Hohndel
This isn't just about showing the PIN or not. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-17Correct spelling for text in prefs georeferencesGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-09Preferences units dialog: Tab order and silence warningsGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-09Display units in dive list table based on prefs optionGravatar Stefan Fuchs
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-08preferences: add missing dialog iconGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-09-20Remove option to apply GFlow at maxdepthGravatar Robert C. Helling
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-16Remove some very small marble leftoversGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-09-04googlemaps: clear the cache folder on language changeGravatar Lubomir I. Ivanov
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-05-06Wire up duration units preference UIGravatar Dirk Hohndel
Now we track the preference, but we don't act on it, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-05-06Add UI for duration preferenceGravatar Dirk Hohndel
This isn't hooked up, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29Add SPDX header to desktop widgetsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-29UI: preferences-profile screen beautifyGravatar Jan Mulder
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-28minimal pO2 threshold: split max threshold into min and maxGravatar Jan Mulder
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-18Prefix and suffix changes in preferences and planner preferencesGravatar Stefan Fuchs
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-13Settings Graph is about dive Profile.Gravatar Martin Měřinský
2017-03-13Settings Defaults > GeneralGravatar Martin Měřinský
These are more general options, than default values.
2017-03-13Planner uses "Conservatism level", do the same for Settings.Gravatar Martin Měřinský
2017-03-11Merge branch 'master' of https://github.com/dje29/subsurfaceGravatar Dirk Hohndel
2017-03-11Use abbreviations with dots.Gravatar Martin Měřinský