exportFunc was a collections of functions for exporting dive data.
It had no state, therefore there is no reason for it to ever be
instantiated.
Simply remove the class. Rename the saveProfile function to
exportProfile so that all export functions start with "export".
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When exporting dives we show a message. The message is closed when
the export is finished. This is coordinated by a QFuture. Instead
of keeping a global QFuture in the export-code, pass it around
as a local variable.
This is supported according to Qt's documentation:
"QFuture is a lightweight reference counted class that can be
passed by value." and the source code indicates the same.
Not only does this remove a global, it also makes the code
more flexible: Now we could show one notification per export,
for example.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Fix two issues:
1) When narrowing the selection, we didn't get setSelection()
calls. Only, when the user released the mouse button was
the selection updated. Therefore, hook into the mouse-release-
event and update the UI if the selection changed.
2) We updated the ui in setSelection(). However, this was called
on mouse-move even if the actual selection didn't change.
Therefore, compare selection before and after processing of
the event and only refresh the UI if there are changes.
Clearly, this can only be a quick stopgap solution and we
should find out how to properly hook into the selection change
machinery. Though see commit 4928c4ae04
for the reason why we do things as we do them.
Fixes#2595
Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Remove two erroneous comments stating that a function-local
QSettings variable should not be static because it is initialized
too early. Scoped static variables are initialized when execution
first hits the statement.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This also deals with a bug we had before where we didn't re-start the calculation
for the various sizes from the assumption of 'at least 21 grid units'. Now you can
rotate the device and the right thing will happen.
Small warning - this checks the orientation of the screen, which is exactly what
you want it to do on your device. When running mobile on desktop this may not be
what you expect. Even if the window has a portrait aspect ratio, your screen is
likely still landscape... so testing this feature in mobile on desktop mode is a
bit harder...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The idea is that in portrait mode we can force the display to be single column (which
makes sure that the profile in dive display mode is nice and big).
This commit only implements the preference variable that we need for that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
No one will ask you about your dives in the last seven months (and the
existing code actually provided the past 210 days in that case). Instead
do more intuitive periods. Last month, quarter, half year, year.
Use Qt's ability to make sane date calculations easy.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use more idiomatic ways to indent the rows, replace the TemplateLabel with a
simple Label since drawing the extra rectangle for the background of the
TemplateLabel is obviously redundant and using it doesn't change the number
of properties we need to set.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I keep forgetting that the verticalAlignment is only within the current object,
which means that in a single line label it has no meaning at all.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On tablet devices, the summary page stays open and therefore
the summary is not refreshed. For now, add a button. Later, this
should be connected to signals when dives are edited, added or
deleted.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add section headers to the dive summaries on mobile by adding
a section-property. Of course, this will not work on desktop.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Since we now use a model to calculate the dive summary, there
is no need to export recalculation of the dive summary via
QMLInterface.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Implements the ListView and its delegate to use the dynamic data
provided by the DiveSummaryModel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of passing the dive summary via a completely unstructured
QStringList to QML, implement a dynamic model. For potential reuse
on desktop (though somewhat unlikely) the model has two interfaces,
one for QtWidgets and one for QML. The former is based on columns,
whereas the later is based on roles. The number of columns is
set dynamically. The roles currently support access to two columns.
If more columns should be accessed from QML, more roles have to
be added manually.
This commit only creates the model and hooks it into QMLs global
context, but does not yet change the QML page.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Recalcluate not only the statistics for the given period, but also
the global first and last dive date.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Instead of transporting the global first and last dive date
in the dive summary, calculate it in an external function.
Since we already have time and date functions in qthelper.cpp
implement those functions there. Provide a stub in QMLInterface
so that QML can access these standalone functions.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
As we do XSLT parsing for the CSV import, ampersand characters need to
be encoded with & for the parsing to succeed.
Fixes#2037
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
move initialWidth/initialHeight out of subsurfaceTheme to placeHolder,
this secures no change in behaviour.
Signed-off-by: jan Iversen <jan@casacondor.com>
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>
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>
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>
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>
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>