mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-03 17:39:54 +00:00
StandardDropdown, Transfer: adjust dropdown width based on content; display estimating fee label, adjust fee text
This commit is contained in:
parent
b6682330a6
commit
a5b8e71399
2 changed files with 41 additions and 7 deletions
|
@ -56,6 +56,7 @@ ColumnLayout {
|
||||||
property bool showingHeader: dropdownLabel.text !== ""
|
property bool showingHeader: dropdownLabel.text !== ""
|
||||||
property int labelFontSize: 14
|
property int labelFontSize: 14
|
||||||
property bool labelFontBold: false
|
property bool labelFontBold: false
|
||||||
|
property bool dropdownFillWidth: true
|
||||||
property int dropdownHeight: 39
|
property int dropdownHeight: 39
|
||||||
property int fontSize: 14
|
property int fontSize: 14
|
||||||
property int fontItemSize: 14
|
property int fontItemSize: 14
|
||||||
|
@ -94,7 +95,15 @@ ColumnLayout {
|
||||||
border.width: dropdown.headerBorder ? 1 : 0
|
border.width: dropdown.headerBorder ? 1 : 0
|
||||||
border.color: dropdown.colorBorder
|
border.color: dropdown.colorBorder
|
||||||
radius: 4
|
radius: 4
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: {
|
||||||
|
if (dropdown.dropdownFillWidth) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
dropdown.Layout.maximumWidth = repeater.implicitWidth;
|
||||||
|
head.Layout.preferredWidth = repeater.implicitWidth;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
Layout.preferredHeight: dropdownHeight
|
Layout.preferredHeight: dropdownHeight
|
||||||
|
|
||||||
MoneroComponents.TextPlain {
|
MoneroComponents.TextPlain {
|
||||||
|
@ -149,7 +158,7 @@ ColumnLayout {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: droplist
|
id: droplist
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
width: dropdown.width
|
width: dropdown.dropdownFillWidth ? dropdown.width : repeater.implicitWidth
|
||||||
y: head.y + head.height
|
y: head.y + head.height
|
||||||
clip: true
|
clip: true
|
||||||
height: dropdown.expanded ? columnid.height : 0
|
height: dropdown.expanded ? columnid.height : 0
|
||||||
|
@ -168,6 +177,7 @@ ColumnLayout {
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: repeater
|
id: repeater
|
||||||
|
implicitWidth: getMaximumWidth()
|
||||||
|
|
||||||
// Workaround for translations in listElements. All translated strings needs to be listed in this file.
|
// Workaround for translations in listElements. All translated strings needs to be listed in this file.
|
||||||
property string stringAutomatic: qsTr("Automatic") + translationManager.emptyString
|
property string stringAutomatic: qsTr("Automatic") + translationManager.emptyString
|
||||||
|
@ -176,6 +186,17 @@ ColumnLayout {
|
||||||
property string stringFast: qsTr("Fast (x5 fee)") + translationManager.emptyString
|
property string stringFast: qsTr("Fast (x5 fee)") + translationManager.emptyString
|
||||||
property string stringFastest: qsTr("Fastest (x200 fee)") + translationManager.emptyString
|
property string stringFastest: qsTr("Fastest (x200 fee)") + translationManager.emptyString
|
||||||
|
|
||||||
|
function getMaximumWidth() {
|
||||||
|
var maximumWidthInList = 0;
|
||||||
|
for (var i = 0; i < repeater.count; i++) {
|
||||||
|
var listItemWidth = repeater.itemAt(i).children[0].contentWidth
|
||||||
|
if (listItemWidth > maximumWidthInList) {
|
||||||
|
maximumWidthInList = listItemWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 12 + maximumWidthInList + 12 + 24;
|
||||||
|
}
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
@ -186,6 +207,7 @@ ColumnLayout {
|
||||||
MoneroComponents.TextPlain {
|
MoneroComponents.TextPlain {
|
||||||
id: col1Text
|
id: col1Text
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
width: 12 + col1Text.contentWidth + 12 + 24
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: col2Text.left
|
anchors.right: col2Text.left
|
||||||
anchors.leftMargin: 12
|
anchors.leftMargin: 12
|
||||||
|
|
|
@ -698,8 +698,8 @@ Rectangle {
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
|
||||||
StandardDropdown {
|
StandardDropdown {
|
||||||
Layout.maximumWidth: 200
|
|
||||||
id: priorityDropdown
|
id: priorityDropdown
|
||||||
|
dropdownFillWidth: false
|
||||||
currentIndex: 0
|
currentIndex: 0
|
||||||
dataModel: priorityModelV5
|
dataModel: priorityModelV5
|
||||||
labelText: qsTr("Transaction priority") + translationManager.emptyString
|
labelText: qsTr("Transaction priority") + translationManager.emptyString
|
||||||
|
@ -709,6 +709,7 @@ Rectangle {
|
||||||
MoneroComponents.TextPlain {
|
MoneroComponents.TextPlain {
|
||||||
id: feeLabel
|
id: feeLabel
|
||||||
Layout.alignment: Qt.AlignBottom
|
Layout.alignment: Qt.AlignBottom
|
||||||
|
Layout.fillWidth: true
|
||||||
Layout.bottomMargin: 11
|
Layout.bottomMargin: 11
|
||||||
font.family: MoneroComponents.Style.fontRegular.name
|
font.family: MoneroComponents.Style.fontRegular.name
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
|
@ -751,16 +752,27 @@ Rectangle {
|
||||||
if (!sendButton.enabled || estimatedFee == null) {
|
if (!sendButton.enabled || estimatedFee == null) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return "~%1 XMR%2 %3".arg(estimatedFee)
|
return "%1: ~%2 XMR%3".arg(qsTr("Fee") + translationManager.emptyString)
|
||||||
.arg(estimatedFeeFiat)
|
.arg(estimatedFee)
|
||||||
.arg(qsTr("fee") + translationManager.emptyString);
|
.arg(estimatedFeeFiat);
|
||||||
}
|
}
|
||||||
|
|
||||||
BusyIndicator {
|
BusyIndicator {
|
||||||
anchors.left: parent.left
|
Layout.fillWidth: true
|
||||||
running: feeLabel.estimating
|
running: feeLabel.estimating
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: height
|
width: height
|
||||||
|
|
||||||
|
MoneroComponents.TextPlain {
|
||||||
|
anchors.left: parent.right
|
||||||
|
anchors.leftMargin: 8
|
||||||
|
font.family: MoneroComponents.Style.fontRegular.name
|
||||||
|
font.pixelSize: 14
|
||||||
|
color: MoneroComponents.Style.defaultFontColor
|
||||||
|
opacity: 0.7
|
||||||
|
text: qsTr("Estimating fee") + "..." + translationManager.emptyString
|
||||||
|
visible: parent.running
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue