Calc: configure crypto/fiat symbols

This commit is contained in:
tobtoht
2021-05-26 15:14:53 +02:00
parent 8e663d4a18
commit bf533ddfaa
10 changed files with 515 additions and 151 deletions
+3
View File
@@ -68,6 +68,9 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::redditFrontend, {QS("redditFrontend"), "old.reddit.com"}},
{Config::localMoneroFrontend, {QS("localMoneroFrontend"), "https://localmonero.co"}},
{Config::fiatSymbols, {QS("fiatSymbols"), QStringList{"USD", "EUR", "GBP", "CAD", "AUD", "RUB"}}},
{Config::cryptoSymbols, {QS("cryptoSymbols"), QStringList{"BTC", "ETH", "LTC", "XMR", "ZEC"}}},
// Tor
{Config::torPrivacyLevel, {QS("torPrivacyLevel"), 1}},
{Config::socks5Host, {QS("socks5Host"), "127.0.0.1"}},
+10
View File
@@ -20,6 +20,7 @@ public:
enum ConfigKey
{
// General
firstRun,
warnOnStagenet,
warnOnTestnet,
@@ -33,14 +34,17 @@ public:
windowState,
GUI_HistoryViewState,
// Wallets
walletDirectory, // Directory where wallet files are stored
autoOpenWalletPath,
recentlyOpenedWallets,
// Nodes
nodes,
nodeSource,
useOnionNodes,
// Tabs
showTabHome,
showTabCoins,
showTabExchange,
@@ -48,9 +52,11 @@ public:
showTabXMRig,
showSearchbar,
// Mining
xmrigPath,
xmrigPool,
// Settings
preferredFiatCurrency,
skin,
amountPrecision,
@@ -66,6 +72,10 @@ public:
redditFrontend,
localMoneroFrontend,
fiatSymbols,
cryptoSymbols,
// Tor
torPrivacyLevel,
socks5Host,
socks5Port,
+5 -6
View File
@@ -3,9 +3,9 @@
#include "utils/prices.h"
Prices::Prices(QObject *parent) : QObject(parent) {
this->rates = QMap<QString, double>();
this->markets = QMap<QString, marketStruct>();
Prices::Prices(QObject *parent)
: QObject(parent)
{
}
void Prices::cryptoPricesReceived(const QJsonArray &data) {
@@ -30,9 +30,8 @@ void Prices::cryptoPricesReceived(const QJsonArray &data) {
void Prices::fiatPricesReceived(const QJsonObject &data) {
QJsonObject ratesData = data.value("rates").toObject();
for (const auto &currency : ratesData) {
QString currencyStr = currency.toString();
this->rates.insert(currencyStr, ratesData.value(currencyStr).toDouble());
for (const auto &currency : ratesData.keys()) {
this->rates.insert(currency, ratesData.value(currency).toDouble());
}
emit fiatPricesUpdated();
}