mirror of
https://github.com/monero-project/monero-gui
synced 2024-11-25 10:47:19 +01:00
wallet sync: progressbar ui improvements
This commit is contained in:
parent
2d6ddf043e
commit
3adeab87ed
@ -37,7 +37,7 @@ Item {
|
||||
visible: false
|
||||
//clip: true
|
||||
|
||||
function updateProgress(currentBlock,targetBlock){
|
||||
function updateProgress(currentBlock,targetBlock, blocksToSync){
|
||||
if(targetBlock == 1) {
|
||||
fillLevel = 0
|
||||
progressText.text = qsTr("Establishing connection...");
|
||||
@ -46,9 +46,15 @@ Item {
|
||||
}
|
||||
|
||||
if(targetBlock > 0) {
|
||||
var progressLevel = ((currentBlock/targetBlock) * 100).toFixed(0);
|
||||
var remaining = targetBlock - currentBlock
|
||||
// wallet sync
|
||||
if(blocksToSync > 0)
|
||||
var progressLevel = (100*(blocksToSync - remaining)/blocksToSync).toFixed(0);
|
||||
// Daemon sync
|
||||
else
|
||||
var progressLevel = (100*(currentBlock/targetBlock)).toFixed(0);
|
||||
fillLevel = progressLevel
|
||||
progressText.text = qsTr("Synchronizing blocks %1/%2").arg(currentBlock.toFixed(0)).arg(targetBlock.toFixed(0));
|
||||
progressText.text = qsTr("Blocks remaining: %1").arg(remaining.toFixed(0));
|
||||
progressBar.visible = currentBlock < targetBlock
|
||||
}
|
||||
}
|
||||
|
8
main.qml
8
main.qml
@ -66,6 +66,7 @@ ApplicationWindow {
|
||||
property bool foundNewBlock: false
|
||||
property int timeToUnlock: 0
|
||||
property bool qrScannerEnabled: builtWithScanner && (QtMultimedia.availableCameras.length > 0)
|
||||
property int blocksToSync: 1
|
||||
|
||||
// true if wallet ever synchronized
|
||||
property bool walletInitialized : false
|
||||
@ -408,7 +409,12 @@ ApplicationWindow {
|
||||
|
||||
function onWalletNewBlock(blockHeight, targetHeight) {
|
||||
// Update progress bar
|
||||
leftPanel.progressBar.updateProgress(blockHeight,targetHeight);
|
||||
var remaining = targetHeight - blockHeight;
|
||||
if(blocksToSync < remaining) {
|
||||
blocksToSync = remaining;
|
||||
}
|
||||
|
||||
leftPanel.progressBar.updateProgress(blockHeight,targetHeight, blocksToSync);
|
||||
foundNewBlock = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user