mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-28 18:56:32 +02:00
Integrate splash counter with restore-height
This commit is contained in:
parent
868610c778
commit
38db5a4178
32
main.qml
32
main.qml
@ -55,6 +55,8 @@ ApplicationWindow {
|
|||||||
property alias password : passwordDialog.password
|
property alias password : passwordDialog.password
|
||||||
property int splashCounter: 0
|
property int splashCounter: 0
|
||||||
property bool isNewWallet: false
|
property bool isNewWallet: false
|
||||||
|
property int restoreHeight:0
|
||||||
|
|
||||||
// true if wallet ever synchronized
|
// true if wallet ever synchronized
|
||||||
property bool walletInitialized : false
|
property bool walletInitialized : false
|
||||||
|
|
||||||
@ -150,7 +152,15 @@ ApplicationWindow {
|
|||||||
// wallet already opened with wizard, we just need to initialize it
|
// wallet already opened with wizard, we just need to initialize it
|
||||||
if (typeof wizard.settings['wallet'] !== 'undefined') {
|
if (typeof wizard.settings['wallet'] !== 'undefined') {
|
||||||
console.log("using wizard wallet")
|
console.log("using wizard wallet")
|
||||||
|
//Set restoreHeight
|
||||||
|
if(persistentSettings.restoreHeight > 0){
|
||||||
|
restoreHeight = persistentSettings.restoreHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("using wizard wallet")
|
||||||
|
|
||||||
connectWallet(wizard.settings['wallet'])
|
connectWallet(wizard.settings['wallet'])
|
||||||
|
|
||||||
isNewWallet = true
|
isNewWallet = true
|
||||||
// We don't need the wizard wallet any more - delete to avoid conflict with daemon adress change
|
// We don't need the wizard wallet any more - delete to avoid conflict with daemon adress change
|
||||||
delete wizard.settings['wallet']
|
delete wizard.settings['wallet']
|
||||||
@ -242,11 +252,22 @@ ApplicationWindow {
|
|||||||
console.log("wallet stored after first successfull refresh")
|
console.log("wallet stored after first successfull refresh")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dCurrentBlock = currentWallet.daemonBlockChainHeight();
|
||||||
|
var dTargetBlock = currentWallet.daemonBlockChainTargetHeight();
|
||||||
|
leftPanel.daemonProgress.updateProgress(dCurrentBlock,dTargetBlock);
|
||||||
|
|
||||||
|
// Store wallet after first refresh. To prevent broken wallet after a crash
|
||||||
|
// TODO: Move this to libwallet?
|
||||||
|
if(isNewWallet && currentWallet.blockChainHeight() > 0){
|
||||||
|
currentWallet.store(persistentSettings.wallet_path)
|
||||||
|
isNewWallet = false
|
||||||
|
console.log("wallet stored after first successfull refresh")
|
||||||
|
}
|
||||||
|
|
||||||
// initialize transaction history once wallet is initializef first time;
|
// initialize transaction history once wallet is initializef first time;
|
||||||
if (!walletInitialized) {
|
if (!walletInitialized) {
|
||||||
currentWallet.history.refresh()
|
currentWallet.history.refresh()
|
||||||
walletInitialized = true
|
walletInitialized = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
leftPanel.networkStatus.connected = currentWallet.connected
|
leftPanel.networkStatus.connected = currentWallet.connected
|
||||||
@ -256,8 +277,12 @@ ApplicationWindow {
|
|||||||
|
|
||||||
function onWalletNewBlock(blockHeight) {
|
function onWalletNewBlock(blockHeight) {
|
||||||
if (splash.visible) {
|
if (splash.visible) {
|
||||||
var currHeight = blockHeight.toFixed(0)
|
var currHeight = blockHeight
|
||||||
if(currHeight > splashCounter + 1000){
|
|
||||||
|
//fast refresh until restoreHeight is reached
|
||||||
|
var increment = ((restoreHeight == 0) || currHeight < restoreHeight)? 1000 : 10
|
||||||
|
|
||||||
|
if(currHeight > splashCounter + increment){
|
||||||
splashCounter = currHeight
|
splashCounter = currHeight
|
||||||
var locale = Qt.locale()
|
var locale = Qt.locale()
|
||||||
var currHeightString = currHeight.toLocaleString(locale,"f",0)
|
var currHeightString = currHeight.toLocaleString(locale,"f",0)
|
||||||
@ -433,6 +458,7 @@ ApplicationWindow {
|
|||||||
property bool testnet: true
|
property bool testnet: true
|
||||||
property string daemon_address: "localhost:38081"
|
property string daemon_address: "localhost:38081"
|
||||||
property string payment_id
|
property string payment_id
|
||||||
|
property int restoreHeight:0
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: replace with customized popups
|
// TODO: replace with customized popups
|
||||||
|
Loading…
Reference in New Issue
Block a user