mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core/settings: split "normal" version of unit_system
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>
This commit is contained in:
parent
d000cb2b0d
commit
14db760044
2 changed files with 13 additions and 9 deletions
|
@ -89,18 +89,20 @@ DISK_LOADSYNC_ENUM_EXT(Units, "temperature", units::TEMPERATURE, temperature, un
|
|||
QString qPrefUnits::unit_system()
|
||||
{
|
||||
return prefs.unit_system == METRIC ? QStringLiteral("metric") :
|
||||
prefs.unit_system == IMPERIAL ? QStringLiteral("imperial") :
|
||||
QStringLiteral("personalized");
|
||||
prefs.unit_system == IMPERIAL ? QStringLiteral("imperial") :
|
||||
QStringLiteral("personalized");
|
||||
}
|
||||
void qPrefUnits::set_unit_system(const QString& value)
|
||||
{
|
||||
short int v = value == QStringLiteral("metric") ? METRIC :
|
||||
value == QStringLiteral("imperial")? IMPERIAL :
|
||||
PERSONALIZE;
|
||||
if (v == METRIC) {
|
||||
set_unit_system(value == QStringLiteral("metric") ? METRIC : value == QStringLiteral("imperial")? IMPERIAL : PERSONALIZE);
|
||||
emit instance()->unit_systemStringChanged(value);
|
||||
}
|
||||
void qPrefUnits::set_unit_system(unit_system_values value)
|
||||
{
|
||||
if (value == METRIC) {
|
||||
prefs.unit_system = METRIC;
|
||||
prefs.units = SI_units;
|
||||
} else if (v == IMPERIAL) {
|
||||
} else if (value == IMPERIAL) {
|
||||
prefs.unit_system = IMPERIAL;
|
||||
prefs.units = IMPERIAL_units;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue