From 705bc83ae1aa0b808e99c714887b05ad1e5c0f70 Mon Sep 17 00:00:00 2001 From: Jaquee Date: Wed, 14 Dec 2016 13:48:12 +0100 Subject: [PATCH] move refresh progress to leftpanel --- LeftPanel.qml | 8 ++++---- .../{DaemonProgress.qml => ProgressBar.qml} | 5 ----- main.qml | 15 +++++---------- qml.qrc | 2 +- 4 files changed, 10 insertions(+), 20 deletions(-) rename components/{DaemonProgress.qml => ProgressBar.qml} (96%) diff --git a/LeftPanel.qml b/LeftPanel.qml index 89665f59..b1bb1d49 100644 --- a/LeftPanel.qml +++ b/LeftPanel.qml @@ -37,7 +37,7 @@ Rectangle { property alias unlockedBalanceText: unlockedBalanceText.text property alias balanceText: balanceText.text property alias networkStatus : networkStatus - property alias daemonProgress : daemonProgress + property alias progressBar : progressBar signal dashboardClicked() signal historyClicked() @@ -408,12 +408,12 @@ Rectangle { id: networkStatus anchors.left: parent.left anchors.right: parent.right - anchors.bottom: (daemonProgress.visible)? daemonProgress.top : parent.bottom; + anchors.bottom: (progressBar.visible)? progressBar.top : parent.bottom; connected: Wallet.ConnectionStatus_Disconnected } - DaemonProgress { - id: daemonProgress + ProgressBar { + id: progressBar anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/components/DaemonProgress.qml b/components/ProgressBar.qml similarity index 96% rename from components/DaemonProgress.qml rename to components/ProgressBar.qml index 53a2f5c7..33f2c585 100644 --- a/components/DaemonProgress.qml +++ b/components/ProgressBar.qml @@ -41,13 +41,8 @@ Item { if(targetBlock > 0) { var progressLevel = ((currentBlock/targetBlock) * 100).toFixed(0); fillLevel = progressLevel - console.log("target block: ",progressLevel) progressText.text = qsTr("Synchronizing blocks %1/%2").arg(currentBlock.toFixed(0)).arg(targetBlock.toFixed(0)); - - // TODO: lower daemon block height cache, ttl and refresh interval? - item.visible = (currentWallet.connected !== Wallet.ConnectionStatus_Disconnected) && (currentBlock < targetBlock) - } } diff --git a/main.qml b/main.qml index a601596c..72fe7e4d 100644 --- a/main.qml +++ b/main.qml @@ -300,7 +300,7 @@ 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) - leftPanel.daemonProgress.updateProgress(dCurrentBlock,dTargetBlock); + leftPanel.progressBar.updateProgress(dCurrentBlock,dTargetBlock); middlePanel.updateStatus(); // If wallet isnt connected and no daemon is running - Ask @@ -351,27 +351,22 @@ ApplicationWindow { } function onDaemonStopped(){ console.log("daemon stopped"); + hideProcessingSplash(); daemonRunning = false; } function onWalletNewBlock(blockHeight) { - if (splash.visible) { - var currHeight = 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 - var locale = Qt.locale() - var currHeightString = currHeight.toLocaleString(locale,"f",0) - var targetHeightString = currentWallet.daemonBlockChainTargetHeight().toLocaleString(locale,"f",0) - var progressText = qsTr("Synchronizing blocks %1 / %2").arg(currHeightString).arg(targetHeightString); - console.log("Progress text: " + progressText); - splash.heightProgressText = progressText + leftPanel.progressBar.updateProgress(currHeight,currentWallet.daemonBlockChainTargetHeight()); } - } } function onWalletMoneyReceived(txId, amount) { diff --git a/qml.qrc b/qml.qrc index c1aa0ece..b15f58a0 100644 --- a/qml.qrc +++ b/qml.qrc @@ -117,7 +117,7 @@ lang/flags/italy.png components/PasswordDialog.qml components/ProcessingSplash.qml - components/DaemonProgress.qml + components/ProgressBar.qml components/StandardDialog.qml pages/Sign.qml components/DaemonManagerDialog.qml