feather/src/utils/config.h

213 lines
4.2 KiB
C
Raw Normal View History

// 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>
2024-01-01 17:07:58 +00:00
// SPDX-FileCopyrightText: 2020-2024 The Monero Project
2021-06-27 12:51:15 +00:00
#ifndef FEATHER_CONFIG_H
#define FEATHER_CONFIG_H
#include <QObject>
#include <QSettings>
#include <QPointer>
2021-03-12 18:26:48 +00:00
#include <QDir>
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,
warnOnStagenet,
warnOnTestnet,
2023-12-02 18:28:31 +00:00
warnOnKiImport,
2021-05-18 15:59:18 +00:00
homeWidget,
donateBeg,
2021-05-18 15:59:18 +00:00
showHistorySyncNotice,
geometry,
windowState,
GUI_HistoryViewState,
2023-12-02 18:28:31 +00:00
geometryOTSWizard,
2021-05-18 15:59:18 +00:00
2021-05-26 13:14:53 +00:00
// Wallets
2021-05-18 15:59:18 +00:00
walletDirectory, // Directory where wallet files are stored
autoOpenWalletPath,
2021-05-18 15:59:18 +00:00
recentlyOpenedWallets,
2021-05-26 13:14:53 +00:00
// Nodes
nodes,
nodeSource,
useOnionNodes,
2021-05-18 15:59:18 +00:00
2021-05-26 13:14:53 +00:00
// Tabs
2023-11-30 14:01:39 +00:00
enabledTabs,
2021-05-23 14:58:18 +00:00
showSearchbar,
2023-12-30 15:46:14 +00:00
// History
historyShowFullTxid,
2023-11-16 15:26:58 +00:00
// Receive
showUsedAddresses,
showHiddenAddresses,
showFullAddresses,
showChangeAddresses,
showAddressIndex,
showAddressLabels,
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,
xmrigDaemon,
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
2022-03-11 13:56:07 +00:00
lastSettingsPage,
2023-02-11 17:11:21 +00:00
// Appearance
2021-05-18 15:59:18 +00:00
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,
2023-02-11 17:11:21 +00:00
preferredFiatCurrency,
// Network -> Proxy
proxy,
socks5Host,
socks5Port,
socks5User,
socks5Pass,
useLocalTor, // Prevents Feather from starting bundled Tor daemon
torOnlyAllowOnion,
torPrivacyLevel, // Tor node network traffic strategy
torManagedPort, // Port for managed Tor daemon
initSyncThreshold, // Switch to Tor after initial sync threshold blocks
// Network -> Websocket
2022-03-04 21:55:29 +00:00
disableWebsocket,
2023-02-11 17:11:21 +00:00
// Network -> Offline
2022-03-14 21:36:58 +00:00
offlineMode,
2021-05-18 15:59:18 +00:00
2023-02-11 17:11:21 +00:00
// Storage -> Logging
writeStackTraceToDisk,
disableLogging,
2023-02-11 17:11:21 +00:00
logLevel,
// Storage -> Misc
writeRecentlyOpenedWallets,
// Display
hideBalance,
hideUpdateNotifications,
hideNotifications,
2023-02-11 17:11:21 +00:00
warnOnExternalLink,
inactivityLockEnabled,
inactivityLockTimeout,
lockOnMinimize,
// Transactions
multiBroadcast,
2023-12-02 18:28:31 +00:00
offlineTxSigningMethod,
offlineTxSigningForceKISync,
2021-05-18 15:59:18 +00:00
2023-02-11 17:11:21 +00:00
// Misc
2021-05-18 15:59:18 +00:00
blockExplorer,
redditFrontend,
localMoneroFrontend,
2023-02-11 17:11:21 +00:00
bountiesFrontend, // unused
2023-12-02 18:28:31 +00:00
lastPath,
// UR
URmsPerFragment,
URfragmentLength,
URfountainCode,
// Camera
cameraManualExposure,
cameraExposureTime,
2021-05-18 15:59:18 +00:00
2021-05-26 13:14:53 +00:00
fiatSymbols,
cryptoSymbols,
2023-11-30 14:01:39 +00:00
enabledPlugins,
restartRequired,
// Tickers
tickers,
tickersShowFiatBalance,
2021-05-02 18:22:38 +00:00
};
enum PrivacyLevel {
allTorExceptNode = 0,
allTorExceptInitSync,
allTor
};
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
};
2023-02-11 17:11:21 +00:00
enum Proxy {
None = 0,
Tor,
i2p,
socks5
};
2023-12-02 18:28:31 +00:00
enum OTSMethod {
UnifiedResources = 0,
FileTransfer
};
~Config() override;
QVariant get(ConfigKey key);
QString getFileName();
void set(ConfigKey key, const QVariant& value);
void remove(ConfigKey key);
void sync();
void resetToDefaults();
2021-03-12 18:26:48 +00:00
static QDir defaultConfigDir();
static Config* instance();
signals:
2021-05-02 18:22:38 +00:00
void changed(Config::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* conf()
{
return Config::instance();
}
2021-06-27 12:51:15 +00:00
#endif //FEATHER_CONFIG_H