Browse Source

qml tx details and rbf dialogs: use a single InfoTextArea, to the

top of each dialog.

Do not display 'cannot bump fee' as the first thing we see when we
enter the bump fee dialog; suggest to move the slider instead.
master
ThomasV 3 years ago
parent
commit
48689ecc89
  1. 8
      electrum/gui/qml/components/RbfBumpFeeDialog.qml
  2. 8
      electrum/gui/qml/components/RbfCancelDialog.qml
  3. 106
      electrum/gui/qml/components/TxDetails.qml
  4. 13
      electrum/gui/qml/qetxfinalizer.py

8
electrum/gui/qml/components/RbfBumpFeeDialog.qml

@ -44,12 +44,11 @@ ElDialog {
columns: 2 columns: 2
Label { InfoTextArea {
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: constants.paddingLarge Layout.bottomMargin: constants.paddingLarge
text: qsTr('Increase your transaction\'s fee to improve its position in the mempool') text: qsTr('Move the slider to increase your transaction\'s fee. This will improve its position in the mempool')
wrapMode: Text.Wrap
} }
Label { Label {
@ -186,12 +185,11 @@ ElDialog {
} }
} }
InfoTextArea { Label {
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
visible: rbffeebumper.warning != '' visible: rbffeebumper.warning != ''
text: rbffeebumper.warning text: rbffeebumper.warning
iconStyle: InfoTextArea.IconStyle.Warn
} }
Label { Label {

8
electrum/gui/qml/components/RbfCancelDialog.qml

@ -41,12 +41,11 @@ ElDialog {
width: parent.width width: parent.width
columns: 2 columns: 2
Label { InfoTextArea {
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: constants.paddingLarge Layout.bottomMargin: constants.paddingLarge
text: qsTr('Cancel an unconfirmed RBF transaction by double-spending its inputs back to your wallet with a higher fee.') text: qsTr('Cancel an unconfirmed transaction by double-spending its inputs back to your wallet with a higher fee.')
wrapMode: Text.Wrap
} }
Label { Label {
@ -156,12 +155,11 @@ ElDialog {
} }
} }
InfoTextArea { Label {
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
visible: txcanceller.warning != '' visible: txcanceller.warning != ''
text: txcanceller.warning text: txcanceller.warning
iconStyle: InfoTextArea.IconStyle.Warn
} }
Label { Label {

106
electrum/gui/qml/components/TxDetails.qml

@ -47,7 +47,18 @@ Pane {
Heading { Heading {
Layout.columnSpan: 2 Layout.columnSpan: 2
text: qsTr('Transaction Details') text: qsTr('On-chain Transaction')
}
InfoTextArea {
id: bumpfeeinfo
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.bottomMargin: constants.paddingLarge
visible: txdetails.canBump || txdetails.canCpfp || txdetails.canCancel
text: qsTr('This transaction is still unconfirmed.') + '\n' + (txdetails.canCancel
? qsTr('You can bump its fee to speed up its confirmation, or cancel this transaction')
: qsTr('You can bump its fee to speed up its confirmation'))
} }
RowLayout { RowLayout {
@ -126,70 +137,6 @@ Pane {
visible: txdetails.mempoolDepth visible: txdetails.mempoolDepth
} }
TextHighlightPane {
Layout.fillWidth: true
Layout.topMargin: constants.paddingSmall
Layout.columnSpan: 2
borderColor: constants.colorWarning
visible: txdetails.canBump || txdetails.canCpfp || txdetails.canCancel
GridLayout {
width: parent.width
columns: actionButtonsLayout.implicitWidth > parent.width/2
? 1
: 2
Label {
id: bumpfeeinfo
Layout.fillWidth: true
text: qsTr('This transaction is still unconfirmed.') + '\n' + (txdetails.canCancel
? qsTr('You can increase fees to speed up the transaction, or cancel this transaction')
: qsTr('You can increase fees to speed up the transaction'))
wrapMode: Text.Wrap
}
ColumnLayout {
id: actionButtonsLayout
Layout.alignment: Qt.AlignHCenter
Pane {
Layout.alignment: Qt.AlignHCenter
background: Rectangle { color: Material.dialogColor }
padding: 0
visible: txdetails.canBump || txdetails.canCpfp
FlatButton {
id: feebumpButton
textUnderIcon: false
icon.source: '../../icons/add.png'
text: qsTr('Bump fee')
onClicked: {
if (txdetails.canBump) {
var dialog = rbfBumpFeeDialog.createObject(root, { txid: root.txid })
} else {
var dialog = cpfpBumpFeeDialog.createObject(root, { txid: root.txid })
}
dialog.open()
}
}
}
Pane {
Layout.alignment: Qt.AlignHCenter
background: Rectangle { color: Material.dialogColor }
padding: 0
visible: txdetails.canCancel
FlatButton {
id: cancelButton
textUnderIcon: false
icon.source: '../../icons/closebutton.png'
text: qsTr('Cancel Tx')
onClicked: {
var dialog = rbfCancelDialog.createObject(root, { txid: root.txid })
dialog.open()
}
}
}
}
}
}
Label { Label {
visible: txdetails.isMined visible: txdetails.isMined
text: qsTr('Date') text: qsTr('Date')
@ -348,6 +295,34 @@ Pane {
ButtonContainer { ButtonContainer {
Layout.fillWidth: true Layout.fillWidth: true
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
id: feebumpButton
icon.source: '../../icons/add.png'
text: qsTr('Bump fee')
visible: txdetails.canBump || txdetails.canCpfp
onClicked: {
if (txdetails.canBump) {
var dialog = rbfBumpFeeDialog.createObject(root, { txid: root.txid })
} else {
var dialog = cpfpBumpFeeDialog.createObject(root, { txid: root.txid })
}
dialog.open()
}
}
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
id: cancelButton
icon.source: '../../icons/closebutton.png'
text: qsTr('Cancel Tx')
visible: txdetails.canCancel
onClicked: {
var dialog = rbfCancelDialog.createObject(root, { txid: root.txid })
dialog.open()
}
}
FlatButton { FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: 1 Layout.preferredWidth: 1
@ -452,7 +427,6 @@ Pane {
} }
function onBroadcastSucceeded() { function onBroadcastSucceeded() {
bumpfeeinfo.text = qsTr('Transaction was broadcast successfully') bumpfeeinfo.text = qsTr('Transaction was broadcast successfully')
actionButtonsLayout.visible = false
} }
} }

13
electrum/gui/qml/qetxfinalizer.py

@ -527,7 +527,12 @@ class QETxRbfFeeBumper(TxFeeSlider, TxMonMixin):
return return
new_fee_rate = fee_per_kb / 1000 new_fee_rate = fee_per_kb / 1000
if new_fee_rate <= float(self._oldfee_rate):
self._tx = None
self._valid = False
self.validChanged.emit()
self.warning = _("The new fee rate needs to be higher than the old fee rate.")
return
try: try:
self._tx = self._wallet.wallet.bump_fee( self._tx = self._wallet.wallet.bump_fee(
tx=self._orig_tx, tx=self._orig_tx,
@ -630,6 +635,12 @@ class QETxCanceller(TxFeeSlider, TxMonMixin):
return return
new_fee_rate = fee_per_kb / 1000 new_fee_rate = fee_per_kb / 1000
if new_fee_rate <= float(self._oldfee_rate):
self._tx = None
self._valid = False
self.validChanged.emit()
self.warning = _("The new fee rate needs to be higher than the old fee rate.")
return
try: try:
self._tx = self._wallet.wallet.dscancel( self._tx = self._wallet.wallet.dscancel(

Loading…
Cancel
Save