The get_*_unit() functions return the unit-name as set in
the preferences. Add versions with a "metric" parameter.
This will be used by the statistics code, which may in
the future allow for binning with alternative units.
All the unit-formatting functions should probably be moved
away from qthelper to their own source file.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This was only used by the filter, but will also be used
by the statistics module. To avoid duplicate translation
strings, move to a common place.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The start-selection widget will need icons with a transparent
background so that the icons don't stick out like a sore thumb.
So far the icons rendered by this function were only used by
the images on the profile and were perfectly rectangular.
Therefore there was no need for this.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Create a gastype enum, which describes the type of a gas.
For now: air, nitrox, normoxic, trimix and oxygen.
This probably should be made configurable.
The gas types will be used to bin gasses in the statistics
module.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The renderIcon() function was used by the thumbnailer to
render SVG-based icons. Move it to the global qthelper.cpp
so that it can also be used by the statistics module.
Add "SVG" to the name to emphasize what it is used for.
For consistency also move the renderSVGIconWidth() function,
which renders to a fixed width, to qthelper.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Using the y coordinate of the component directly doesn't work if we use
the component inside other components. Instead we need to grab the
position relative to the flickable.
The comment about needing the function for this to work seemed dubious.
So for now I've removed that function and am setting the position
directly.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Doing this check every time we get a 'pressed' signal for the input
field seems excessive. We really only need to check when the input field
gets focus - that's when the OS virtual keyboard might open and hide the
field the user wants to edit.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It's entirely reasonable to use the component in a context where we
don't have a flickable. Simply don't try to reposition things in that
case.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This reuses the logic we implemented in the SsrfTextField.
Eventually we will need to clean up the inconsistent names for these
elements.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
By removing focus from all input fields we can ensure that we have the
correct data reflected when saving an edited dive.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of always showing info about the location, allow all data to be
captured in a more structured format - but only when the app is in
verbose mode.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There's no point in doing that - we set the correct text and leave that
in the editText and displayText for the combo box. If the user uses the
drop down they can replace that. This works correctly for single people,
and for multiple people the drop down doesn't work at all, anyway.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When we start editing a dive the OS will open the virtual keyboard if
any of the input fields have focus (which they might get when we set
their content).
The explicit closing of the keyboard might be overkill, but also doesn't
appear to hurt.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On macOS the cmake build system doesn't copy the QML resources into the app
bundle and so we do that manually. I forgot to add that for QtCharts.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Trying to keep the different build environments consistent I messed up and
dropped wget and curl from the Coverity build. Moving them to the beginning of
the list so they stand out more.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Contrary to the Launchpad builds, OBS isn't actually using the spec file that
is included in the Subsurface source but instead maintains its own.
So this is just updating to the version that has been tracked over there,
mostly for reference.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are just so many places where I need to remember to update the package
lists. Turns out I had forgotten to add libmtp to the Linux builds when we
add the Garmin Descent mk2 support...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We now require qmake to be found much earlier in the script so we can simply
use that to get the right prefix path.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Update to Qt 5.12.10, latest OpenSSL, add QtChart, add other missing packages.
Also switch to gcc-7 as our statistics code requires better C++17 support than
what gcc-6 can offer.
This then creates trusty-qt512:1.1
Signed-off-by: Subsurface CI <dirk@hohndel.org>
Even though the mobile build doesn't have a UI for the statistics, yet, it
already builds the base files.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Weirdly, this function was declared in dive.h and defined in
subsurface-startup.c. Let's move declaration and definition to
more appropriate places, viz. subsurface-time.h and time.c.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This function was not used anywhere. Moreover, remove a few
unused includes from qthelper.h. Surprisingly, a number of users
of qthelper.h depend on these, so readd them at the appropriate
places.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Arguably, the number of filtered dives is a matter of the divefilter.
Let's move it there.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
When removing dives, the UndoCommands would keep track of the
shown dives. When adding, they were calling into the filter
instead. Let's remove this asymmetry.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The shown_dives variable was reset by the dive_list code. Arguably,
the filter should keep track of the number of shown dives, so move
the resetting there. This means adding a new "reset()" member function
to the filter and call that instead of "updateAll()" when the core
data is reset.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>