mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-09 12:30:10 +00:00
Balance on UI updated by the signal
This commit is contained in:
parent
eaf59243b2
commit
8ac86a8042
3 changed files with 20 additions and 1 deletions
12
main.qml
12
main.qml
|
@ -142,10 +142,19 @@ ApplicationWindow {
|
||||||
console.log("Error initialize wallet: ", wallet.errorString);
|
console.log("Error initialize wallet: ", wallet.errorString);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// subscribing for wallet updates
|
||||||
|
wallet.updated.connect(onWalletUpdate);
|
||||||
|
|
||||||
// TODO: refresh asynchronously without blocking UI, implement signal(s)
|
// TODO: refresh asynchronously without blocking UI, implement signal(s)
|
||||||
wallet.refresh();
|
wallet.refresh();
|
||||||
|
|
||||||
console.log("wallet balance: ", wallet.balance)
|
console.log("wallet balance: ", wallet.balance)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function onWalletUpdate() {
|
||||||
|
console.log("wallet updated")
|
||||||
leftPanel.unlockedBalanceText = walletManager.displayAmount(wallet.unlockedBalance);
|
leftPanel.unlockedBalanceText = walletManager.displayAmount(wallet.unlockedBalance);
|
||||||
leftPanel.balanceText = walletManager.displayAmount(wallet.balance);
|
leftPanel.balanceText = walletManager.displayAmount(wallet.balance);
|
||||||
}
|
}
|
||||||
|
@ -176,8 +185,11 @@ ApplicationWindow {
|
||||||
+ ", fee: " + walletManager.displayAmount(pendingTransaction.fee));
|
+ ", fee: " + walletManager.displayAmount(pendingTransaction.fee));
|
||||||
if (!pendingTransaction.commit()) {
|
if (!pendingTransaction.commit()) {
|
||||||
console.log("Error committing transaction: " + pendingTransaction.errorString);
|
console.log("Error committing transaction: " + pendingTransaction.errorString);
|
||||||
|
} else {
|
||||||
|
wallet.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wallet.disposeTransaction(pendingTransaction);
|
wallet.disposeTransaction(pendingTransaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -81,7 +82,10 @@ quint64 Wallet::unlockedBalance() const
|
||||||
|
|
||||||
bool Wallet::refresh()
|
bool Wallet::refresh()
|
||||||
{
|
{
|
||||||
return m_walletImpl->refresh();
|
bool result = m_walletImpl->refresh();
|
||||||
|
if (result)
|
||||||
|
emit updated();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PendingTransaction *Wallet::createTransaction(const QString &dst_addr, quint64 amount)
|
PendingTransaction *Wallet::createTransaction(const QString &dst_addr, quint64 amount)
|
||||||
|
|
|
@ -85,6 +85,9 @@ public:
|
||||||
TransactionHistory * history();
|
TransactionHistory * history();
|
||||||
|
|
||||||
// TODO: setListenter() when it implemented in API
|
// TODO: setListenter() when it implemented in API
|
||||||
|
signals:
|
||||||
|
void updated();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Wallet(Bitmonero::Wallet *w, QObject * parent = 0);
|
Wallet(Bitmonero::Wallet *w, QObject * parent = 0);
|
||||||
|
|
Loading…
Reference in a new issue