ProgressBar: hide progress bar when sync is completed; add tooltips; display wallet restore height

This commit is contained in:
rating89us 2021-08-05 21:43:52 +02:00 committed by rating89us
parent 51828babbb
commit c85b0a2e0d
3 changed files with 76 additions and 33 deletions

View file

@ -213,7 +213,7 @@ Rectangle {
MoneroComponents.Label {
fontSize: 16
visible: isSyncing
visible: isSyncing || progressBar.bar.visible
text: qsTr("Syncing...") + translationManager.emptyString
color: MoneroComponents.Style.blackTheme ? "white" : "black"
anchors.left: parent.left
@ -525,9 +525,9 @@ Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: daemonProgressBar.top
height: 48
anchors.bottomMargin: 6
syncType: qsTr("Wallet") + translationManager.emptyString
visible: !appWindow.disconnected
visible: !appWindow.disconnected && !daemonProgressBar.isSynchronizing
}
MoneroComponents.ProgressBar {
@ -535,9 +535,9 @@ Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: networkStatus.top
syncType: qsTr("Daemon") + translationManager.emptyString
anchors.bottomMargin: 6
syncType: qsTr("Node") + translationManager.emptyString
visible: !appWindow.disconnected
height: 62
}
MoneroComponents.NetworkStatusItem {

View file

@ -35,8 +35,9 @@ Rectangle {
id: item
property int fillLevel: 0
property string syncType // Wallet or Daemon
property string syncText: qsTr("%1 blocks remaining: ").arg(syncType)
visible: false
property alias bar: bar
property bool isSynchronizing: true
height: progressText.height + (bar.visible ? 20 : 0)
color: "transparent"
function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){
@ -46,43 +47,76 @@ Rectangle {
fillLevel = progressLevel
if(typeof statusTxt != "undefined" && statusTxt != "") {
progressText.text = statusTxt;
progressTextValue.text = "";
bar.visible = false;
item.isSynchronizing = false;
} else {
progressText.text = syncText;
progressTextValue.text = remaining.toFixed(0);
progressText.text = qsTr("%1: synchronizing. Blocks remaining: %2").arg(syncType).arg(remaining.toFixed(0));
bar.visible = true;
item.isSynchronizing = true;
}
}
}
Item {
anchors.top: item.top
anchors.topMargin: 10
Rectangle {
anchors.topMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 15
anchors.rightMargin: 15
anchors.fill: parent
color: "transparent"
MoneroComponents.TextPlain {
id: progressText
anchors.top: parent.top
anchors.topMargin: 6
anchors.topMargin: 0
font.family: MoneroComponents.Style.fontMedium.name
font.pixelSize: 13
font.bold: MoneroComponents.Style.progressBarProgressTextBold
color: MoneroComponents.Style.defaultFontColor
text: qsTr("Synchronizing %1").arg(syncType) + translationManager.emptyString
font.pixelSize: 12
color: MoneroComponents.Style.blackTheme ? MoneroComponents.Style.dimmedFontColor : MoneroComponents.Style.defaultFontColor
opacity: MoneroComponents.Style.blackTheme ? 0.65 : 0.75
text: qsTr("%1: synchronizing").arg(syncType) + translationManager.emptyString
height: 18
tooltip: {
if (syncType == qsTr("Node")) {
if (persistentSettings.useRemoteNode) {
if (item.isSynchronizing) {
return qsTr("Checking remote node synchronization") + translationManager.emptyString;
} else if (!item.isSynchronizing && appWindow.currentBlockHeight != 0) {
return qsTr("The remote node is synchronized and the last block received was block #") + appWindow.currentBlockHeight + translationManager.emptyString;
} else if (!item.isSynchronizing) {
return qsTr("Your wallet is connected to a remote node that is synchronized") + translationManager.emptyString;
}
} else if (!persistentSettings.useRemoteNode) {
if (item.isSynchronizing) {
return qsTr("Your local node is downloading the blockchain") + translationManager.emptyString;
} else if (!item.isSynchronizing && appWindow.currentBlockHeight != 0) {
return qsTr("Your local node is synchronized and the last block received was block #") + appWindow.currentBlockHeight + translationManager.emptyString;
} else if (!item.isSynchronizing) {
return qsTr("Your local node is synchronized") + translationManager.emptyString;
}
}
} else {
if (item.isSynchronizing) {
return qsTr("Currently scanning the blockchain for transactions that occured after block #") + (currentWallet ? currentWallet.walletCreationHeight.toFixed(0) : "") + "<br>" +
qsTr("After scanning is complete, your balance should be correct.") + translationManager.emptyString;
} else {
return qsTr("The wallet has finished scanning the blockchain for transactions that occured after block #") + (currentWallet ? currentWallet.walletCreationHeight.toFixed(0) : "") + "<br>" +
qsTr("If you have received a transaction in a block before this block height, go to Settings > Info page") + "<br>" +
qsTr("and change the 'Wallet restore height' to the block height of your first transaction.") + translationManager.emptyString;
}
}
}
MoneroComponents.TextPlain {
id: progressTextValue
anchors.top: parent.top
anchors.topMargin: 6
anchors.right: parent.right
font.family: MoneroComponents.Style.fontMedium.name
font.pixelSize: 13
font.bold: MoneroComponents.Style.progressBarProgressTextBold
color: MoneroComponents.Style.defaultFontColor
height:18
MouseArea {
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onEntered: parent.tooltipPopup.open()
onExited: parent.tooltipPopup.close()
onClicked: {
middlePanel.settingsView.settingsStateViewState = "Info";
appWindow.showPageRequest("Settings");
}
}
}
Rectangle {
@ -94,6 +128,7 @@ Rectangle {
height: 8
radius: 8
color: MoneroComponents.Style.progressBarBackgroundColor
visible: fillRect.width != 0
states: [
State {

View file

@ -72,6 +72,7 @@ ApplicationWindow {
property var transaction;
property var walletPassword
property int restoreHeight:0
property int currentBlockHeight: 0
property bool daemonSynced: false
property bool walletSynced: false
property int maxWindowHeight: (isAndroid || isIOS)? screenAvailableHeight : (screenAvailableHeight < 900)? 720 : 800;
@ -654,6 +655,8 @@ ApplicationWindow {
}
function onHeightRefreshed(bcHeight, dCurrentBlock, dTargetBlock) {
appWindow.currentBlockHeight = dCurrentBlock.toFixed(0);
// 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.
@ -666,11 +669,12 @@ ApplicationWindow {
// Update progress bars
if(!daemonSynced) {
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock, dTargetBlock-firstBlockSeen);
leftPanel.progressBar.updateProgress(0,dTargetBlock, dTargetBlock, qsTr("Waiting for daemon to sync"));
leftPanel.progressBar.visible = false;
} else {
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock, 0, qsTr("Daemon is synchronized (%1)").arg(dCurrentBlock.toFixed(0)));
leftPanel.progressBar.visible = Qt.binding(function() { return !appWindow.disconnected && !leftPanel.daemonProgressBar.isSynchronizing });
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock, 0, qsTr("Node: synchronized (height: %1)").arg(dCurrentBlock.toFixed(0)));
if(walletSynced)
leftPanel.progressBar.updateProgress(bcHeight,dTargetBlock,dTargetBlock-bcHeight, qsTr("Wallet is synchronized"))
leftPanel.progressBar.updateProgress(bcHeight,dTargetBlock,dTargetBlock-bcHeight, qsTr("Wallet: synchronized (restore height: %1)").arg(currentWallet ? currentWallet.walletCreationHeight.toFixed(0) : ""))
}
// Update wallet sync progress
@ -765,7 +769,11 @@ ApplicationWindow {
leftPanel.progressBar.updateProgress(blockHeight,targetHeight, blocksToSync);
// If wallet is syncing, daemon is already synced
leftPanel.daemonProgressBar.updateProgress(1,1,0,qsTr("Daemon is synchronized"));
if (appWindow.currentBlockHeight != 0) {
leftPanel.daemonProgressBar.updateProgress(1, 1, 0, qsTr("Node: synchronized (height: %1)").arg(appWindow.currentBlockHeight));
} else {
leftPanel.daemonProgressBar.updateProgress(1, 1, 0, qsTr("Node: synchronized"));
}
foundNewBlock = true;
}