Merge pull request #442

0b41fbc Don't close/reopen when changing daemon requires #1655 (Jaquee)
2586404 sync progress improvements (Jaquee)
eb909e1 async connectionStatus and init (Jaquee)
cb3281d WalletManager: fix possible race (Jaquee)
9dbbd4c WalletManager: check connection before isMining() (Jaquee)
This commit is contained in:
Riccardo Spagni
2017-02-04 17:46:57 +02:00
7 changed files with 96 additions and 45 deletions

View File

@@ -55,7 +55,6 @@ ApplicationWindow {
property var transaction;
property var transactionDescription;
property alias password : passwordDialog.password
property int splashCounter: 0
property bool isNewWallet: false
property int restoreHeight:0
property bool daemonSynced: false
@@ -265,10 +264,12 @@ ApplicationWindow {
return path.replace(/.*[\/\\]/, '').replace(/\.keys$/, '')
}
function onWalletConnectionStatusChanged(){
function onWalletConnectionStatusChanged(status){
console.log("Wallet connection status changed")
middlePanel.updateStatus();
}
leftPanel.networkStatus.connected = status
leftPanel.progressBar.visible = (status === Wallet.ConnectionStatus_Connected) && !daemonSynced
}
function onWalletOpened(wallet) {
walletName = usefulName(wallet.path)
@@ -310,7 +311,6 @@ 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;
@@ -336,11 +336,16 @@ ApplicationWindow {
// Daemon fully synced
// TODO: implement onDaemonSynced or similar in wallet API and don't start refresh thread before daemon is synced
daemonSynced = (currentWallet.connected != Wallet.ConnectionStatus_Disconnected && dCurrentBlock >= dTargetBlock)
daemonSynced = dCurrentBlock >= dTargetBlock
// Update daemon sync progress
leftPanel.progressBar.updateProgress(dCurrentBlock,dTargetBlock);
updateSyncing((currentWallet.connected !== Wallet.ConnectionStatus_Disconnected) && (dCurrentBlock < dTargetBlock))
leftPanel.progressBar.visible = !daemonSynced && currentWallet.connected !== Wallet.ConnectionStatus_Disconnected
// Update wallet sync progress
updateSyncing((currentWallet.connected !== Wallet.ConnectionStatus_Disconnected) && !daemonSynced)
// Update transfer page status
middlePanel.updateStatus();
// If wallet isnt connected and no daemon is running - Ask
if(currentWallet.connected === Wallet.ConnectionStatus_Disconnected && !daemonManager.running() && !walletInitialized){
daemonManagerDialog.open();
@@ -392,17 +397,10 @@ ApplicationWindow {
daemonRunning = false;
}
function onWalletNewBlock(blockHeight) {
// Update progress bar
var currHeight = blockHeight
//fast refresh until restoreHeight is reached
var increment = ((restoreHeight == 0) || currHeight < restoreHeight)? 1000 : 10
if(currHeight > splashCounter + increment){
splashCounter = currHeight
leftPanel.progressBar.updateProgress(currHeight,currentWallet.daemonBlockChainTargetHeight());
}
foundNewBlock = true;
function onWalletNewBlock(blockHeight, targetHeight) {
// Update progress bar
leftPanel.progressBar.updateProgress(blockHeight,targetHeight);
foundNewBlock = true;
}
function onWalletMoneyReceived(txId, amount) {
@@ -712,7 +710,6 @@ ApplicationWindow {
// close wallet and show wizard
function showWizard(){
walletInitialized = false;
splashCounter = 0;
closeWallet();
currentWallet = undefined;
wizard.restart();