Recently (674c20227b), the call to ProfileWidget::clearHandlers()
was moved from PlannerWidgets::replanDive() to ProfileWidget2.
This cause a crash, because the code assumes that the number
of elements in the handles-vector the divepointplanner model
is the same.
Clearing the handles violates this assumption. It turns out
that the clearHandlers() function is broken anyway: it clear
the handles-vector, but not the gases-vector, which should
likewise have the same number of elements. It appears that
the clearHandlers() function is an artifact and it is
mysterious how this has worked so far. Remove.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Again, the fact that you basically need to completely reimplement the
ComboBox in order to change some colors is frustrating.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is needed for the Export page.
And may I say for the record that it's rather surprising that in order
to change the color of one of those elements one ends up having to
completely re-implement them.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
While the text name is 'light primary color' it really has to be a dark
blueish color to fit with the theme.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This requires more changes to Kirigami, but with this we get dark
drawers (the menus that slide in from the side) in the dark theme.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We do theming very differently from what Kirigami intended. Mostly
that's because our code predates theirs. But also because Kirigami wants
and app to simply use an OS theme - whereas we want to be able to
provide different looks, independent from the OS theme.
Ideally we'd still use the existing methods to change the colors and
sizes of Kirigami UI elements, but for now this hack helps improve
readability of the title bar.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In the dive list the rendering of the line ended up being subject to
rounding errors. With this change we ensure that the thin line is always
shown.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is kind of a random choice - I don't see much value to build this
everywhere, but it's kinda neat to use this to test that the -all option works
correctly and does the right thing with WebKit now. And it will also ensure
that the downloader build isn't broken.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is just adding the third option and then untangles some of the 'there are
only two options' based code.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On clicking the DivePictureItem "trash" icon, the item would delete
the picture it represents in the currently displayed dive. This needed
an access to the global "displayed_dive" variable, which we want
to get rid of to make the profile more flexible. For example, we
want to render the profile for printing without messing with global
state.
One solution would be to save the dive with every DivePictureItem.
This commit follows a more Qt-ish strategy by handling this via
signals: The close button emits a signal that is recast by the
DivePictureItem and ultimately handled by the ProfileWidget2,
which knows which dive it represents.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
These were only calling the corresponding functions in the
base class. So just don't override them..?
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The RemovePictures command filters the pictures provided by the
UI: only actually existing pictures are removed. The code was
buggy: the original list was copied and then the filtered list
was added. Thus, every picture was listed twice leading to
annoying warning messages. Remove the copy.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since switching to the mobile-models and removing grantlee,
DiveObjectHelper was demoted to a thin wrapper around string
formatting functions. The last user was removed in a previous
commit.
It was never a good idea, given QML's strange memory-management.
Let's remove it.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When editing a dive, a DiveObjectHelper of the unmodified dive
was created to compare the edited with the old values. Since
the DiveObjectHelper is used here only as a pointless wrapper
around the formatting functions, call these functions directly.
However, note that the code is in principle wrong since the
change to the mobile-models, which do not use the DiveObjectHelper.
The real fix would be to reload the data from the model to prevent
going out-of-sync with respect to the formatting routines!
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
With the removal of grantlee, this became pointless glue
code. Call the formatting functions directly.
Since the printing code was the only user of CylinderObjectHelper,
remove the whole thing.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
At this point (post grantlee), DiveObjectHelper is just pointless
glue code. Let's remove it from the printing code and call the
formatting functions directly. If necessary, move these functions
to core/string-format.cpp.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This was a weird helper object, needed for grantlee. Instead
of storing this object, loop over cylinders and dives directly.
The actual accessor function is unchanged and now generates
a DiveObjectHelper or DiveCylinderHelper for every variable
access. Obviously, this is very inefficient. However, this
will be replaced in future commits by direct calls to formatting
functions.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The mobile version of the list used string formatting functions
defined in DiveObjectHelper and declared in mobilelistmodels.h.
Very confusing. Move them to a separate source file where - in
the long run - all the string-formatting functions, which
are scattered all over the place, can be collected.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
QPointer is a strange "smart" pointer class, which resets itself
when the pointed-to QObject is deleted. It does this by listening
to the corresponding signal and therefore is surprisingly heavy
for a plain pointer. A cynic would say that the existence of
QPointer is an expression of Qt's broken ownership model.
In any case, QPointer was only used at two places, were it was
100% useless: As a parameter to a function and as a locally scoped
pointer. It only makes sense if
a) there is a chance that the object disappears during the pointer's
lifetime and
b) it is actually checked for null before use
None of which was the case here. Remove.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This is a wrapper around "stats *" used to pass statistics
through Qt's weird metatype system. Not needed anymore.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This does not rename the variables, only the user-visible output.
Case "Dive guide" vs. "Dive Guide" is according to the rest of
the templates.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The loop code was buggy: the current position was only increased
inside when executing the loop once. This would obviously fail
for empty lists. Moreover, the whole thing was quite difficult
to reason about, since a reference to the current position was
passed down in the call hierarchy.
Instead, pass from and to values to the parse function and
create a generic function that can search for the end of
loop and if blocks. This function handles nested if and for
loops.
The if-code now formats the block only if the condition is true.
The old code would format the block and throw it away if not
needed.
This should now provide better diagnostics for mismatched tags.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
An artifact from the old grantlee code: the whole parser state
was kept in an untyped QVariant map. One case was particularly
bizarre: the options were a class member and yet added to the
weird map.
Replace this by a strongly typed state structure. Ultimately,
this will allow us to replace the "dive object helper".
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
These two structs describe options used during printing.
They are passed through numerous classes as pointer. In this
case, reference semantics are preferred, as references:
- can never be null
- can not change during their lifetime
This not only helps the compiler, as it can optimize away null
checks, but also your fellow coder. Moreover, it prevents
unintentional creation of uninitialized references: one can't
create an instance of a class without initializing a reference
member. It does not prevent references from going dangling.
However, pointers have the same disadvantage.
Contains a few whitespace cleanups.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The places we build things are still rather inconsistent for historic reasons -
this definitely deserves some more cleaning up.
The top level build-ios dir was completely unused, and the build location for
the googlemaps plugin was inconsistent with all of the other build dirs.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
3.1.0 was never released, but this is a quick hack to work around a versioning
issue in the iOS app store. Not ideal, but at least it works.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This has now been verified to work on a fresh clean Ubuntu 20.04 install, both
using the docker image route as well as the full local build system.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The way I test things locally I build in the directory above the subsurface
directory. Let's match this on GitHub as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
19.10 is no longer receiving updates and causing problems when running
the tests. 20.04 also uses Qt 5.12.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This seems more consistent with how we do things elsewhere.
Also make sure that the ssrf-version.h file is created in the correct
directory.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>