2020-10-07 10:36:04 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2022-02-10 10:26:41 +00:00
|
|
|
// SPDX-FileCopyrightText: 2011 Felix Geyer <debfx@fobos.de>
|
|
|
|
// SPDX-FileCopyrightText: 2020 KeePassXC Team <team@keepassxc.org>
|
|
|
|
// SPDX-FileCopyrightText: 2020-2022 The Monero Project
|
2020-10-07 10:36:04 +00:00
|
|
|
|
2021-06-27 12:51:15 +00:00
|
|
|
#ifndef FEATHER_CONFIG_H
|
|
|
|
#define FEATHER_CONFIG_H
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QPointer>
|
2021-03-12 18:26:48 +00:00
|
|
|
#include <QDir>
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
class Config : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Q_DISABLE_COPY(Config)
|
|
|
|
|
|
|
|
enum ConfigKey
|
|
|
|
{
|
2021-05-26 13:14:53 +00:00
|
|
|
// General
|
2021-05-18 15:59:18 +00:00
|
|
|
firstRun,
|
2020-10-07 10:36:04 +00:00
|
|
|
warnOnStagenet,
|
|
|
|
warnOnTestnet,
|
2021-05-18 15:59:18 +00:00
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
homeWidget,
|
|
|
|
donateBeg,
|
2021-05-18 15:59:18 +00:00
|
|
|
showHistorySyncNotice,
|
|
|
|
|
|
|
|
geometry,
|
|
|
|
windowState,
|
|
|
|
GUI_HistoryViewState,
|
|
|
|
|
2021-05-26 13:14:53 +00:00
|
|
|
// Wallets
|
2021-05-18 15:59:18 +00:00
|
|
|
walletDirectory, // Directory where wallet files are stored
|
2020-10-07 10:36:04 +00:00
|
|
|
autoOpenWalletPath,
|
2021-05-18 15:59:18 +00:00
|
|
|
recentlyOpenedWallets,
|
|
|
|
|
2021-05-26 13:14:53 +00:00
|
|
|
// Nodes
|
2020-10-07 10:36:04 +00:00
|
|
|
nodes,
|
|
|
|
nodeSource,
|
|
|
|
useOnionNodes,
|
2021-05-18 15:59:18 +00:00
|
|
|
|
2021-05-26 13:14:53 +00:00
|
|
|
// Tabs
|
2020-12-30 04:45:00 +00:00
|
|
|
showTabHome,
|
2020-10-07 10:36:04 +00:00
|
|
|
showTabCoins,
|
2020-12-12 01:49:33 +00:00
|
|
|
showTabExchange,
|
2020-10-07 10:36:04 +00:00
|
|
|
showTabCalc,
|
2020-10-14 20:12:32 +00:00
|
|
|
showTabXMRig,
|
2021-05-23 14:58:18 +00:00
|
|
|
showSearchbar,
|
2021-05-18 15:59:18 +00:00
|
|
|
|
2021-05-26 13:14:53 +00:00
|
|
|
// Mining
|
2021-10-12 12:45:06 +00:00
|
|
|
miningMode,
|
2021-05-18 15:59:18 +00:00
|
|
|
xmrigPath,
|
2021-10-12 12:45:06 +00:00
|
|
|
xmrigElevated,
|
|
|
|
xmrigThreads,
|
2021-05-18 15:59:18 +00:00
|
|
|
xmrigPool,
|
2021-10-12 12:45:06 +00:00
|
|
|
xmrigNetworkTLS,
|
|
|
|
xmrigNetworkTor,
|
2021-07-07 17:11:12 +00:00
|
|
|
pools,
|
2021-05-18 15:59:18 +00:00
|
|
|
|
2021-05-26 13:14:53 +00:00
|
|
|
// Settings
|
2021-05-18 15:59:18 +00:00
|
|
|
preferredFiatCurrency,
|
|
|
|
skin,
|
2021-03-12 18:26:48 +00:00
|
|
|
amountPrecision,
|
2021-03-14 21:12:02 +00:00
|
|
|
dateFormat,
|
2021-03-16 03:17:01 +00:00
|
|
|
timeFormat,
|
2021-05-22 14:12:39 +00:00
|
|
|
balanceDisplay,
|
2021-05-18 15:59:18 +00:00
|
|
|
|
2021-05-02 18:22:38 +00:00
|
|
|
multiBroadcast,
|
2021-05-18 15:59:18 +00:00
|
|
|
warnOnExternalLink,
|
|
|
|
hideBalance,
|
|
|
|
|
|
|
|
blockExplorer,
|
|
|
|
redditFrontend,
|
|
|
|
localMoneroFrontend,
|
|
|
|
|
2021-05-26 13:14:53 +00:00
|
|
|
fiatSymbols,
|
|
|
|
cryptoSymbols,
|
|
|
|
|
|
|
|
// Tor
|
2021-05-02 18:22:38 +00:00
|
|
|
torPrivacyLevel,
|
|
|
|
socks5Host,
|
|
|
|
socks5Port,
|
|
|
|
socks5User,
|
|
|
|
socks5Pass,
|
|
|
|
useLocalTor, // Prevents Feather from starting bundled Tor daemon
|
2021-05-24 15:20:19 +00:00
|
|
|
initSyncThreshold
|
2021-05-02 18:22:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum PrivacyLevel {
|
|
|
|
allTorExceptNode = 0,
|
|
|
|
allTorExceptInitSync,
|
|
|
|
allTor
|
2020-10-07 10:36:04 +00:00
|
|
|
};
|
|
|
|
|
2021-05-22 14:12:39 +00:00
|
|
|
enum BalanceDisplay {
|
|
|
|
totalBalance = 0,
|
|
|
|
spendablePlusUnconfirmed,
|
|
|
|
spendable
|
|
|
|
};
|
|
|
|
|
2021-10-12 12:45:06 +00:00
|
|
|
enum MiningMode {
|
|
|
|
Pool = 0,
|
|
|
|
Solo
|
|
|
|
};
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
~Config() override;
|
|
|
|
QVariant get(ConfigKey key);
|
|
|
|
QString getFileName();
|
|
|
|
void set(ConfigKey key, const QVariant& value);
|
2021-07-08 12:03:54 +00:00
|
|
|
void remove(ConfigKey key);
|
2020-10-07 10:36:04 +00:00
|
|
|
void sync();
|
|
|
|
void resetToDefaults();
|
|
|
|
|
2021-03-12 18:26:48 +00:00
|
|
|
static QDir defaultConfigDir();
|
|
|
|
static QDir defaultPortableConfigDir();
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
static Config* instance();
|
|
|
|
|
|
|
|
signals:
|
2021-05-02 18:22:38 +00:00
|
|
|
void changed(Config::ConfigKey key);
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2021-06-27 12:51:15 +00:00
|
|
|
#endif //FEATHER_CONFIG_H
|