prefs.unit_system is set at the top, so no need to set it again.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
prefs.unit = x needs to be after the setters are called, otherwise the setter
will not do anything, and result in an inconsistency between the values stored
on disk and in prefs.units.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Remove string version of unit_system, duration_units, length, pressure,
temperature, vertical_speed_time, and volume, including tests and make signals
strongly typed in C++
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When using the string setters, the original signal should still be emitted.
Change to call original setter in string setter.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When changing between METRICS <-> IMPERIAL, all type signals are emitted.
This may cause double sending of some signals, but all signals will be emitted
at least once.
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When switching between imperial/metric it is important to change the single
measurements as well (e.g. METER <-> FEET).
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
All unit functions have a string version and a normal version, except
unit_system.
Make a non string version of unit_system.
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use string literals to communicate with QML.
Instead of passing arounds enum/int value, it seems easier to pass string literals to QML and have that code respond to those
Signed-off-by: Jan Iversen <jani@apache.org>
Unit_system is read from git storage but units are set from locale when the
app starts. To prevent a miss-match between unit and unit_system we have to
always update the preferences variable when set_unit_system is called so that
the user doesn't end up with imperial units when the preferences say metric.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
QML demands signals to be of the form
<name>Changed
Changing all of qPref
REMARK: this commit is not compileable, since it only change qPref and not
the rest of the system
Signed-off-by: Jan Iversen <jani@apache.org>
We had a couple of instances of names being incorrectly merged with their
group, this should handle that better. It's a bit of a big hammer to use, but
it seems to work (and it makes it easy to then git grep for cases that don't
use the new helper function.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Make methods static to allow fast and esay access
use qPrefXYZ::foo() instead of qPrefXYZ::instance()->foo()
Signed-off-by: Jan Iversen <jani@apache.org>
Update set/get functions to follow common name scheme:
- get function have same name as in struct diveComputer
- set function have set_<name>
- signal function have <name>_changed
one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way
SettingsObjectWrapper handles it) secures the same storage name
is used. Having the set/get/load/sync functions grouped together
makes it easier to get an overview.
REMARK: this commit only defines the class, it is not active in production
Signed-off-by: Jan Iversen <jani@apache.org>