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.Controls 1.4
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>();
QQmlApplicationEngine engine;
OSCursor cursor;
@ -83,6 +85,7 @@ int main(int argc, char *argv[])
engine.rootContext()->setContextProperty("translationManager", TranslationManager::instance());
// export to QML monero accounts root directory
// wizard is talking about where
// 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,
persistentSettings.testnet);
}
}
function connectWallet(wallet) {
showProcessingSplash()
currentWallet = wallet
currentWallet.refreshed.connect(onWalletRefresh)
currentWallet.updated.connect(onWalletUpdate)
@ -167,7 +167,6 @@ ApplicationWindow {
function onWalletOpened(wallet) {
console.log(">>> wallet opened: " + wallet)
if (wallet.status !== Wallet.Status_Ok) {
if (appWindow.password === '') {
console.error("Error opening wallet with empty password: ", wallet.errorString);
@ -188,7 +187,6 @@ ApplicationWindow {
informationPopup.onCloseCallback = function() {
passwordDialog.open()
}
}
return;
}
@ -212,6 +210,10 @@ ApplicationWindow {
function onWalletRefresh() {
console.log(">>> wallet refreshed")
if (splash.visible) {
hideProcessingSplash()
}
leftPanel.networkStatus.connected = currentWallet.connected
onWalletUpdate();
}
@ -297,6 +299,19 @@ ApplicationWindow {
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"
visible: true
@ -371,10 +386,6 @@ ApplicationWindow {
onAccepted: {
appWindow.currentWallet = null
appWindow.initialize();
// var wallet_path = walletPath();
// console.log("opening wallet with password: ", wallet_path);
// walletManager.openWalletAsync(wallet_path, password, persistentSettings.testnet);
}
onRejected: {
appWindow.enableUI(false)
@ -384,19 +395,18 @@ ApplicationWindow {
}
}
Window {
id: walletInitializationSplash
modality: Qt.ApplicationModal
flags: Qt.SplashScreen
height: 100
width: 250
Text {
anchors.fill: parent
text: qsTr("Initializing Wallet...");
}
ProcessingSplash {
id: splash
width: appWindow.width / 2
height: appWindow.height / 2
x: (appWindow.width - width) / 2 + appWindow.x
y: (appWindow.height - height) / 2 + appWindow.y
message: qsTr("Please wait...")
}
Item {
id: rootItem
anchors.fill: parent

View File

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