summaryrefslogtreecommitdiffstats
path: root/core/subsurface-qt/SettingsObjectWrapper.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-11-18 16:06:41 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-20 20:56:13 +0100
commitdd8e4fae2aa31f1fac2a8a6f086db0db0a3209c6 (patch)
tree5bf0f8872a35f71430733c9766bc70ad65cea499 /core/subsurface-qt/SettingsObjectWrapper.h
parente762fd2d416cbe77669a83e302709aa3fbda68f7 (diff)
downloadsubsurface-dd8e4fae2aa31f1fac2a8a6f086db0db0a3209c6.tar.gz
Make handling of booleans consistent on the C++-side of preferences
In general, the C++-side of the preferences code consistently uses the bool data type for boolean settings. There are five exceptions, which use short instead: showPo2 showPn2 showPhe saveUserIdLocal displayInvalidDives This patch attempts to make the code more consistent by turning these into bools as well. Tests showed that writing as short and reading as bool is handled gracefully by the Qt variant code. Therefore, an upgrade should not cause user-visible changes to their settings. As a bonus, two extern declarations of the set_save_userid_local() function, which is not defined anywhere, were removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/subsurface-qt/SettingsObjectWrapper.h')
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h
index 19cfcdd50..e8fe6a103 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.h
+++ b/core/subsurface-qt/SettingsObjectWrapper.h
@@ -74,9 +74,9 @@ private:
/* Control the state of the Partial Pressure Graphs preferences */
class PartialPressureGasSettings : public QObject {
Q_OBJECT
- Q_PROPERTY(short show_po2 READ showPo2 WRITE setShowPo2 NOTIFY showPo2Changed)
- Q_PROPERTY(short show_pn2 READ showPn2 WRITE setShowPn2 NOTIFY showPn2Changed)
- Q_PROPERTY(short show_phe READ showPhe WRITE setShowPhe NOTIFY showPheChanged)
+ Q_PROPERTY(bool show_po2 READ showPo2 WRITE setShowPo2 NOTIFY showPo2Changed)
+ Q_PROPERTY(bool show_pn2 READ showPn2 WRITE setShowPn2 NOTIFY showPn2Changed)
+ Q_PROPERTY(bool show_phe READ showPhe WRITE setShowPhe NOTIFY showPheChanged)
Q_PROPERTY(double po2_threshold_min READ po2ThresholdMin WRITE setPo2ThresholdMin NOTIFY po2ThresholdMinChanged)
Q_PROPERTY(double po2_threshold_max READ po2ThresholdMax WRITE setPo2ThresholdMax NOTIFY po2ThresholdMaxChanged)
Q_PROPERTY(double pn2_threshold READ pn2Threshold WRITE setPn2Threshold NOTIFY pn2ThresholdChanged)
@@ -84,27 +84,27 @@ class PartialPressureGasSettings : public QObject {
public:
PartialPressureGasSettings(QObject *parent);
- short showPo2() const;
- short showPn2() const;
- short showPhe() const;
+ bool showPo2() const;
+ bool showPn2() const;
+ bool showPhe() const;
double po2ThresholdMin() const;
double po2ThresholdMax() const;
double pn2Threshold() const;
double pheThreshold() const;
public slots:
- void setShowPo2(short value);
- void setShowPn2(short value);
- void setShowPhe(short value);
+ void setShowPo2(bool value);
+ void setShowPn2(bool value);
+ void setShowPhe(bool value);
void setPo2ThresholdMin(double value);
void setPo2ThresholdMax(double value);
void setPn2Threshold(double value);
void setPheThreshold(double value);
signals:
- void showPo2Changed(short value);
- void showPn2Changed(short value);
- void showPheChanged(short value);
+ void showPo2Changed(bool value);
+ void showPn2Changed(bool value);
+ void showPheChanged(bool value);
void po2ThresholdMaxChanged(double value);
void po2ThresholdMinChanged(double value);
void pn2ThresholdChanged(double value);
@@ -328,7 +328,7 @@ class CloudStorageSettings : public QObject {
Q_PROPERTY(QString userid READ userId WRITE setUserId NOTIFY userIdChanged)
Q_PROPERTY(QString base_url READ baseUrl WRITE setBaseUrl NOTIFY baseUrlChanged)
Q_PROPERTY(QString git_url READ gitUrl WRITE setGitUrl NOTIFY gitUrlChanged)
- Q_PROPERTY(short save_userid_local READ saveUserIdLocal WRITE setSaveUserIdLocal NOTIFY saveUserIdLocalChanged)
+ Q_PROPERTY(bool save_userid_local READ saveUserIdLocal WRITE setSaveUserIdLocal NOTIFY saveUserIdLocalChanged)
Q_PROPERTY(bool git_local_only READ gitLocalOnly WRITE setGitLocalOnly NOTIFY gitLocalOnlyChanged)
Q_PROPERTY(bool save_password_local READ savePasswordLocal WRITE setSavePasswordLocal NOTIFY savePasswordLocalChanged)
Q_PROPERTY(short verification_status READ verificationStatus WRITE setVerificationStatus NOTIFY verificationStatusChanged)
@@ -346,7 +346,7 @@ public:
short verificationStatus() const;
bool backgroundSync() const;
bool gitLocalOnly() const;
- short saveUserIdLocal() const;
+ bool saveUserIdLocal() const;
public slots:
void setPassword(const QString& value);
@@ -360,7 +360,7 @@ public slots:
void setVerificationStatus(short value);
void setBackgroundSync(bool value);
void setGitLocalOnly(bool value);
- void setSaveUserIdLocal(short value);
+ void setSaveUserIdLocal(bool value);
signals:
void passwordChanged(const QString& value);
@@ -374,7 +374,7 @@ signals:
void verificationStatusChanged(short value);
void backgroundSyncChanged(bool value);
void gitLocalOnlyChanged(bool value);
- void saveUserIdLocalChanged(short value);
+ void saveUserIdLocalChanged(bool value);
private:
const QString group = QStringLiteral("CloudStorage");
@@ -592,20 +592,20 @@ class DisplaySettingsObjectWrapper : public QObject {
Q_OBJECT
Q_PROPERTY(QString divelist_font READ divelistFont WRITE setDivelistFont NOTIFY divelistFontChanged)
Q_PROPERTY(double font_size READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
- Q_PROPERTY(short display_invalid_dives READ displayInvalidDives WRITE setDisplayInvalidDives NOTIFY displayInvalidDivesChanged)
+ Q_PROPERTY(bool display_invalid_dives READ displayInvalidDives WRITE setDisplayInvalidDives NOTIFY displayInvalidDivesChanged)
public:
DisplaySettingsObjectWrapper(QObject *parent);
QString divelistFont() const;
double fontSize() const;
- short displayInvalidDives() const;
+ bool displayInvalidDives() const;
public slots:
void setDivelistFont(const QString& value);
void setFontSize(double value);
- void setDisplayInvalidDives(short value);
+ void setDisplayInvalidDives(bool value);
signals:
void divelistFontChanged(const QString& value);
void fontSizeChanged(double value);
- void displayInvalidDivesChanged(short value);
+ void displayInvalidDivesChanged(bool value);
private:
const QString group = QStringLiteral("Display");
};