Skip to content

Commit

Permalink
Merge pull request #8909 from accumulator/qml_finalizer_options
Browse files Browse the repository at this point in the history
qml: add tx options to ConfirmTxDialog, RbfBumpFeeDialog
  • Loading branch information
ecdsa committed Mar 15, 2024
2 parents 9b08eec + a9282c0 commit dcdbb0f
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 0 deletions.
60 changes: 60 additions & 0 deletions electrum/gui/qml/components/ConfirmTxDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,66 @@ ElDialog {
}
}

ToggleLabel {
id: optionstoggle
Layout.columnSpan: 2
labelText: qsTr('Options')
color: Material.accentColor
}

TextHighlightPane {
Layout.columnSpan: 2
Layout.fillWidth: true
visible: !optionstoggle.collapsed
height: optionslayout.height

GridLayout {
id: optionslayout
width: parent.width
columns: 2

ElCheckBox {
Layout.fillWidth: true
text: qsTr('Use multiple change addresses')
onCheckedChanged: {
if (activeFocus) {
Daemon.currentWallet.multipleChange = checked
finalizer.doUpdate()
}
}
Component.onCompleted: {
checked = Daemon.currentWallet.multipleChange
}
}

HelpButton {
heading: qsTr('Use multiple change addresses')
helptext: qsTr('To somewhat protect your privacy, Electrum tries to create change with similar precision to other outputs.')
}

ElCheckBox {
Layout.fillWidth: true
text: qsTr('Enable output value rounding')
onCheckedChanged: {
if (activeFocus) {
Config.outputValueRounding = checked
finalizer.doUpdate()
}
}
Component.onCompleted: {
checked = Config.outputValueRounding
}
}

HelpButton {
heading: qsTr('Enable output value rounding')
helptext: qsTr('In some cases, use up to 3 change addresses in order to break up large coin amounts and obfuscate the recipient address.')
+ ' ' + qsTr('This may result in higher transactions fees.')
}

}
}

InfoTextArea {
Layout.columnSpan: 2
Layout.fillWidth: true
Expand Down
40 changes: 40 additions & 0 deletions electrum/gui/qml/components/RbfBumpFeeDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,46 @@ ElDialog {
}
}

ToggleLabel {
id: optionstoggle
Layout.columnSpan: 2
labelText: qsTr('Options')
color: Material.accentColor
}

TextHighlightPane {
Layout.columnSpan: 2
Layout.fillWidth: true
visible: !optionstoggle.collapsed
height: optionslayout.height

GridLayout {
id: optionslayout
width: parent.width
columns: 2

ElCheckBox {
Layout.fillWidth: true
text: qsTr('Enable output value rounding')
onCheckedChanged: {
if (activeFocus) {
Config.outputValueRounding = checked
rbffeebumper.doUpdate()
}
}
Component.onCompleted: {
checked = Config.outputValueRounding
}
}

HelpButton {
heading: qsTr('Enable output value rounding')
helptext: qsTr('In some cases, use up to 3 change addresses in order to break up large coin amounts and obfuscate the recipient address.')
+ ' ' + qsTr('This may result in higher transactions fees.')
}
}
}

InfoTextArea {
Layout.columnSpan: 2
Layout.preferredWidth: parent.width * 3/4
Expand Down
11 changes: 11 additions & 0 deletions electrum/gui/qml/qeconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,17 @@ def addresslistShowUsed(self, addresslistShowUsed):
self.config.GUI_QML_ADDRESS_LIST_SHOW_USED = addresslistShowUsed
self.addresslistShowUsedChanged.emit()

outputValueRoundingChanged = pyqtSignal()
@pyqtProperty(bool, notify=outputValueRoundingChanged)
def outputValueRounding(self):
return self.config.WALLET_COIN_CHOOSER_OUTPUT_ROUNDING

@outputValueRounding.setter
def outputValueRounding(self, outputValueRounding):
if outputValueRounding != self.config.WALLET_COIN_CHOOSER_OUTPUT_ROUNDING:
self.config.WALLET_COIN_CHOOSER_OUTPUT_ROUNDING = outputValueRounding
self.outputValueRoundingChanged.emit()

@pyqtSlot('qint64', result=str)
@pyqtSlot(QEAmount, result=str)
def formatSatsForEditing(self, satoshis):
Expand Down
4 changes: 4 additions & 0 deletions electrum/gui/qml/qetxfinalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ def warning(self, warning):
def valid(self):
return self._valid

@pyqtSlot()
def doUpdate(self):
self.update()

def update_from_tx(self, tx):
tx_size = tx.estimated_size()
fee = tx.get_fee()
Expand Down
12 changes: 12 additions & 0 deletions electrum/gui/qml/qewallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ def synchronizingProgress(self, progress):
self._logger.info(progress)
self.synchronizingProgressChanged.emit()

multipleChangeChanged = pyqtSignal()
@pyqtProperty(bool, notify=multipleChangeChanged)
def multipleChange(self):
return self.wallet.multiple_change

@multipleChange.setter
def multipleChange(self, multiple_change):
if self.wallet.multiple_change != multiple_change:
self.wallet.multiple_change = multiple_change
self.wallet.db.put('multiple_change', self.wallet.multiple_change)
self.multipleChangeChanged.emit()

@qt_event_listener
def on_event_request_status(self, wallet, key, status):
if wallet == self.wallet:
Expand Down

0 comments on commit dcdbb0f

Please sign in to comment.