You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.3 KiB
65 lines
1.3 KiB
// SPDX-License-Identifier: BSD-3-Clause
|
|
// Copyright (c) 2020-2021, The Monero Project.
|
|
// Copyright (c) 2020 KeePassXC Team <team@keepassxc.org>
|
|
// Copyright (c) 2011 Felix Geyer <debfx@fobos.de>
|
|
|
|
#ifndef MONEROSERVICE_SETTINGS_H
|
|
#define MONEROSERVICE_SETTINGS_H
|
|
|
|
#include <QObject>
|
|
#include <QSettings>
|
|
#include <QPointer>
|
|
|
|
class Config : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
Q_DISABLE_COPY(Config)
|
|
|
|
enum ConfigKey
|
|
{
|
|
network,
|
|
pathToMonerod,
|
|
pruneBlockchain,
|
|
dataDir,
|
|
logLevel,
|
|
limitRateDown,
|
|
customStartupFlags,
|
|
noZeroMQ,
|
|
RPCBindIP,
|
|
RPCBindPort,
|
|
P2PBindIP,
|
|
P2PBindPort
|
|
};
|
|
|
|
~Config() override;
|
|
QVariant get(ConfigKey key);
|
|
QString getFileName();
|
|
void set(ConfigKey key, const QVariant& value);
|
|
void sync();
|
|
void resetToDefaults();
|
|
|
|
static Config* instance();
|
|
|
|
signals:
|
|
void changed(ConfigKey key);
|
|
|
|
private:
|
|
Config(const QString& fileName, QObject* parent = nullptr);
|
|
explicit Config(QObject* parent);
|
|
void init(const QString& configFileName);
|
|
|
|
static QPointer<Config> m_instance;
|
|
|
|
QScopedPointer<QSettings> m_settings;
|
|
QHash<QString, QVariant> m_defaults;
|
|
};
|
|
|
|
inline Config* config()
|
|
{
|
|
return Config::instance();
|
|
}
|
|
|
|
#endif //MONEROSERVICE_SETTINGS_H
|