The error-callback is installed in the MainWindow constructor.
Therefore, in the error-callback the existence of the MainWindow
instance is guaranteed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Up to now, errors produced by threads were not directly shown in
the MainWindow. Code running in the GUI thread had to manually
show the errors.
This can be simplified by using Qt's queued connection as message
passing facility.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When performing a factory reset to an uemis, the object_ids within the divelog
will not be reset. Nevertheless, the dive numbers are reset to 1.
So, the first log will have a positive offset n to the first dive number.
The uemis-downloader used the object_id from the logs as a start point for
getDive, if dives were already synced before. This causes the sync to stall.
I prevent this by subtracting the lowest object_id from the requested before
using it as dive number.
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
uemis-downloader downloads the dive spot for each dive, even if the same
location was already downloaded before within the ongoing synchronization run.
I modified the function "get_uemis_divespot" to remember all requested
divespot_ids and their mapping to uuids.
New helper functions:
- static void erase_divespot_mapping()
- static void add_to_divespot_mapping(int divespot_id,
uint32_t dive_site_uuid)
- static bool is_divespot_mappable(int divespot_id)
- static uint32_t get_dive_site_uuid_by_divespot_id(int divespot_id)
The memory leak is removed through the call of erade_divespot_mapping().
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
Rewrite some parts text dealing with dive planner as well as
using the Photos tab.
Replace 7 images to reflect new features of the UI.
Add some text to the user manual on planning recreationa dives.
Replace one image and add another image.
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Otherwise, with large gradient factors, one can have infinite NDL
which result in an infinite loop when no gas is set.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
QMLManager::tryRetrieveDataFromBackend() was a one-liner calling
void QMLManager::checkCredentialsAndExecute() with a pointer-to-member.
The latter was never called with a different pointer, therefore
fold the latter into the former and remove the indirection.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The gas fractions (in %) are now printed at a resolution of 0.1%
and not at 0.01% as previously.
The string in the info box that provides icd data is reformatted
so that the info-box is as narrow as possible.
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
The reason for this issue, and fix for this is very similar
to commit b4d37e8ee. Just set both recalculate flags on a mouse
release event, so that the cylinder pressure line is recalculated.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Refuse to add a ConnectionList row, when the row is already
there. This, obviously, prevents double items.
Fixes: #1069
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Change the format from (example!)
ICD: ΔHe=-34% ΔN₂=3%<3%
to
ICD: ΔHe=-34% ΔN₂=+3%<+2.8%
Change strings given to translation to less complex ones.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>