mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 21:43:23 +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()
|
QString qPrefUnits::unit_system()
|
||||||
{
|
{
|
||||||
return prefs.unit_system == METRIC ? QStringLiteral("metric") :
|
return prefs.unit_system == METRIC ? QStringLiteral("metric") :
|
||||||
prefs.unit_system == IMPERIAL ? QStringLiteral("imperial") :
|
prefs.unit_system == IMPERIAL ? QStringLiteral("imperial") :
|
||||||
QStringLiteral("personalized");
|
QStringLiteral("personalized");
|
||||||
}
|
}
|
||||||
void qPrefUnits::set_unit_system(const QString& value)
|
void qPrefUnits::set_unit_system(const QString& value)
|
||||||
{
|
{
|
||||||
short int v = value == QStringLiteral("metric") ? METRIC :
|
set_unit_system(value == QStringLiteral("metric") ? METRIC : value == QStringLiteral("imperial")? IMPERIAL : PERSONALIZE);
|
||||||
value == QStringLiteral("imperial")? IMPERIAL :
|
emit instance()->unit_systemStringChanged(value);
|
||||||
PERSONALIZE;
|
}
|
||||||
if (v == METRIC) {
|
void qPrefUnits::set_unit_system(unit_system_values value)
|
||||||
|
{
|
||||||
|
if (value == METRIC) {
|
||||||
prefs.unit_system = METRIC;
|
prefs.unit_system = METRIC;
|
||||||
prefs.units = SI_units;
|
prefs.units = SI_units;
|
||||||
} else if (v == IMPERIAL) {
|
} else if (value == IMPERIAL) {
|
||||||
prefs.unit_system = IMPERIAL;
|
prefs.unit_system = IMPERIAL;
|
||||||
prefs.units = IMPERIAL_units;
|
prefs.units = IMPERIAL_units;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -14,7 +14,7 @@ class qPrefUnits : public QObject {
|
||||||
Q_PROPERTY(QString pressure READ pressure WRITE set_pressure NOTIFY pressureStringChanged)
|
Q_PROPERTY(QString pressure READ pressure WRITE set_pressure NOTIFY pressureStringChanged)
|
||||||
Q_PROPERTY(bool show_units_table READ show_units_table WRITE set_show_units_table NOTIFY show_units_tableChanged)
|
Q_PROPERTY(bool show_units_table READ show_units_table WRITE set_show_units_table NOTIFY show_units_tableChanged)
|
||||||
Q_PROPERTY(QString temperature READ temperature WRITE set_temperature NOTIFY temperatureStringChanged)
|
Q_PROPERTY(QString temperature READ temperature WRITE set_temperature NOTIFY temperatureStringChanged)
|
||||||
Q_PROPERTY(QString unit_system READ unit_system WRITE set_unit_system NOTIFY unit_systemChanged)
|
Q_PROPERTY(QString unit_system READ unit_system WRITE set_unit_system NOTIFY unit_systemStringChanged)
|
||||||
Q_PROPERTY(QString vertical_speed_time READ vertical_speed_time WRITE set_vertical_speed_time NOTIFY vertical_speed_timeStringChanged)
|
Q_PROPERTY(QString vertical_speed_time READ vertical_speed_time WRITE set_vertical_speed_time NOTIFY vertical_speed_timeStringChanged)
|
||||||
Q_PROPERTY(QString volume READ volume WRITE set_volume NOTIFY volumeStringChanged)
|
Q_PROPERTY(QString volume READ volume WRITE set_volume NOTIFY volumeStringChanged)
|
||||||
Q_PROPERTY(QString weight READ weight WRITE set_weight NOTIFY weightStringChanged)
|
Q_PROPERTY(QString weight READ weight WRITE set_weight NOTIFY weightStringChanged)
|
||||||
|
@ -50,6 +50,7 @@ public slots:
|
||||||
static void set_show_units_table(bool value);
|
static void set_show_units_table(bool value);
|
||||||
static void set_temperature(units::TEMPERATURE value);
|
static void set_temperature(units::TEMPERATURE value);
|
||||||
static void set_temperature(const QString& value);
|
static void set_temperature(const QString& value);
|
||||||
|
static void set_unit_system(unit_system_values value);
|
||||||
static void set_unit_system(const QString& value);
|
static void set_unit_system(const QString& value);
|
||||||
static void set_vertical_speed_time(units::TIME value);
|
static void set_vertical_speed_time(units::TIME value);
|
||||||
static void set_vertical_speed_time(const QString& value);
|
static void set_vertical_speed_time(const QString& value);
|
||||||
|
@ -77,7 +78,8 @@ signals:
|
||||||
void show_units_tableChanged(bool value);
|
void show_units_tableChanged(bool value);
|
||||||
void temperatureChanged(int value);
|
void temperatureChanged(int value);
|
||||||
void temperatureStringChanged(const QString& value);
|
void temperatureStringChanged(const QString& value);
|
||||||
void unit_systemChanged(const QString& value);
|
void unit_systemChanged(int value);
|
||||||
|
void unit_systemStringChanged(const QString& value);
|
||||||
void vertical_speed_timeChanged(int value);
|
void vertical_speed_timeChanged(int value);
|
||||||
void vertical_speed_timeStringChanged(const QString& value);
|
void vertical_speed_timeStringChanged(const QString& value);
|
||||||
void volumeChanged(int value);
|
void volumeChanged(int value);
|
||||||
|
|
Loading…
Add table
Reference in a new issue