progressBar redesign

This commit is contained in:
Jaquee 2017-08-08 10:44:11 +02:00
parent 31675f4c16
commit b82a17aa97

View File

@ -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,18 +52,29 @@ Item {
else else
var progressLevel = (100*(currentBlock/targetBlock)).toFixed(0); var progressLevel = (100*(currentBlock/targetBlock)).toFixed(0);
fillLevel = progressLevel fillLevel = progressLevel
if(typeof statusTxt != "undefined" && statusTxt != "") {
progressText.text = statusTxt + (" %1").arg(remaining.toFixed(0));
} else {
progressText.text = qsTr("Blocks remaining: %1").arg(remaining.toFixed(0)); progressText.text = qsTr("Blocks remaining: %1").arg(remaining.toFixed(0));
}
progressBar.visible = currentBlock < targetBlock progressBar.visible = currentBlock < targetBlock
} }
} }
Item {
anchors.leftMargin: 15 * scaleRatio
anchors.rightMargin: 15 * scaleRatio
anchors.fill: parent
Rectangle { Rectangle {
id: bar id: bar
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
height: 22 height: 22 * scaleRatio
radius: 2 radius: 2 * scaleRatio
color: "#FFFFFF" color: "#FFFFFF"
Rectangle { Rectangle {
@ -73,9 +82,9 @@ Item {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.margins: 2 anchors.margins: 2 * scaleRatio
height: bar.height height: bar.height
property int maxWidth: parent.width - 4 property int maxWidth: parent.width - 4 * scaleRatio
width: (maxWidth * fillLevel) / 100 width: (maxWidth * fillLevel) / 100
color: { color: {
if(item.fillLevel < 99 ) return "#FF6C3C" if(item.fillLevel < 99 ) return "#FF6C3C"
@ -89,18 +98,22 @@ Item {
color:"#333" color:"#333"
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 8 anchors.leftMargin: 8 * scaleRatio
Text { Text {
id:progressText id:progressText
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
font.family: "Arial" font.family: "Arial"
font.pixelSize: 12 font.pixelSize: 12 * scaleRatio
color: "#000" color: "#000"
text: qsTr("Synchronizing blocks") text: qsTr("Synchronizing blocks")
height:18 height:18 * scaleRatio
} }
} }
} }
} }
}