Receive: update subaddress table design

This commit is contained in:
selsta 2019-01-22 15:51:37 +01:00
parent c7f3deb5cc
commit 28332f54e6
No known key found for this signature in database
GPG key ID: 2EA0A99A8B07AE5E

View file

@ -88,8 +88,8 @@ Rectangle {
ColumnLayout { ColumnLayout {
id: subaddressListRow id: subaddressListRow
property int subaddressListItemHeight: 32 * scaleRatio property int subaddressListItemHeight: 50 * scaleRatio
Layout.topMargin: 22 * scaleRatio Layout.topMargin: 6 * scaleRatio
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 240 Layout.minimumWidth: 240
Layout.preferredHeight: subaddressListItemHeight * subaddressListView.count Layout.preferredHeight: subaddressListItemHeight * subaddressListView.count
@ -97,8 +97,8 @@ Rectangle {
ListView { ListView {
id: subaddressListView id: subaddressListView
Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
anchors.fill: parent
clip: true clip: true
boundsBehavior: ListView.StopAtBounds boundsBehavior: ListView.StopAtBounds
delegate: Rectangle { delegate: Rectangle {
@ -128,7 +128,7 @@ Rectangle {
color: index === appWindow.current_subaddress_table_index ? "white" : "#757575" color: index === appWindow.current_subaddress_table_index ? "white" : "#757575"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 6 anchors.leftMargin: 6 * scaleRatio
fontSize: 14 * scaleRatio fontSize: 14 * scaleRatio
fontBold: true fontBold: true
text: "#" + index text: "#" + index
@ -139,29 +139,26 @@ Rectangle {
color: "#a5a5a5" color: "#a5a5a5"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: idLabel.right anchors.left: idLabel.right
anchors.leftMargin: 6 anchors.leftMargin: 6 * scaleRatio
fontSize: 14 * scaleRatio fontSize: 14 * scaleRatio
fontBold: true fontBold: true
text: label text: label
elide: Text.ElideRight
textWidth: addressLabel.x - nameLabel.x - 1
} }
MoneroComponents.Label { MoneroComponents.Label {
id: addressLabel
color: "white" color: "white"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: nameLabel.right anchors.left: parent.right
anchors.leftMargin: 6 anchors.leftMargin: (mainLayout.width < 510 ? -130 : -190) * scaleRatio
fontSize: 14 * scaleRatio fontSize: 14 * scaleRatio
fontBold: true fontBold: true
text: { text: TxUtils.addressTruncate(address, mainLayout.width < 510 ? 6 : 10)
if(isMobile){
TxUtils.addressTruncate(address, 6);
} else {
return TxUtils.addressTruncate(address, 10);
}
}
} }
MouseArea{ MouseArea {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
@ -181,9 +178,9 @@ Rectangle {
id: renameButton id: renameButton
imageSource: "../images/editIcon.png" imageSource: "../images/editIcon.png"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: index !== 0 ? copyButton.left : parent.right anchors.right: parent.right
anchors.rightMargin: index !== 0 ? 0 : 6 anchors.rightMargin: 30 * scaleRatio
anchors.top: undefined anchors.topMargin: 1 * scaleRatio
visible: index !== 0 visible: index !== 0
onClicked: { onClicked: {
@ -193,7 +190,7 @@ Rectangle {
MoneroComponents.IconButton { MoneroComponents.IconButton {
id: copyButton id: copyButton
imageSource: "../images/copyToClipboard.png" imageSource: "../images/dropdownCopy.png"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.top: undefined anchors.top: undefined
anchors.right: parent.right anchors.right: parent.right
@ -216,56 +213,32 @@ Rectangle {
} }
} }
// 'fake' row for 'create new address' Rectangle {
ColumnLayout { color: "#404040"
id: createAddressRow
Layout.fillWidth: true Layout.fillWidth: true
spacing: 0 height: 1
}
Rectangle { MoneroComponents.CheckBox {
color: "#404040" id: addNewAccountCheckbox
Layout.fillWidth: true visible: !selectAndSend
height: 1 border: false
} checkedIcon: "qrc:///images/plus-in-circle-medium-white.png"
uncheckedIcon: "qrc:///images/plus-in-circle-medium-white.png"
Rectangle { fontSize: 14 * scaleRatio
id: createAddressRect iconOnTheLeft: true
Layout.preferredHeight: subaddressListRow.subaddressListItemHeight Layout.fillWidth: true
color: "transparent" Layout.topMargin: 10 * scaleRatio
Layout.fillWidth: true text: qsTr("Create new account") + translationManager.emptyString;
onClicked: {
MoneroComponents.Label { inputDialog.labelText = qsTr("Set the label of the new address:") + translationManager.emptyString
color: "#757575" inputDialog.inputText = qsTr("(Untitled)")
anchors.verticalCenter: parent.verticalCenter inputDialog.onAcceptedCallback = function() {
anchors.left: parent.left appWindow.currentWallet.subaddress.addRow(appWindow.currentWallet.currentSubaddressAccount, inputDialog.inputText)
anchors.leftMargin: 6 current_subaddress_table_index = appWindow.currentWallet.numSubaddresses(appWindow.currentWallet.currentSubaddressAccount) - 1
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(appWindow.currentWallet.currentSubaddressAccount) - 1
}
inputDialog.onRejectedCallback = null;
inputDialog.open()
}
} }
inputDialog.onRejectedCallback = null;
inputDialog.open()
} }
} }
} }