aboutsummaryrefslogtreecommitdiff
path: root/src/qt/optionsmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/optionsmodel.h')
-rw-r--r--src/qt/optionsmodel.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h
index 510ebb5cfd..42b89c5029 100644
--- a/src/qt/optionsmodel.h
+++ b/src/qt/optionsmodel.h
@@ -13,6 +13,7 @@
#include <assert.h>
+struct bilingual_str;
namespace interfaces {
class Node;
}
@@ -41,7 +42,7 @@ class OptionsModel : public QAbstractListModel
Q_OBJECT
public:
- explicit OptionsModel(QObject *parent = nullptr, bool resetSettings = false);
+ explicit OptionsModel(interfaces::Node& node, QObject *parent = nullptr);
enum OptionID {
StartAtStartup, // bool
@@ -74,12 +75,14 @@ public:
OptionIDRowCount,
};
- void Init(bool resetSettings = false);
+ bool Init(bilingual_str& error);
void Reset();
int rowCount(const QModelIndex & parent = QModelIndex()) const override;
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole) override;
+ QVariant getOption(OptionID option) const;
+ bool setOption(OptionID option, const QVariant& value);
/** Updates current unit in memory, settings and emits displayUnitChanged(new_unit) signal */
void setDisplayUnit(const QVariant& new_unit);
@@ -96,18 +99,16 @@ public:
const QString& getOverriddenByCommandLine() { return strOverriddenByCommandLine; }
/* Explicit setters */
- void SetPruneEnabled(bool prune, bool force = false);
- void SetPruneTargetGB(int prune_target_gb, bool force = false);
+ void SetPruneTargetGB(int prune_target_gb);
/* Restart flag helper */
void setRestartRequired(bool fRequired);
bool isRestartRequired() const;
- interfaces::Node& node() const { assert(m_node); return *m_node; }
- void setNode(interfaces::Node& node) { assert(!m_node); m_node = &node; }
+ interfaces::Node& node() const { return m_node; }
private:
- interfaces::Node* m_node = nullptr;
+ interfaces::Node& m_node;
/* Qt-only settings */
bool m_show_tray_icon;
bool fMinimizeToTray;
@@ -119,6 +120,16 @@ private:
bool fCoinControlFeatures;
bool m_sub_fee_from_amount;
bool m_enable_psbt_controls;
+
+ //! In-memory settings for display. These are stored persistently by the
+ //! bitcoin node but it's also nice to store them in memory to prevent them
+ //! getting cleared when enable/disable toggles are used in the GUI.
+ int m_prune_size_gb;
+ QString m_proxy_ip;
+ QString m_proxy_port;
+ QString m_onion_ip;
+ QString m_onion_port;
+
/* settings that were overridden by command-line */
QString strOverriddenByCommandLine;
@@ -127,6 +138,7 @@ private:
// Check settings version and upgrade default values if required
void checkAndMigrate();
+
Q_SIGNALS:
void displayUnitChanged(BitcoinUnit unit);
void coinControlFeaturesChanged(bool);