summaryrefslogtreecommitdiffstats
path: root/core/settings
diff options
context:
space:
mode:
Diffstat (limited to 'core/settings')
-rw-r--r--core/settings/qPref.cpp3
-rw-r--r--core/settings/qPrefEquipment.cpp22
-rw-r--r--core/settings/qPrefEquipment.h40
-rw-r--r--core/settings/qPrefGeneral.cpp3
-rw-r--r--core/settings/qPrefGeneral.h5
-rw-r--r--core/settings/qPrefTechnicalDetails.cpp3
-rw-r--r--core/settings/qPrefTechnicalDetails.h5
7 files changed, 65 insertions, 16 deletions
diff --git a/core/settings/qPref.cpp b/core/settings/qPref.cpp
index 4c4a7961c..c70ad4dbe 100644
--- a/core/settings/qPref.cpp
+++ b/core/settings/qPref.cpp
@@ -14,6 +14,7 @@
#include "qPrefTechnicalDetails.h"
#include "qPrefUnit.h"
#include "qPrefUpdateManager.h"
+#include "qPrefEquipment.h"
#include <QtQml>
#include <QQmlContext>
@@ -38,6 +39,7 @@ void qPref::loadSync(bool doSync)
qPrefTechnicalDetails::loadSync(doSync);
qPrefUnits::loadSync(doSync);
qPrefUpdateManager::loadSync(doSync);
+ qPrefEquipment::loadSync(doSync);
}
Q_DECLARE_METATYPE(deco_mode);
@@ -61,6 +63,7 @@ void qPref::registerQML(QQmlEngine *engine)
ct->setContextProperty("PrefTechnicalDetails", qPrefTechnicalDetails::instance());
ct->setContextProperty("PrefUnits", qPrefUnits::instance());
ct->setContextProperty("PrefUpdateManager", qPrefUpdateManager::instance());
+ ct->setContextProperty("PrefEquipment", qPrefUpdateManager::instance());
}
// Register special types
diff --git a/core/settings/qPrefEquipment.cpp b/core/settings/qPrefEquipment.cpp
new file mode 100644
index 000000000..f7bdb01e1
--- /dev/null
+++ b/core/settings/qPrefEquipment.cpp
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "qPrefEquipment.h"
+#include "qPrefPrivate.h"
+
+static const QString group = QStringLiteral("Equipment");
+
+qPrefEquipment *qPrefEquipment::instance()
+{
+ static qPrefEquipment *self = new qPrefEquipment;
+ return self;
+}
+
+void qPrefEquipment::loadSync(bool doSync)
+{
+ disk_default_cylinder(doSync);
+ disk_display_unused_tanks(doSync);
+
+}
+
+HANDLE_PREFERENCE_TXT(Equipment, "default_cylinder", default_cylinder);
+HANDLE_PREFERENCE_BOOL(Equipment, "display_unused_tanks", display_unused_tanks);
+
diff --git a/core/settings/qPrefEquipment.h b/core/settings/qPrefEquipment.h
new file mode 100644
index 000000000..33fe9f8d6
--- /dev/null
+++ b/core/settings/qPrefEquipment.h
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef QPREFEQUIPMENT_H
+#define QPREFEQUIPMENT_H
+#include "core/pref.h"
+
+#include <QObject>
+
+class qPrefEquipment : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString default_cylinder READ default_cylinder WRITE set_default_cylinder NOTIFY default_cylinderChanged)
+ Q_PROPERTY(bool display_unused_tanks READ display_unused_tanks WRITE set_display_unused_tanks NOTIFY display_unused_tanksChanged)
+
+public:
+ static qPrefEquipment *instance();
+
+ // Load/Sync local settings (disk) and struct preference
+ static void loadSync(bool doSync);
+ static void load() { loadSync(false); }
+ static void sync() { loadSync(true); }
+
+public:
+ static QString default_cylinder() { return prefs.default_cylinder; }
+ static bool display_unused_tanks() { return prefs.display_unused_tanks; }
+
+public slots:
+ static void set_default_cylinder(const QString& value);
+ static void set_display_unused_tanks(bool value);
+
+signals:
+ void default_cylinderChanged(const QString& value);
+ void display_unused_tanksChanged(bool value);
+
+private:
+ qPrefEquipment() {}
+ static void disk_default_cylinder(bool doSync);
+ static void disk_display_unused_tanks(bool doSync);
+};
+
+#endif
+
diff --git a/core/settings/qPrefGeneral.cpp b/core/settings/qPrefGeneral.cpp
index 766f5edbc..b3e9fb761 100644
--- a/core/settings/qPrefGeneral.cpp
+++ b/core/settings/qPrefGeneral.cpp
@@ -22,7 +22,6 @@ void qPrefGeneral::loadSync(bool doSync)
{
disk_auto_recalculate_thumbnails(doSync);
disk_auto_recalculate_thumbnails(doSync);
- disk_default_cylinder(doSync);
disk_default_filename(doSync);
disk_default_file_behavior(doSync);
disk_defaultsetpoint(doSync);
@@ -44,8 +43,6 @@ void qPrefGeneral::loadSync(bool doSync)
HANDLE_PREFERENCE_BOOL(General, "auto_recalculate_thumbnails", auto_recalculate_thumbnails);
-HANDLE_PREFERENCE_TXT(General, "default_cylinder", default_cylinder);
-
HANDLE_PREFERENCE_TXT(General, "default_filename", default_filename);
diff --git a/core/settings/qPrefGeneral.h b/core/settings/qPrefGeneral.h
index df45a56b8..c55063bd2 100644
--- a/core/settings/qPrefGeneral.h
+++ b/core/settings/qPrefGeneral.h
@@ -8,7 +8,6 @@
class qPrefGeneral : public QObject {
Q_OBJECT
Q_PROPERTY(bool auto_recalculate_thumbnails READ auto_recalculate_thumbnails WRITE set_auto_recalculate_thumbnails NOTIFY auto_recalculate_thumbnailsChanged)
- Q_PROPERTY(QString default_cylinder READ default_cylinder WRITE set_default_cylinder NOTIFY default_cylinderChanged)
Q_PROPERTY(QString default_filename READ default_filename WRITE set_default_filename NOTIFY default_filenameChanged)
Q_PROPERTY(enum def_file_behavior default_file_behavior READ default_file_behavior WRITE set_default_file_behavior NOTIFY default_file_behaviorChanged)
Q_PROPERTY(int defaultsetpoint READ defaultsetpoint WRITE set_defaultsetpoint NOTIFY defaultsetpointChanged)
@@ -35,7 +34,6 @@ public:
public:
static bool auto_recalculate_thumbnails() { return prefs.auto_recalculate_thumbnails; }
- static QString default_cylinder() { return prefs.default_cylinder; }
static QString default_filename() { return prefs.default_filename; }
static enum def_file_behavior default_file_behavior() { return prefs.default_file_behavior; }
static int defaultsetpoint() { return prefs.defaultsetpoint; }
@@ -53,7 +51,6 @@ public:
public slots:
static void set_auto_recalculate_thumbnails(bool value);
- static void set_default_cylinder(const QString& value);
static void set_default_filename(const QString& value);
static void set_default_file_behavior(enum def_file_behavior value);
static void set_defaultsetpoint(int value);
@@ -71,7 +68,6 @@ public slots:
signals:
void auto_recalculate_thumbnailsChanged(bool value);
- void default_cylinderChanged(const QString& value);
void default_filenameChanged(const QString& value);
void default_file_behaviorChanged(enum def_file_behavior value);
void defaultsetpointChanged(int value);
@@ -92,7 +88,6 @@ private:
qPrefGeneral() {}
static void disk_auto_recalculate_thumbnails(bool doSync);
- static void disk_default_cylinder(bool doSync);
static void disk_default_filename(bool doSync);
static void disk_default_file_behavior(bool doSync);
static void disk_defaultsetpoint(bool doSync);
diff --git a/core/settings/qPrefTechnicalDetails.cpp b/core/settings/qPrefTechnicalDetails.cpp
index cfa6cae0e..1d0e30c0c 100644
--- a/core/settings/qPrefTechnicalDetails.cpp
+++ b/core/settings/qPrefTechnicalDetails.cpp
@@ -20,7 +20,6 @@ void qPrefTechnicalDetails::loadSync(bool doSync)
disk_calcndltts(doSync);
disk_dcceiling(doSync);
disk_display_deco_mode(doSync);
- disk_display_unused_tanks(doSync);
disk_ead(doSync);
disk_gfhigh(doSync);
disk_gflow(doSync);
@@ -57,8 +56,6 @@ HANDLE_PREFERENCE_BOOL(TechnicalDetails, "dcceiling", dcceiling);
HANDLE_PREFERENCE_ENUM(TechnicalDetails, deco_mode, "display_deco_mode", display_deco_mode);
-HANDLE_PREFERENCE_BOOL(TechnicalDetails, "display_unused_tanks", display_unused_tanks);
-
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "ead", ead);
void qPrefTechnicalDetails::set_gfhigh(int value)
diff --git a/core/settings/qPrefTechnicalDetails.h b/core/settings/qPrefTechnicalDetails.h
index 68974e8bb..dfd477320 100644
--- a/core/settings/qPrefTechnicalDetails.h
+++ b/core/settings/qPrefTechnicalDetails.h
@@ -15,7 +15,6 @@ class qPrefTechnicalDetails : public QObject {
Q_PROPERTY(bool decoinfo READ decoinfo WRITE set_decoinfo NOTIFY decoinfoChanged)
Q_PROPERTY(bool dcceiling READ dcceiling WRITE set_dcceiling NOTIFY dcceilingChanged)
Q_PROPERTY(deco_mode display_deco_mode READ display_deco_mode WRITE set_display_deco_mode NOTIFY display_deco_modeChanged)
- Q_PROPERTY(bool display_unused_tanks READ display_unused_tanks WRITE set_display_unused_tanks NOTIFY display_unused_tanksChanged)
Q_PROPERTY(bool ead READ ead WRITE set_ead NOTIFY eadChanged)
Q_PROPERTY(int gfhigh READ gfhigh WRITE set_gfhigh NOTIFY gfhighChanged)
Q_PROPERTY(int gflow READ gflow WRITE set_gflow NOTIFY gflowChanged)
@@ -53,7 +52,6 @@ public:
static bool decoinfo() { return prefs.decoinfo; }
static bool dcceiling() { return prefs.dcceiling; }
static deco_mode display_deco_mode() { return prefs.display_deco_mode; }
- static bool display_unused_tanks() { return prefs.display_unused_tanks; }
static bool ead() { return prefs.ead; }
static int gfhigh() { return prefs.gfhigh; }
static int gflow() { return prefs.gflow; }
@@ -83,7 +81,6 @@ public slots:
static void set_decoinfo(bool value);
static void set_dcceiling(bool value);
static void set_display_deco_mode(deco_mode value);
- static void set_display_unused_tanks(bool value);
static void set_ead(bool value);
static void set_gfhigh(int value);
static void set_gflow(int value);
@@ -113,7 +110,6 @@ signals:
void decoinfoChanged(bool value);
void dcceilingChanged(bool value);
void display_deco_modeChanged(deco_mode value);
- void display_unused_tanksChanged(bool value);
void eadChanged(bool value);
void gfhighChanged(int value);
void gflowChanged(int value);
@@ -145,7 +141,6 @@ private:
static void disk_decoinfo(bool doSync);
static void disk_dcceiling(bool doSync);
static void disk_display_deco_mode(bool doSync);
- static void disk_display_unused_tanks(bool doSync);
static void disk_ead(bool doSync);
static void disk_gfhigh(bool doSync);
static void disk_gflow(bool doSync);