1
mirror of https://github.com/monero-project/monero-gui synced 2024-12-25 01:53:43 +01:00

sync progress improvements

This commit is contained in:
Jaquee 2017-01-31 10:34:18 +01:00
parent eb909e1ae7
commit 2586404339
4 changed files with 17 additions and 21 deletions

View File

@ -42,7 +42,7 @@ Item {
var progressLevel = ((currentBlock/targetBlock) * 100).toFixed(0);
fillLevel = progressLevel
progressText.text = qsTr("Synchronizing blocks %1/%2").arg(currentBlock.toFixed(0)).arg(targetBlock.toFixed(0));
item.visible = (currentWallet.connected !== Wallet.ConnectionStatus_Disconnected) && (currentBlock < targetBlock)
progressBar.visible = currentBlock < targetBlock
}
}

View File

@ -54,7 +54,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
@ -261,10 +260,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)
@ -306,7 +307,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;
@ -332,11 +332,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();
@ -388,17 +393,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) {
@ -708,7 +706,6 @@ ApplicationWindow {
// close wallet and show wizard
function showWizard(){
walletInitialized = false;
splashCounter = 0;
closeWallet();
currentWallet = undefined;
wizard.restart();

View File

@ -655,7 +655,6 @@ Rectangle {
//TODO: enable send page when we're connected and daemon is synced
function updateStatus() {
console.log("updated transfer page status")
if(typeof currentWallet === "undefined") {
statusText.text = qsTr("Wallet is not connected to daemon.") + "<br>" + root.startLinkText
return;

View File

@ -127,9 +127,9 @@ void Wallet::updateConnectionStatusAsync()
Wallet::ConnectionStatus Wallet::connected(bool forceCheck)
{
qDebug() << "Checking connection status";
// cache connection status
if (forceCheck || !m_initialized || (m_connectionStatusTime.elapsed() / 1000 > m_connectionStatusTtl && !m_connectionStatusRunning) || m_connectionStatusTime.elapsed() > 30000) {
qDebug() << "Checking connection status";
m_connectionStatusRunning = true;
m_initialized = true;
m_connectionStatusTime.restart();