Add estimated time countdown for locked balance

This commit is contained in:
Jaquee
2017-01-13 23:21:58 +01:00
parent 205bfcdd7b
commit ad5115ac3c
5 changed files with 49 additions and 12 deletions

View File

@@ -61,6 +61,10 @@ ApplicationWindow {
property int maxWindowHeight: (Screen.height < 900)? 720 : 800;
property bool daemonRunning: false
property alias toolTip: toolTip
property string walletName
property bool viewOnly: false
property bool foundNewBlock: false
property int timeToUnlock: 0
// true if wallet ever synchronized
property bool walletInitialized : false
@@ -293,6 +297,15 @@ ApplicationWindow {
console.log(">>> wallet updated")
middlePanel.unlockedBalanceText = leftPanel.unlockedBalanceText = walletManager.displayAmount(currentWallet.unlockedBalance);
middlePanel.balanceText = leftPanel.balanceText = walletManager.displayAmount(currentWallet.balance);
console.log("time to unlock: ", currentWallet.history.minutesToUnlock);
// Update history if new block found since last update and balance is locked.
if(foundNewBlock && currentWallet.history.locked) {
foundNewBlock = false;
console.log("New block found - updating history")
currentWallet.history.refresh()
timeToUnlock = currentWallet.history.minutesToUnlock
leftPanel.minutesToUnlockTxt = (timeToUnlock > 0)? qsTr("Unlocked balance (~%1 min)").arg(timeToUnlock) : qsTr("Unlocked balance");
}
}
function onWalletRefresh() {
@@ -337,13 +350,11 @@ ApplicationWindow {
}
}
// initialize transaction history once wallet is initializef first time;
if (!walletInitialized) {
currentWallet.history.refresh()
walletInitialized = true
}
}
onWalletUpdate();
}
@@ -370,7 +381,6 @@ ApplicationWindow {
function onWalletNewBlock(blockHeight) {
// Update progress bar
var currHeight = blockHeight
//fast refresh until restoreHeight is reached
@@ -380,10 +390,7 @@ ApplicationWindow {
splashCounter = currHeight
leftPanel.progressBar.updateProgress(currHeight,currentWallet.daemonBlockChainTargetHeight());
}
// Update num of confirmations on history page
// TODO: check performance on big wallets. Maybe no need to refresh full history?
currentWallet.history.refresh()
foundNewBlock = true;
}
function onWalletMoneyReceived(txId, amount) {
@@ -394,6 +401,7 @@ ApplicationWindow {
function onWalletUnconfirmedMoneyReceived(txId, amount) {
// refresh history
console.log("unconfirmed money found")
currentWallet.history.refresh()
}