aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2021-07-06 11:46:35 -0400
committerluigi1111 <luigi1111w@gmail.com>2021-07-06 11:46:35 -0400
commitb4e6f20b5358b748b5180cc575d96a11adf716e8 (patch)
tree1ac8181b4e175e585e49baee9fdcbab2c914476c /pages
parenta278781abf445d8ae1c4be7655454a370fe3b6cb (diff)
parent0fd0fc5ceb32a0ce44c4ea9bfc7b92a04d7396ac (diff)
downloadmonzero-gui-b4e6f20b5358b748b5180cc575d96a11adf716e8.tar.gz
monzero-gui-b4e6f20b5358b748b5180cc575d96a11adf716e8.tar.xz
monzero-gui-b4e6f20b5358b748b5180cc575d96a11adf716e8.zip
Merge pull request #3580
0fd0fc5 Receive: selected address details on top; QR code click to ampliate/right click to save as image; click on description to edit; display full address; use standard button for 'create new address' (rating89us)
Diffstat (limited to 'pages')
-rw-r--r--pages/Receive.qml278
1 files changed, 195 insertions, 83 deletions
diff --git a/pages/Receive.qml b/pages/Receive.qml
index 2008e779..fdc9cf10 100644
--- a/pages/Receive.qml
+++ b/pages/Receive.qml
@@ -72,17 +72,194 @@ Rectangle {
anchors.top: parent.top
anchors.right: parent.right
- spacing: 20
+ spacing: 15
ColumnLayout {
- id: addressRow
+ id: selectedAddressDetailsColumn
+ Layout.alignment: Qt.AlignHCenter
spacing: 0
+ property int qrSize: 220
- MoneroComponents.LabelSubheader {
+ Rectangle {
+ id: qrContainer
+ color: MoneroComponents.Style.blackTheme ? "white" : "transparent"
Layout.fillWidth: true
- fontSize: 24
+ Layout.alignment: Qt.AlignHCenter
+ Layout.maximumWidth: parent.qrSize
+ Layout.preferredHeight: width
+ radius: 4
+
+ Image {
+ id: qrCode
+ anchors.fill: parent
+ anchors.margins: 1
+ smooth: false
+ fillMode: Image.PreserveAspectFit
+ source: "image://qrcode/" + TxUtils.makeQRCodeString(appWindow.current_address)
+
+ MouseArea {
+ anchors.fill: parent
+ hoverEnabled: true
+ cursorShape: Qt.PointingHandCursor
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ if (mouse.button == Qt.LeftButton){
+ selectedAddressDetailsColumn.qrSize = selectedAddressDetailsColumn.qrSize == 220 ? 300 : 220;
+ } else if (mouse.button == Qt.RightButton){
+ qrMenu.x = this.mouseX;
+ qrMenu.y = this.mouseY;
+ qrMenu.open()
+ }
+ }
+ }
+ }
+
+ Menu {
+ id: qrMenu
+ title: "QrCode"
+
+ MenuItem {
+ text: qsTr("Save as Image") + translationManager.emptyString;
+ onTriggered: qrFileDialog.open()
+ }
+ }
+ }
+
+ MoneroComponents.TextPlain {
+ id: selectedaddressIndex
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredWidth: 220
+ Layout.maximumWidth: 220
+ Layout.topMargin: 15
+ horizontalAlignment: Text.AlignHCenter
+ text: qsTr("Address #") + subaddressListView.currentIndex + translationManager.emptyString
+ wrapMode: Text.WordWrap
+ font.family: MoneroComponents.Style.fontRegular.name
+ font.pixelSize: 17
textFormat: Text.RichText
- text: qsTr("Addresses") + translationManager.emptyString
+ color: MoneroComponents.Style.defaultFontColor
+ themeTransition: false
+ }
+
+ MoneroComponents.TextPlain {
+ id: selectedAddressDrescription
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredWidth: 220
+ Layout.maximumWidth: 220
+ Layout.topMargin: 10
+ horizontalAlignment: Text.AlignHCenter
+ text: "(" + qsTr("no label") + ")" + translationManager.emptyString
+ wrapMode: Text.WordWrap
+ font.family: MoneroComponents.Style.fontRegular.name
+ font.pixelSize: 17
+ textFormat: Text.RichText
+ color: selectedAddressDrescriptionMouseArea.containsMouse ? MoneroComponents.Style.orange : MoneroComponents.Style.dimmedFontColor
+ themeTransition: false
+ tooltip: subaddressListView.currentIndex > 0 ? qsTr("Edit address label") : "" + translationManager.emptyString
+ MouseArea {
+ id: selectedAddressDrescriptionMouseArea
+ visible: subaddressListView.currentIndex > 0
+ hoverEnabled: true
+ anchors.fill: parent
+ cursorShape: Qt.PointingHandCursor
+ onEntered: parent.tooltip ? parent.tooltipPopup.open() : ""
+ onExited: parent.tooltip ? parent.tooltipPopup.close() : ""
+ onClicked: {
+ renameSubaddressLabel(appWindow.current_subaddress_table_index);
+ }
+ }
+ }
+
+ MoneroComponents.TextPlain {
+ id: selectedAddress
+ Layout.alignment: Qt.AlignHCenter
+ Layout.maximumWidth: 300
+ Layout.topMargin: 11
+ text: appWindow.current_address ? appWindow.current_address : ""
+ horizontalAlignment: TextInput.AlignHCenter
+ wrapMode: Text.Wrap
+ textFormat: Text.RichText
+ color: selectedAddressMouseArea.containsMouse ? MoneroComponents.Style.orange : MoneroComponents.Style.defaultFontColor
+ font.pixelSize: 15
+ font.family: MoneroComponents.Style.fontRegular.name
+ themeTransition: false
+ tooltip: qsTr("Copy address to clipboard") + translationManager.emptyString
+ MouseArea {
+ id: selectedAddressMouseArea
+ hoverEnabled: true
+ anchors.fill: parent
+ cursorShape: Qt.PointingHandCursor
+ onEntered: parent.tooltip ? parent.tooltipPopup.open() : ""
+ onExited: parent.tooltip ? parent.tooltipPopup.close() : ""
+ onClicked: {
+ clipboard.setText(appWindow.current_address);
+ appWindow.showStatusMessage(qsTr("Address copied to clipboard") + translationManager.emptyString, 3);
+ }
+ }
+ }
+
+ MoneroComponents.StandardButton {
+ Layout.preferredWidth: 220
+ Layout.alignment: Qt.AlignHCenter
+ Layout.topMargin: 18
+ small: true
+ text: qsTr("Show on device") + translationManager.emptyString
+ fontSize: 14
+ visible: appWindow.currentWallet ? appWindow.currentWallet.isHwBacked() : false
+ onClicked: {
+ appWindow.currentWallet.deviceShowAddressAsync(
+ appWindow.currentWallet.currentSubaddressAccount,
+ appWindow.current_subaddress_table_index,
+ '');
+ }
+ }
+ }
+
+ ColumnLayout {
+ id: addressRow
+ spacing: 0
+
+ RowLayout {
+ spacing: 0
+
+ MoneroComponents.LabelSubheader {
+ Layout.fillWidth: true
+ fontSize: 24
+ textFormat: Text.RichText
+ text: qsTr("Addresses") + translationManager.emptyString
+ }
+
+ MoneroComponents.StandardButton {
+ id: createAddressButton
+ small: true
+ text: qsTr("Create new address") + translationManager.emptyString
+ fontSize: 13
+ onClicked: {
+ inputDialog.labelText = qsTr("Set the label of the new address:") + translationManager.emptyString
+ inputDialog.onAcceptedCallback = function() {
+ appWindow.currentWallet.subaddress.addRow(appWindow.currentWallet.currentSubaddressAccount, inputDialog.inputText)
+ current_subaddress_table_index = appWindow.currentWallet.numSubaddresses(appWindow.currentWallet.currentSubaddressAccount) - 1
+ subaddressListView.currentIndex = current_subaddress_table_index
+ }
+ inputDialog.onRejectedCallback = null;
+ inputDialog.open()
+ }
+
+ Rectangle {
+ anchors.top: createAddressButton.bottom
+ anchors.topMargin: 8
+ anchors.left: createAddressButton.left
+ anchors.right: createAddressButton.right
+ height: 2
+ color: MoneroComponents.Style.appWindowBorderColor
+
+ MoneroEffects.ColorTransition {
+ targetObj: parent
+ blackColor: MoneroComponents.Style._b_appWindowBorderColor
+ whiteColor: MoneroComponents.Style._w_appWindowBorderColor
+ }
+ }
+ }
}
ColumnLayout {
@@ -239,6 +416,16 @@ Rectangle {
appWindow.currentWallet.currentSubaddressAccount,
subaddressListView.currentIndex
);
+ if (subaddressListView.currentIndex == 0) {
+ selectedAddressDrescription.text = qsTr("Primary address") + translationManager.emptyString;
+ } else {
+ var selectedAddressLabel = appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, appWindow.current_subaddress_table_index);
+ if (selectedAddressLabel == "") {
+ selectedAddressDrescription.text = "(" + qsTr("no label") + ")" + translationManager.emptyString
+ } else {
+ selectedAddressDrescription.text = selectedAddressLabel
+ }
+ }
}
}
}
@@ -254,84 +441,6 @@ Rectangle {
whiteColor: MoneroComponents.Style._w_appWindowBorderColor
}
}
-
- MoneroComponents.CheckBox {
- id: addNewAddressCheckbox
- border: false
- uncheckedIcon: FontAwesome.plusCircle
- toggleOnClick: false
- fontAwesomeIcons: true
- fontSize: 16
- iconOnTheLeft: true
- Layout.fillWidth: true
- Layout.topMargin: 10
- text: qsTr("Create new address") + translationManager.emptyString;
- onClicked: {
- inputDialog.labelText = qsTr("Set the label of the new address:") + translationManager.emptyString
- inputDialog.onAcceptedCallback = function() {
- appWindow.currentWallet.subaddress.addRow(appWindow.currentWallet.currentSubaddressAccount, inputDialog.inputText)
- current_subaddress_table_index = appWindow.currentWallet.numSubaddresses(appWindow.currentWallet.currentSubaddressAccount) - 1
- subaddressListView.currentIndex = current_subaddress_table_index
- }
- inputDialog.onRejectedCallback = null;
- inputDialog.open()
- }
- }
- }
-
- ColumnLayout {
- Layout.alignment: Qt.AlignHCenter
- spacing: 11
- property int qrSize: 220
-
- Rectangle {
- id: qrContainer
- color: MoneroComponents.Style.blackTheme ? "white" : "transparent"
- Layout.fillWidth: true
- Layout.maximumWidth: parent.qrSize
- Layout.preferredHeight: width
- radius: 4
-
- Image {
- id: qrCode
- anchors.fill: parent
- anchors.margins: 1
-
- smooth: false
- fillMode: Image.PreserveAspectFit
- source: "image://qrcode/" + TxUtils.makeQRCodeString(appWindow.current_address)
-
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.RightButton
- onPressAndHold: qrFileDialog.open()
- }
- }
- }
-
- MoneroComponents.StandardButton {
- Layout.preferredWidth: 220
- small: true
- text: FontAwesome.save + " %1".arg(qsTr("Save as image")) + translationManager.emptyString
- label.font.family: FontAwesome.fontFamily
- fontSize: 13
- onClicked: qrFileDialog.open()
- }
-
- MoneroComponents.StandardButton {
- Layout.preferredWidth: 220
- small: true
- text: FontAwesome.eye + " %1".arg(qsTr("Show on device")) + translationManager.emptyString
- label.font.family: FontAwesome.fontFamily
- fontSize: 13
- visible: appWindow.currentWallet ? appWindow.currentWallet.isHwBacked() : false
- onClicked: {
- appWindow.currentWallet.deviceShowAddressAsync(
- appWindow.currentWallet.currentSubaddressAccount,
- appWindow.current_subaddress_table_index,
- '');
- }
- }
}
MessageDialog {
@@ -364,6 +473,9 @@ Rectangle {
if (appWindow.currentWallet) {
appWindow.current_address = appWindow.currentWallet.address(appWindow.currentWallet.currentSubaddressAccount, 0)
appWindow.currentWallet.subaddress.refresh(appWindow.currentWallet.currentSubaddressAccount)
+ if (subaddressListView.currentIndex == -1) {
+ subaddressListView.currentIndex = 0;
+ }
}
}