Browse Source

qml: layout fixes for small form-factor devices

master
Sander van Grieken 3 years ago
parent
commit
a5c58f8aae
  1. 301
      electrum/gui/qml/components/CpfpBumpFeeDialog.qml
  2. 317
      electrum/gui/qml/components/RbfBumpFeeDialog.qml
  3. 264
      electrum/gui/qml/components/RbfCancelDialog.qml

301
electrum/gui/qml/components/CpfpBumpFeeDialog.qml

@ -26,185 +26,198 @@ ElDialog {
anchors.fill: parent anchors.fill: parent
spacing: 0 spacing: 0
GridLayout { Flickable {
Layout.preferredWidth: parent.width Layout.fillWidth: true
Layout.leftMargin: constants.paddingLarge Layout.fillHeight: true
Layout.rightMargin: constants.paddingLarge
columns: 2
Label {
Layout.columnSpan: 2
Layout.fillWidth: true
text: qsTr('A CPFP is a transaction that sends an unconfirmed output back to yourself, with a high fee. The goal is to have miners confirm the parent transaction in order to get the fee attached to the child transaction.')
wrapMode: Text.Wrap
}
Label { leftMargin: constants.paddingLarge
Layout.columnSpan: 2 rightMargin: constants.paddingLarge
Layout.fillWidth: true
Layout.bottomMargin: constants.paddingLarge
text: qsTr('The proposed fee is computed using your fee/kB settings, applied to the total size of both child and parent transactions. After you broadcast a CPFP transaction, it is normal to see a new unconfirmed transaction in your history.')
wrapMode: Text.Wrap
}
Label { contentHeight: rootLayout.height
Layout.preferredWidth: 1 clip: true
Layout.fillWidth: true interactive: height < contentHeight
text: qsTr('Total size')
color: Material.accentColor
}
Label { GridLayout {
Layout.preferredWidth: 1 id: rootLayout
Layout.fillWidth: true width: parent.width
text: qsTr('%1 bytes').arg(cpfpfeebumper.totalSize)
}
Label { columns: 2
text: qsTr('Input amount')
color: Material.accentColor
}
FormattedAmount { Label {
amount: cpfpfeebumper.inputAmount Layout.columnSpan: 2
} Layout.fillWidth: true
text: qsTr('A CPFP is a transaction that sends an unconfirmed output back to yourself, with a high fee. The goal is to have miners confirm the parent transaction in order to get the fee attached to the child transaction.')
wrapMode: Text.Wrap
}
Label { Label {
text: qsTr('Output amount') Layout.columnSpan: 2
color: Material.accentColor Layout.fillWidth: true
} Layout.bottomMargin: constants.paddingLarge
text: qsTr('The proposed fee is computed using your fee/kB settings, applied to the total size of both child and parent transactions. After you broadcast a CPFP transaction, it is normal to see a new unconfirmed transaction in your history.')
wrapMode: Text.Wrap
}
FormattedAmount { Label {
amount: cpfpfeebumper.outputAmount Layout.preferredWidth: 1
valid: cpfpfeebumper.valid Layout.fillWidth: true
} text: qsTr('Total size')
color: Material.accentColor
}
Slider { Label {
id: feeslider Layout.preferredWidth: 1
leftPadding: constants.paddingMedium Layout.fillWidth: true
snapMode: Slider.SnapOnRelease text: qsTr('%1 bytes').arg(cpfpfeebumper.totalSize)
stepSize: 1
from: 0
to: cpfpfeebumper.sliderSteps
onValueChanged: {
if (activeFocus)
cpfpfeebumper.sliderPos = value
}
Component.onCompleted: {
value = cpfpfeebumper.sliderPos
}
Connections {
target: cpfpfeebumper
function onSliderPosChanged() {
feeslider.value = cpfpfeebumper.sliderPos
}
} }
}
FeeMethodComboBox { Label {
id: feemethod text: qsTr('Input amount')
feeslider: cpfpfeebumper color: Material.accentColor
} }
Label { FormattedAmount {
visible: feemethod.currentValue amount: cpfpfeebumper.inputAmount
text: qsTr('Target') }
color: Material.accentColor
}
Label { Label {
visible: feemethod.currentValue text: qsTr('Output amount')
text: cpfpfeebumper.target color: Material.accentColor
} }
Label { FormattedAmount {
text: qsTr('Fee for child') amount: cpfpfeebumper.outputAmount
color: Material.accentColor valid: cpfpfeebumper.valid
} }
FormattedAmount { RowLayout {
amount: cpfpfeebumper.feeForChild Layout.columnSpan: 2
valid: cpfpfeebumper.valid Slider {
} id: feeslider
leftPadding: constants.paddingMedium
snapMode: Slider.SnapOnRelease
stepSize: 1
from: 0
to: cpfpfeebumper.sliderSteps
onValueChanged: {
if (activeFocus)
cpfpfeebumper.sliderPos = value
}
Component.onCompleted: {
value = cpfpfeebumper.sliderPos
}
Connections {
target: cpfpfeebumper
function onSliderPosChanged() {
feeslider.value = cpfpfeebumper.sliderPos
}
}
}
Label { FeeMethodComboBox {
text: qsTr('Total fee') id: feemethod
color: Material.accentColor feeslider: cpfpfeebumper
} }
}
FormattedAmount { Label {
amount: cpfpfeebumper.totalFee visible: feemethod.currentValue
valid: cpfpfeebumper.valid text: qsTr('Target')
} color: Material.accentColor
}
Label { Label {
text: qsTr('Total fee rate') visible: feemethod.currentValue
color: Material.accentColor text: cpfpfeebumper.target
} }
RowLayout {
Label { Label {
text: cpfpfeebumper.valid ? cpfpfeebumper.totalFeeRate : '' text: qsTr('Fee for child')
font.family: FixedFont color: Material.accentColor
}
FormattedAmount {
amount: cpfpfeebumper.feeForChild
valid: cpfpfeebumper.valid
} }
Label { Label {
visible: cpfpfeebumper.valid text: qsTr('Total fee')
text: 'sat/vB'
color: Material.accentColor color: Material.accentColor
} }
}
InfoTextArea { FormattedAmount {
Layout.columnSpan: 2 amount: cpfpfeebumper.totalFee
Layout.preferredWidth: parent.width * 3/4 valid: cpfpfeebumper.valid
Layout.alignment: Qt.AlignHCenter }
Layout.topMargin: constants.paddingLarge
visible: cpfpfeebumper.warning != ''
text: cpfpfeebumper.warning
iconStyle: InfoTextArea.IconStyle.Warn
}
Label { Label {
visible: cpfpfeebumper.valid text: qsTr('Total fee rate')
text: qsTr('Outputs') color: Material.accentColor
Layout.columnSpan: 2 }
color: Material.accentColor
} RowLayout {
Label {
text: cpfpfeebumper.valid ? cpfpfeebumper.totalFeeRate : ''
font.family: FixedFont
}
Repeater { Label {
model: cpfpfeebumper.valid ? cpfpfeebumper.outputs : [] visible: cpfpfeebumper.valid
delegate: TextHighlightPane { text: 'sat/vB'
color: Material.accentColor
}
}
InfoTextArea {
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.fillWidth: true Layout.preferredWidth: parent.width * 3/4
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: constants.paddingLarge
visible: cpfpfeebumper.warning != ''
text: cpfpfeebumper.warning
iconStyle: InfoTextArea.IconStyle.Warn
}
RowLayout { Label {
width: parent.width visible: cpfpfeebumper.valid
Label { text: qsTr('Outputs')
text: modelData.address Layout.columnSpan: 2
Layout.fillWidth: true color: Material.accentColor
wrapMode: Text.Wrap }
font.pixelSize: constants.fontSizeLarge
font.family: FixedFont Repeater {
color: modelData.is_mine ? constants.colorMine : Material.foreground model: cpfpfeebumper.valid ? cpfpfeebumper.outputs : []
} delegate: TextHighlightPane {
Label { Layout.columnSpan: 2
text: Config.formatSats(modelData.value_sats) Layout.fillWidth: true
font.pixelSize: constants.fontSizeMedium
font.family: FixedFont RowLayout {
} width: parent.width
Label { Label {
text: Config.baseUnit text: modelData.address
font.pixelSize: constants.fontSizeMedium Layout.fillWidth: true
color: Material.accentColor wrapMode: Text.Wrap
font.pixelSize: constants.fontSizeLarge
font.family: FixedFont
color: modelData.is_mine ? constants.colorMine : Material.foreground
}
Label {
text: Config.formatSats(modelData.value_sats)
font.pixelSize: constants.fontSizeMedium
font.family: FixedFont
}
Label {
text: Config.baseUnit
font.pixelSize: constants.fontSizeMedium
color: Material.accentColor
}
} }
} }
} }
} }
} }
Item { Layout.fillHeight: true; Layout.preferredWidth: 1 }
FlatButton { FlatButton {
id: sendButton id: sendButton
Layout.fillWidth: true Layout.fillWidth: true

317
electrum/gui/qml/components/RbfBumpFeeDialog.qml

@ -26,201 +26,212 @@ ElDialog {
anchors.fill: parent anchors.fill: parent
spacing: 0 spacing: 0
GridLayout { Flickable {
Layout.preferredWidth: parent.width Layout.fillWidth: true
Layout.leftMargin: constants.paddingLarge Layout.fillHeight: true
Layout.rightMargin: constants.paddingLarge
columns: 2
Label {
Layout.columnSpan: 2
Layout.fillWidth: true
text: qsTr('Increase your transaction\'s fee to improve its position in the mempool')
wrapMode: Text.Wrap
}
Label { leftMargin: constants.paddingLarge
Layout.preferredWidth: 1 rightMargin: constants.paddingLarge
Layout.fillWidth: true
text: qsTr('Method')
color: Material.accentColor
}
RowLayout { contentHeight: rootLayout.height
Layout.preferredWidth: 1 clip: true
Layout.fillWidth: true interactive: height < contentHeight
ElComboBox {
enabled: rbffeebumper.canChangeBumpMethod
textRole: 'text'
valueRole: 'value'
model: [
{ text: qsTr('Preserve payment'), value: 'preserve_payment' },
{ text: qsTr('Decrease payment'), value: 'decrease_payment' }
]
onCurrentValueChanged: {
if (activeFocus)
rbffeebumper.bumpMethod = currentValue
}
Component.onCompleted: {
currentIndex = indexOfValue(rbffeebumper.bumpMethod)
}
}
Item { Layout.fillWidth: true; Layout.preferredHeight: 1 }
}
Label { GridLayout {
Layout.preferredWidth: 1 id: rootLayout
Layout.fillWidth: true
text: qsTr('Old fee')
color: Material.accentColor
}
FormattedAmount { width: parent.width
Layout.preferredWidth: 1
Layout.fillWidth: true
amount: rbffeebumper.oldfee
}
Label { columns: 2
text: qsTr('Old fee rate')
color: Material.accentColor
}
RowLayout {
Label { Label {
id: oldfeeRate Layout.columnSpan: 2
text: rbffeebumper.oldfeeRate Layout.fillWidth: true
font.family: FixedFont text: qsTr('Increase your transaction\'s fee to improve its position in the mempool')
wrapMode: Text.Wrap
} }
Label { Label {
text: 'sat/vB' Layout.preferredWidth: 1
Layout.fillWidth: true
text: qsTr('Method')
color: Material.accentColor color: Material.accentColor
} }
}
Label { RowLayout {
text: qsTr('Mining fee') Layout.preferredWidth: 1
color: Material.accentColor Layout.fillWidth: true
} Layout.minimumWidth: bumpMethodComboBox.implicitWidth
ElComboBox {
id: bumpMethodComboBox
enabled: rbffeebumper.canChangeBumpMethod
textRole: 'text'
valueRole: 'value'
model: [
{ text: qsTr('Preserve payment'), value: 'preserve_payment' },
{ text: qsTr('Decrease payment'), value: 'decrease_payment' }
]
onCurrentValueChanged: {
if (activeFocus)
rbffeebumper.bumpMethod = currentValue
}
Component.onCompleted: {
currentIndex = indexOfValue(rbffeebumper.bumpMethod)
}
}
Item { Layout.fillWidth: true; Layout.preferredHeight: 1 }
}
FormattedAmount { Label {
amount: rbffeebumper.fee Layout.preferredWidth: 1
valid: rbffeebumper.valid Layout.fillWidth: true
} text: qsTr('Old fee')
color: Material.accentColor
}
Label { FormattedAmount {
text: qsTr('Fee rate') Layout.preferredWidth: 1
color: Material.accentColor Layout.fillWidth: true
} amount: rbffeebumper.oldfee
}
RowLayout {
Label { Label {
id: feeRate text: qsTr('Old fee rate')
text: rbffeebumper.valid ? rbffeebumper.feeRate : '' color: Material.accentColor
font.family: FixedFont }
RowLayout {
Label {
id: oldfeeRate
text: rbffeebumper.oldfeeRate
font.family: FixedFont
}
Label {
text: 'sat/vB'
color: Material.accentColor
}
} }
Label { Label {
visible: rbffeebumper.valid text: qsTr('Mining fee')
text: 'sat/vB'
color: Material.accentColor color: Material.accentColor
} }
}
Label { FormattedAmount {
text: qsTr('Target') amount: rbffeebumper.fee
color: Material.accentColor valid: rbffeebumper.valid
} }
Label { Label {
id: targetdesc text: qsTr('Fee rate')
text: rbffeebumper.target color: Material.accentColor
} }
RowLayout { RowLayout {
Layout.columnSpan: 2 Label {
Layout.fillWidth: true id: feeRate
Slider { text: rbffeebumper.valid ? rbffeebumper.feeRate : ''
id: feeslider font.family: FixedFont
Layout.fillWidth: true
leftPadding: constants.paddingMedium
snapMode: Slider.SnapOnRelease
stepSize: 1
from: 0
to: rbffeebumper.sliderSteps
onValueChanged: {
if (activeFocus)
rbffeebumper.sliderPos = value
} }
Component.onCompleted: {
value = rbffeebumper.sliderPos Label {
} visible: rbffeebumper.valid
Connections { text: 'sat/vB'
target: rbffeebumper color: Material.accentColor
function onSliderPosChanged() {
feeslider.value = rbffeebumper.sliderPos
}
} }
} }
FeeMethodComboBox { Label {
id: target text: qsTr('Target')
feeslider: rbffeebumper color: Material.accentColor
} }
}
InfoTextArea { Label {
Layout.columnSpan: 2 id: targetdesc
Layout.preferredWidth: parent.width * 3/4 text: rbffeebumper.target
Layout.alignment: Qt.AlignHCenter }
visible: rbffeebumper.warning != ''
text: rbffeebumper.warning
iconStyle: InfoTextArea.IconStyle.Warn
}
Label { RowLayout {
visible: rbffeebumper.valid Layout.columnSpan: 2
text: qsTr('Outputs') Slider {
Layout.columnSpan: 2 id: feeslider
color: Material.accentColor leftPadding: constants.paddingMedium
} snapMode: Slider.SnapOnRelease
stepSize: 1
from: 0
to: rbffeebumper.sliderSteps
onValueChanged: {
if (activeFocus)
rbffeebumper.sliderPos = value
}
Component.onCompleted: {
value = rbffeebumper.sliderPos
}
Connections {
target: rbffeebumper
function onSliderPosChanged() {
feeslider.value = rbffeebumper.sliderPos
}
}
}
Repeater { FeeMethodComboBox {
model: rbffeebumper.valid ? rbffeebumper.outputs : [] id: target
delegate: TextHighlightPane { feeslider: rbffeebumper
}
}
InfoTextArea {
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
visible: rbffeebumper.warning != ''
text: rbffeebumper.warning
iconStyle: InfoTextArea.IconStyle.Warn
}
RowLayout { Label {
width: parent.width visible: rbffeebumper.valid
Label { text: qsTr('Outputs')
text: modelData.address Layout.columnSpan: 2
Layout.fillWidth: true color: Material.accentColor
wrapMode: Text.Wrap }
font.pixelSize: constants.fontSizeLarge
font.family: FixedFont Repeater {
color: modelData.is_mine ? constants.colorMine : Material.foreground model: rbffeebumper.valid ? rbffeebumper.outputs : []
} delegate: TextHighlightPane {
Label { Layout.columnSpan: 2
text: Config.formatSats(modelData.value_sats) Layout.fillWidth: true
font.pixelSize: constants.fontSizeMedium
font.family: FixedFont RowLayout {
} width: parent.width
Label { Label {
text: Config.baseUnit text: modelData.address
font.pixelSize: constants.fontSizeMedium Layout.fillWidth: true
color: Material.accentColor wrapMode: Text.Wrap
font.pixelSize: constants.fontSizeLarge
font.family: FixedFont
color: modelData.is_mine ? constants.colorMine : Material.foreground
}
Label {
text: Config.formatSats(modelData.value_sats)
font.pixelSize: constants.fontSizeMedium
font.family: FixedFont
}
Label {
text: Config.baseUnit
font.pixelSize: constants.fontSizeMedium
color: Material.accentColor
}
} }
} }
} }
} }
} }
Item { Layout.fillHeight: true; Layout.preferredWidth: 1 }
FlatButton { FlatButton {
id: sendButton id: sendButton
Layout.fillWidth: true Layout.fillWidth: true

264
electrum/gui/qml/components/RbfCancelDialog.qml

@ -25,173 +25,183 @@ ElDialog {
anchors.fill: parent anchors.fill: parent
spacing: 0 spacing: 0
GridLayout { Flickable {
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: constants.paddingLarge Layout.fillHeight: true
Layout.rightMargin: constants.paddingLarge
columns: 2 leftMargin: constants.paddingLarge
rightMargin: constants.paddingLarge
Label { contentHeight: rootLayout.height
Layout.columnSpan: 2 clip: true
Layout.fillWidth: true interactive: height < contentHeight
text: qsTr('Cancel an unconfirmed RBF transaction by double-spending its inputs back to your wallet with a higher fee.')
wrapMode: Text.Wrap
}
Label {
text: qsTr('Old fee')
color: Material.accentColor
}
FormattedAmount {
amount: txcanceller.oldfee
}
Label { GridLayout {
text: qsTr('Old fee rate') id: rootLayout
color: Material.accentColor width: parent.width
} columns: 2
RowLayout {
Label { Label {
id: oldfeeRate Layout.columnSpan: 2
text: txcanceller.oldfeeRate Layout.fillWidth: true
font.family: FixedFont text: qsTr('Cancel an unconfirmed RBF transaction by double-spending its inputs back to your wallet with a higher fee.')
wrapMode: Text.Wrap
} }
Label { Label {
text: 'sat/vB' text: qsTr('Old fee')
color: Material.accentColor color: Material.accentColor
} }
}
Label { FormattedAmount {
text: qsTr('Mining fee') amount: txcanceller.oldfee
color: Material.accentColor }
}
FormattedAmount { Label {
amount: txcanceller.fee text: qsTr('Old fee rate')
valid: txcanceller.valid color: Material.accentColor
} }
Label { RowLayout {
text: qsTr('Fee rate') Label {
color: Material.accentColor id: oldfeeRate
} text: txcanceller.oldfeeRate
font.family: FixedFont
}
RowLayout { Label {
Label { text: 'sat/vB'
id: feeRate color: Material.accentColor
text: txcanceller.valid ? txcanceller.feeRate : '' }
font.family: FixedFont
} }
Label { Label {
visible: txcanceller.valid text: qsTr('Mining fee')
text: 'sat/vB'
color: Material.accentColor color: Material.accentColor
} }
}
Label { FormattedAmount {
text: qsTr('Target') amount: txcanceller.fee
color: Material.accentColor valid: txcanceller.valid
} }
Label { Label {
id: targetdesc text: qsTr('Fee rate')
text: txcanceller.target color: Material.accentColor
} }
Slider { RowLayout {
id: feeslider Label {
leftPadding: constants.paddingMedium id: feeRate
snapMode: Slider.SnapOnRelease text: txcanceller.valid ? txcanceller.feeRate : ''
stepSize: 1 font.family: FixedFont
from: 0 }
to: txcanceller.sliderSteps
onValueChanged: { Label {
if (activeFocus) visible: txcanceller.valid
txcanceller.sliderPos = value text: 'sat/vB'
} color: Material.accentColor
Component.onCompleted: {
value = txcanceller.sliderPos
}
Connections {
target: txcanceller
function onSliderPosChanged() {
feeslider.value = txcanceller.sliderPos
} }
} }
}
FeeMethodComboBox { Label {
id: target text: qsTr('Target')
feeslider: txcanceller color: Material.accentColor
} }
CheckBox { Label {
id: final_cb id: targetdesc
text: qsTr('Replace-by-Fee') text: txcanceller.target
Layout.columnSpan: 2
checked: txcanceller.rbf
onCheckedChanged: {
if (activeFocus)
txcanceller.rbf = checked
} }
}
InfoTextArea { RowLayout {
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.preferredWidth: parent.width * 3/4 Slider {
Layout.alignment: Qt.AlignHCenter id: feeslider
visible: txcanceller.warning != '' leftPadding: constants.paddingMedium
text: txcanceller.warning snapMode: Slider.SnapOnRelease
iconStyle: InfoTextArea.IconStyle.Warn stepSize: 1
} from: 0
to: txcanceller.sliderSteps
onValueChanged: {
if (activeFocus)
txcanceller.sliderPos = value
}
Component.onCompleted: {
value = txcanceller.sliderPos
}
Connections {
target: txcanceller
function onSliderPosChanged() {
feeslider.value = txcanceller.sliderPos
}
}
}
Label { FeeMethodComboBox {
visible: txcanceller.valid id: target
text: qsTr('Outputs') feeslider: txcanceller
Layout.columnSpan: 2 }
color: Material.accentColor }
}
Repeater { CheckBox {
model: txcanceller.valid ? txcanceller.outputs : [] id: final_cb
delegate: TextHighlightPane { text: qsTr('Replace-by-Fee')
Layout.columnSpan: 2
checked: txcanceller.rbf
onCheckedChanged: {
if (activeFocus)
txcanceller.rbf = checked
}
}
InfoTextArea {
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
visible: txcanceller.warning != ''
text: txcanceller.warning
iconStyle: InfoTextArea.IconStyle.Warn
}
RowLayout { Label {
width: parent.width visible: txcanceller.valid
Label { text: qsTr('Outputs')
text: modelData.address Layout.columnSpan: 2
Layout.fillWidth: true color: Material.accentColor
wrapMode: Text.Wrap }
font.pixelSize: constants.fontSizeLarge
font.family: FixedFont Repeater {
color: modelData.is_mine ? constants.colorMine : Material.foreground model: txcanceller.valid ? txcanceller.outputs : []
} delegate: TextHighlightPane {
Label { Layout.columnSpan: 2
text: Config.formatSats(modelData.value_sats) Layout.fillWidth: true
font.pixelSize: constants.fontSizeMedium
font.family: FixedFont RowLayout {
} width: parent.width
Label { Label {
text: Config.baseUnit text: modelData.address
font.pixelSize: constants.fontSizeMedium Layout.fillWidth: true
color: Material.accentColor wrapMode: Text.Wrap
font.pixelSize: constants.fontSizeLarge
font.family: FixedFont
color: modelData.is_mine ? constants.colorMine : Material.foreground
}
Label {
text: Config.formatSats(modelData.value_sats)
font.pixelSize: constants.fontSizeMedium
font.family: FixedFont
}
Label {
text: Config.baseUnit
font.pixelSize: constants.fontSizeMedium
color: Material.accentColor
}
} }
} }
} }
} }
} }
Item { Layout.fillHeight: true; Layout.preferredWidth: 1 }
FlatButton { FlatButton {
id: confirmButton id: confirmButton
Layout.fillWidth: true Layout.fillWidth: true

Loading…
Cancel
Save