summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2018-01-21Only give ICD warning if pN2 increasesGravatar Robert C. Helling
as otherwise there are warning on the descent. The ICD line in the info box is generated for all gas switches with decreasing He content. Also change the presentation in the info box to align it with the notes. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-21CHANGELOG entry for ICDGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-21Show ICD in gaschange iconsGravatar Robert C. Helling
Add an exclamation mark in the gas change icons if the change violates our isobaric counter diffusion criterium. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-21Show ICD events data in infoboxGravatar Robert C. Helling
If a gas switch violates our ICD criteria, show this in the info box. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-21Planner notes min gas: Remove incorrect line wrap inside printf stringGravatar Stefan Fuchs
With old code the tabs at the start of the second line were incorrectly added to the string. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-21Planner notes ICD: Format HTML with DIV, do table title differentlyGravatar Stefan Fuchs
In the planner notes format the HTML for different sections with div tags. Put the table title for the ICD table outside the table because then the alignment looks a little bit nicer. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-21Planner notes ICD: Coding style change onlyGravatar Stefan Fuchs
Avoid the need for a char array for the "old_gas_name" by passing two pointers to the gasmixes to the add_icd_entry function and calling helper function gasname() there twice. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-21Planner notes ICD: Print correct runtime for gaschangeGravatar Stefan Fuchs
If a gaschange happens at the beginning of a segment, currently the wrong runtime (end of segment time) is printed in the ICD table. This is corrected here. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2018-01-20Move function isobaric_counterdiffusion()Gravatar Willem Ferguson
Move the above function from plannernotes.c to dive.c so that it is available to be called from the dive log part of the software, and not only from the planner. The following was done: 1) Edit the comment above the code to make it more accurate 2) Move the structure icd_data to dive.h 3) Create an external reference in dive.h for the above function 4) Copy the body of isobaric_counterdiffusion() to dive.c Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-01-19Implement ICD calculations in planner outputGravatar Willem Ferguson
This patch implements the calculation and printing of icd parameters in the dive planner output. It does: 1) icd parameters are calculated following the rule-of-fifths for OC trimix dives. For each gas change on the ascent that involves helium, the change in gas composition as well as the change in partial pressures are shown. If rule-of-fifths is exceeded, a warning message is prinetd. 2) An independent function is provided that in principle enables calculation of icd paramaters outside of the context of the dive planner. Further updates to icd calculations These changes respond to #1047. Code style conventions have been improved. The ICD table is now also printed when the planner is set to verbatim mode. The code that created the html icd results has been moved to a function. This does not make the code more efficient (many parameters passed) but it makes the code more clean. Free a new dynamic variable (old_gas_name) Stylistic changes to new code in plannernotes.c Changes in comments to explain some of the changes I made. Preparation of comments and functioning of isobaric_counterdiffusion() and its dependent data structure for possible transfer to dive.c and dive.h after finalisation and merging of the present PR. Smaller stylistic changes to conform to our coding rules. The several comments and suggestions during github review (@atdotde, @leolit123, @sfuchs79) are incorporated. Fixed up mis-aligned comments and text descriptions by replacing tab characters with space characters, thereby hard-forcing alignment of indented lines of text. Remove parameter *dive from function isobaric_counterdiffusion(). Improve a few constructs to conform to our style rules. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-01-19Preserve wiki pages about headless Subsurface from trac wikiGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-19Improve profile display in plannerGravatar Willem Ferguson
This patch allows the planner to save the last manually-entered dive planner point of a dive plan. When the plan has been saved and re-opened for edit, the time of the last-entered dive planner point is used to ensure that dive planning continues from the same point in the profile as was when the original dive plan was saved. Mechanism: 1) In dive.h, create a new dc attribute dc->last_manual_time with data type of duration_t. 2) In diveplanner.c, ensure that the last manually-entered dive planner point is saved in dc->last_manual_time. 3) In save-xml.c, create a new XML attribute for the <divecomputer> element, named last-manual-time. For dive plans, the element would now look like: <divecomputer model='planned dive' last-manual-time='31:17 min'> 4) In parse-xml.c, insert code that recognises the last-manual-time XML attribute, reads the time value and assigns this time to dc->last_manual_time. 5) In diveplannermodel.cpp, method DiveplannerPointModel::loadfromdive, insert code that sets the appropriate boolean value to dp->entered by comparing newtime (i.e. time of dp) with dc->last_manual_time. 6) Diveplannermodel.cpp also accepts profile data from normal dives in the dive log, whether hand-entered or loaded from dive computer. It looks like the reduction of dive points for dives with >100 points continues to work ok. The result is that when a dive plan is saved with manually entered points up to e.g. 10 minutes into the dive, it can be re-opened for edit in the dive planner and the planner re-creates the plan with manually entered points up to 10 minutes. The rest of the points are "soft" points, shaped by the deco calculations of the planner. Improvements: Improve code for profile display in dive planner This responds to #1052. Change load-git.c and save-git.c so that the last-manual-time is also saved in the git-format dive log. Several stylistic changes in text for consistent C source code. Improvement of dive planner profile display: Do some simplification of my alterations to diveplannermodel.cpp Two small style changes in planner.c and diveplannermodel.cpp as requested ny @neolit123 Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-01-19Unify username handling of remote git repositoriesGravatar Berthold Stoeger
The username was extracted from https:// urls but not from ssh:// urls. Unify this by extracting the username from any remote url. This is done with regard to unifying the file handling in the frontend. For this approach to work, the credential callback of the ssh:// transport had to be adapted. It now also supports username/password in addition to private-key authentication. Currently, the only way the user can use the username/password authentication is by deleting a potential public key. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-19Support non-https:// repositories for savingGravatar Berthold Stoeger
On saving to a remote git repository, the transport was set to https://, which broke saving to ssh:// repositories. Instead determine the transport from the remote url. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-19Create local cache and push to remote for any remote repositoryGravatar Berthold Stoeger
This used to be done only for cloud repositories. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-19Check cloudserver availability only for cloud repositoriesGravatar Berthold Stoeger
The check used to be done for any https:// repository. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-19Factor out counting of authentication attempts into functionGravatar Berthold Stoeger
Moreover, make the maximum number of authentication attempts a const variable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-19Use different preference file for mobileGravatar Jan Mulder
This is a change mainly for developers working on both mobile and desktop application. As the current setup is that all preferences are stored in one file (Subsurface.conf), for both mobile and desktop, the unwary developer might get confused that the things tested on mobile-on-desktop are not working on mobile-on-device. As we share a lot of code between the desktop and the mobile code, also our fairly extensive set of preferences play a significant role in the inner workings of our applications. So, this commit introduces an own preferences file for mobile (on desktop) resulting in the preferences between the plain desktop apllication now invisible to the mobile-on-desktop application and vise versa. Making the mobile-on-desktop a much more realistic test plaform for mobile development. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-19Checking for ACK for getDive.Gravatar Oliver Schwaneberg
get_matching_dive does not check if the DC wrote an acknowledgement for the requested dive. As result, the sync stalls if dive number 0 is not available. Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
2018-01-18code cleanup: translators are not globalGravatar Jan Mulder
Un-globalize unused global variables. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-18Mobile: start message timer on startupGravatar Berthold Stoeger
Since the timer will be started on first message anyway, we might just start it at application startup. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18Mobile: don't show timer twice in log-messageGravatar Berthold Stoeger
This was probably an oversight - the timer was only shown for very specific messages. This was change to show the timer for all messages. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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-18Remove redundant local variables cloudPwd and cloudUserGravatar Berthold Stoeger
These were assigned the member variables QMLManager::m_cloudPassword and QMLManager::m_cloudPassword. Use the member variables directly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-18Remove redundant QML getter functionsGravatar Berthold Stoeger
QMLManager was full of redundant getter functions of the type bool QMLManager::locationServiceAvailable() const { return m_locationServiceAvailable; } These can be removed changing READ keywords to MEMBER keywords in the QPROPERTY declarations. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-17Use format_string() in core/git_access.cGravatar Berthold Stoeger
Since this helper-function exists, we might just use it. A subtle reuse of a buffer (string of second use was known to be shorter than string of first use) was replaced by a separate allocation. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-13Fix leak(s) in core/git-access.cGravatar Berthold Stoeger
The libgit2 functions git_cred_ssh_key_new() and git_cred_userpass_plaintext_new() copy their arguments. Therefore, free the string arguments or don't copy them in the first place. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-13Resize progress bar width to fit all textGravatar Robert C. Helling
At least on Mac with larger font sizes part of the label text of the git access progress bar is cut off (even though it should automatically resize). This patch adds explicit resize. Fixes #1041 Signed-off-by: Robert C. Helling <helling@atdotde.de>
2018-01-12profile: fix garbled profiles after visiting the plannerGravatar Jan Mulder
See mentioned GitHub issue for the full issue, and images. The reason for this weird behavior is the existence of 2 flags in the profile code: shouldCalculateMaxTime and shouldCalculateMaxDepth. When exactly following the use case and test data as attached to the GitHub issue (a very short dive, shorter than most of the dives in the logbook), the shouldCalculateMaxTime flag never got back to its true status, causing the the time scale not to adapt to other dives when just clicking (or selecting) them from the dive list. The problem is fixed here by also setting the shouldCalculateMaxTime flag on manipulating wayppoints in the dive plan. Fixes: #1039 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-11Fix indentations for plannernotes.cGravatar Willem Ferguson
The last 2 commits have now been squashed. S Fuchs's comment on line 315 has been fixed Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
2018-01-11Move always true ++lineptr out of while-conditionGravatar Berthold Stoeger
In core/file.c move ++lineptr out of the while condition !empty_string(lineptr) && (lineptr = strchr(lineptr, '\n') && ++lineptr since it always evaluates to true. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11Use helper function empty_string() instead of manual checksGravatar Berthold Stoeger
For code consistency, substitute boolean expressions: s && *s -> !empty_string(s) s && s[0] -> !empty_string(s) !s || !*s -> empty_string(s) !s || !s[0] -> empty_string(s) Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-11Introduce helper function empty_string()Gravatar Berthold Stoeger
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-11Change return code of string comparison functions to boolGravatar Berthold Stoeger
These functions were returning 0 or 1 anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Pictures tied to profile are not supported on mobileGravatar Jan Mulder
Move divepicturemodel.cpp to the desktop only category and deal with the (limited) fallout. We, currently, do not support dive pictures tied to the profile on mobile, so there is no use including this code. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10Un-tie plannner model from profile on mobileGravatar Jan Mulder
Do not pull in the DivePlannerPointsModel::instance as this is not used in the called function. We (currently) do not support deco computations on mobile, so trying to pull in any deco state from the planner is futile anyway. With this uncoupling, 6 more model files are not needed in mobile any more. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10Typo: Threshould -> ThresholdGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Typo: indice -> indexGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Replace CREATE_PP_GAS macro by member function in profilewidget2.cppGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Remove two arguments from ProfileWidget2::setupItem()Gravatar Berthold Stoeger
1) hAxis was always set to timeAxis 2) model was always set to dataModel Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Replace ADD_ACTION macro by member function in profilewidget2.cppGravatar Berthold Stoeger
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Replace HIDE_ALL macro by template function in profilewidget2.cppGravatar Berthold Stoeger
This is easier to read and debug. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10Remove unnecessary deletes in destructor of ProfileWidget2Gravatar Berthold Stoeger
All the deleted items were added to the scene, which takes "ownership" (a remarkably fuzzy concept in Qt) of these objects. In principle, deleting these items is a bug - even though it is handled gracefully. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-01-10mobile: fix crash on delete dive from divelistGravatar Jan Mulder
This is a somewhat hacky commit. For a very long time, the delete from the divelist on mobile crashed. That is, not always for anyone, but for me almost consistently. This commit tries to solve it. I found that trying to save the delete immediately after removing data from the underlying model seemed to cause the crash. Hacking around, I found that a simple beginResetModel/endResetModel between the delete of the underlying model data and actual save is sufficient to solve the crash. The big question is, why does this all work? I suspect some of race condition between deleting model data, and giving the QML engine the opportunity to do its thing. This is also related to issue #311, but that is not implemented here. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10cleanup: fix possbile buffer overrunGravatar Jan Mulder
No reason to mess around with a 5 byte buffer when we have a proper buffer available to receive a possibly 8 byte output based on the format string. And silences compiler warning. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10cleanup: initilize local variableGravatar Jan Mulder
Silence compiler warning by correctly initializing local variable. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10GpsLocation::clearGpsData() is only used in SUBSURFACE_MOBILEGravatar Jan Mulder
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2018-01-10Unused code: GpsListModel::addGpsFix()Gravatar Jan Mulder
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>