mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 03:59:38 +00:00
ProgressBar: hide progress bar when sync is completed; add tooltips; display wallet restore height
This commit is contained in:
parent
51828babbb
commit
c85b0a2e0d
3 changed files with 76 additions and 33 deletions
|
@ -213,7 +213,7 @@ Rectangle {
|
||||||
|
|
||||||
MoneroComponents.Label {
|
MoneroComponents.Label {
|
||||||
fontSize: 16
|
fontSize: 16
|
||||||
visible: isSyncing
|
visible: isSyncing || progressBar.bar.visible
|
||||||
text: qsTr("Syncing...") + translationManager.emptyString
|
text: qsTr("Syncing...") + translationManager.emptyString
|
||||||
color: MoneroComponents.Style.blackTheme ? "white" : "black"
|
color: MoneroComponents.Style.blackTheme ? "white" : "black"
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -525,9 +525,9 @@ Rectangle {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: daemonProgressBar.top
|
anchors.bottom: daemonProgressBar.top
|
||||||
height: 48
|
anchors.bottomMargin: 6
|
||||||
syncType: qsTr("Wallet") + translationManager.emptyString
|
syncType: qsTr("Wallet") + translationManager.emptyString
|
||||||
visible: !appWindow.disconnected
|
visible: !appWindow.disconnected && !daemonProgressBar.isSynchronizing
|
||||||
}
|
}
|
||||||
|
|
||||||
MoneroComponents.ProgressBar {
|
MoneroComponents.ProgressBar {
|
||||||
|
@ -535,9 +535,9 @@ Rectangle {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: networkStatus.top
|
anchors.bottom: networkStatus.top
|
||||||
syncType: qsTr("Daemon") + translationManager.emptyString
|
anchors.bottomMargin: 6
|
||||||
|
syncType: qsTr("Node") + translationManager.emptyString
|
||||||
visible: !appWindow.disconnected
|
visible: !appWindow.disconnected
|
||||||
height: 62
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MoneroComponents.NetworkStatusItem {
|
MoneroComponents.NetworkStatusItem {
|
||||||
|
|
|
@ -35,8 +35,9 @@ Rectangle {
|
||||||
id: item
|
id: item
|
||||||
property int fillLevel: 0
|
property int fillLevel: 0
|
||||||
property string syncType // Wallet or Daemon
|
property string syncType // Wallet or Daemon
|
||||||
property string syncText: qsTr("%1 blocks remaining: ").arg(syncType)
|
property alias bar: bar
|
||||||
visible: false
|
property bool isSynchronizing: true
|
||||||
|
height: progressText.height + (bar.visible ? 20 : 0)
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){
|
function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){
|
||||||
|
@ -46,43 +47,76 @@ Rectangle {
|
||||||
fillLevel = progressLevel
|
fillLevel = progressLevel
|
||||||
if(typeof statusTxt != "undefined" && statusTxt != "") {
|
if(typeof statusTxt != "undefined" && statusTxt != "") {
|
||||||
progressText.text = statusTxt;
|
progressText.text = statusTxt;
|
||||||
progressTextValue.text = "";
|
bar.visible = false;
|
||||||
|
item.isSynchronizing = false;
|
||||||
} else {
|
} else {
|
||||||
progressText.text = syncText;
|
progressText.text = qsTr("%1: synchronizing. Blocks remaining: %2").arg(syncType).arg(remaining.toFixed(0));
|
||||||
progressTextValue.text = remaining.toFixed(0);
|
bar.visible = true;
|
||||||
|
item.isSynchronizing = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Rectangle {
|
||||||
anchors.top: item.top
|
anchors.topMargin: 0
|
||||||
anchors.topMargin: 10
|
anchors.bottomMargin: 0
|
||||||
anchors.leftMargin: 15
|
anchors.leftMargin: 15
|
||||||
anchors.rightMargin: 15
|
anchors.rightMargin: 15
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
MoneroComponents.TextPlain {
|
MoneroComponents.TextPlain {
|
||||||
id: progressText
|
id: progressText
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: 6
|
anchors.topMargin: 0
|
||||||
font.family: MoneroComponents.Style.fontMedium.name
|
font.family: MoneroComponents.Style.fontMedium.name
|
||||||
font.pixelSize: 13
|
font.pixelSize: 12
|
||||||
font.bold: MoneroComponents.Style.progressBarProgressTextBold
|
color: MoneroComponents.Style.blackTheme ? MoneroComponents.Style.dimmedFontColor : MoneroComponents.Style.defaultFontColor
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
opacity: MoneroComponents.Style.blackTheme ? 0.65 : 0.75
|
||||||
text: qsTr("Synchronizing %1").arg(syncType) + translationManager.emptyString
|
text: qsTr("%1: synchronizing").arg(syncType) + translationManager.emptyString
|
||||||
height: 18
|
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 {
|
MouseArea {
|
||||||
id: progressTextValue
|
hoverEnabled: true
|
||||||
anchors.top: parent.top
|
anchors.fill: parent
|
||||||
anchors.topMargin: 6
|
cursorShape: Qt.PointingHandCursor
|
||||||
anchors.right: parent.right
|
onEntered: parent.tooltipPopup.open()
|
||||||
font.family: MoneroComponents.Style.fontMedium.name
|
onExited: parent.tooltipPopup.close()
|
||||||
font.pixelSize: 13
|
onClicked: {
|
||||||
font.bold: MoneroComponents.Style.progressBarProgressTextBold
|
middlePanel.settingsView.settingsStateViewState = "Info";
|
||||||
color: MoneroComponents.Style.defaultFontColor
|
appWindow.showPageRequest("Settings");
|
||||||
height:18
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -94,6 +128,7 @@ Rectangle {
|
||||||
height: 8
|
height: 8
|
||||||
radius: 8
|
radius: 8
|
||||||
color: MoneroComponents.Style.progressBarBackgroundColor
|
color: MoneroComponents.Style.progressBarBackgroundColor
|
||||||
|
visible: fillRect.width != 0
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
|
|
16
main.qml
16
main.qml
|
@ -72,6 +72,7 @@ ApplicationWindow {
|
||||||
property var transaction;
|
property var transaction;
|
||||||
property var walletPassword
|
property var walletPassword
|
||||||
property int restoreHeight:0
|
property int restoreHeight:0
|
||||||
|
property int currentBlockHeight: 0
|
||||||
property bool daemonSynced: false
|
property bool daemonSynced: false
|
||||||
property bool walletSynced: false
|
property bool walletSynced: false
|
||||||
property int maxWindowHeight: (isAndroid || isIOS)? screenAvailableHeight : (screenAvailableHeight < 900)? 720 : 800;
|
property int maxWindowHeight: (isAndroid || isIOS)? screenAvailableHeight : (screenAvailableHeight < 900)? 720 : 800;
|
||||||
|
@ -654,6 +655,8 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onHeightRefreshed(bcHeight, dCurrentBlock, dTargetBlock) {
|
function onHeightRefreshed(bcHeight, dCurrentBlock, dTargetBlock) {
|
||||||
|
appWindow.currentBlockHeight = dCurrentBlock.toFixed(0);
|
||||||
|
|
||||||
// Daemon fully synced
|
// Daemon fully synced
|
||||||
// TODO: implement onDaemonSynced or similar in wallet API and don't start refresh thread before daemon is 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.
|
// targetBlock = currentBlock = 1 before network connection is established.
|
||||||
|
@ -666,11 +669,12 @@ ApplicationWindow {
|
||||||
// Update progress bars
|
// Update progress bars
|
||||||
if(!daemonSynced) {
|
if(!daemonSynced) {
|
||||||
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock, dTargetBlock-firstBlockSeen);
|
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock, dTargetBlock-firstBlockSeen);
|
||||||
leftPanel.progressBar.updateProgress(0,dTargetBlock, dTargetBlock, qsTr("Waiting for daemon to sync"));
|
leftPanel.progressBar.visible = false;
|
||||||
} else {
|
} 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)
|
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
|
// Update wallet sync progress
|
||||||
|
@ -765,7 +769,11 @@ ApplicationWindow {
|
||||||
leftPanel.progressBar.updateProgress(blockHeight,targetHeight, blocksToSync);
|
leftPanel.progressBar.updateProgress(blockHeight,targetHeight, blocksToSync);
|
||||||
|
|
||||||
// If wallet is syncing, daemon is already synced
|
// 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;
|
foundNewBlock = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue