The comment said "Clear everything but the first element" but
actually the macro freed the whole list including the first element.
For dive computers it was explicitly called on the second element.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Make dive.h a bit slimmer. It's only a drop in the bucket - but at
least when modifying tag functions not the *whole* application is
rebuilt anymore.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Headers should not have to be included in a certain order.
Therefore include stdarg.h and stdio.h in membuffer.h, since
the latter uses FILE and va_list.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
There is a function for copying tag-lists, use that instead of the
raw STRUCTURED_LIST_COPY macro-invocation. This will help in moving
tag functions into their own translation unit.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This was probably used for debugging but has no callers anymore.
Let's remove it. If needed, it can be trivially readded.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When a different field is edited, hide any old multi-dive-edit
warning message. The reason is that we might want to add an "undo"
button to the message. But this will undo the wrong command if
we don't hide the message.
Sadly, this means that we can't use animated show / hide, because
an animatedHide() followed immediately by an animatedShow() does
not necessarily show the message. In other words, and animatedShow()
does not interupt a started animatedHide()!?
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The multiple-dives-edited message was shown even if the value was
not changed. Notably, when tab-flipping through the dive fields.
Therefore, changed the execute_edit() function to return zero
when no command was executed. For this, return a boolean from
the execute() function indicating whether the command was really
executed or trashed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
On the MainTab, warn if more than one dive was edited. To this purpose,
add a new KMessageWidget with an "OK" button that closes the message.
Code is mostly a copy of the already existing "Editing dive" message.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This is a pointless one-liner function. Let's remove it. The
message it shows will probably be moved to the profile in the
not-so-distant future anyway.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
To enable a "multiple dives edited" message, return the number
of edited dives from dive edit undo commands. Since there are
two kinds of these commands, viz. normal fields and tag fields,
and the former use templates, create a common base class that
can return the number of dives. Yes, the class hierarchy is
getting scarily deep! At least, this gives a tiny bit of
code-reuse.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When tabbing through the dive-info fields we get *EditingFinished
signals. This would create undo commands. The undo commands should
recognize if nothing changed. But for the temperature fields,
owing to rounding, an unchanged text could actually represent a
different value.
This would lead to very confusing situations:
1) Edit air temperature
2) Press tab to finish editing
3) Focus goes to water temperature
4) Try to undo change in menu
5) When opening the menu water temperature loses focus
6) Water temperature is edited
7) Undo undos the water temperature, not the air temperature
8) Goto 4
Fortunately, QLineEdit fields have the isModified() member function
that returns true if the field was changed by the user. Use
this to prevent this case. This is not a general method, i.e.
it has to applied to every field with that problem. But it is
less intrusive than subclassing the QLineEdit class.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The PIMPL idiom is used by some frameworks (notably Qt) to
ensure binary compatibility. Objects consist only the general
object header (ref-count, connections, children, etc..) plus
a single pointer to private data.
MinMaxAvgWidget was implemented using this idiom. This seems
to make no sense, as we don't produce a general library with
the need of a stable ABI. Let's remove this unnecessary
indirection.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Owing to the recent undo-changes, the git id was not invalidated
when accepting changes to cylinders and weights.
Do this in the MODIFY_DIVES macro for now.
Reported-by: Jan Iversen <jani@apache.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The location fields are hidden in trip mode. Only the location-popup
button was shown. Hide it as well.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
A regular expression was generated and then copied twice without
apparent reason. Remove these copies.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
preprocessTemplate() replaces variables of the kind "dive.weight0"
by "dive.weights.0". Replace the old code by regexps. This not
only makes the code significantly shorter, it also makes it independent
from the name of the dive variable (i.e. "dive").
Moreover, it removes a dependency on MAX_WEIGHTSYSTEMS and MAX_CYLINDERS,
which might help in removing these restrictions.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This optionally allows accessing data in /media/ folders, if the user
issues:
snap connect subsurface:removable-media
https://docs.snapcraft.io/removable-media-interface
Signed-off-by: Michał Sawicz <michal@sawicz.net>
Add display of the difference between pO2 in rebreather loop and the
equivalent OC pO2: this is the oxygen drop over the mouthpiece for
SCR dives. Obviously this is only displayed for SCR dives.
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Some users understood "Configure dive computer" as the
menu entry where you configure which dive computer to
use. Reworded to make clear that this modifies the
settings on the dive computer.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Note that we don't really have libdivecomputer support for it yet, only
newly added model numbers etc. But the name detection should make it
easier for people to at least download a memory dump.
In addition to the libdivecomputer model number updates, this also has a
merge of Jef's upstram libdivecomputer changes.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
When deleting a dive computer, don't just show the first
dive computer, but the next one in the list (if it exists).
Moreover, on undo jump to the previously shown dive computer.
Do this by keeping track of the before and after dive computer
number in the undo command.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Currently, count_divecomputers only works on the current_dive.
Instead, let it take a pointer to an arbitrary dive. This is
in preparation for being smarter in the undo code concerning
which dive computer to show on deletion.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This function clones a dive and clear out the old dive. This
corresponds to move semantics. Name the function accordingly.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This is just minor fixes that are not user-visible:
Fix a few erroneous comments and a debug message. These are
copy & paste mistakes and mistakes introduced during code-
refactoring.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of the elegant solution that just modifies the dive,
keep two copies and add either the old or the new copy. This
is primitive, but it trivially keeps the dives in the right order.
The order might change on renumbering the dive computers.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The .app.zip should once again run on any Mac (ignoring the security issue of
unsigned binaries). The Qt binaries in that archive include the jpeg and png
libraries that were missing in the Qt 5.11.1 binaries we used until now.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
0.9 docker image includes static libraries to build mdbtools so there is
no need for an aditional tarball.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add -a parameter to tee to avoid overwriting build.log when building
static libraries for smtk2ssrf
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Passing an argument on the docker build command line avoids the need to
modify the Dockerfile for each image build.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
mdbtools only builds static under mxe.
This should add static build of glib to the container with the mxe
libraries.
[Dirk Hohndel: merged with latest version of Dockerfile]
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>