Commit graph

17044 commits

Author SHA1 Message Date
Dirk Hohndel
988ccba710 mobile: prevent crash adding dives
When the cylinders became a dynamic data structure, a get_cylinder() call
suddenly could return a NULL pointer. So use get_or_create_cylinder() for the
first call when parsing the user's data.

Also, deal with an oddity where the string lists look different because an
empty list technically isn't the same as a list with one empty string.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-08 10:26:21 -08:00
willemferguson
92ea29ebcb Updates to user manual
Add an image that was lost in the latest updates.
Add text about checking of hand-entered coordinates.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-02-08 10:26:07 -08:00
Dirk Hohndel
102f3bf295 mobile/notes-edit: ensure cursor stays visible editing dive notes
This seems to work much more reliably as it specifically compares the cursor
position to the visible bottom and top of the screen.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-07 14:01:23 -08:00
Dirk Hohndel
074dcfb656 mobile/settings: fix the width of cylinder drop down
The GridLayout isn't part of a Layout, so set its width and
have the combo box fill it's part of the grid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
5735c1f387 mobile UI: set correct width for TeplatePage
A page by default fits in a column.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
bb123c78fa random white space fix
QtCreator fixes that for me after every edit, I'm getting tired
of manually removing those hunks.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
eb410aee55 mobile UI: redo the screen size magic
This still is way to fragile. Ordering of object completion doesn't appear
consistent. Hopefully bringing the properties all into one (now reasonably
named) object will help.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
f1a08eb952 mobile: comment out planner references
I don't expect this to be complieted. I'll keep it in the tree
for the moment, but expect to remove all of the related code
eventually.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
f44e63b427 mobile/settings: correctly draw the size buttons
With the columnSpan 3 (in a grid with only two columns) they were drawn
on top of the drop down for the theme.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
b7433b15ff mobile/settings: refer to the correct theme object
This was missed when switching object names.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
b3994ffd3f mobile/settings: white space cleanup
Some odd empty lines and an unnecessary line break.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
2a0ba04d33 mobile/settings: make the color swatches work as color swatches
In a color swatch the color of the body of the swatch is the one that
matters. And we need to ensure readability. So for each pair of colors,
use the combination in the regular order (color/textcolor) for the
background swatch, and inverted for the text swatch.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
0f33aee1af mobile/settings: correctly set label background
The TemplateLabel comes with a set background color which creates a very odd
effect and makes the text generally unreadable in the color swatches.
Fix this by matching the color of the parent rectangle.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
Dirk Hohndel
f532aae2e9 mobile/settings: remove confusing frame around column titles
These are not color swatches like the rest, these are the column titles, so
don't draw them the same way as the color swatches.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-06 21:45:00 -08:00
willemferguson
45c331042b Changes to user manuals
Added text dealing with problems in user cloud registration
and loss of password

Other small edits and corrections to these texts.

Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
2020-02-06 08:53:16 -08:00
Berthold Stoeger
285ea9b7ca Cleanup: don't initialize DivePlannerPointsModel at startup
The whole point of having X::instance() functions is to solve
the infamous "Static Initialization Order Fiasco": When having
global objects in different translation units, their order
of initialization is undefined. Thus, when these objects access
each other one cannot guarantee the correct order of
initialization. The X::instance() functions generate the objects
on first use.

DivePlannerPointsModel has such an instance() function. However,
for convenience(?) in diveplanner.cpp we find the global variable
 static DivePlannerPointsModel* plannerModel =
	DivePlannerPointsModel::instance();
Thus, the DivePlannerPointsModel constructor is run before main(),
negating the whole purpose of the instance() function.

Let's remove this line to avoid hard-to-debug startup issues.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-06 08:51:32 -08:00
Berthold Stoeger
cf1e3524a1 Gps coordinates: be more graceful when parsing coordinates
Some Wikipedia pages use special (non-ASCII) unicode symbols for
representing the " and ' separators. Before parsing, replace these
by the ASCII symbols to enable copy & paste from Wikipedia (and
other sources?).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-06 08:50:22 -08:00
Berthold Stoeger
96a03b4b26 Dive site: don't save invalid GPS coordinates
On the dive site screen, when entering invalid GPS coordinates,
we cleared the location of the dive site. Don't do this. To
clear the location, the user now has to enter the empty string.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-06 08:50:22 -08:00
Berthold Stoeger
cabaaa69db Dive site: give visual clue for invalid coordinates
On the dive site edit screen, when the user enters invalid
coordinates and saves, we treat this as "no location". This
is rather unfriendly, therefore warn the user with a visual
clue. This is performed by setting the background color of
the widget to red.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-06 08:50:22 -08:00
Berthold Stoeger
e5487f86a6 Coding style: remove braces around single-line if blocks
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-06 08:50:22 -08:00
Berthold Stoeger
1bebf55737 Coding style: move & from type to variable
Trivial white-space cleanup according to coding style document.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-06 08:50:22 -08:00
Miika Turkia
90b0e38ed8 CSV import: fix importing ampersand character
As we do XSLT parsing for the CSV import, ampersand characters need to
be encoded with &amp; for the parsing to succeed.

Fixes #2037

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
2020-02-06 08:46:52 -08:00
Dirk Hohndel
550ec34101 GitHub Actions: convert Coverity build to using container as well
Same build failures as we had with the other Bionic based build.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-05 10:17:44 -08:00
Berthold Stoeger
5e0ce206a0 Cleanup: remove capture-all lambda clauses
These were forgotten the last time.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04 16:24:29 +01:00
jan Iversen
35de9c49a4 mobile-widgets: switch to new subsurfaceTheme
Remove subsurfaceTheme from main.qml
Replace ThemeNew -> subsurfaceTheme
change registration ThemeNew -> subsurfaceTheme

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:35 -08:00
jan Iversen
38120d555f mobile-widgets/qml: secure subsurfaceTheme.initial*
move initialWidth/initialHeight out of subsurfaceTheme to placeHolder,
this secures no change in behaviour.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:29 -08:00
jan Iversen
c3be85fbd9 mobile-widgets/qml/settings.qml: show all colors
Show all colors in a theme, allowing user to change theme.

This is preparation for allowing users to click on the individual
colors and change them.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:20 -08:00
jan Iversen
15fbcb655a mobile-widgets/themeinterface: make most part static
Make variables and functions static where possible, this is done
to prevent different versions of theme with different values.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:15 -08:00
jan Iversen
f16dc72556 mobile-widgets/qml: use new templates in converted pages
Use the TemplatePage and TemplateButton in the converted pages.

In order to avoid a bigger search/replace all other pages are left
untouched (for now).

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-02-03 17:30:06 -08:00
jan Iversen
3aa43f3ea5 mobile-widgets/qml: add TemplateButton
Do "git mv SsrfButton TemplateButton", and search/replace
all uses.

The general idea of the templates are to secure common layout,
but also to isolate the Kirigami parts (slowly) in the templates.

Signed-off-by: Jan Iversen <jani@apache.org>
2020-02-03 17:29:58 -08:00
jan Iversen
fb7920ef58 mobile-widgets/qml: add TemplatePage
Signed-off-by: Jan Iversen <jani@apache.org>
2020-02-03 17:29:51 -08:00
Berthold Stoeger
3fc2da567b Dive site: ignore dive sites without location in proximity search
When editing a dive site, the user can search for close dive sites
to merge duplicates. Dive sites without location are treated as
being located at 0N0E. This makes no sense, because:

When selecting a dive site without location, we shouldn't list
dive sites close to 0N0E.

Likewise when having a dive site close to 0N0E, we shouldn't list
dive sites that have no location.

Therefore, ignore these cases.

This also means that now dive sites without location are not
considered as close to other dive sites without location. That
might be a debatable point.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04 02:18:58 +01:00
Berthold Stoeger
670a5bd55a Dive sites: select each dive site only once
After selecting dives, the selected dive sites are collected.
This was done using the selectionModel()->selection().indexes(),
which is wrong, because it gives one index per row *and* column.
Accordingly, every dive site was added numerous times to the
array of dive sites to be selected. Change this to
selectionModel()->selectedRows(), which gives one entry per row.

Moreover, if multiple dives with the same site were selected,
this site was also added to the array multiple times. Therefore,
check the array before adding sites.

Note that all this should not change the user experience in
any way, it is only a code-hygiene thing.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04 02:18:28 +01:00
Berthold Stoeger
65df9ca7b0 Coding style: PascalCase for classes
Codify our unspoken practice in the coding style document.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04 02:17:52 +01:00
Berthold Stoeger
d27b6805f3 Cleanup: rename plannerShared to PlannerShared
Usually, we use PascalCase (i.e. camelCase with a capital
letter at the start) for class names. For consistency, let's
do it here as well.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04 02:17:52 +01:00
Berthold Stoeger
317ee2f104 Dive site: inform map of selection in DiveFilter::setFilterDiveSite
When starting / changing the dive-site filter, inform the map of
the changed dive site selection by calling
	MapWidget::instance()->selectionChanged();
This fixes a bug, where on clicking dive sites in the dive site
tab the dive sites from the *previous* click were highlighted.

Perhaps the selectionChanged() call should be put into the
setSelected() call. But the data flow between the different
parts of the dive-site and map code are so convoluted that I
don't want to risk anything!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04 02:17:36 +01:00
Berthold Stoeger
9ed886e4be Cleanup: lower-case filenames in core/subsurface-qt/
We tend to use lower-case filenames. Let's do it for these files
as well. Simple search & replace.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-02-04 02:16:46 +01:00
Dirk Hohndel
3ad1a5c7c7 GitHub Actions: use the official Ubuntu 18.04 container
Something is seriously wrong with the default Ubuntu 18.04 environment
on GitHub Actions. C++ builds fail with very confusing messages about
C++11 support.

Switching to building in a Ubuntu 18.04 based container - that seems
redundant, but it fixes the problem.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-03 17:14:28 -08:00
Dirk Hohndel
a686be07f9 android: use non-broken version of qt-android-cmake
A recent merge upstream causes build faiilures because the
PROJECT_VERSION variiable isn't defined. I can't figure out how to make
sure that it is defined correctly, so hack around that by using the
version prior to that merge.

See https://github.com/LaurentGomila/qt-android-cmake/issues/33

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-03 17:13:49 -08:00
Berthold Stoeger
8396b4bf01 Remove plannerShared::instance()
This class contains only static functions (i.e. it does not contain
any state). There does not seem to be a reason to have an instance
of that class. Therefore, remove the instance() function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-31 21:31:26 +01:00
Berthold Stoeger
3b42de66dc Cleanup: remove QMLInterface::instance()
QMLInterface::instance() is only used in one single place. This
makes the whole notion of having a global instance of the object
moot, isn't it?

Simply make the object static to the function that uses it, which
guarantees that the object will be created when the function is
called. I.e. the same behavior is retained with less complexity.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-31 21:28:45 +01:00
Berthold Stoeger
188e513761 Cleanup: connect QMLInterface signals in constructor
It appears weird to connect the QMLInterface signal/slot combination
in a static helper function. This generates a bunch of lambdas that
call the instance() function.

Instead, simply do the connections in the constructor as we do it
in numerous other places.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-31 21:28:45 +01:00
jan Iversen
9452a78b1d divesummary: fix potential division by zero
[Dirk Hohndel: extracted from a larger commit from Jan]

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 19:55:47 +02:00
jan Iversen
a65ec77263 mobile-widgets/qml/divesummary.qml: detect change in units
When either length or volume unit is changed, the text needs to be
changed.

Let signal lengthChanged and volumeChanged cause a recalcation and therefore
new text.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-30 19:51:50 +02:00
Dirk Hohndel
636af40897 mobile: increment version number
In order to be able to roll out new betas, we need to first increment the
version number. Given the magnitude of the changes, incrementing the minor
version (not that we have ever been really consistent with how we do the
numbering in the first place).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 19:51:50 +02:00
Berthold Stoeger
15a4142839 Cleanup: remove redundant(?) comment
We don't have such a comment anywhere in the code base.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-30 19:33:21 +02:00
Berthold Stoeger
997e7fe1d2 Profile: fill gas change context menu from current dive
The gas change context menu was filled from the CylindersModel.
This means that even before saving new cylinders, the user could
add a gas change event to these cylinders.

Instead, fill from the current dive.

Fixes #2552.

Reported-by: Doug Junkins <junkins@foghead.com>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-30 19:33:21 +02:00
Berthold Stoeger
03f9e29146 Profile: transport gas id and timestamp via lambda
When adding a gas change event via a context menu, the gas-id and
timestamp were passed in two distinct ways.

1) The gas id was extracted from the text of the action. This meant
   doing rather complicated parsing.
2) The timestamp was passed via the "user data" of the action, which
   means transporting via "QVariant".

There is a much simpler way to pass arbitrary data, that is strongly
typed: lambdas. Instead of shoehorning the data onto the action in
an archaic way, we can simply connect to a stateful lambda. That's
what they're for after all.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-30 19:33:21 +02:00
Berthold Stoeger
62b869b24a CylindersModel: don't crash if accessing non-existing cylinder
It shouldn't happen, but currently we overwrite the displayed_dive
without updating the CylindersModel. Thus, CylindersModel may now
crash when the new displayed_dive has less cylinders than the old
one.

For now, catch this condition. Treat the root cause later.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-01-30 19:33:21 +02:00
jan Iversen
906cce9e88 mobile-widgets: emit signals for each color
Emit signals for each standard color when theme changes.

The iconStyle property was changed from being a constant, because it can
change, and thus a signal was added.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-30 07:53:34 +02:00