WalletManager: displayAmount should be static

This commit is contained in:
xiphon 2020-07-14 15:44:13 +00:00
parent b7b1221221
commit 2fd3974194
4 changed files with 7 additions and 7 deletions

View file

@ -75,7 +75,7 @@ void QrCodeScanner::processCode(int type, const QString &data)
emit notifyError(error, true);
}
qDebug() << "Parsed URI : " << address << " " << payment_id << " " << amount << " " << tx_description << " " << recipient_name << " " << error;
QString s_amount = WalletManager::instance()->displayAmount(amount);
QString s_amount = WalletManager::displayAmount(amount);
qDebug() << "Amount passed " << s_amount ;
emit decoded(address, payment_id, s_amount, tx_description, recipient_name, parsed_unknown_parameters);
}

View file

@ -61,14 +61,14 @@ quint64 TransactionInfo::atomicAmount() const
QString TransactionInfo::displayAmount() const
{
return WalletManager::instance()->displayAmount(m_amount);
return WalletManager::displayAmount(m_amount);
}
QString TransactionInfo::fee() const
{
if(m_fee == 0)
return "";
return WalletManager::instance()->displayAmount(m_fee);
return WalletManager::displayAmount(m_fee);
}
quint64 TransactionInfo::blockHeight() const
@ -132,7 +132,7 @@ QString TransactionInfo::destinations_formatted() const
for (auto const& t: m_transfers) {
if (!destinations.isEmpty())
destinations += "<br> ";
destinations += WalletManager::instance()->displayAmount(t->amount()) + ": " + t->address();
destinations += WalletManager::displayAmount(t->amount()) + ": " + t->address();
}
return destinations;
}

View file

@ -272,7 +272,7 @@ QString WalletManager::maximumAllowedAmountAsString() const
return WalletManager::displayAmount(WalletManager::maximumAllowedAmount());
}
QString WalletManager::displayAmount(quint64 amount) const
QString WalletManager::displayAmount(quint64 amount)
{
return QString::fromStdString(Monero::Wallet::displayAmount(amount));
}
@ -415,7 +415,7 @@ QVariantMap WalletManager::parse_uri_to_object(const QString &uri) const
if (this->parse_uri(uri, address, payment_id, amount, tx_description, recipient_name, unknown_parameters, error)) {
result.insert("address", address);
result.insert("payment_id", payment_id);
result.insert("amount", amount > 0 ? this->displayAmount(amount) : "");
result.insert("amount", amount > 0 ? displayAmount(amount) : "");
result.insert("tx_description", tx_description);
result.insert("recipient_name", recipient_name);
} else {

View file

@ -129,7 +129,7 @@ public:
Q_INVOKABLE QString errorString() const;
//! since we can't call static method from QML, move it to this class
Q_INVOKABLE QString displayAmount(quint64 amount) const;
Q_INVOKABLE static QString displayAmount(quint64 amount);
Q_INVOKABLE quint64 amountFromString(const QString &amount) const;
Q_INVOKABLE quint64 amountFromDouble(double amount) const;
Q_INVOKABLE quint64 maximumAllowedAmount() const;