Browse Source

send/receive amounts same style

patch-4
Sander van Grieken 3 years ago
parent
commit
a8ff969ad7
  1. 108
      electrum/gui/qml/components/Receive.qml
  2. 42
      electrum/gui/qml/components/Send.qml

108
electrum/gui/qml/components/Receive.qml

@ -13,8 +13,8 @@ Pane {
GridLayout { GridLayout {
id: form id: form
width: parent.width width: parent.width
rowSpacing: 10 rowSpacing: constants.paddingSmall
columnSpacing: 10 columnSpacing: constants.paddingSmall
columns: 4 columns: 4
Label { Label {
@ -23,22 +23,22 @@ Pane {
TextField { TextField {
id: message id: message
placeholderText: qsTr('Description of payment request')
Layout.columnSpan: 3 Layout.columnSpan: 3
Layout.fillWidth: true Layout.fillWidth: true
} }
Label { Label {
text: qsTr('Requested Amount') text: qsTr('Request')
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
Layout.preferredWidth: 50 // trigger wordwrap
Layout.rightMargin: constants.paddingXLarge Layout.rightMargin: constants.paddingXLarge
Layout.rowSpan: 2
} }
TextField { TextField {
id: amount id: amount
font.family: FixedFont font.family: FixedFont
Layout.fillWidth: true Layout.preferredWidth: parent.width /2
placeholderText: qsTr('Amount')
inputMethodHints: Qt.ImhPreferNumbers inputMethodHints: Qt.ImhPreferNumbers
} }
@ -47,10 +47,26 @@ Pane {
color: Material.accentColor color: Material.accentColor
} }
ColumnLayout { Item { width: 1; height: 1; Layout.fillWidth: true }
Layout.rowSpan: 2
Layout.preferredWidth: rootItem.width /3 Item { visible: Daemon.fx.enabled; width: 1; height: 1 }
Layout.leftMargin: constants.paddingXLarge
TextField {
id: amountFiat
visible: Daemon.fx.enabled
font.family: FixedFont
Layout.preferredWidth: parent.width /2
placeholderText: qsTr('Amount')
inputMethodHints: Qt.ImhDigitsOnly
}
Label {
visible: Daemon.fx.enabled
text: Daemon.fx.fiatCurrency
color: Material.accentColor
}
Item { width: 1; height: 1; Layout.fillWidth: true }
Label { Label {
text: qsTr('Expires after') text: qsTr('Expires after')
@ -59,7 +75,8 @@ Pane {
ComboBox { ComboBox {
id: expires id: expires
Layout.fillWidth: true Layout.columnSpan: 2
textRole: 'text' textRole: 'text'
valueRole: 'value' valueRole: 'value'
@ -76,73 +93,16 @@ Pane {
expires.currentIndex = 0 expires.currentIndex = 0
} }
} }
}
}
TextField { // redefine contentItem, as the default crops the widest item
id: amountFiat contentItem: Label {
visible: Daemon.fx.fiatCurrency != '' text: expires.currentText
font.family: FixedFont padding: constants.paddingLarge
Layout.fillWidth: true font.pixelSize: constants.fontSizeMedium
inputMethodHints: Qt.ImhDigitsOnly
} }
Label {
visible: Daemon.fx.fiatCurrency != ''
text: Daemon.fx.fiatCurrency
color: Material.accentColor
} }
Item { visible: Daemon.fx.fiatCurrency == ''; width: 1; height: 1; Layout.columnSpan: 2 } Item { width: 1; height: 1; Layout.fillWidth: true }
RowLayout {
Layout.columnSpan: 4
Layout.alignment: Qt.AlignHCenter
visible: false
CheckBox {
id: cb_onchain
text: qsTr('Onchain')
checked: true
contentItem: RowLayout {
Text {
text: cb_onchain.text
font: cb_onchain.font
opacity: enabled ? 1.0 : 0.3
color: Material.foreground
verticalAlignment: Text.AlignVCenter
leftPadding: cb_onchain.indicator.width + cb_onchain.spacing
}
Image {
x: 16
Layout.preferredWidth: 16
Layout.preferredHeight: 16
source: '../../icons/bitcoin.png'
}
}
}
CheckBox {
id: cb_lightning
text: qsTr('Lightning')
enabled: false
contentItem: RowLayout {
Text {
text: cb_lightning.text
font: cb_lightning.font
opacity: enabled ? 1.0 : 0.3
color: Material.foreground
verticalAlignment: Text.AlignVCenter
leftPadding: cb_lightning.indicator.width + cb_lightning.spacing
}
Image {
x: 16
Layout.preferredWidth: 16
Layout.preferredHeight: 16
source: '../../icons/lightning.png'
}
}
}
}
Button { Button {
Layout.columnSpan: 4 Layout.columnSpan: 4

42
electrum/gui/qml/components/Send.qml

@ -8,10 +8,12 @@ Pane {
GridLayout { GridLayout {
width: parent.width width: parent.width
columns: 6 rowSpacing: constants.paddingSmall
columnSpacing: constants.paddingSmall
columns: 4
BalanceSummary { BalanceSummary {
Layout.columnSpan: 6 Layout.columnSpan: 4
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
@ -19,19 +21,20 @@ Pane {
text: qsTr('Recipient') text: qsTr('Recipient')
} }
TextField { TextArea {
id: address id: address
Layout.columnSpan: 4 Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
font.family: FixedFont font.family: FixedFont
wrapMode: Text.Wrap
placeholderText: qsTr('Paste address or invoice') placeholderText: qsTr('Paste address or invoice')
} }
ToolButton { ToolButton {
icon.source: '../../icons/copy.png' icon.source: '../../icons/copy.png'
icon.color: 'transparent' icon.color: 'transparent'
icon.height: 16 icon.height: constants.iconSizeSmall
icon.width: 16 icon.width: constants.iconSizeSmall
} }
Label { Label {
@ -42,31 +45,38 @@ Pane {
id: amount id: amount
font.family: FixedFont font.family: FixedFont
placeholderText: qsTr('Amount') placeholderText: qsTr('Amount')
Layout.preferredWidth: parent.width /2
inputMethodHints: Qt.ImhPreferNumbers inputMethodHints: Qt.ImhPreferNumbers
} }
Label { Label {
text: Config.baseUnit + ' ' // add spaces for easy right margin text: Config.baseUnit
color: Material.accentColor color: Material.accentColor
Layout.fillWidth: true
} }
Item { width: 1; height: 1 }
Item { width: 1; height: 1; visible: Daemon.fx.enabled }
TextField { TextField {
id: amountFiat id: amountFiat
visible: Daemon.fx.fiatCurrency != '' visible: Daemon.fx.enabled
font.family: FixedFont font.family: FixedFont
Layout.preferredWidth: parent.width /2
placeholderText: qsTr('Amount') placeholderText: qsTr('Amount')
inputMethodHints: Qt.ImhPreferNumbers inputMethodHints: Qt.ImhPreferNumbers
} }
Label { Label {
visible: Daemon.fx.fiatCurrency != '' visible: Daemon.fx.enabled
text: Daemon.fx.fiatCurrency text: Daemon.fx.fiatCurrency
color: Material.accentColor color: Material.accentColor
Layout.fillWidth: true
} }
Item { visible: Daemon.fx.fiatCurrency == ''; height: 1; Layout.columnSpan: 2; Layout.fillWidth: true } Item { visible: Daemon.fx.enabled ; height: 1; width: 1 }
Item { width: 1; height: 1 } // workaround colspan on baseunit messing up row above
Label { Label {
text: qsTr('Fee') text: qsTr('Fee')
@ -76,13 +86,15 @@ Pane {
id: fee id: fee
font.family: FixedFont font.family: FixedFont
placeholderText: qsTr('sat/vB') placeholderText: qsTr('sat/vB')
Layout.columnSpan: 5 Layout.columnSpan: 2
} }
Item { width: 1; height: 1 }
RowLayout { RowLayout {
Layout.columnSpan: 6 Layout.columnSpan: 4
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
spacing: 10 spacing: constants.paddingMedium
Button { Button {
text: qsTr('Pay') text: qsTr('Pay')

Loading…
Cancel
Save