diff --git a/components/PasswordDialog.qml b/components/PasswordDialog.qml index cd66d461..a8ff294a 100644 --- a/components/PasswordDialog.qml +++ b/components/PasswordDialog.qml @@ -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 diff --git a/components/ProcessingSplash.qml b/components/ProcessingSplash.qml new file mode 100644 index 00000000..f98feb3b --- /dev/null +++ b/components/ProcessingSplash.qml @@ -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 + } + } + + +} diff --git a/main.cpp b/main.cpp index d0e9e085..387c4b13 100644 --- a/main.cpp +++ b/main.cpp @@ -72,6 +72,8 @@ int main(int argc, char *argv[]) qRegisterMetaType(); + + 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 diff --git a/main.qml b/main.qml index f589c666..636945e8 100644 --- a/main.qml +++ b/main.qml @@ -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 diff --git a/qml.qrc b/qml.qrc index dcf4b9b1..a44266b9 100644 --- a/qml.qrc +++ b/qml.qrc @@ -115,5 +115,6 @@ components/IconButton.qml lang/flags/italy.png components/PasswordDialog.qml + components/ProcessingSplash.qml