diff --git a/src/QR-Code-scanner/QrCodeScanner.cpp b/src/QR-Code-scanner/QrCodeScanner.cpp index 5aa2e336..1a1c57b8 100644 --- a/src/QR-Code-scanner/QrCodeScanner.cpp +++ b/src/QR-Code-scanner/QrCodeScanner.cpp @@ -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); } diff --git a/src/libwalletqt/TransactionInfo.cpp b/src/libwalletqt/TransactionInfo.cpp index 9c5094bb..2be9d0e9 100644 --- a/src/libwalletqt/TransactionInfo.cpp +++ b/src/libwalletqt/TransactionInfo.cpp @@ -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 += "
"; - destinations += WalletManager::instance()->displayAmount(t->amount()) + ": " + t->address(); + destinations += WalletManager::displayAmount(t->amount()) + ": " + t->address(); } return destinations; } diff --git a/src/libwalletqt/WalletManager.cpp b/src/libwalletqt/WalletManager.cpp index 62836149..90cdf26e 100644 --- a/src/libwalletqt/WalletManager.cpp +++ b/src/libwalletqt/WalletManager.cpp @@ -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 { diff --git a/src/libwalletqt/WalletManager.h b/src/libwalletqt/WalletManager.h index 3564ad61..013846fa 100644 --- a/src/libwalletqt/WalletManager.h +++ b/src/libwalletqt/WalletManager.h @@ -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;