1
0

qml: Addresses fills page

This commit is contained in:
Sander van Grieken
2023-02-09 01:17:13 +01:00
parent 1e60cb740f
commit c9b6917ab7

View File

@@ -10,128 +10,123 @@ import "controls"
Pane { Pane {
id: rootItem id: rootItem
padding: 0 padding: 0
width: parent.width
ColumnLayout { ColumnLayout {
id: layout id: layout
width: parent.width anchors.fill: parent
height: parent.height
Item { ListView {
width: parent.width id: listview
Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
ListView { clip: true
id: listview model: Daemon.currentWallet.addressModel
width: parent.width currentIndex: -1
height: parent.height
clip: true
model: Daemon.currentWallet.addressModel
currentIndex: -1
section.property: 'type' section.property: 'type'
section.criteria: ViewSection.FullString section.criteria: ViewSection.FullString
section.delegate: sectionDelegate section.delegate: sectionDelegate
delegate: ItemDelegate { delegate: ItemDelegate {
id: delegate id: delegate
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
onClicked: { onClicked: {
var page = app.stack.push(Qt.resolvedUrl('AddressDetails.qml'), {'address': model.address}) var page = app.stack.push(Qt.resolvedUrl('AddressDetails.qml'), {'address': model.address})
page.addressDetailsChanged.connect(function() { page.addressDetailsChanged.connect(function() {
// update listmodel when details change // update listmodel when details change
listview.model.update_address(model.address) listview.model.update_address(model.address)
}) })
} }
ColumnLayout { ColumnLayout {
id: delegateLayout id: delegateLayout
width: parent.width width: parent.width
spacing: 0 spacing: 0
GridLayout { GridLayout {
columns: 2 columns: 2
Layout.topMargin: constants.paddingSmall Layout.topMargin: constants.paddingSmall
Layout.leftMargin: constants.paddingLarge Layout.leftMargin: constants.paddingLarge
Layout.rightMargin: constants.paddingLarge Layout.rightMargin: constants.paddingLarge
Label {
id: indexLabel
font.bold: true
text: '#' + ('00'+model.iaddr).slice(-2)
Layout.fillWidth: true
}
Label {
font.family: FixedFont
text: model.address
elide: Text.ElideMiddle
Layout.fillWidth: true
}
Rectangle {
id: useIndicator
Layout.preferredWidth: constants.iconSizeMedium
Layout.preferredHeight: constants.iconSizeMedium
color: model.held
? constants.colorAddressFrozen
: model.numtx > 0
? model.balance.satsInt == 0
? constants.colorAddressUsed
: constants.colorAddressUsedWithBalance
: model.type == 'receive'
? constants.colorAddressExternal
: constants.colorAddressInternal
}
RowLayout {
Label { Label {
id: indexLabel id: labelLabel
font.bold: true font.pixelSize: model.label != '' ? constants.fontSizeLarge : constants.fontSizeSmall
text: '#' + ('00'+model.iaddr).slice(-2) text: model.label != '' ? model.label : '<no label>'
opacity: model.label != '' ? 1.0 : 0.8
elide: Text.ElideRight
maximumLineCount: 2
wrapMode: Text.WordWrap
Layout.fillWidth: true Layout.fillWidth: true
} }
Label { Label {
font.family: FixedFont font.family: FixedFont
text: model.address text: Config.formatSats(model.balance, false)
elide: Text.ElideMiddle visible: model.balance.satsInt != 0
Layout.fillWidth: true
} }
Label {
Rectangle { color: Material.accentColor
id: useIndicator text: Config.baseUnit + ','
Layout.preferredWidth: constants.iconSizeMedium visible: model.balance.satsInt != 0
Layout.preferredHeight: constants.iconSizeMedium
color: model.held
? constants.colorAddressFrozen
: model.numtx > 0
? model.balance.satsInt == 0
? constants.colorAddressUsed
: constants.colorAddressUsedWithBalance
: model.type == 'receive'
? constants.colorAddressExternal
: constants.colorAddressInternal
} }
Label {
RowLayout { text: model.numtx
Label { visible: model.numtx > 0
id: labelLabel }
font.pixelSize: model.label != '' ? constants.fontSizeLarge : constants.fontSizeSmall Label {
text: model.label != '' ? model.label : '<no label>' color: Material.accentColor
opacity: model.label != '' ? 1.0 : 0.8 text: qsTr('tx')
elide: Text.ElideRight visible: model.numtx > 0
maximumLineCount: 2
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
Label {
font.family: FixedFont
text: Config.formatSats(model.balance, false)
visible: model.balance.satsInt != 0
}
Label {
color: Material.accentColor
text: Config.baseUnit + ','
visible: model.balance.satsInt != 0
}
Label {
text: model.numtx
visible: model.numtx > 0
}
Label {
color: Material.accentColor
text: qsTr('tx')
visible: model.numtx > 0
}
} }
}
Item {
Layout.preferredWidth: 1
Layout.preferredHeight: constants.paddingSmall
} }
} }
}
ScrollIndicator.vertical: ScrollIndicator { } Item {
Layout.preferredWidth: 1
Layout.preferredHeight: constants.paddingSmall
}
}
} }
ScrollIndicator.vertical: ScrollIndicator { }
} }
} }
Component { Component {