progress bar improvements

This commit is contained in:
Jaquee
2018-03-20 19:19:30 +01:00
parent da0155e260
commit ee6dd2ec56
2 changed files with 21 additions and 17 deletions

View File

@@ -37,27 +37,16 @@ Rectangle {
color: "#1C1C1C"
function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){
if(targetBlock == 1) {
fillLevel = 0
progressText.text = qsTr("Establishing connection...");
progressBar.visible = true
return
}
if(targetBlock > 0) {
var remaining = (currentBlock < targetBlock) ? targetBlock - currentBlock : 0
var progressLevel = (blocksToSync > 0) ? (100*(blocksToSync - remaining)/blocksToSync).toFixed(0) : 100
var progressLevel = (blocksToSync > 0 && blocksToSync != remaining) ? (100*(blocksToSync - remaining)/blocksToSync).toFixed(0) : 100*(currentBlock / targetBlock).toFixed(0)
fillLevel = progressLevel
if(typeof statusTxt != "undefined" && statusTxt != "") {
progressText.text = statusTxt;
} else {
progressText.text = syncText + remaining.toFixed(0);
}
}
if(remaining == 0 && (typeof statusTxt == "undefined" || statusTxt == ""))
progressText.text = qsTr("%1 is synchronized").arg(syncType)
}
Item {