diff --git a/MiddlePanel.qml b/MiddlePanel.qml index e14255a5..16cc9492 100644 --- a/MiddlePanel.qml +++ b/MiddlePanel.qml @@ -32,6 +32,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.1 import QtGraphicalEffects 1.0 +import moneroComponents.Wallet 1.0 import "./pages" @@ -56,9 +57,6 @@ Rectangle { signal generatePaymentIdInvoked() signal checkPaymentClicked(string address, string txid, string txkey); - // Disable transfer page if daemon isnt fully synced - enabled: (currentView !== transferView || appWindow.daemonSynced) - color: "#F0EEEE" onCurrentViewChanged: { @@ -72,6 +70,10 @@ Rectangle { } } + function updateStatus(){ + transferView.updateStatus(); + } + // XXX: just for memo, to be removed // states: [ @@ -292,14 +294,6 @@ Rectangle { color: "#DBDBDB" } - Rectangle { - id:desaturate - color:"black" - anchors.fill: parent - opacity: 0.1 - visible: (root.enabled)? 0 : 1; - } - /* connect "payment" click */ Connections { diff --git a/pages/Transfer.qml b/pages/Transfer.qml index d2bfc213..7ef534a2 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -29,6 +29,7 @@ import QtQuick 2.0 import moneroComponents.PendingTransaction 1.0 import "../components" +import moneroComponents.Wallet 1.0 Rectangle { @@ -331,4 +332,69 @@ Rectangle { } } + + Rectangle { + id:desaturate + color:"black" + anchors.fill: parent + opacity: 0.1 + visible: (root.enabled)? 0 : 1; + } + + Rectangle { + x: root.width/2 - width/2 + y: root.height/2 - height/2 + height:statusText.paintedHeight + 50 + width:statusText.paintedWidth + 40 + visible: statusText.text != "" + opacity: 0.9 + + Text { + id: statusText + anchors.fill:parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + } + + Component.onCompleted: { + //Disable password page until enabled by updateStatus + root.enabled = false + } + + // fires on every page load + function onPageCompleted() { + console.log("transfer page loaded") + updateStatus(); + } + + //TODO: Add daemon sync status + //TODO: enable send page when we're connected and daemon is synced + + function updateStatus() { + console.log("updated transfer page status") + if(typeof currentWallet === "undefined") { + statusText.text = qsTr("Wallet is not connected to daemon.") + return; + } + + switch (currentWallet.connected) { + case Wallet.ConnectionStatus_Disconnected: + statusText.text = qsTr("Wallet is not connected to daemon.") + break + case Wallet.ConnectionStatus_WrongVersion: + statusText.text = qsTr("Connected daemon is not compatible with GUI. \n" + + "Please upgrade or connect to another daemon") + break + default: + if(!appWindow.daemonSynced){ + statusText.text = qsTr("Waiting on daemon synchronization to finish") + } else { + // everything OK, enable transfer page + root.enabled = true; + statusText.text = ""; + } + + } + } }