diff options
-rw-r--r-- | core/prefs-macros.h | 10 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.cpp | 6 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.h | 8 | ||||
-rw-r--r-- | core/units.h | 4 |
4 files changed, 15 insertions, 13 deletions
diff --git a/core/prefs-macros.h b/core/prefs-macros.h index 7648580ef..6f1b665fd 100644 --- a/core/prefs-macros.h +++ b/core/prefs-macros.h @@ -18,11 +18,11 @@ else \ prefs.units.field = default_prefs.units.field -#define GET_UNIT_INT(name, field) \ - v = s.value(QString(name)); \ - if (v.isValid()) \ - prefs.units.field = v.toInt(); \ - else \ +#define GET_UNIT_BOOL(name, field) \ + v = s.value(QString(name)); \ + if (v.isValid()) \ + prefs.units.field = v.toBool(); \ + else \ prefs.units.field = default_prefs.units.field #define GET_BOOL(name, field) \ diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index 7fc738461..e4a9a71d6 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -1603,7 +1603,7 @@ int UnitsSettings::durationUnits() const return prefs.units.duration_units; } -int UnitsSettings::showUnitsTable() const +bool UnitsSettings::showUnitsTable() const { return prefs.units.show_units_table; } @@ -1698,7 +1698,7 @@ void UnitsSettings::setDurationUnits(int value) emit durationUnitChanged(value); } -void UnitsSettings::setShowUnitsTable(int value) +void UnitsSettings::setShowUnitsTable(bool value) { if (value == prefs.units.show_units_table) return; @@ -2193,7 +2193,7 @@ void SettingsObjectWrapper::load() } GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS); GET_UNIT3("duration_units", duration_units, units::MIXED, units::ALWAYS_HOURS, units::DURATION); - GET_UNIT_INT("show_units_table", show_units_table); + GET_UNIT_BOOL("show_units_table", show_units_table); GET_BOOL("coordinates", coordinates_traditional); s.endGroup(); s.beginGroup("TecDetails"); diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h index e8fe6a103..508f6a6ad 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.h +++ b/core/subsurface-qt/SettingsObjectWrapper.h @@ -505,7 +505,7 @@ class UnitsSettings : public QObject { Q_PROPERTY(bool coordinates_traditional READ coordinatesTraditional WRITE setCoordinatesTraditional NOTIFY coordinatesTraditionalChanged) Q_PROPERTY(int vertical_speed_time READ verticalSpeedTime WRITE setVerticalSpeedTime NOTIFY verticalSpeedTimeChanged) Q_PROPERTY(int duration_units READ durationUnits WRITE setDurationUnits NOTIFY durationUnitChanged) - Q_PROPERTY(int show_units_table READ showUnitsTable WRITE setShowUnitsTable NOTIFY showUnitsTableChanged) + Q_PROPERTY(bool show_units_table READ showUnitsTable WRITE setShowUnitsTable NOTIFY showUnitsTableChanged) public: UnitsSettings(QObject *parent = 0); @@ -516,7 +516,7 @@ public: int weight() const; int verticalSpeedTime() const; int durationUnits() const; - int showUnitsTable() const; + bool showUnitsTable() const; QString unitSystem() const; bool coordinatesTraditional() const; @@ -528,7 +528,7 @@ public slots: void setWeight(int value); void setVerticalSpeedTime(int value); void setDurationUnits(int value); - void setShowUnitsTable(int value); + void setShowUnitsTable(bool value); void setUnitSystem(const QString& value); void setCoordinatesTraditional(bool value); @@ -542,7 +542,7 @@ signals: void unitSystemChanged(const QString& value); void coordinatesTraditionalChanged(bool value); void durationUnitChanged(int value); - void showUnitsTableChanged(int value); + void showUnitsTableChanged(bool value); private: const QString group = QStringLiteral("Units"); }; diff --git a/core/units.h b/core/units.h index ff1ae3430..21f646f79 100644 --- a/core/units.h +++ b/core/units.h @@ -9,6 +9,8 @@ #ifdef __cplusplus extern "C" { +#else +#include <stdbool.h> #endif #define O2_IN_AIR 209 // permille @@ -263,7 +265,7 @@ struct units { MINUTES_ONLY, ALWAYS_HOURS } duration_units; - int show_units_table; + bool show_units_table; }; /* |