Browse Source

send/receive amounts same style

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

126
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,103 +47,63 @@ Pane {
color: Material.accentColor color: Material.accentColor
} }
ColumnLayout { Item { width: 1; height: 1; Layout.fillWidth: true }
Layout.rowSpan: 2
Layout.preferredWidth: rootItem.width /3
Layout.leftMargin: constants.paddingXLarge
Label { Item { visible: Daemon.fx.enabled; width: 1; height: 1 }
text: qsTr('Expires after')
Layout.fillWidth: false
}
ComboBox {
id: expires
Layout.fillWidth: true
textRole: 'text'
valueRole: 'value'
model: ListModel {
id: expiresmodel
Component.onCompleted: {
// we need to fill the model like this, as ListElement can't evaluate script
expiresmodel.append({'text': qsTr('10 minutes'), 'value': 10*60})
expiresmodel.append({'text': qsTr('1 hour'), 'value': 60*60})
expiresmodel.append({'text': qsTr('1 day'), 'value': 24*60*60})
expiresmodel.append({'text': qsTr('1 week'), 'value': 7*24*60*60})
expiresmodel.append({'text': qsTr('1 month'), 'value': 31*7*24*60*60})
expiresmodel.append({'text': qsTr('Never'), 'value': 0})
expires.currentIndex = 0
}
}
}
}
TextField { TextField {
id: amountFiat id: amountFiat
visible: Daemon.fx.fiatCurrency != '' visible: Daemon.fx.enabled
font.family: FixedFont font.family: FixedFont
Layout.fillWidth: true Layout.preferredWidth: parent.width /2
placeholderText: qsTr('Amount')
inputMethodHints: Qt.ImhDigitsOnly inputMethodHints: Qt.ImhDigitsOnly
} }
Label { Label {
visible: Daemon.fx.fiatCurrency != '' visible: Daemon.fx.enabled
text: Daemon.fx.fiatCurrency text: Daemon.fx.fiatCurrency
color: Material.accentColor color: Material.accentColor
} }
Item { visible: Daemon.fx.fiatCurrency == ''; width: 1; height: 1; Layout.columnSpan: 2 } Item { width: 1; height: 1; Layout.fillWidth: true }
RowLayout { Label {
Layout.columnSpan: 4 text: qsTr('Expires after')
Layout.alignment: Qt.AlignHCenter Layout.fillWidth: false
visible: false }
CheckBox {
id: cb_onchain ComboBox {
text: qsTr('Onchain') id: expires
checked: true Layout.columnSpan: 2
contentItem: RowLayout {
Text { textRole: 'text'
text: cb_onchain.text valueRole: 'value'
font: cb_onchain.font
opacity: enabled ? 1.0 : 0.3 model: ListModel {
color: Material.foreground id: expiresmodel
verticalAlignment: Text.AlignVCenter Component.onCompleted: {
leftPadding: cb_onchain.indicator.width + cb_onchain.spacing // we need to fill the model like this, as ListElement can't evaluate script
} expiresmodel.append({'text': qsTr('10 minutes'), 'value': 10*60})
Image { expiresmodel.append({'text': qsTr('1 hour'), 'value': 60*60})
x: 16 expiresmodel.append({'text': qsTr('1 day'), 'value': 24*60*60})
Layout.preferredWidth: 16 expiresmodel.append({'text': qsTr('1 week'), 'value': 7*24*60*60})
Layout.preferredHeight: 16 expiresmodel.append({'text': qsTr('1 month'), 'value': 31*7*24*60*60})
source: '../../icons/bitcoin.png' expiresmodel.append({'text': qsTr('Never'), 'value': 0})
} expires.currentIndex = 0
} }
} }
CheckBox { // redefine contentItem, as the default crops the widest item
id: cb_lightning contentItem: Label {
text: qsTr('Lightning') text: expires.currentText
enabled: false padding: constants.paddingLarge
contentItem: RowLayout { font.pixelSize: constants.fontSizeMedium
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'
}
}
} }
} }
Item { width: 1; height: 1; Layout.fillWidth: true }
Button { Button {
Layout.columnSpan: 4 Layout.columnSpan: 4
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter

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