summaryrefslogtreecommitdiffstats
path: root/subsurfacestartup.c
AgeCommit message (Collapse)Author
2015-10-30Move all core-functionality to subsurface-coreGravatar Tomaz Canabrava
And adapt a new CMakeLists.txt file for it. On the way I've also found out that we where double-compilling a few files. I've also set the subsurface-core as a include_path but that was just to reduce the noise on this commit, since I plan to remove it from the include path to make it obligatory to specify something like include "subsurface-core/dive.h" for the header files. Since the app is growing quite a bit we ended up having a few different files with almost same name that did similar things, I want to kill that (for instance Dive.h, dive.h, PrintDive.h and such). Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06Avoid leaking memoryGravatar Dirk Hohndel
Coverity CID 1325758, 1325759, 1325760 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06Correctly copy preferencesGravatar Dirk Hohndel
When just assigning one structure to the other we copy the string pointers. If we then modify those strings in the copy, we happily free the strings of the original. And then resetting the preferences equally happily reused those strings, pointing to long since freed memory. I think what I did now is excessive for the current use case in that it copies a ton of strings that are unset in the default_prefs. But I figured this is a rarely used function and I might as well do it correctly. Also, once we implement multi user support with per user preferences we will be copying completely populated preferences around (at least that's my guess). Fixes #940 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06Detect if variables were not initializedGravatar Dirk Hohndel
In print_files() it is possible that is_git_repository() actually doesn't initialize remote and branch. Don't access them if they were not set up correctly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-06Remove unused part of the geocoding preferencesGravatar Dirk Hohndel
And always turn on geocoding. The user needs to trigger this manually anyway, so there's no point in having the extra option in the preferences. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-04Print paths to internal files in verbose modeGravatar Robert C. Helling
When run with -v option, this prints local file names like the path to the local git repository and the hash file. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-27VPM-B set default conservatism +3Gravatar Rick Walsh
Nominal (aka 0) conservatism for VPM-B is generally considered aggressive. We don't want to be aggressive, especially as some users might assume the default is the correct value. Our default Buhlmann gradient factors are 30/75. The most similar VPM-B conservatism level is probably +3, at least for dives in the 40-50 metre, 50-70 minute range. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-18Revert "Pref. to ascent to next stop only when stop is below ceiling"Gravatar Dirk Hohndel
This reverts commit a6ed36fb7368254d694a4f397d6d033326c37ef2.
2015-08-17Pref. to ascent to next stop only when stop is below ceilingGravatar Robert C. Helling
Usually, we try to ascent to the next stop and check if we break the ceiling while doing that. This patch adds a preference value to rather check if the ceiling is above the next stop before attempting to ascent. The difference if off-gasing during the ascent is taken into account. Logically, it does not sound like it could be relevant to ignore that off-gasing but it leads to more conservative schedules and it seems the original Fortran VPM-B implementation does just this. So one could argue it is part of that model (if it makes sense or not), so we should at least give users the possibility to turn this on. Maybe we should even make this the default for VPM-B. This patch just addes the code to have the value in the preferences and the planner to act accordingly. There is no UI for it, yet. To test, you have to set it in the code. There could be a later patch with a UI if people like to have it. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-15VPM-B: Add conservatism levels to deco.cGravatar Jan Darowski
Signed-off-by: Jan Darowski <jan.darowski@gmail.com>
2015-07-03VPM-B: add deco choice to the ui.Gravatar Jan Darowski
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-01Geo taxonomy: adjust the preferences to the new data structuresGravatar Dirk Hohndel
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-06-26Add only switch at required stop optionGravatar Rick Walsh
Add the option to only switch at required stop to the planner UI. This is not actually used yet. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-22Preferences infrastructure for GeoManagementGravatar Tomaz Canabrava
Simple preferences infrastructure with default prefs, prefs and hooks for the Qt Settings system and our preferences ui. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-19Add planner minimum gas switch duration optionGravatar Rick Walsh
Add the option for a minimum gas switch duration to the planner UI. This is not actually used yet. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-17Store the user's unit preferences in git storageGravatar Dirk Hohndel
Save and load a usually unused copy of the preferences with the units that were active the last time the dive list was saved to git storage (this isn't used in XML files); storing the unit preferences in the data file is usually pointless (that's a setting of the software, not a property of the data), but it's a great hint of what the user might expect to see when creating a backend service that visualizes the dive list without Subsurface running - so this is basically a functionality for the core library that Subsurface itself doesn't use but that another consumer of the library (like an HTML exporter) will need. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-15Cloud storage: create preference entry for base URLGravatar Dirk Hohndel
This just deals with the mechanics. There is no UI to enter / change this URL (and that's intentional), neither is it used, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-12Cloud storage: Add preference option whether to sync in the backgroundGravatar Dirk Hohndel
This defaults to on as that's the most useful setting for the average user. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-31Cloud storage: rethink the terminology usedGravatar Dirk Hohndel
Cloud storage makes more sense that remote storage - at least I assume that more people are used to thinking about "storing things in the cloud". Don't use PIN or passphrase, call it a password everywhere. Don't use copy_string() to copy the password - the git credentials routine asserts that password is not NULL, so make sure we at least have a pointer to an empty string here. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-28Remote storage: add preference for the passphraseGravatar Dirk Hohndel
While we don't expose it as this to the user, we'll need an ssh key and potentially a passphrase in order to communicate with the git server in our infrastructure. This simply sets up a way to store the passphrase. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-05-20Add option to display GPS coordinates as decimalsGravatar Robert C. Helling
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-04-09Recmode: Allow the user to specify gas reserve.Gravatar Joakim Bygdell
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-02Checkbox and preference for safety stopGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-02Introduce recreational planner modeGravatar Robert C. Helling
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-03-25Save more planner settings into prefsGravatar Gaetan Bisson
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-02-15add and use a version.c / version.h pairGravatar Lubomir I. Ivanov
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-01-21CCR option: display o2 sensor dataGravatar willem ferguson
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-17Minor PSCR fixesGravatar Robert C. Helling
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-10Refactor dctype -> divemodeGravatar Robert C. Helling
... 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-10Maintab combobox to set dive typeGravatar Robert C. Helling
still needs some work Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-05Display CCR setpoint values on the po2 graphGravatar Willem Ferguson
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-01Always show the full git version when called with --versionGravatar Dirk Hohndel
This way we finally get the right version shown on Mac and Windows. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-24Changed Facebook stuff to socialnetworks.h/cppGravatar Tomaz Canabrava
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-24Save and restore Facebook Prefs.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-18Free strduped prefs before exitGravatar Anton Lundin
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-14Default some graphs to falseGravatar Miika Turkia
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-11-04Prepare for PSCR calculationsGravatar Robert C. Helling
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-09-19Tissue saturation plot a la Sherwater PretelGravatar Robert C. Helling
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-08-22Use the Windows default font on Windows 7 and 8/8.1Gravatar Dirk Hohndel
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-15TankBar: hook into prefs and make ppGraphs resize accordinglyGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-23Animation speed is a value, not a booleanGravatar Tomaz Canabrava
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-19De-duplicate planner default settingsGravatar Anton Lundin
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-16Store drop_stone_mode, bottomsac, decosac in prefsGravatar Gaetan Bisson
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-10Added the toggle picture button and hoocked it upGravatar Tomaz Canabrava
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-09Move drop_stone_mode setting to prefsGravatar Anton Lundin
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-03Planner: Add backgas breaksGravatar Robert C. Helling
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-06-25Make pO2 settings functional in plannerGravatar Robert C. Helling
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-25Hook up UI elements for ascent rates to plannerGravatar Robert C. Helling
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-23Be more consistent in partial pressure namingGravatar Henrik Brautaset Aronsen
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-14User survey: force running the survey from command lineGravatar Dirk Hohndel
This way people can test the dialog much easier. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>