mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-02-07 16:43:42 +02:00
Improved blockchain sync status ui
This commit is contained in:
parent
465f6bfe27
commit
2d6ddf043e
@ -48,8 +48,11 @@ Row {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getConnectionStatusString(status) {
|
function getConnectionStatusString(status) {
|
||||||
if (status == Wallet.ConnectionStatus_Connected)
|
if (status == Wallet.ConnectionStatus_Connected) {
|
||||||
|
if(!appWindow.daemonSynced)
|
||||||
|
return qsTr("Synchronizing")
|
||||||
return qsTr("Connected")
|
return qsTr("Connected")
|
||||||
|
}
|
||||||
if (status == Wallet.ConnectionStatus_WrongVersion)
|
if (status == Wallet.ConnectionStatus_WrongVersion)
|
||||||
return qsTr("Wrong version")
|
return qsTr("Wrong version")
|
||||||
if (status == Wallet.ConnectionStatus_Disconnected)
|
if (status == Wallet.ConnectionStatus_Disconnected)
|
||||||
|
@ -38,6 +38,13 @@ Item {
|
|||||||
//clip: true
|
//clip: true
|
||||||
|
|
||||||
function updateProgress(currentBlock,targetBlock){
|
function updateProgress(currentBlock,targetBlock){
|
||||||
|
if(targetBlock == 1) {
|
||||||
|
fillLevel = 0
|
||||||
|
progressText.text = qsTr("Establishing connection...");
|
||||||
|
progressBar.visible = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if(targetBlock > 0) {
|
if(targetBlock > 0) {
|
||||||
var progressLevel = ((currentBlock/targetBlock) * 100).toFixed(0);
|
var progressLevel = ((currentBlock/targetBlock) * 100).toFixed(0);
|
||||||
fillLevel = progressLevel
|
fillLevel = progressLevel
|
||||||
|
4
main.qml
4
main.qml
@ -351,10 +351,10 @@ ApplicationWindow {
|
|||||||
// Check daemon status
|
// Check daemon status
|
||||||
var dCurrentBlock = currentWallet.daemonBlockChainHeight();
|
var dCurrentBlock = currentWallet.daemonBlockChainHeight();
|
||||||
var dTargetBlock = currentWallet.daemonBlockChainTargetHeight();
|
var dTargetBlock = currentWallet.daemonBlockChainTargetHeight();
|
||||||
|
|
||||||
// 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
|
||||||
daemonSynced = dCurrentBlock >= dTargetBlock
|
// targetBlock = currentBlock = 1 before network connection is established.
|
||||||
|
daemonSynced = dCurrentBlock >= dTargetBlock && dTargetBlock != 1
|
||||||
// Update daemon sync progress
|
// Update daemon sync progress
|
||||||
leftPanel.progressBar.updateProgress(dCurrentBlock,dTargetBlock);
|
leftPanel.progressBar.updateProgress(dCurrentBlock,dTargetBlock);
|
||||||
leftPanel.progressBar.visible = !daemonSynced && currentWallet.connected() !== Wallet.ConnectionStatus_Disconnected
|
leftPanel.progressBar.visible = !daemonSynced && currentWallet.connected() !== Wallet.ConnectionStatus_Disconnected
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
static const int DAEMON_BLOCKCHAIN_HEIGHT_CACHE_TTL_SECONDS = 5;
|
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;
|
static const int WALLET_CONNECTION_STATUS_CACHE_TTL_SECONDS = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ quint64 Wallet::daemonBlockChainHeight() const
|
|||||||
|
|
||||||
quint64 Wallet::daemonBlockChainTargetHeight() const
|
quint64 Wallet::daemonBlockChainTargetHeight() const
|
||||||
{
|
{
|
||||||
if (m_daemonBlockChainTargetHeight == 0
|
if (m_daemonBlockChainTargetHeight <= 1
|
||||||
|| m_daemonBlockChainTargetHeightTime.elapsed() / 1000 > m_daemonBlockChainTargetHeightTtl) {
|
|| m_daemonBlockChainTargetHeightTime.elapsed() / 1000 > m_daemonBlockChainTargetHeightTtl) {
|
||||||
m_daemonBlockChainTargetHeight = m_walletImpl->daemonBlockChainTargetHeight();
|
m_daemonBlockChainTargetHeight = m_walletImpl->daemonBlockChainTargetHeight();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user