mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 00:07:51 +00:00
Merge pull request #1182
37cb006
separate progress bars for daemon and walletd253991
remove obsolete remote node logic
This commit is contained in:
commit
da0155e260
4 changed files with 27 additions and 44 deletions
|
@ -39,6 +39,7 @@ Rectangle {
|
|||
property alias balanceText: balanceText.text
|
||||
property alias networkStatus : networkStatus
|
||||
property alias progressBar : progressBar
|
||||
property alias daemonProgressBar : daemonProgressBar
|
||||
property alias minutesToUnlockTxt: unlockedBalanceLabel.text
|
||||
|
||||
signal dashboardClicked()
|
||||
|
@ -541,8 +542,20 @@ Rectangle {
|
|||
id: progressBar
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: daemonProgressBar.top
|
||||
height: 35 * scaleRatio
|
||||
syncType: qsTr("Wallet")
|
||||
visible: networkStatus.connected
|
||||
}
|
||||
|
||||
ProgressBar {
|
||||
id: daemonProgressBar
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
height: 35 * scaleRatio
|
||||
syncType: qsTr("Daemon")
|
||||
visible: networkStatus.connected
|
||||
}
|
||||
} // menuRect
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ import moneroComponents.Wallet 1.0
|
|||
Rectangle {
|
||||
id: item
|
||||
property int fillLevel: 0
|
||||
visible: false
|
||||
property string syncType // Wallet or Daemon
|
||||
property string syncText: qsTr("%1 blocks remaining: ").arg(syncType)
|
||||
color: "#1C1C1C"
|
||||
|
||||
function updateProgress(currentBlock,targetBlock, blocksToSync, statusTxt){
|
||||
|
@ -44,24 +45,19 @@ Rectangle {
|
|||
}
|
||||
|
||||
if(targetBlock > 0) {
|
||||
var remaining = targetBlock - currentBlock
|
||||
// wallet sync
|
||||
if(blocksToSync > 0)
|
||||
var progressLevel = (100*(blocksToSync - remaining)/blocksToSync).toFixed(0);
|
||||
// Daemon sync
|
||||
else
|
||||
var progressLevel = (100*(currentBlock/targetBlock)).toFixed(0);
|
||||
var remaining = (currentBlock < targetBlock) ? targetBlock - currentBlock : 0
|
||||
var progressLevel = (blocksToSync > 0) ? (100*(blocksToSync - remaining)/blocksToSync).toFixed(0) : 100
|
||||
fillLevel = progressLevel
|
||||
if(typeof statusTxt != "undefined" && statusTxt != "") {
|
||||
progressText.text = statusTxt + (" %1").arg(remaining.toFixed(0));
|
||||
progressText.text = statusTxt;
|
||||
} else {
|
||||
progressText.text = qsTr("Blocks remaining: %1").arg(remaining.toFixed(0));
|
||||
progressText.text = syncText + remaining.toFixed(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
progressBar.visible = currentBlock < targetBlock
|
||||
}
|
||||
|
||||
if(remaining == 0 && (typeof statusTxt == "undefined" || statusTxt == ""))
|
||||
progressText.text = qsTr("%1 is synchronized").arg(syncType)
|
||||
}
|
||||
|
||||
Item {
|
||||
|
@ -106,7 +102,7 @@ Rectangle {
|
|||
font.family: "Arial"
|
||||
font.pixelSize: 12 * scaleRatio
|
||||
color: "#000"
|
||||
text: qsTr("Synchronizing blocks")
|
||||
text: qsTr("Synchronizing %1").arg(syncType)
|
||||
height:18 * scaleRatio
|
||||
}
|
||||
}
|
||||
|
|
31
main.qml
31
main.qml
|
@ -320,7 +320,6 @@ ApplicationWindow {
|
|||
console.log("Wallet connection status changed " + status)
|
||||
middlePanel.updateStatus();
|
||||
leftPanel.networkStatus.connected = status
|
||||
leftPanel.progressBar.visible = (status === Wallet.ConnectionStatus_Connected) && !daemonSynced
|
||||
|
||||
// Update fee multiplier dropdown on transfer page
|
||||
middlePanel.transferView.updatePriorityDropdown();
|
||||
|
@ -414,38 +413,14 @@ ApplicationWindow {
|
|||
// targetBlock = currentBlock = 1 before network connection is established.
|
||||
daemonSynced = dCurrentBlock >= dTargetBlock && dTargetBlock != 1
|
||||
// Update daemon sync progress
|
||||
leftPanel.progressBar.updateProgress(dCurrentBlock,dTargetBlock);
|
||||
leftPanel.progressBar.visible = !daemonSynced && currentWallet.connected() !== Wallet.ConnectionStatus_Disconnected
|
||||
leftPanel.daemonProgressBar.updateProgress(dCurrentBlock,dTargetBlock);
|
||||
if(!daemonSynced)
|
||||
leftPanel.progressBar.updateProgress(0,dTargetBlock, dTargetBlock, qsTr("Waiting for daemon to sync"));
|
||||
// Update wallet sync progress
|
||||
updateSyncing((currentWallet.connected() !== Wallet.ConnectionStatus_Disconnected) && !daemonSynced)
|
||||
// Update transfer page status
|
||||
middlePanel.updateStatus();
|
||||
|
||||
// Use remote node while local daemon is syncing
|
||||
if (persistentSettings.useRemoteNode) {
|
||||
var localNodeConnected = walletManager.connected;
|
||||
var localNodeSynced = localNodeConnected && walletManager.localDaemonSynced()
|
||||
if (!currentWallet.connected() || !localNodeSynced) {
|
||||
console.log("Using remote node while local node is syncing")
|
||||
// Connect to remote node if not already connected
|
||||
if(!remoteNodeConnected) {
|
||||
connectRemoteNode();
|
||||
}
|
||||
|
||||
//update local daemon sync progress bar
|
||||
if(localNodeConnected) {
|
||||
leftPanel.progressBar.updateProgress(walletManager.blockchainHeight(),walletManager.blockchainTargetHeight(), 0, qsTr("Remaining blocks (local node):"));
|
||||
leftPanel.progressBar.visible = true
|
||||
} else if (!persistentSettings.useRemoteNode && !startLocalNodeCancelled) {
|
||||
daemonManagerDialog.open()
|
||||
}
|
||||
|
||||
// local daemon is synced - use it!
|
||||
} else if (localNodeSynced && remoteNodeConnected) {
|
||||
disconnectRemoteNode();
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh is succesfull if blockchain height > 1
|
||||
if (currentWallet.blockChainHeight() > 1){
|
||||
|
||||
|
|
|
@ -184,8 +184,7 @@ ColumnLayout {
|
|||
RowLayout {
|
||||
CheckBox {
|
||||
id: remoteNode
|
||||
text: (localNode.checked) ? qsTr("Connect to a remote node until my own node has finished syncing") + translationManager.emptyString
|
||||
: qsTr("Connect to a remote node") + translationManager.emptyString
|
||||
text: qsTr("Connect to a remote node") + translationManager.emptyString
|
||||
Layout.topMargin: 20 * scaleRatio
|
||||
background: "#FFFFFF"
|
||||
fontColor: "#4A4646"
|
||||
|
|
Loading…
Reference in a new issue