Commit graph

94 commits

Author SHA1 Message Date
Berthold Stoeger
2df30a4144 core: remove ssrf.h include file
It didn't contain anything.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
8e106b0449 core: replace qDebug() by report_info() in subsurface-helper.cpp
Start unifying debug output.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
da7ea17b66 cleanup: replace fprintf to stderr by report_info()
Let's try to unify debugging output!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
41cb916060 core: turn existing_filename into std::string
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
8733828380 computer configuration: use value semantics for DeviceDetails
The memory managements for DeviceDetails was very sketchy.
First of all, sharing a pointer to a structure between threads
seems like a recipe for disaster. Secondly, the structure was
a QObject and when first generated included in the (silly)
Qt object tree, but when generated in the threads it was not.
Clearly, this leaks.

Instead, use value semantics and use local copies of the
structure. I didn't go full length and use std::move to
move the data, because this doesn't work through signals
(which are the wrong abstraction here, but OK) and secondly
I didn't have time to analyze whether the caller still
needs the data after passing it down to the worker thread.

To be able to pass an object through signals, the class
has to be registered in the Qt MetaType system. Super
ugly, but fine for now. Ultimately, this whole thing should
probably be replaced by futures, co-routines, or whatever.

Moreover, this removes the prefix from  number of "m_*"
function parameters. By convention, "m_" marks member
variables, which function parameters are not.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>

make DeviceDetails a metatype

So that we can pass it as value through the signal/slot system.
(squash with original commit)

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-24 17:53:19 +01:00
Berthold Stoeger
a133c6c4db mobile: turn testqml into a std::string
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-03-10 11:01:42 +13:00
Dirk Hohndel
2241a28499 build-system: make map support its own thing
Making this simply depend on Qt5 or Qt6 was short-sighted as work on QtLocation
upstream continues. Instead break this out as its own option.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-04-18 07:24:38 +02:00
Berthold Stoeger
ee9344eccf desktop: make MainWindow a "global object"
Thus, we don't have to delete it explicitly on exit.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 13:06:06 -07:00
Berthold Stoeger
8577b00cb7 core: add class that collects global objects to be deleted on exit
We have a prevailing problem with global QObjects defined as
static global variables. These get destructed after main()
exits, which means that the QApplication object does not
exist anymore. This more often than not leads to crashes.

In a quick search I didn't find a mechanism to register
objects for deletion with QApplication. Therefore, let's
do our own list of global objects that get destructed
before destroying the QApplication.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2022-03-16 13:06:06 -07:00
Dirk Hohndel
47d900bee5 Qt6: don't build MapWidget
Since Qt6 doesn't include QtLocation anymore, we can't build MapWidget.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-03-12 08:28:32 -08:00
Dirk Hohndel
bea552bf0d mobile: remove GpsListModel
This is only needed to show the list of GPS fixes obtained with
the now removed location service.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-09-13 11:21:34 -07:00
Dirk Hohndel
323e97c603 mobile/UI: remember the system default font size
We need to do this before the preferences are loaded, or the system
default size is lost. Given that our other sizes are all relative to
this value, that would be a problem.

With this we can now ensure that we always have the right font size for
smaller, regular, and larger theme settings.

Also removes some obsolete commented out code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-19 12:35:29 -08:00
Dirk Hohndel
1472117541 cleanup: create separate UI entry points for desktop and mobile
This doesn't really change anything, but makes the code easier to read.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-19 12:35:29 -08:00
Dirk Hohndel
11ae662545 mobile/Android: ensure the onePlus font has point size
Otherwise this throws off the calculation of the gridUnit on onePlus
devices.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-01-19 12:35:29 -08:00
Berthold Stoeger
46bb242c69 mobile/statistics: export ChartListModel to QML
For QML, the roles have to be associated dynamically with
name. Moreover, the model has to be registered as a QML
type to make it accessible from QML.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-13 11:39:36 -08:00
Berthold Stoeger
d77f254328 statistics: add a skeleton StatsManager class
In analogy to "QMLManager", add a "StatsManager" class,
which manages the statistics module on mobile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10 15:16:52 -08:00
Berthold Stoeger
e7907c494f statistics: convert chart to QQuickItem
It turns out that the wrong base class was used for the chart.
QQuickWidget can only be used on desktop, not in a mobile UI.

Therefore, turn this into a QQuickItem and move the container
QQuickWidget into desktop-only code.

Currently, this code is insane: The chart is rendered onto a
QGraphicsScene (as it was before), which is then rendered into
a QImage, which is transformed into a QSGTexture, which is then
projected onto the device. This is performed on every mouse
move event, since these events in general change the position
of the info-box.

The plan is to slowly convert elements such as the info-box into
QQuickItems. Browsing the QtQuick documentation, this will
not be much fun.

Also note that the rendering currently tears, flickers and has
antialiasing artifacts, most likely owing to integer (QImage)
to floating point (QGraphicsScene, QQuickItem) conversion
problems. The data flow is
QGraphicsScene (float) -> QImage (int) -> QQuickItem (float).

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2021-01-10 15:16:52 -08:00
Dirk Hohndel
820fefb372 mobile: more build hackery
So while the documentation explicitly says that you need to have the
getInstance()registerTypes() call, that clearly is not supported if you
build kirigami as a library. Even the required include file doesn't
exist in the install-root.
So let's try some other way to make this work. Heck if I know what the
correct way of doing this might be.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
d9d3588d55 mobile: add yet another import path to find Kirigami QML module
This needs some careful testing across the different OSs we are trying
to support.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
9c208e88d6 mobile/Android: register the Kirigami plugin
According to the Kirigami documentation, this is only required on Android.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
9f21699cd1 mobile: use 3rdparty build of Kirigami
This should allow us to use the kirigami version that was built as 3rdparty
component.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-12-17 09:17:54 -08:00
Dirk Hohndel
4c3b6e6df2 android: avoid crash with failed font load
Check that we found font families before accessing them.
But the larger issue is likely that bundling the font failed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-11-20 11:46:17 -08:00
Berthold Stoeger
2b86fe84f9 cleanup: move application flags to core/subsurfacehelper.h
These flags are not dive-related, therefore move their declaration
to the appropriate header file. Likewise, move their definition
from parse-xml.c to subsurfacehelper.c

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-25 13:59:52 -07:00
Berthold Stoeger
6dbc9ca4b0 cleanup: don't compile subsurface-helper.cpp for tests
It is unclear why the subsurface-helper.cpp file was linked with the
tests. In any case, it led to comlicated ifdef-ery, so let's remove
that for now and readd later if the need arises.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-31 08:49:12 -07:00
Berthold Stoeger
d2f828fbf3 cleanup: replace REGISTER_TYPE macro by template
Arguably easier to read.
By using the qWarning("...") instead of the qWarning() << "..."
version, we can remove the <QDebug> include.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
53b216b228 cleanup: move initialization of QMLInterface
QMLInterface was initialized in the register_qml_types function.
Therein, it was in an if branch that tested whether the passed-in
engine argument was not NULL. However, on mobile this could never
be NULL. Let's just move the initialization out of that function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
2db6b16a70 cleanup: move initialization of ThemeInterface
The ThemeInterface was initialized and connected to QML in
the register_qml_types() function. However, it is not a
type. Move the initialization to a place where we create the
other global QML objects.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
9d485f9626 cleanup: fold ThemeInterface::setup() into constructor
There appears to be no reason for two-phase initialization.
Let's keep things simple: let the constructor produce a
functioning object.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
ce1629ccce coding style: rename themeInterface to ThemeInterface
As per coding style, class names are PascalCase.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
79bf243ec0 cleanup: make members of ThemeInterface non-static
We have a singleton class ThemeInterface, which means that it
is global and exists only once. It's members are static, i.e.
also global. A message from the department of redundancy department?
In any case, that makes no sense. Let's just make these members
local to the class.

I would even rip out the whole singleton thing, since the object
is not accessed anywhere outside from QML. Let's keep it for now.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-30 13:54:12 -07:00
Berthold Stoeger
3c2a192864 mobile: remove no longer used DiveListModel
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
c34b7857fc mobile/divelist: implement model that shows all dives in trip-order
MobileSwipeModel is probably not an ideal name, but all I could come up with.

One of the main complications here is that our list is reversed with respect to
the source model. We should change that one day.  Probably by moving the
sorting down to the core-model.

Since looking up the source row is somewhat expensive, the lookup is cached for
a single entry because accesses come in bursts for a single dive. This should
be a good compromise and avoids keeping track of a full row-to-dive array.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
7e1ac2167b mobile/divelist: create memory management class for models
Since we want to add a second model, but not have to manage two models
everywhere, create a class MobileModels that contains both of the models. When
calling reset() on that class, it will reset both of the models, etc.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Berthold Stoeger
0fc82e3398 mobile/divelist: switch to the correct model
This obviously breaks everything, but now we can start fixing
things.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10 09:25:57 -07:00
Dirk Hohndel
64ae6d54a7 mobile/divelist: set up the new model for the dive list
And remove the reference to the collapsed model.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-09 12:41:11 -07:00
Dirk Hohndel
6026f95247 mobile UI: add second environment variable for height
This is intended for testing on the desktop; this way a developer can reproduce
the screen size (in grid units) that a user might experience.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-02-11 22:16:47 -08:00
Berthold Stoeger
1a85b0e941 mobile/summary: create DiveSummaryModel
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>
2020-02-08 10:29:36 -08:00
jan Iversen
1d35942249 themeinterface: move registration to themeinterface
Move setup call and registration from subsurface-helper
to themeInterface, in order to keep the registration where the code
are.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-28 11:05:45 -08:00
jan Iversen
3c93ee862b mobile: register themeInterface
Register themeInterface with a temporary name, which allows it to be integrated
in subsurfaceTheme (main.qml).

Once all of subsurfaceTheme (main.qml) is available in themeInterface, the name
will be changed.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-26 16:42:35 -08:00
jan Iversen
14931db0a9 dive-planner: removed unused QML interface
Remove Q_PROPERTY and signals from plannershared, since they are
no longer used (transferred to qmlinterface).

Unregister object plannershared, since it is no longer used in QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-25 17:26:33 -08:00
jan Iversen
9105a4c39b mobile: register QML interface
call setup with registration of QML interface class

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-18 17:33:15 -08:00
jan Iversen
8bc7bef065 QML: remove registration of qmlprefs
It is no longer used.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-29 12:20:19 -08:00
jan Iversen
7751ec1c78 build-system: move plannerShared to backend-shared
WARNING: multi directory commit, needed to secure it builds.

move the core/plannerShared.* to backend-shared.

update CMakeLists.txt to include backend-shared lib in link process.

update ios project to reflect new directory

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24 08:44:23 +09:00
jan Iversen
0c23e005ea startup mobile: make diveplanner part of Qt type system
Register DivePlanner before starting QML.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-24 06:30:57 +09:00
jan Iversen
bf7954ebe7 core: remove LOG_STP from mobile
LOG_STP is on longer providing the data needed, since a lot of the startup
is indirectly in QML, furthermore using the xcode project and running profiler
gives much more detailed information

Signed-off-by: Jan Iversen <jani@apache.org>
2019-12-13 07:04:00 -05:00
jan Iversen
d88ccf3221 startup mobile: make ExportType enum available to QML
Register ExportType before starting QML.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-12-03 21:30:39 -08:00
jan Iversen
271d058af3 startup mobile: test for --testqml when loading qml engine.
the command line option --testqml selects if running
using resources or files on disk.

Signed-off-by: Jan Iversen <jan@casacondor.com>
2019-11-26 09:44:13 -08:00
Dirk Hohndel
c759157331 Mobile: setup CollapsedDiveListSortModel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-11-08 20:50:05 +01:00
Dirk Hohndel
e855dde965 Mobile: stop dumping the list of supported dive computers
This doesn't seem to add much value anymore and massively clutters the output.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-10-13 11:32:27 -07:00
Berthold Stoeger
7343fe4cc6 Cleanup: Implicitly free QApplication
Instead of deleting the Application explicitly in exit_ui(),
use a unique_ptr to have the instance automatically freed.
This is the pattern given in the Qt-docs:
https://doc.qt.io/qt-5/qapplication.html

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-04 09:19:10 -07:00