mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 03:59:38 +00:00
Merge pull request #2881
487e706
Improved daemon sync progress bar (rbrunner7)
This commit is contained in:
commit
38612c1285
2 changed files with 10 additions and 2 deletions
|
@ -42,7 +42,7 @@ Rectangle {
|
|||
function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){
|
||||
if(targetBlock > 0) {
|
||||
var remaining = (currentBlock < targetBlock) ? targetBlock - currentBlock : 0
|
||||
var progressLevel = (blocksToSync > 0 && blocksToSync != remaining) ? (100*(blocksToSync - remaining)/blocksToSync).toFixed(0) : (100*(currentBlock / targetBlock)).toFixed(0)
|
||||
var progressLevel = (blocksToSync > 0 ) ? (100*(blocksToSync - remaining)/blocksToSync).toFixed(0) : 100
|
||||
fillLevel = progressLevel
|
||||
if(typeof statusTxt != "undefined" && statusTxt != "") {
|
||||
progressText.text = statusTxt;
|
||||
|
|
10
main.qml
10
main.qml
|
@ -73,6 +73,7 @@ ApplicationWindow {
|
|||
property bool foundNewBlock: false
|
||||
property bool qrScannerEnabled: (typeof builtWithScanner != "undefined") && builtWithScanner
|
||||
property int blocksToSync: 1
|
||||
property int firstBlockSeen
|
||||
property bool isMining: false
|
||||
property int walletMode: persistentSettings.walletMode
|
||||
property var cameraUi
|
||||
|
@ -470,6 +471,9 @@ ApplicationWindow {
|
|||
console.log("Wallet connection status changed " + status)
|
||||
middlePanel.updateStatus();
|
||||
leftPanel.networkStatus.connected = status
|
||||
if (status == Wallet.ConnectionStatus_Disconnected) {
|
||||
firstBlockSeen = 0;
|
||||
}
|
||||
|
||||
// Update fee multiplier dropdown on transfer page
|
||||
middlePanel.transferView.updatePriorityDropdown();
|
||||
|
@ -609,18 +613,22 @@ ApplicationWindow {
|
|||
currentDaemonAddress = localDaemonAddress
|
||||
currentWallet.initAsync(currentDaemonAddress, isTrustedDaemon());
|
||||
walletManager.setDaemonAddressAsync(currentDaemonAddress);
|
||||
firstBlockSeen = 0;
|
||||
}
|
||||
|
||||
function onHeightRefreshed(bcHeight, dCurrentBlock, dTargetBlock) {
|
||||
// Daemon fully synced
|
||||
// TODO: implement onDaemonSynced or similar in wallet API and don't start refresh thread before daemon is synced
|
||||
// targetBlock = currentBlock = 1 before network connection is established.
|
||||
if (firstBlockSeen == 0 && dTargetBlock != 1) {
|
||||
firstBlockSeen = dCurrentBlock;
|
||||
}
|
||||
daemonSynced = dCurrentBlock >= dTargetBlock && dTargetBlock != 1
|
||||
walletSynced = bcHeight >= dTargetBlock
|
||||
|
||||
// Update progress bars
|
||||
if(!daemonSynced) {
|
||||
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock, dTargetBlock-dCurrentBlock);
|
||||
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock, dTargetBlock-firstBlockSeen);
|
||||
leftPanel.progressBar.updateProgress(0,dTargetBlock, dTargetBlock, qsTr("Waiting for daemon to sync"));
|
||||
} else {
|
||||
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock, 0, qsTr("Daemon is synchronized (%1)").arg(dCurrentBlock.toFixed(0)));
|
||||
|
|
Loading…
Reference in a new issue