Display "processing.." splashscreen while wallet initializing

This commit is contained in:
Ilya Kitaev 2016-08-23 11:55:51 +03:00
parent 6b9afcf291
commit 376db6cf16
5 changed files with 122 additions and 17 deletions

View file

@ -1,3 +1,31 @@
// Copyright (c) 2014-2015, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2

View file

@ -0,0 +1,63 @@
// Copyright (c) 2014-2015, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.0
import QtQuick.Window 2.1
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
Window {
id: splash
modality: Qt.ApplicationModal
flags: Qt.SplashScreen
property alias message: message.text
width: 200
height: 100
opacity: 0.5
ColumnLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
BusyIndicator {
running: parent.visible
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
}
Text {
id: message
text: "Please wait..."
font {
pointSize: 22
}
horizontalAlignment: Text.AlignHCenter
}
}
}

View file

@ -72,6 +72,8 @@ int main(int argc, char *argv[])
qRegisterMetaType<PendingTransaction::Priority>(); qRegisterMetaType<PendingTransaction::Priority>();
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
OSCursor cursor; OSCursor cursor;
@ -83,6 +85,7 @@ int main(int argc, char *argv[])
engine.rootContext()->setContextProperty("translationManager", TranslationManager::instance()); engine.rootContext()->setContextProperty("translationManager", TranslationManager::instance());
// export to QML monero accounts root directory // export to QML monero accounts root directory
// wizard is talking about where // wizard is talking about where
// to save the wallet file (.keys, .bin), they have to be user-accessible for // to save the wallet file (.keys, .bin), they have to be user-accessible for

View file

@ -147,11 +147,11 @@ ApplicationWindow {
walletManager.openWalletAsync(wallet_path, appWindow.password, walletManager.openWalletAsync(wallet_path, appWindow.password,
persistentSettings.testnet); persistentSettings.testnet);
} }
} }
function connectWallet(wallet) { function connectWallet(wallet) {
showProcessingSplash()
currentWallet = wallet currentWallet = wallet
currentWallet.refreshed.connect(onWalletRefresh) currentWallet.refreshed.connect(onWalletRefresh)
currentWallet.updated.connect(onWalletUpdate) currentWallet.updated.connect(onWalletUpdate)
@ -167,7 +167,6 @@ ApplicationWindow {
function onWalletOpened(wallet) { function onWalletOpened(wallet) {
console.log(">>> wallet opened: " + wallet) console.log(">>> wallet opened: " + wallet)
if (wallet.status !== Wallet.Status_Ok) { if (wallet.status !== Wallet.Status_Ok) {
if (appWindow.password === '') { if (appWindow.password === '') {
console.error("Error opening wallet with empty password: ", wallet.errorString); console.error("Error opening wallet with empty password: ", wallet.errorString);
@ -188,7 +187,6 @@ ApplicationWindow {
informationPopup.onCloseCallback = function() { informationPopup.onCloseCallback = function() {
passwordDialog.open() passwordDialog.open()
} }
} }
return; return;
} }
@ -212,6 +210,10 @@ ApplicationWindow {
function onWalletRefresh() { function onWalletRefresh() {
console.log(">>> wallet refreshed") console.log(">>> wallet refreshed")
if (splash.visible) {
hideProcessingSplash()
}
leftPanel.networkStatus.connected = currentWallet.connected leftPanel.networkStatus.connected = currentWallet.connected
onWalletUpdate(); onWalletUpdate();
} }
@ -297,6 +299,19 @@ ApplicationWindow {
basicPanel.enabled = enable; basicPanel.enabled = enable;
} }
function showProcessingSplash(message) {
console.log("Displaying processing splash")
if (typeof message != 'undefined') {
splash.message = message
}
splash.show()
}
function hideProcessingSplash() {
console.log("Hiding processing splash")
splash.hide()
}
objectName: "appWindow" objectName: "appWindow"
visible: true visible: true
@ -371,10 +386,6 @@ ApplicationWindow {
onAccepted: { onAccepted: {
appWindow.currentWallet = null appWindow.currentWallet = null
appWindow.initialize(); appWindow.initialize();
// var wallet_path = walletPath();
// console.log("opening wallet with password: ", wallet_path);
// walletManager.openWalletAsync(wallet_path, password, persistentSettings.testnet);
} }
onRejected: { onRejected: {
appWindow.enableUI(false) appWindow.enableUI(false)
@ -384,19 +395,18 @@ ApplicationWindow {
} }
} }
Window {
id: walletInitializationSplash ProcessingSplash {
modality: Qt.ApplicationModal id: splash
flags: Qt.SplashScreen width: appWindow.width / 2
height: 100 height: appWindow.height / 2
width: 250 x: (appWindow.width - width) / 2 + appWindow.x
Text { y: (appWindow.height - height) / 2 + appWindow.y
anchors.fill: parent message: qsTr("Please wait...")
text: qsTr("Initializing Wallet...");
}
} }
Item { Item {
id: rootItem id: rootItem
anchors.fill: parent anchors.fill: parent

View file

@ -115,5 +115,6 @@
<file>components/IconButton.qml</file> <file>components/IconButton.qml</file>
<file>lang/flags/italy.png</file> <file>lang/flags/italy.png</file>
<file>components/PasswordDialog.qml</file> <file>components/PasswordDialog.qml</file>
<file>components/ProcessingSplash.qml</file>
</qresource> </qresource>
</RCC> </RCC>