2019-12-07 18:27:25 +00:00
|
|
|
// 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)
|
2023-07-09 00:14:27 +00:00
|
|
|
Q_PROPERTY(bool include_unused_tanks READ include_unused_tanks WRITE set_include_unused_tanks NOTIFY include_unused_tanksChanged)
|
2020-12-11 22:55:18 +00:00
|
|
|
Q_PROPERTY(bool display_default_tank_infos READ display_default_tank_infos WRITE set_display_default_tank_infos NOTIFY display_default_tank_infosChanged)
|
2019-12-07 18:27:25 +00:00
|
|
|
|
|
|
|
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:
|
2024-06-13 20:59:32 +00:00
|
|
|
static QString default_cylinder() { return QString::fromStdString(prefs.default_cylinder); }
|
2023-07-09 00:14:27 +00:00
|
|
|
static bool include_unused_tanks() { return prefs.include_unused_tanks; }
|
2020-12-11 22:55:18 +00:00
|
|
|
static bool display_default_tank_infos() { return prefs.display_default_tank_infos; }
|
2019-12-07 18:27:25 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
static void set_default_cylinder(const QString& value);
|
2023-07-09 00:14:27 +00:00
|
|
|
static void set_include_unused_tanks(bool value);
|
2020-12-11 22:55:18 +00:00
|
|
|
static void set_display_default_tank_infos(bool value);
|
2019-12-07 18:27:25 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void default_cylinderChanged(const QString& value);
|
2023-07-09 00:14:27 +00:00
|
|
|
void include_unused_tanksChanged(bool value);
|
2020-12-11 22:55:18 +00:00
|
|
|
void display_default_tank_infosChanged(bool value);
|
2019-12-07 18:27:25 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
qPrefEquipment() {}
|
|
|
|
static void disk_default_cylinder(bool doSync);
|
2023-07-09 00:14:27 +00:00
|
|
|
static void disk_include_unused_tanks(bool doSync);
|
2020-12-11 22:55:18 +00:00
|
|
|
static void disk_display_default_tank_infos(bool doSync);
|
2019-12-07 18:27:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|