Commit graph

16 commits

Author SHA1 Message Date
Michael Keller
fb41999c73 Mobile: Fix Gradient Factor Preference Setting.
Fix the persisting and use of gradient factor preferences for dive
profiles in the mobile version.
Also rename the mobile backend gradient factor settings to make it
obvious that they are used by the (not currently enabled) planner.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-27 20:55:32 -08:00
Michael Keller
a38ea971a0 Import: Add option to sync time on dive computer download
Add an option for users to sync the dive computer time with the PC time
every time dives are downloaded.
Obviously this will only work on dive computers that have time
synchronisation support in libdivecomputer, for other computers a notice
is logged.
The selection for this option is persisted as a preference.

Signed-off-by: Michael Keller <github@ike.ch>
2023-04-17 07:56:02 -07:00
Berthold Stoeger
1809dbd00a mobile/summary: remove dive summary calculation
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>
2020-02-08 10:29:36 -08: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
6cd46bee06 divesummary: add DiveSummary class to shared and backend
Create DiveSummary class in backend-shared and make the DiveSummary calculation
results available to QML.

This adds a loop over all dives (could have been done with a model, but the
models available to mobile are very limited, so use the basic way).

[Dirk Hohndel: renamed the results variable and combined a couple of commits]

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-27 14:25:03 -08:00
jan Iversen
1e3879d87d diveplanner: add last gas variables to QMLInterface
Add bottompo2, decopo2 and bestmixend to QMLInterface

Bestmixend in gas options changing with
meter/feet

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
86fd49f2d7 diveplanner: adjust sac-factor calculation.
The real values are 1.0 to 10.0, but QML needs int so mobile
gets values 10.0 to 100.0

add sacfactor() to QMLInterface and update QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
cd3c2266f9 dive planner: correct bottomsac/decosac calc.
Move conversion cuft <-> liter from desktop-widget/diveplanner.cpp
to plannerShared, to facilitate the same results in mobile
diveplanner

Use Backend for bottomsac/decosac and update to check
for switch LITER <-> CUFT

Add bottomsac/decosac to QMLinterface.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
e55c740d84 diveplanner: call planner model directly for simple variables.
Variables without conversion, do not need to pass plannerShared
(due to the QML interface).

Simple variables do not pass plannerShared, but diveplanner
in desktop-widgets and qmlinterface in mobile-widgets call the
implementation directly.

Signed-off-by: jan Iversen <jan@casacondor.com>
2020-01-25 17:13:20 -08:00
jan Iversen
0710e610d3 mobile-widgets: add simple part of remaining planner variables
Add simple variables, where getter uses prefs. and setters call directly to set
function (without using plannerShared).

rename last_stop --> last_stop6m

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 20:23:15 -08:00
jan Iversen
b0e46c208d mobile: move dive planner notes access to pure interface
Make notes rates available to QML through the Backend interface.
Remove the corresponding variables from plannerShared.

Getters are from prefs. while setters are linked to diveplan model.

Remark: signals from qPrefDivePlanner is used, because the diveplanner model
sets qPrefDivePlanner but do not issue special signals.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-24 20:20:42 -08:00
jan Iversen
699665ce9e mobile-widgets: add asc/desc rates to pure interface
Make ascent/descent rates available to QML through the Backend interface.

Remark signals from qPrefDivePlanner is used because the diveplanner model
sets qPrefDivePlanner but does not issue its own signals.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 15:46:08 -08:00
jan Iversen
25a5be0fe9 mobile-widgets: allow qPrefUnit strongly typed in QML
Add qPrefUnit Q_PROPERTY but using QMLInterface enums, that way
all variables become strongly typed in QML.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-20 09:49:05 -08:00
jan Iversen
c93b76eee6 mobile-widgets: make cloud_verification_status type proof in QML.
Add CLOUD_STATUS enum to interface.

Add cloud_verifification_status variable to interface, and make
it strongly typed in QML.

using backend.cloud_verification_status = 1 will fail but
backend.cloud_verification_status = backend.CS_UNKNOWN is correct.

Added note to the original definitions of the enums that they have been
duplicated.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-18 17:35:04 -08:00
jan Iversen
fdc2fd35bf mobile-widgets: add pure interface for passing values to QML
Add a header file that contains a duplicate of the enums,
that are needed in QML in one class.
the unit enums are added imidiatly, since they are needed
or will be neede shortly in Settings and DivePlannerSettings

This class will also contain Q_PROPERTY and signal/slot for
variables used in QML. This is done to allow e.g.

deco_mode qPrefUnits::planner_deco_mode()
void qPrefUnits::set_planner_deco_mode(deco_mode)
as strongly typed in C++
and
DECO_MODE planner_deco_mode()
void set_planner_deco_mode(DECO_MODE)
as strongly typed in QML
Remark: wrong assignments gives errors in QML

The advantage over using strings or the value directly is that
QML detects typos and flags them as errors/warnings.

It is important to note that the class may only contain
a) a function call to the implementation
b) a reference to a global variable e.g. prefs.

Added note to the original definitions of the enums that they
have been duplicated.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-01-18 17:31:58 -08:00