Transfer: new connectionStatus handling + show status msg

pull/2/head
Jaquee 8 years ago
parent 76e6ae8b6f
commit 93a8200e4a
No known key found for this signature in database
GPG Key ID: 384E52B09F45DC39

@ -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 {

@ -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 = "";
}
}
}
}