Browse Source

qml: Addresses fills page

master
Sander van Grieken 3 years ago
parent
commit
c9b6917ab7
  1. 191
      electrum/gui/qml/components/Addresses.qml

191
electrum/gui/qml/components/Addresses.qml

@ -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 section.property: 'type'
model: Daemon.currentWallet.addressModel section.criteria: ViewSection.FullString
currentIndex: -1 section.delegate: sectionDelegate
section.property: 'type' delegate: ItemDelegate {
section.criteria: ViewSection.FullString id: delegate
section.delegate: sectionDelegate width: ListView.view.width
height: delegateLayout.height
delegate: ItemDelegate { highlighted: ListView.isCurrentItem
id: delegate
width: ListView.view.width
height: delegateLayout.height
highlighted: ListView.isCurrentItem
font.pixelSize: constants.fontSizeMedium // set default font size for child controls
onClicked: {
var page = app.stack.push(Qt.resolvedUrl('AddressDetails.qml'), {'address': model.address})
page.addressDetailsChanged.connect(function() {
// update listmodel when details change
listview.model.update_address(model.address)
})
}
ColumnLayout { font.pixelSize: constants.fontSizeMedium // set default font size for child controls
id: delegateLayout
width: parent.width
spacing: 0
GridLayout { onClicked: {
columns: 2 var page = app.stack.push(Qt.resolvedUrl('AddressDetails.qml'), {'address': model.address})
Layout.topMargin: constants.paddingSmall page.addressDetailsChanged.connect(function() {
Layout.leftMargin: constants.paddingLarge // update listmodel when details change
Layout.rightMargin: constants.paddingLarge listview.model.update_address(model.address)
})
}
ColumnLayout {
id: delegateLayout
width: parent.width
spacing: 0
GridLayout {
columns: 2
Layout.topMargin: constants.paddingSmall
Layout.leftMargin: 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 { Item {
Layout.preferredWidth: 1 Layout.preferredWidth: 1
Layout.preferredHeight: constants.paddingSmall Layout.preferredHeight: constants.paddingSmall
}
} }
} }
ScrollIndicator.vertical: ScrollIndicator { }
} }
ScrollIndicator.vertical: ScrollIndicator { }
} }
} }
Component { Component {

Loading…
Cancel
Save