diff options
| author | Jacob Brydolf <jacob@brydolf.net> | 2016-10-08 01:37:47 +0200 |
|---|---|---|
| committer | Ilya Kitaev <mbg033@gmail.com> | 2016-10-10 00:21:19 +0300 |
| commit | 38db5a4178dad8ac933f013e22e3ee3e20e22fe7 (patch) | |
| tree | dccb95be98b6a66ad530e80b1018e5d99663d7ae | |
| parent | 868610c7781efd6b3329cc0e0c44b7694759c11b (diff) | |
| download | monzero-gui-38db5a4178dad8ac933f013e22e3ee3e20e22fe7.tar.gz monzero-gui-38db5a4178dad8ac933f013e22e3ee3e20e22fe7.tar.xz monzero-gui-38db5a4178dad8ac933f013e22e3ee3e20e22fe7.zip | |
Integrate splash counter with restore-height
| -rw-r--r-- | main.qml | 32 |
1 files changed, 29 insertions, 3 deletions
@@ -55,6 +55,8 @@ ApplicationWindow { property alias password : passwordDialog.password property int splashCounter: 0 property bool isNewWallet: false + property int restoreHeight:0 + // true if wallet ever synchronized property bool walletInitialized : false @@ -150,7 +152,15 @@ ApplicationWindow { // wallet already opened with wizard, we just need to initialize it if (typeof wizard.settings['wallet'] !== 'undefined') { console.log("using wizard wallet") + //Set restoreHeight + if(persistentSettings.restoreHeight > 0){ + restoreHeight = persistentSettings.restoreHeight + } + + console.log("using wizard wallet") + connectWallet(wizard.settings['wallet']) + isNewWallet = true // We don't need the wizard wallet any more - delete to avoid conflict with daemon adress change delete wizard.settings['wallet'] @@ -242,11 +252,22 @@ ApplicationWindow { 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; if (!walletInitialized) { currentWallet.history.refresh() walletInitialized = true - } leftPanel.networkStatus.connected = currentWallet.connected @@ -256,8 +277,12 @@ ApplicationWindow { function onWalletNewBlock(blockHeight) { if (splash.visible) { - var currHeight = blockHeight.toFixed(0) - if(currHeight > splashCounter + 1000){ + var currHeight = blockHeight + + //fast refresh until restoreHeight is reached + var increment = ((restoreHeight == 0) || currHeight < restoreHeight)? 1000 : 10 + + if(currHeight > splashCounter + increment){ splashCounter = currHeight var locale = Qt.locale() var currHeightString = currHeight.toLocaleString(locale,"f",0) @@ -433,6 +458,7 @@ ApplicationWindow { property bool testnet: true property string daemon_address: "localhost:38081" property string payment_id + property int restoreHeight:0 } // TODO: replace with customized popups |
