diff --git a/components/AdvancedOptionsItem.qml b/components/AdvancedOptionsItem.qml new file mode 100644 index 00000000..1efd55ce --- /dev/null +++ b/components/AdvancedOptionsItem.qml @@ -0,0 +1,106 @@ +import QtQuick 2.9 +import QtQuick.Layouts 1.1 +import FontAwesome 1.0 + +import "../components" as MoneroComponents + +RowLayout { + id: advancedOptionsItem + + property alias title: title.text + property alias button1: button1 + property alias button2: button2 + property alias button3: button3 + property alias helpTextLarge: helpTextLarge + property alias helpTextSmall: helpTextSmall + + RowLayout { + id: titlecolumn + Layout.alignment: Qt.AlignTop | Qt.AlignLeft + Layout.preferredWidth: 195 + Layout.maximumWidth: 195 + Layout.leftMargin: 10 + + MoneroComponents.Label { + id: title + fontSize: 14 + } + + MoneroComponents.Label { + id: iconLabel + fontSize: 12 + text: FontAwesome.questionCircle + fontFamily: FontAwesome.fontFamily + opacity: 0.3 + MouseArea { + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: helpText.visible = !helpText.visible + onEntered: parent.opacity = 0.4 + onExited: parent.opacity = 0.3 + } + } + + Rectangle { + id: separator + Layout.fillWidth: true + height: 10 + color: "transparent" + } + } + + ColumnLayout { + Layout.fillWidth: false + Layout.alignment: Qt.AlignTop | Qt.AlignLeft + spacing: 4 + + RowLayout { + Layout.fillWidth: false + spacing: 12 + Layout.alignment: Qt.AlignTop | Qt.AlignLeft + + StandardButton { + id: button1 + small: true + visible: button1.text + } + + StandardButton { + id: button2 + small: true + visible: button2.text + } + + StandardButton { + id: button3 + small: true + visible: button3.text + } + } + + ColumnLayout { + id: helpText + visible: false + Layout.alignment: Qt.AlignTop | Qt.AlignLeft + + MoneroComponents.TextPlain { + id: helpTextLarge + visible: helpTextLarge.text + font.family: MoneroComponents.Style.fontRegular.name + font.pixelSize: 13 + color: MoneroComponents.Style.defaultFontColor + } + + MoneroComponents.TextPlain { + id: helpTextSmall + visible: helpTextSmall.text + Layout.leftMargin: 5 + textFormat: Text.RichText + font.family: MoneroComponents.Style.fontRegular.name + font.pixelSize: 12 + color: MoneroComponents.Style.defaultFontColor + } + } + } +} diff --git a/pages/Transfer.qml b/pages/Transfer.qml index a82d6ebe..e01043cb 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -514,10 +514,9 @@ Rectangle { id: advancedLayout anchors.top: pageRoot.bottom anchors.left: parent.left - anchors.right: parent.right anchors.margins: 20 anchors.topMargin: 32 - spacing: 26 + spacing: 10 enabled: !viewOnly || pageRoot.enabled RowLayout { @@ -532,84 +531,88 @@ Rectangle { } } - GridLayout { + AdvancedOptionsItem { visible: persistentSettings.transferShowAdvanced && appWindow.walletMode >= 2 - columns: 6 - - StandardButton { - id: sweepUnmixableButton - text: qsTr("Sweep Unmixable") + translationManager.emptyString - enabled : pageRoot.enabled - small: true - onClicked: { - console.log("Transfer: sweepUnmixableClicked") - root.sweepUnmixableClicked() - } + title: qsTr("Key images") + translationManager.emptyString + button1.text: qsTr("Export") + translationManager.emptyString + button1.enabled: !appWindow.viewOnly + button1.onClicked: { + console.log("Transfer: export key images clicked") + exportKeyImagesDialog.open(); } - - StandardButton { - id: saveTxButton - text: qsTr("Create tx file") + translationManager.emptyString - visible: appWindow.viewOnly - enabled: pageRoot.checkInformation(amountLine.text, addressLine.text, appWindow.persistentSettings.nettype) - small: true - onClicked: { - console.log("Transfer: saveTx Clicked") - var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority - console.log("priority: " + priority) - console.log("amount: " + amountLine.text) - addressLine.text = addressLine.text.trim() - setPaymentId(paymentIdLine.text.trim()); - root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, root.mixin, priority, descriptionLine.text) - - } + button2.text: qsTr("Import") + translationManager.emptyString + button2.enabled: appWindow.viewOnly && appWindow.isTrustedDaemon() + button2.onClicked: { + console.log("Transfer: import key images clicked") + importKeyImagesDialog.open(); } - - StandardButton { - id: signTxButton - text: qsTr("Sign tx file") + translationManager.emptyString - small: true - visible: !appWindow.viewOnly - onClicked: { - console.log("Transfer: sign tx clicked") - signTxDialog.open(); + helpTextLarge.text: qsTr("Required for view-only wallets to display the real balance") + translationManager.emptyString + helpTextSmall.text: { + var errorMessage = ""; + if (appWindow.viewOnly && !appWindow.isTrustedDaemon()){ + errorMessage = "

" + qsTr("* To import, you must connect to a local node or a trusted remote node") + "

"; } + return "" + + "

" + qsTr("1. Using cold wallet, export the key images into a file") + "

" + + "

" + qsTr("2. Using view-only wallet, import the key images file") + "

" + + errorMessage + translationManager.emptyString } - - StandardButton { - id: submitTxButton - text: qsTr("Submit tx file") + translationManager.emptyString - small: true - visible: appWindow.viewOnly - enabled: pageRoot.enabled - onClicked: { - console.log("Transfer: submit tx clicked") - submitTxDialog.open(); - } + helpTextSmall.themeTransition: false + } + + AdvancedOptionsItem { + visible: persistentSettings.transferShowAdvanced && appWindow.walletMode >= 2 + title: qsTr("Offline transaction signing") + translationManager.emptyString + button1.text: qsTr("Create") + translationManager.emptyString + button1.enabled: appWindow.viewOnly && pageRoot.checkInformation(amountLine.text, addressLine.text, appWindow.persistentSettings.nettype) + button1.onClicked: { + console.log("Transfer: saveTx Clicked") + var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority + console.log("priority: " + priority) + console.log("amount: " + amountLine.text) + addressLine.text = addressLine.text.trim() + setPaymentId(paymentIdLine.text.trim()); + root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, root.mixin, priority, descriptionLine.text) } - - StandardButton { - id: exportKeyImagesButton - text: qsTr("Export key images") + translationManager.emptyString - small: true - visible: !appWindow.viewOnly - enabled: pageRoot.enabled - onClicked: { - console.log("Transfer: export key images clicked") - exportKeyImagesDialog.open(); + button2.text: qsTr("Sign (offline)") + translationManager.emptyString + button2.enabled: !appWindow.viewOnly + button2.onClicked: { + console.log("Transfer: sign tx clicked") + signTxDialog.open(); + } + button3.text: qsTr("Submit") + translationManager.emptyString + button3.enabled: appWindow.viewOnly + button3.onClicked: { + console.log("Transfer: submit tx clicked") + submitTxDialog.open(); + } + helpTextLarge.text: qsTr("Spend XMR from a cold (offline) wallet") + translationManager.emptyString + helpTextSmall.text: { + var errorMessage = ""; + if (appWindow.viewOnly && !pageRoot.checkInformation(amountLine.text, addressLine.text, appWindow.persistentSettings.nettype)){ + errorMessage = "

" + qsTr("* To create a transaction file, please enter address and amount above") + "

"; } + return "" + + "

" + qsTr("1. Using view-only wallet, export the outputs into a file") + + "

" + qsTr("2. Using cold wallet, import the outputs file and export the key images") + "

" + + "

" + qsTr("3. Using view-only wallet, import the key images file and create a transaction file") + "

" + + errorMessage + + "

" + qsTr("4. Using cold wallet, sign your transaction file") + "

" + + "

" + qsTr("5. Using view-only wallet, submit your signed transaction") + "

" + translationManager.emptyString } + helpTextSmall.themeTransition: false + } - StandardButton { - id: importKeyImagesButton - text: qsTr("Import key images") + translationManager.emptyString - small: true - enabled: appWindow.viewOnly && appWindow.isTrustedDaemon() - onClicked: { - console.log("Transfer: import key images clicked") - importKeyImagesDialog.open(); - } + AdvancedOptionsItem { + visible: persistentSettings.transferShowAdvanced && appWindow.walletMode >= 2 + title: qsTr("Unmixable outputs") + translationManager.emptyString + button1.text: qsTr("Sweep") + translationManager.emptyString + button1.enabled : pageRoot.enabled + button1.onClicked: { + console.log("Transfer: sweepUnmixableClicked") + root.sweepUnmixableClicked() } + helpTextLarge.text: qsTr("Create a transaction that spends old unmovable outputs") + translationManager.emptyString } } diff --git a/qml.qrc b/qml.qrc index 12d1f37d..2893f15a 100644 --- a/qml.qrc +++ b/qml.qrc @@ -237,5 +237,6 @@ images/edit.svg images/arrow-right-in-circle-outline-medium-white.svg images/tails-grey.png + components/AdvancedOptionsItem.qml