Merge pull request #266

28b1272 Transfer: add a "start daemon" button when not connected (moneromooo.monero)
This commit is contained in:
Riccardo Spagni 2016-12-14 23:37:09 +02:00
commit dc4e6f9e98
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD

View File

@ -39,6 +39,7 @@ Rectangle {
signal sweepUnmixableClicked() signal sweepUnmixableClicked()
color: "#F0EEEE" color: "#F0EEEE"
property string startLinkText: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><font size='2'> (</font><a href='#'>Start daemon</a><font size='2'>)</font>"
function scaleValueToMixinCount(scaleValue) { function scaleValueToMixinCount(scaleValue) {
var scaleToMixinCount = [4,5,6,7,8,9,10,11,12,13,14,15,20,25]; var scaleToMixinCount = [4,5,6,7,8,9,10,11,12,13,14,15,20,25];
@ -50,6 +51,9 @@ Rectangle {
} }
Item {
id: pageRoot
anchors.fill: parent
Label { Label {
id: amountLabel id: amountLabel
anchors.left: parent.left anchors.left: parent.left
@ -299,7 +303,7 @@ Rectangle {
shadowPressedColor: "#B32D00" shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C" releasedColor: "#FF6C3C"
pressedColor: "#FF4304" pressedColor: "#FF4304"
enabled : checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.testnet) enabled : pageRoot.checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.testnet)
onClicked: { onClicked: {
console.log("Transfer: paymentClicked") console.log("Transfer: paymentClicked")
var priority = priorityModel.get(priorityDropdown.currentIndex).priority var priority = priorityModel.get(priorityDropdown.currentIndex).priority
@ -338,8 +342,9 @@ Rectangle {
color:"black" color:"black"
anchors.fill: parent anchors.fill: parent
opacity: 0.1 opacity: 0.1
visible: (root.enabled)? 0 : 1; visible: (pageRoot.enabled)? 0 : 1;
} }
} // Rectangle
Rectangle { Rectangle {
x: root.width/2 - width/2 x: root.width/2 - width/2
@ -354,12 +359,14 @@ Rectangle {
anchors.fill:parent anchors.fill:parent
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
textFormat: Text.RichText
onLinkActivated: { appWindow.startDaemon(); }
} }
} }
Component.onCompleted: { Component.onCompleted: {
//Disable password page until enabled by updateStatus //Disable password page until enabled by updateStatus
root.enabled = false pageRoot.enabled = false
} }
// fires on every page load // fires on every page load
@ -374,13 +381,13 @@ Rectangle {
function updateStatus() { function updateStatus() {
console.log("updated transfer page status") console.log("updated transfer page status")
if(typeof currentWallet === "undefined") { if(typeof currentWallet === "undefined") {
statusText.text = qsTr("Wallet is not connected to daemon.") statusText.text = qsTr("Wallet is not connected to daemon.") + "<br>" + root.startLinkText
return; return;
} }
switch (currentWallet.connected) { switch (currentWallet.connected) {
case Wallet.ConnectionStatus_Disconnected: case Wallet.ConnectionStatus_Disconnected:
statusText.text = qsTr("Wallet is not connected to daemon.") statusText.text = qsTr("Wallet is not connected to daemon.") + "<br>" + root.startLinkText
break break
case Wallet.ConnectionStatus_WrongVersion: case Wallet.ConnectionStatus_WrongVersion:
statusText.text = qsTr("Connected daemon is not compatible with GUI. \n" + statusText.text = qsTr("Connected daemon is not compatible with GUI. \n" +
@ -391,7 +398,7 @@ Rectangle {
statusText.text = qsTr("Waiting on daemon synchronization to finish") statusText.text = qsTr("Waiting on daemon synchronization to finish")
} else { } else {
// everything OK, enable transfer page // everything OK, enable transfer page
root.enabled = true; pageRoot.enabled = true;
statusText.text = ""; statusText.text = "";
} }