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

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

@ -111,7 +111,7 @@ Item {
icon.color: action.enabled ? 'transparent' : Material.iconDisabledColor
icon.source: '../../icons/tab_addresses.png'
action: Action {
text: qsTr('Addresses');
text: qsTr('Addresses/Coins');
onTriggered: menu.openPage(Qt.resolvedUrl('Addresses.qml'));
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
height: delegateLayout.height
highlighted: ListView.isCurrentItem
font.pixelSize: constants.fontSizeMedium // set default font size for child controls
property int indent: 0
ColumnLayout {
id: delegateLayout
width: parent.width
spacing: 0
GridLayout {
columns: 3
columns: 2
Layout.topMargin: constants.paddingSmall
Layout.leftMargin: constants.paddingLarge + 2*constants.paddingLarge
Layout.bottomMargin: constants.paddingSmall
Layout.leftMargin: constants.paddingLarge + indent
Layout.rightMargin: constants.paddingLarge
Rectangle {
@ -41,15 +43,15 @@ ItemDelegate {
font.family: FixedFont
text: model.outpoint
elide: Text.ElideMiddle
Layout.preferredWidth: implicitWidth + constants.paddingMedium
}
Label {
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 {
Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
@ -60,15 +62,18 @@ ItemDelegate {
sourceSize.height: constants.iconSizeSmall
}
}
}
RowLayout {
Label {
Layout.leftMargin: constants.paddingMedium
Layout.minimumWidth: implicitWidth
Layout.preferredWidth: implicitWidth
horizontalAlignment: Text.AlignRight
font.family: FixedFont
text: Config.formatSats(model.amount, false)
visible: model.amount.satsInt != 0
}
Label {
Layout.minimumWidth: implicitWidth
Layout.preferredWidth: implicitWidth
color: Material.accentColor
text: Config.baseUnit
visible: model.amount.satsInt != 0
@ -78,7 +83,6 @@ ItemDelegate {
Label {
id: labelLabel
Layout.fillWidth: true
Layout.columnSpan: 2
visible: model.label
font.pixelSize: constants.fontSizeMedium
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:
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'])
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):
return True
return False

Loading…
Cancel
Save