mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Preferences UI: create new equipment tab
Remove the "Show unused cylinders" checkbox (Profile tab) and the "Set default cylinder" qTextEdit box (General tab) and put them in a separate and new Equipment tab. This sounds like a simple task but, as can be seen from the files changed, was actually a complex matter. Adapt the existing test programs (General and TechDetails) for creating a test program that tests parts of the Equipment tab. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c121afc96c
commit
3e853e37a5
25 changed files with 369 additions and 105 deletions
|
|
@ -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
|
||||
|
|
|
|||
22
core/settings/qPrefEquipment.cpp
Normal file
22
core/settings/qPrefEquipment.cpp
Normal file
|
|
@ -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);
|
||||
|
||||
40
core/settings/qPrefEquipment.h
Normal file
40
core/settings/qPrefEquipment.h
Normal file
|
|
@ -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
|
||||
|
||||
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue