This change deals with issue #554.
If you enter a dive duration manually, the cell renderer cuts the seconds
away when the changes are saved. I added the helper "render_seconds_to_string"
as a counterpart to "parseDurationToSeconds". The helper keeps the seconds,
if not null. The rendering of the cell is done at two places in the code,
so I think it is cleaner to add a dedicated method for it.
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
Reduce the impact and visibility of icd calculations by writing
the data to the planner output only in cases where gas switches
involve:
1) ascent
2) helium is used as part of breathing gas
3) gas switch results in an increase in partial pressure of nitrogen.
Coding change:
1) The code for writing the header of the icd table as well as
the inclusion of the data in the planner output is made
conditional on the above three requirements. This involves
moving the code that writes the table header into the
function that writes an icd data item to buffer.
2) Manipulation of a boolean variable that controls writing
of the table header to buffer and that also determines
whether any icd results should be inluded in the planner
results.
3) Reorganise comments so that there are not multiple tabs between
the code and the start of a comment.
Correct type and insert braces where important
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Commits fed2c5b6a1 and 572fc4707 erroneously deleted two
aliases. That is corrected here. Yes, QML with only runtime
errors can be a pain.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
The settingsChanged() function of the profile widget tries to be
clever and tries to prevent not needed replots of the profile.
I'm not sure this is very relevant in the first place as change
of settings are almost instantly, with or without replot. It
appears that replot is always executed when there are
calculated ceilings visible. But without calculated ceilings
a replot is "optimized out". This does, however, introduce dangling
divehandles in PLAN/EDIT and ADD mode of the profile, when
any setting that influences the y-axis is changed.
The fix is trivial. Just force a replot in the PLAN/EDIT and ADD
modes.
Fixes: #1070
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
As we need to update our new stringlist models on multiple
locations, just refactor them into a new function.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
See also e6e1473e6. The construction of the locationlist
was not the same as the 3 previous lists, and it needs
the inclusion of a new model file (divelocationmodel.cpp)
in the mobile app. In addition, as the mobile app is mainly
interested in a simple stringList (model) to populate a HintsText
field (or maybe later a combobox), this stringlist is added
to the model, to easy interfacing with QML.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
See e6e1473e6. Exact same commit but here for the
list of divemaster. The careful reader will spot a
small addition to the clearDetailsEdit() QML function.
Two more field are cleared.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This is the first of a set of commits that are (very) similar.
It appeared that a number of more or less static lists, which are
constructed by a loop over all dives in the logbook, were executed
when changing focus to a next dive. For example, the in this
commit addressed list of used dive suits.
What was wrong was that the suitList was linked to a dive. There
is only a need to construct the list of used suits when data is
changed (and obviously, once on startup of the app). Further, it
appeared that a lot of code was duplicated and that we can use
(in this case) the same code from the desktop completionmodels.cpp.
Basically, this commit involves the following changes:
- include completionmodels.cpp in mobile and desktop (so move
it from the desktop only category to the generic category).
- remove double code from DiveObjectHelper.cpp
- Do not differentiate in the init phase and the normal refresh
of the list
- the per dive logic is now only the getting of a previously
constructed list (in init or update of the divelist).
There are no visible changes in the UI, other than a better
performance when scrolling over dive details.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
- Variable max_deleted_seen had no effect and is removed.
- Results of read/write operations are evaluated to assert success
and to prevent compiler warnings.
Signed-off-by: Oliver Schwaneberg <oliver.schwaneberg@gmail.com>
Remove the global error buffer and pass the error string directly
to the frontend. The frontend is then responsible for accumulating
errors.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of manually logging errors after each potentially
error-producing function, use the error-callback. The error texts
are accumulated in the QMLManager object for further use.
The text is transported to the QMLManager object via a queued
connection. Thus, errors can be reported from other threads
without having to deal with manual locking.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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>