Browse Source

UI history page

patch-4
Sander van Grieken 3 years ago
parent
commit
bbaf0fe5db
  1. 3
      electrum/gui/qml/components/Constants.qml
  2. 150
      electrum/gui/qml/components/History.qml

3
electrum/gui/qml/components/Constants.qml

@ -21,4 +21,7 @@ QtObject {
readonly property int iconSizeLarge: 32 readonly property int iconSizeLarge: 32
readonly property int iconSizeXLarge: 48 readonly property int iconSizeXLarge: 48
readonly property int iconSizeXXLarge: 64 readonly property int iconSizeXXLarge: 64
property color colorCredit: "#ff80ff80"
property color colorDebit: "#ffff8080"
} }

150
electrum/gui/qml/components/History.qml

@ -20,101 +20,81 @@ Pane {
delegate: Item { delegate: Item {
id: delegate id: delegate
width: ListView.view.width width: ListView.view.width
height: txinfo.height height: delegateLayout.height
MouseArea { ColumnLayout {
anchors.fill: delegate id: delegateLayout
onClicked: extinfo.visible = !extinfo.visible width: parent.width
} spacing: 0
GridLayout { Rectangle {
id: txinfo visible: index > 0
columns: 3 Layout.fillWidth: true
Layout.preferredHeight: constants.paddingSmall
x: 6 color: Qt.rgba(0,0,0,0.10)
width: delegate.width - 12
Image {
readonly property variant tx_icons : [
"../../../gui/icons/unconfirmed.png",
"../../../gui/icons/clock1.png",
"../../../gui/icons/clock2.png",
"../../../gui/icons/clock3.png",
"../../../gui/icons/clock4.png",
"../../../gui/icons/clock5.png",
"../../../gui/icons/confirmed.png"
]
Layout.preferredWidth: 32
Layout.preferredHeight: 32
Layout.alignment: Qt.AlignVCenter
Layout.rowSpan: 2
source: tx_icons[Math.min(6,model.confirmations)]
} }
Label {
font.pixelSize: 18 ItemDelegate {
Layout.fillWidth: true Layout.fillWidth: true
text: model.label !== '' ? model.label : '<no label>' Layout.preferredHeight: txinfo.height
color: model.label !== '' ? Material.accentColor : 'gray'
} GridLayout {
Label { id: txinfo
id: valueLabel columns: 3
font.family: FixedFont
font.pixelSize: 15 x: constants.paddingSmall
text: Config.formatSats(model.bc_value) width: delegate.width - 2*constants.paddingSmall
font.bold: true
color: model.incoming ? "#ff80ff80" : "#ffff8080" Item { Layout.columnSpan: 3; Layout.preferredWidth: 1; Layout.preferredHeight: 1}
} Image {
Label { readonly property variant tx_icons : [
font.pixelSize: 12 "../../../gui/icons/unconfirmed.png",
text: model.date "../../../gui/icons/clock1.png",
} "../../../gui/icons/clock2.png",
Label { "../../../gui/icons/clock3.png",
font.pixelSize: 10 "../../../gui/icons/clock4.png",
text: 'fee: ' + (model.fee !== undefined ? model.fee : '0') "../../../gui/icons/clock5.png",
} "../../../gui/icons/confirmed.png"
]
Layout.preferredWidth: constants.iconSizeLarge
Layout.preferredHeight: constants.iconSizeLarge
Layout.alignment: Qt.AlignVCenter
Layout.rowSpan: 2
source: tx_icons[Math.min(6,model.confirmations)]
}
GridLayout { Label {
id: extinfo font.pixelSize: constants.fontSizeLarge
visible: false Layout.fillWidth: true
columns: 2 text: model.label !== '' ? model.label : '<no label>'
Layout.columnSpan: 3 color: model.label !== '' ? Material.accentColor : 'gray'
wrapMode: Text.Wrap
Label { text: 'txid' } maximumLineCount: 2
Label { elide: Text.ElideRight
font.pixelSize: 10 }
text: model.txid Label {
elide: Text.ElideMiddle id: valueLabel
Layout.fillWidth: true font.family: FixedFont
} font.pixelSize: constants.fontSizeMedium
Label { text: 'height' } text: Config.formatSats(model.bc_value)
Label { font.bold: true
font.pixelSize: 10 color: model.incoming ? constants.colorCredit : constants.colorDebit
text: model.height
}
Label { text: 'confirmations' }
Label {
font.pixelSize: 10
text: model.confirmations
}
Label { text: 'address' }
Label {
font.pixelSize: 10
elide: Text.ElideMiddle
Layout.fillWidth: true
text: {
for (var i=0; i < Object.keys(model.outputs).length; i++) {
if (model.outputs[i].value === model.bc_value) {
return model.outputs[i].address
}
}
} }
Label {
font.pixelSize: constants.fontSizeSmall
text: model.date
}
Label {
font.pixelSize: constants.fontSizeXSmall
Layout.alignment: Qt.AlignRight
text: model.fee !== undefined ? 'fee: ' + model.fee : ''
}
Item { Layout.columnSpan: 3; Layout.preferredWidth: 1; Layout.preferredHeight: 1 }
} }
} }
} }
// as the items in the model are not bindings to QObjects, // as the items in the model are not bindings to QObjects,
// hook up events that might change the appearance // hook up events that might change the appearance
Connections { Connections {

Loading…
Cancel
Save