diff options
| author | xiphon <xiphon@protonmail.com> | 2020-07-28 17:29:13 +0000 |
|---|---|---|
| committer | xiphon <xiphon@protonmail.com> | 2020-09-28 13:50:01 +0000 |
| commit | 1aa98c3cfd3679de27346ff74f71ea72eddc8eca (patch) | |
| tree | 78ea697be9157736a51db70281c5157bede623b4 /src/qt/MoneroSettings.h | |
| parent | c137a6ea36040aee20366933935805eff67ae3f8 (diff) | |
| download | monzero-gui-1aa98c3cfd3679de27346ff74f71ea72eddc8eca.tar.gz monzero-gui-1aa98c3cfd3679de27346ff74f71ea72eddc8eca.tar.xz monzero-gui-1aa98c3cfd3679de27346ff74f71ea72eddc8eca.zip | |
MoneroSettings: portable mode, CWD relative 'monero-storage' dir
Diffstat (limited to 'src/qt/MoneroSettings.h')
| -rw-r--r-- | src/qt/MoneroSettings.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/qt/MoneroSettings.h b/src/qt/MoneroSettings.h index cda22e02..3f822530 100644 --- a/src/qt/MoneroSettings.h +++ b/src/qt/MoneroSettings.h @@ -36,6 +36,8 @@ #ifndef MONEROSETTINGS_H #define MONEROSETTINGS_H +#include <memory> + #include <QtQml/qqmlparserstatus.h> #include <QGuiApplication> #include <QClipboard> @@ -50,15 +52,23 @@ class MoneroSettings : public QObject, public QQmlParserStatus Q_OBJECT Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QString fileName READ fileName WRITE setFileName FINAL) + Q_PROPERTY(bool portable READ portable NOTIFY portableChanged) + Q_PROPERTY(QString portableFolderName READ portableFolderName CONSTANT) + public: explicit MoneroSettings(QObject *parent = nullptr); QString fileName() const; void setFileName(const QString &fileName); + Q_INVOKABLE bool setPortable(bool enabled); + Q_INVOKABLE void setWritable(bool enabled); public slots: void _q_propertyChanged(); +signals: + void portableChanged() const; + protected: void timerEvent(QTimerEvent *event) override; void classBegin() override; @@ -71,10 +81,19 @@ private: void load(); void store(); + bool portable() const; + bool portableConfigExists() const; + QString portableFilePath() const; + QString portableFolderName() const; + std::unique_ptr<QSettings> portableSettings() const; + std::unique_ptr<QSettings> unportableSettings() const; + void swap(std::unique_ptr<QSettings> newSettings); + QHash<const char *, QVariant> m_changedProperties; - QSettings *m_settings = NULL; + std::unique_ptr<QSettings> m_settings; QString m_fileName = QString(""); bool m_initialized = false; + bool m_writable = true; int m_timerId = 0; }; |
