mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-11 05:14:34 +00:00
progressBar redesign
This commit is contained in:
parent
31675f4c16
commit
b82a17aa97
1 changed files with 55 additions and 42 deletions
|
@ -29,15 +29,13 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import moneroComponents.Wallet 1.0
|
import moneroComponents.Wallet 1.0
|
||||||
|
|
||||||
Item {
|
Rectangle {
|
||||||
id: item
|
id: item
|
||||||
property int fillLevel: 0
|
property int fillLevel: 0
|
||||||
height: 22
|
|
||||||
anchors.margins:15
|
|
||||||
visible: false
|
visible: false
|
||||||
//clip: true
|
color: "#1C1C1C"
|
||||||
|
|
||||||
function updateProgress(currentBlock,targetBlock, blocksToSync){
|
function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){
|
||||||
if(targetBlock == 1) {
|
if(targetBlock == 1) {
|
||||||
fillLevel = 0
|
fillLevel = 0
|
||||||
progressText.text = qsTr("Establishing connection...");
|
progressText.text = qsTr("Establishing connection...");
|
||||||
|
@ -54,53 +52,68 @@ Item {
|
||||||
else
|
else
|
||||||
var progressLevel = (100*(currentBlock/targetBlock)).toFixed(0);
|
var progressLevel = (100*(currentBlock/targetBlock)).toFixed(0);
|
||||||
fillLevel = progressLevel
|
fillLevel = progressLevel
|
||||||
progressText.text = qsTr("Blocks remaining: %1").arg(remaining.toFixed(0));
|
if(typeof statusTxt != "undefined" && statusTxt != "") {
|
||||||
|
progressText.text = statusTxt + (" %1").arg(remaining.toFixed(0));
|
||||||
|
} else {
|
||||||
|
progressText.text = qsTr("Blocks remaining: %1").arg(remaining.toFixed(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
progressBar.visible = currentBlock < targetBlock
|
progressBar.visible = currentBlock < targetBlock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
id: bar
|
anchors.leftMargin: 15 * scaleRatio
|
||||||
anchors.left: parent.left
|
anchors.rightMargin: 15 * scaleRatio
|
||||||
anchors.right: parent.right
|
anchors.fill: parent
|
||||||
anchors.top: parent.top
|
|
||||||
height: 22
|
|
||||||
radius: 2
|
|
||||||
color: "#FFFFFF"
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: fillRect
|
id: bar
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
height: 22 * scaleRatio
|
||||||
anchors.left: parent.left
|
radius: 2 * scaleRatio
|
||||||
anchors.margins: 2
|
color: "#FFFFFF"
|
||||||
height: bar.height
|
|
||||||
property int maxWidth: parent.width - 4
|
|
||||||
width: (maxWidth * fillLevel) / 100
|
|
||||||
color: {
|
|
||||||
if(item.fillLevel < 99 ) return "#FF6C3C"
|
|
||||||
//if(item.fillLevel < 99) return "#FFE00A"
|
|
||||||
return "#36B25C"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
Rectangle {
|
||||||
|
id: fillRect
|
||||||
Rectangle {
|
anchors.top: parent.top
|
||||||
color:"#333"
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 8
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id:progressText
|
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
font.family: "Arial"
|
anchors.left: parent.left
|
||||||
font.pixelSize: 12
|
anchors.margins: 2 * scaleRatio
|
||||||
color: "#000"
|
height: bar.height
|
||||||
text: qsTr("Synchronizing blocks")
|
property int maxWidth: parent.width - 4 * scaleRatio
|
||||||
height:18
|
width: (maxWidth * fillLevel) / 100
|
||||||
|
color: {
|
||||||
|
if(item.fillLevel < 99 ) return "#FF6C3C"
|
||||||
|
//if(item.fillLevel < 99) return "#FFE00A"
|
||||||
|
return "#36B25C"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
color:"#333"
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 8 * scaleRatio
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id:progressText
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 12 * scaleRatio
|
||||||
|
color: "#000"
|
||||||
|
text: qsTr("Synchronizing blocks")
|
||||||
|
height:18 * scaleRatio
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue