mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-16 15:58:11 +00:00
Improved blockchain sync status ui
This commit is contained in:
parent
465f6bfe27
commit
2d6ddf043e
4 changed files with 15 additions and 5 deletions
|
@ -48,8 +48,11 @@ Row {
|
|||
}
|
||||
|
||||
function getConnectionStatusString(status) {
|
||||
if (status == Wallet.ConnectionStatus_Connected)
|
||||
if (status == Wallet.ConnectionStatus_Connected) {
|
||||
if(!appWindow.daemonSynced)
|
||||
return qsTr("Synchronizing")
|
||||
return qsTr("Connected")
|
||||
}
|
||||
if (status == Wallet.ConnectionStatus_WrongVersion)
|
||||
return qsTr("Wrong version")
|
||||
if (status == Wallet.ConnectionStatus_Disconnected)
|
||||
|
|
|
@ -38,6 +38,13 @@ Item {
|
|||
//clip: true
|
||||
|
||||
function updateProgress(currentBlock,targetBlock){
|
||||
if(targetBlock == 1) {
|
||||
fillLevel = 0
|
||||
progressText.text = qsTr("Establishing connection...");
|
||||
progressBar.visible = true
|
||||
return
|
||||
}
|
||||
|
||||
if(targetBlock > 0) {
|
||||
var progressLevel = ((currentBlock/targetBlock) * 100).toFixed(0);
|
||||
fillLevel = progressLevel
|
||||
|
|
4
main.qml
4
main.qml
|
@ -351,10 +351,10 @@ ApplicationWindow {
|
|||
// Check daemon status
|
||||
var dCurrentBlock = currentWallet.daemonBlockChainHeight();
|
||||
var dTargetBlock = currentWallet.daemonBlockChainTargetHeight();
|
||||
|
||||
// Daemon fully synced
|
||||
// TODO: implement onDaemonSynced or similar in wallet API and don't start refresh thread before daemon is synced
|
||||
daemonSynced = dCurrentBlock >= dTargetBlock
|
||||
// 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
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace {
|
||||
static const int DAEMON_BLOCKCHAIN_HEIGHT_CACHE_TTL_SECONDS = 5;
|
||||
static const int DAEMON_BLOCKCHAIN_TARGET_HEIGHT_CACHE_TTL_SECONDS = 60;
|
||||
static const int DAEMON_BLOCKCHAIN_TARGET_HEIGHT_CACHE_TTL_SECONDS = 30;
|
||||
static const int WALLET_CONNECTION_STATUS_CACHE_TTL_SECONDS = 5;
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ quint64 Wallet::daemonBlockChainHeight() const
|
|||
|
||||
quint64 Wallet::daemonBlockChainTargetHeight() const
|
||||
{
|
||||
if (m_daemonBlockChainTargetHeight == 0
|
||||
if (m_daemonBlockChainTargetHeight <= 1
|
||||
|| m_daemonBlockChainTargetHeightTime.elapsed() / 1000 > m_daemonBlockChainTargetHeightTtl) {
|
||||
m_daemonBlockChainTargetHeight = m_walletImpl->daemonBlockChainTargetHeight();
|
||||
|
||||
|
|
Loading…
Reference in a new issue