mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
Reimplemented create/edit/copy (sub)address icons and buttons
This commit is contained in:
parent
6ff273fd32
commit
0e49e4ad37
2 changed files with 109 additions and 50 deletions
|
@ -47,7 +47,7 @@ Rectangle {
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
property var model
|
property var model
|
||||||
property var current_address
|
property var current_address
|
||||||
property var current_subaddress_table_index: 0
|
property int current_subaddress_table_index: 0
|
||||||
property alias addressText : pageReceive.current_address
|
property alias addressText : pageReceive.current_address
|
||||||
|
|
||||||
function makeQRCodeString() {
|
function makeQRCodeString() {
|
||||||
|
@ -158,6 +158,16 @@ Rectangle {
|
||||||
//setTrackingLineText(text + "<br>" + list.join("<br>"))
|
//setTrackingLineText(text + "<br>" + list.join("<br>"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renameSubaddressLabel(_index){
|
||||||
|
inputDialog.labelText = qsTr("Set the label of the selected address:") + translationManager.emptyString;
|
||||||
|
inputDialog.inputText = appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, _index);
|
||||||
|
inputDialog.onAcceptedCallback = function() {
|
||||||
|
appWindow.currentWallet.subaddress.setLabel(appWindow.currentWallet.currentSubaddressAccount, _index, inputDialog.inputText);
|
||||||
|
}
|
||||||
|
inputDialog.onRejectedCallback = null;
|
||||||
|
inputDialog.open()
|
||||||
|
}
|
||||||
|
|
||||||
Clipboard { id: clipboard }
|
Clipboard { id: clipboard }
|
||||||
|
|
||||||
/* main layout */
|
/* main layout */
|
||||||
|
@ -189,24 +199,25 @@ Rectangle {
|
||||||
qsTr("Help") + "</a>" +
|
qsTr("Help") + "</a>" +
|
||||||
translationManager.emptyString
|
translationManager.emptyString
|
||||||
onLinkActivated: {
|
onLinkActivated: {
|
||||||
trackingHowToUseDialog.title = qsTr("Tracking payments") + translationManager.emptyString;
|
receivePageDialog.title = qsTr("Tracking payments") + translationManager.emptyString;
|
||||||
trackingHowToUseDialog.text = qsTr(
|
receivePageDialog.text = qsTr(
|
||||||
"<p>This QR code includes the address you selected above and" +
|
"<p>This QR code includes the address you selected above and" +
|
||||||
"the amount you entered below. Share it with others (right-click->Save) " +
|
"the amount you entered below. Share it with others (right-click->Save) " +
|
||||||
"so they can more easily send you exact amounts.</p>"
|
"so they can more easily send you exact amounts.</p>"
|
||||||
)
|
)
|
||||||
trackingHowToUseDialog.icon = StandardIcon.Information
|
receivePageDialog.icon = StandardIcon.Information
|
||||||
trackingHowToUseDialog.open()
|
receivePageDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: trackingTableRow2
|
id: subaddressListRow
|
||||||
visible: subaddressListView.count >= 1
|
property int subaddressListItemHeight: 32 * scaleRatio
|
||||||
Layout.topMargin: 22 * scaleRatio
|
Layout.topMargin: 22 * scaleRatio
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.minimumWidth: 240
|
Layout.minimumWidth: 240
|
||||||
Layout.preferredHeight: 32 * subaddressListView.count
|
Layout.preferredHeight: subaddressListItemHeight * subaddressListView.count
|
||||||
|
visible: subaddressListView.count >= 1
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: subaddressListView
|
id: subaddressListView
|
||||||
|
@ -216,7 +227,7 @@ Rectangle {
|
||||||
boundsBehavior: ListView.StopAtBounds
|
boundsBehavior: ListView.StopAtBounds
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
id: tableItem2
|
id: tableItem2
|
||||||
height: 32
|
height: subaddressListRow.subaddressListItemHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
@ -282,6 +293,34 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IconButton {
|
||||||
|
id: renameButton
|
||||||
|
imageSource: "../images/editIcon.png"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.right: index !== 0 ? copyButton.left : parent.right
|
||||||
|
anchors.rightMargin: index !== 0 ? 0 : 6
|
||||||
|
anchors.top: undefined
|
||||||
|
visible: index !== 0
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
renameSubaddressLabel(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IconButton {
|
||||||
|
id: copyButton
|
||||||
|
imageSource: "../images/copyToClipboard.png"
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.top: undefined
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
console.log("Address copied to clipboard");
|
||||||
|
clipboard.setText(address);
|
||||||
|
appWindow.showStatusMessage(qsTr("Address copied to clipboard"),3);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onCurrentItemChanged: {
|
onCurrentItemChanged: {
|
||||||
// reset global vars
|
// reset global vars
|
||||||
|
@ -297,37 +336,55 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
// 'fake' row for 'create new address'
|
||||||
spacing: 20
|
ColumnLayout{
|
||||||
Layout.topMargin: 20
|
id: createAddressRow
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
StandardButton {
|
Rectangle {
|
||||||
small: true
|
color: "#404040"
|
||||||
text: qsTr("Create new address") + translationManager.emptyString;
|
Layout.fillWidth: true
|
||||||
onClicked: {
|
height: 1
|
||||||
inputDialog.labelText = qsTr("Set the label of the new address:") + translationManager.emptyString
|
|
||||||
inputDialog.inputText = qsTr("(Untitled)")
|
|
||||||
inputDialog.onAcceptedCallback = function() {
|
|
||||||
appWindow.currentWallet.subaddress.addRow(appWindow.currentWallet.currentSubaddressAccount, inputDialog.inputText)
|
|
||||||
current_subaddress_table_index = appWindow.currentWallet.numSubaddresses() - 1
|
|
||||||
}
|
|
||||||
inputDialog.onRejectedCallback = null;
|
|
||||||
inputDialog.open()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StandardButton {
|
Rectangle{
|
||||||
small: true
|
id: createAddressRect
|
||||||
enabled: current_subaddress_table_index > 0
|
Layout.preferredHeight: subaddressListRow.subaddressListItemHeight
|
||||||
text: qsTr("Rename") + translationManager.emptyString;
|
color: "transparent"
|
||||||
onClicked: {
|
Layout.fillWidth: true
|
||||||
inputDialog.labelText = qsTr("Set the label of the selected address:") + translationManager.emptyString
|
|
||||||
inputDialog.inputText = appWindow.currentWallet.getSubaddressLabel(appWindow.currentWallet.currentSubaddressAccount, current_subaddress_table_index)
|
Label {
|
||||||
inputDialog.onAcceptedCallback = function() {
|
color: "#757575"
|
||||||
appWindow.currentWallet.subaddress.setLabel(appWindow.currentWallet.currentSubaddressAccount, current_subaddress_table_index, inputDialog.inputText)
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 6
|
||||||
|
fontSize: 14 * scaleRatio
|
||||||
|
fontBold: true
|
||||||
|
text: "+ " + qsTr("Create new address") + translationManager.emptyString;
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
|
onEntered: {
|
||||||
|
createAddressRect.color = "#26FFFFFF"
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
createAddressRect.color = "transparent"
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
inputDialog.labelText = qsTr("Set the label of the new address:") + translationManager.emptyString
|
||||||
|
inputDialog.inputText = qsTr("(Untitled)")
|
||||||
|
inputDialog.onAcceptedCallback = function() {
|
||||||
|
appWindow.currentWallet.subaddress.addRow(appWindow.currentWallet.currentSubaddressAccount, inputDialog.inputText)
|
||||||
|
current_subaddress_table_index = appWindow.currentWallet.numSubaddresses() - 1
|
||||||
|
}
|
||||||
|
inputDialog.onRejectedCallback = null;
|
||||||
|
inputDialog.open()
|
||||||
}
|
}
|
||||||
inputDialog.onRejectedCallback = null;
|
|
||||||
inputDialog.open()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -352,14 +409,14 @@ Rectangle {
|
||||||
qsTr("Help") + "</a>" +
|
qsTr("Help") + "</a>" +
|
||||||
translationManager.emptyString
|
translationManager.emptyString
|
||||||
onLinkActivated: {
|
onLinkActivated: {
|
||||||
trackingHowToUseDialog.title = qsTr("QR Code") + translationManager.emptyString;
|
receivePageDialog.title = qsTr("QR Code") + translationManager.emptyString;
|
||||||
trackingHowToUseDialog.text = qsTr(
|
receivePageDialog.text = qsTr(
|
||||||
"<p>This QR code includes the address you selected above and" +
|
"<p>This QR code includes the address you selected above and" +
|
||||||
"the amount you entered below. Share it with others (right-click->Save) " +
|
"the amount you entered below. Share it with others (right-click->Save) " +
|
||||||
"so they can more easily send you exact amounts.</p>"
|
"so they can more easily send you exact amounts.</p>"
|
||||||
)
|
)
|
||||||
trackingHowToUseDialog.icon = StandardIcon.Information
|
receivePageDialog.icon = StandardIcon.Information
|
||||||
trackingHowToUseDialog.open()
|
receivePageDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,8 +499,8 @@ Rectangle {
|
||||||
qsTr("Help") + "</a>" +
|
qsTr("Help") + "</a>" +
|
||||||
translationManager.emptyString
|
translationManager.emptyString
|
||||||
onLinkActivated: {
|
onLinkActivated: {
|
||||||
trackingHowToUseDialog.title = qsTr("Tracking payments") + translationManager.emptyString;
|
receivePageDialog.title = qsTr("Tracking payments") + translationManager.emptyString;
|
||||||
trackingHowToUseDialog.text = qsTr(
|
receivePageDialog.text = qsTr(
|
||||||
"<p><font size='+2'>This is a simple sales tracker:</font></p>" +
|
"<p><font size='+2'>This is a simple sales tracker:</font></p>" +
|
||||||
"<p>Let your customer scan that QR code to make a payment (if that customer has software which " +
|
"<p>Let your customer scan that QR code to make a payment (if that customer has software which " +
|
||||||
"supports QR code scanning).</p>" +
|
"supports QR code scanning).</p>" +
|
||||||
|
@ -454,8 +511,8 @@ Rectangle {
|
||||||
"confirmed in short order, but there is still a possibility they might not, so for larger " +
|
"confirmed in short order, but there is still a possibility they might not, so for larger " +
|
||||||
"values you may want to wait for one or more confirmation(s).</p>"
|
"values you may want to wait for one or more confirmation(s).</p>"
|
||||||
)
|
)
|
||||||
trackingHowToUseDialog.icon = StandardIcon.Information
|
receivePageDialog.icon = StandardIcon.Information
|
||||||
trackingHowToUseDialog.open()
|
receivePageDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +570,7 @@ Rectangle {
|
||||||
width: 12 * scaleRatio
|
width: 12 * scaleRatio
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 12
|
anchors.leftMargin: 8
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
@ -564,6 +621,7 @@ Rectangle {
|
||||||
|
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 4
|
anchors.rightMargin: 4
|
||||||
|
anchors.top: undefined
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -584,7 +642,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageDialog {
|
MessageDialog {
|
||||||
id: trackingHowToUseDialog
|
id: receivePageDialog
|
||||||
standardButtons: StandardButton.Ok
|
standardButtons: StandardButton.Ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,10 +655,10 @@ Rectangle {
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if(!walletManager.saveQrCode(makeQRCodeString(), walletManager.urlToLocalPath(fileUrl))) {
|
if(!walletManager.saveQrCode(makeQRCodeString(), walletManager.urlToLocalPath(fileUrl))) {
|
||||||
console.log("Failed to save QrCode to file " + walletManager.urlToLocalPath(fileUrl) )
|
console.log("Failed to save QrCode to file " + walletManager.urlToLocalPath(fileUrl) )
|
||||||
trackingHowToUseDialog.title = qsTr("Save QrCode") + translationManager.emptyString;
|
receivePageDialog.title = qsTr("Save QrCode") + translationManager.emptyString;
|
||||||
trackingHowToUseDialog.text = qsTr("Failed to save QrCode to ") + walletManager.urlToLocalPath(fileUrl) + translationManager.emptyString;
|
receivePageDialog.text = qsTr("Failed to save QrCode to ") + walletManager.urlToLocalPath(fileUrl) + translationManager.emptyString;
|
||||||
trackingHowToUseDialog.icon = StandardIcon.Error
|
receivePageDialog.icon = StandardIcon.Error
|
||||||
trackingHowToUseDialog.open()
|
receivePageDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
qml.qrc
1
qml.qrc
|
@ -208,5 +208,6 @@
|
||||||
<file>js/Windows.js</file>
|
<file>js/Windows.js</file>
|
||||||
<file>js/Utils.js</file>
|
<file>js/Utils.js</file>
|
||||||
<file>components/RadioButton.qml</file>
|
<file>components/RadioButton.qml</file>
|
||||||
|
<file>images/editIcon.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Loading…
Reference in a new issue