Browse Source

qml: addresses list formatting, add txid/outpoint and amount to filter

master
Sander van Grieken 2 years ago
parent
commit
e88cf0a683
  1. 38
      electrum/gui/qml/components/Addresses.qml
  2. 2
      electrum/gui/qml/components/WalletMainView.qml
  3. 38
      electrum/gui/qml/components/controls/CoinDelegate.qml
  4. 5
      electrum/gui/qml/qeaddresslistmodel.py

38
electrum/gui/qml/components/Addresses.qml

@ -72,16 +72,15 @@ Pane {
} }
} }
} }
RowLayout { TextField {
Layout.columnSpan: 3 id: searchEdit
Layout.fillWidth: true Layout.fillWidth: true
TextField { Layout.columnSpan: 3
id: searchEdit placeholderText: qsTr('search')
Layout.fillWidth: true onTextChanged: listview.filterModel.filterText = text
placeholderText: qsTr('text search')
onTextChanged: listview.filterModel.filterText = text
}
Image { Image {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
source: Qt.resolvedUrl('../../icons/zoom.png') source: Qt.resolvedUrl('../../icons/zoom.png')
sourceSize.width: constants.iconSizeMedium sourceSize.width: constants.iconSizeMedium
sourceSize.height: constants.iconSizeMedium sourceSize.height: constants.iconSizeMedium
@ -193,6 +192,7 @@ Pane {
width: parent.width width: parent.width
property bool selected: loader.DelegateModel.inSelected property bool selected: loader.DelegateModel.inSelected
highlighted: selected highlighted: selected
indent: listview.filterModel.showAddressesCoins == 2 ? 0 : constants.paddingLarge * 2
onClicked: { onClicked: {
if (!listview.selectMode) { if (!listview.selectMode) {
var page = app.stack.push(Qt.resolvedUrl('TxDetails.qml'), { var page = app.stack.push(Qt.resolvedUrl('TxDetails.qml'), {
@ -244,17 +244,17 @@ Pane {
selectedGroup.remove(0, selectedGroup.count) selectedGroup.remove(0, selectedGroup.count)
} }
} }
FlatButton { // FlatButton {
Layout.fillWidth: true // Layout.fillWidth: true
Layout.preferredWidth: 1 // Layout.preferredWidth: 1
text: qsTr('Pay from...') // text: qsTr('Pay from...')
icon.source: '../../icons/tab_send.png' // icon.source: '../../icons/tab_send.png'
visible: listview.selectMode // visible: listview.selectMode
enabled: false // TODO // enabled: false // TODO
onClicked: { // onClicked: {
// // //
} // }
} // }
} }
} }

2
electrum/gui/qml/components/WalletMainView.qml

@ -111,7 +111,7 @@ Item {
icon.color: action.enabled ? 'transparent' : Material.iconDisabledColor icon.color: action.enabled ? 'transparent' : Material.iconDisabledColor
icon.source: '../../icons/tab_addresses.png' icon.source: '../../icons/tab_addresses.png'
action: Action { action: Action {
text: qsTr('Addresses'); text: qsTr('Addresses/Coins');
onTriggered: menu.openPage(Qt.resolvedUrl('Addresses.qml')); onTriggered: menu.openPage(Qt.resolvedUrl('Addresses.qml'));
enabled: Daemon.currentWallet && app.stack.currentItem.objectName != 'Addresses' enabled: Daemon.currentWallet && app.stack.currentItem.objectName != 'Addresses'
} }

38
electrum/gui/qml/components/controls/CoinDelegate.qml

@ -10,18 +10,20 @@ ItemDelegate {
width: ListView.view.width width: ListView.view.width
height: delegateLayout.height height: delegateLayout.height
highlighted: ListView.isCurrentItem highlighted: ListView.isCurrentItem
font.pixelSize: constants.fontSizeMedium // set default font size for child controls font.pixelSize: constants.fontSizeMedium // set default font size for child controls
property int indent: 0
ColumnLayout { ColumnLayout {
id: delegateLayout id: delegateLayout
width: parent.width width: parent.width
spacing: 0 spacing: 0
GridLayout { GridLayout {
columns: 3 columns: 2
Layout.topMargin: constants.paddingSmall Layout.topMargin: constants.paddingSmall
Layout.leftMargin: constants.paddingLarge + 2*constants.paddingLarge Layout.bottomMargin: constants.paddingSmall
Layout.leftMargin: constants.paddingLarge + indent
Layout.rightMargin: constants.paddingLarge Layout.rightMargin: constants.paddingLarge
Rectangle { Rectangle {
@ -41,15 +43,15 @@ ItemDelegate {
font.family: FixedFont font.family: FixedFont
text: model.outpoint text: model.outpoint
elide: Text.ElideMiddle elide: Text.ElideMiddle
Layout.preferredWidth: implicitWidth + constants.paddingMedium
}
Label {
Layout.fillWidth: true Layout.fillWidth: true
visible: model.short_id
font.family: FixedFont
font.pixelSize: constants.fontSizeSmall
text: '[' + model.short_id + ']'
} }
// Label {
// Layout.preferredWidth: implicitWidth
// visible: model.short_id
// font.family: FixedFont
// font.pixelSize: constants.fontSizeSmall
// text: '[' + model.short_id + ']'
// }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.alignment: Qt.AlignLeft | Qt.AlignTop
@ -60,15 +62,18 @@ ItemDelegate {
sourceSize.height: constants.iconSizeSmall sourceSize.height: constants.iconSizeSmall
} }
} }
}
RowLayout {
Label { Label {
Layout.leftMargin: constants.paddingMedium
Layout.minimumWidth: implicitWidth
Layout.preferredWidth: implicitWidth
horizontalAlignment: Text.AlignRight
font.family: FixedFont font.family: FixedFont
text: Config.formatSats(model.amount, false) text: Config.formatSats(model.amount, false)
visible: model.amount.satsInt != 0 visible: model.amount.satsInt != 0
} }
Label { Label {
Layout.minimumWidth: implicitWidth
Layout.preferredWidth: implicitWidth
color: Material.accentColor color: Material.accentColor
text: Config.baseUnit text: Config.baseUnit
visible: model.amount.satsInt != 0 visible: model.amount.satsInt != 0
@ -78,7 +83,6 @@ ItemDelegate {
Label { Label {
id: labelLabel id: labelLabel
Layout.fillWidth: true Layout.fillWidth: true
Layout.columnSpan: 2
visible: model.label visible: model.label
font.pixelSize: constants.fontSizeMedium font.pixelSize: constants.fontSizeMedium
text: model.label text: model.label
@ -88,10 +92,6 @@ ItemDelegate {
} }
} }
Item {
Layout.preferredWidth: 1
Layout.preferredHeight: constants.paddingSmall
}
} }
} }

5
electrum/gui/qml/qeaddresslistmodel.py

@ -46,7 +46,10 @@ class QEAddressCoinFilterProxyModel(QSortFilterProxyModel):
if self._filter_text: if self._filter_text:
label = parent_model.data(parent_model.index(s_row, 0, s_parent), parent_model._ROLE_RMAP['label']) label = parent_model.data(parent_model.index(s_row, 0, s_parent), parent_model._ROLE_RMAP['label'])
address = parent_model.data(parent_model.index(s_row, 0, s_parent), parent_model._ROLE_RMAP['address']) address = parent_model.data(parent_model.index(s_row, 0, s_parent), parent_model._ROLE_RMAP['address'])
for item in [label, address]: outpoint = parent_model.data(parent_model.index(s_row, 0, s_parent), parent_model._ROLE_RMAP['outpoint'])
amount_i = parent_model.data(parent_model.index(s_row, 0, s_parent), parent_model._ROLE_RMAP['amount'])
amount = parent_model.wallet.config.format_amount(amount_i.satsInt) if amount_i else None
for item in [label, address, outpoint, amount]:
if self._filter_text in str(item): if self._filter_text in str(item):
return True return True
return False return False

Loading…
Cancel
Save