From 0a6f6ab00661036afcc90beed69990d37c2d8d4e Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Fri, 6 Jun 2025 13:38:48 +0200 Subject: [PATCH] qml: use color for accounting addresses --- electrum/gui/qml/components/Constants.qml | 1 + electrum/gui/qml/components/controls/TxInput.qml | 8 ++++++-- electrum/gui/qml/components/controls/TxOutput.qml | 10 +++++++--- electrum/gui/qml/qetxdetails.py | 6 ++++-- electrum/gui/qml/qetxfinalizer.py | 1 + 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/electrum/gui/qml/components/Constants.qml b/electrum/gui/qml/components/Constants.qml index 56f1f3b0c..95d79a479 100644 --- a/electrum/gui/qml/components/Constants.qml +++ b/electrum/gui/qml/components/Constants.qml @@ -70,6 +70,7 @@ Item { property color colorAddressFrozen: Qt.rgba(0.5,0.5,1,1) property color colorAddressBilling: "#8cb3f2" property color colorAddressSwap: colorAddressBilling + property color colorAddressAccounting: "#ff9b45" function colorAlpha(baseColor, alpha) { return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, alpha) diff --git a/electrum/gui/qml/components/controls/TxInput.qml b/electrum/gui/qml/components/controls/TxInput.qml index 7d53668e9..b876bc4aa 100644 --- a/electrum/gui/qml/components/controls/TxInput.qml +++ b/electrum/gui/qml/components/controls/TxInput.qml @@ -15,7 +15,9 @@ TextHighlightPane { ? qsTr('mine') : model.is_swap ? qsTr('swap') - : "" + : model.is_accounting + ? qsTr('accounting') + : "" ColumnLayout { width: parent.width @@ -74,7 +76,9 @@ TextHighlightPane { : constants.colorAddressExternal : model.is_swap ? constants.colorAddressSwap - : Material.foreground + : model.is_accounting + ? constants.colorAddressAccounting + : Material.foreground wrapMode: Text.WrapAnywhere } } diff --git a/electrum/gui/qml/components/controls/TxOutput.qml b/electrum/gui/qml/components/controls/TxOutput.qml index 422d1daef..f9309c0ac 100644 --- a/electrum/gui/qml/components/controls/TxOutput.qml +++ b/electrum/gui/qml/components/controls/TxOutput.qml @@ -13,10 +13,12 @@ TextHighlightPane { property bool allowClickAddress: true property int idx: -1 - property string _suffix: model.is_mine || model.is_change + property string _suffix: model.is_mine || model.is_change || model.is_accounting ? model.is_reserve ? qsTr('reserve') - : qsTr('mine') + : model.is_accounting + ? qsTr('accounting') + : qsTr('mine') : model.is_swap ? qsTr('swap') : model.is_billing @@ -83,7 +85,9 @@ TextHighlightPane { ? constants.colorAddressBilling : model.is_swap ? constants.colorAddressSwap - : Material.foreground + : model.is_accounting + ? constants.colorAddressAccounting + : Material.foreground TapHandler { enabled: allowClickAddress && model.is_mine onTapped: { diff --git a/electrum/gui/qml/qetxdetails.py b/electrum/gui/qml/qetxdetails.py index e1df25aba..da39edff5 100644 --- a/electrum/gui/qml/qetxdetails.py +++ b/electrum/gui/qml/qetxdetails.py @@ -308,7 +308,8 @@ class QETxDetails(QObject, QtEventListener): 'address': x.address, 'is_mine': self._wallet.wallet.is_mine(x.address), 'is_change': self._wallet.wallet.is_change(x.address), - 'is_swap': False if not sm else sm.is_lockup_address_for_a_swap(x.address) or x.address == DummyAddress.SWAP + 'is_swap': False if not sm else sm.is_lockup_address_for_a_swap(x.address) or x.address == DummyAddress.SWAP, + 'is_accounting': self._wallet.wallet.is_accounting_address(x.address) }, self._tx.inputs())) self._outputs = list(map(lambda x: { 'address': x.get_ui_address_str(), @@ -317,7 +318,8 @@ class QETxDetails(QObject, QtEventListener): 'is_mine': self._wallet.wallet.is_mine(x.get_ui_address_str()), 'is_change': self._wallet.wallet.is_change(x.get_ui_address_str()), 'is_billing': self._wallet.wallet.is_billing_address(x.get_ui_address_str()), - 'is_swap': False if not sm else sm.is_lockup_address_for_a_swap(x.get_ui_address_str()) or x.get_ui_address_str() == DummyAddress.SWAP + 'is_swap': False if not sm else sm.is_lockup_address_for_a_swap(x.get_ui_address_str()) or x.get_ui_address_str() == DummyAddress.SWAP, + 'is_accounting': self._wallet.wallet.is_accounting_address(x.get_ui_address_str()) }, self._tx.outputs())) txinfo = self._wallet.wallet.get_tx_info(self._tx) diff --git a/electrum/gui/qml/qetxfinalizer.py b/electrum/gui/qml/qetxfinalizer.py index 3908c7e31..107ca52eb 100644 --- a/electrum/gui/qml/qetxfinalizer.py +++ b/electrum/gui/qml/qetxfinalizer.py @@ -289,6 +289,7 @@ class TxFeeSlider(FeeSlider): 'is_change': self._wallet.wallet.is_change(o.get_ui_address_str()), 'is_billing': self._wallet.wallet.is_billing_address(o.get_ui_address_str()), 'is_swap': False if not sm else sm.is_lockup_address_for_a_swap(o.get_ui_address_str()) or o.get_ui_address_str() == DummyAddress.SWAP, + 'is_accounting': self._wallet.wallet.is_accounting_address(o.get_ui_address_str()), 'is_reserve': o.is_utxo_reserve }) self.outputs = outputs