diff --git a/electrum/gui/qml/components/Constants.qml b/electrum/gui/qml/components/Constants.qml index cbef3f31b..19ed130d6 100644 --- a/electrum/gui/qml/components/Constants.qml +++ b/electrum/gui/qml/components/Constants.qml @@ -21,4 +21,7 @@ QtObject { readonly property int iconSizeLarge: 32 readonly property int iconSizeXLarge: 48 readonly property int iconSizeXXLarge: 64 + + property color colorCredit: "#ff80ff80" + property color colorDebit: "#ffff8080" } diff --git a/electrum/gui/qml/components/History.qml b/electrum/gui/qml/components/History.qml index e51c3a5c5..54c627011 100644 --- a/electrum/gui/qml/components/History.qml +++ b/electrum/gui/qml/components/History.qml @@ -20,101 +20,81 @@ Pane { delegate: Item { id: delegate width: ListView.view.width - height: txinfo.height + height: delegateLayout.height - MouseArea { - anchors.fill: delegate - onClicked: extinfo.visible = !extinfo.visible - } + ColumnLayout { + id: delegateLayout + width: parent.width + spacing: 0 - GridLayout { - id: txinfo - columns: 3 - - x: 6 - 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)] + Rectangle { + visible: index > 0 + Layout.fillWidth: true + Layout.preferredHeight: constants.paddingSmall + color: Qt.rgba(0,0,0,0.10) } - Label { - font.pixelSize: 18 + + ItemDelegate { Layout.fillWidth: true - text: model.label !== '' ? model.label : '' - color: model.label !== '' ? Material.accentColor : 'gray' - } - Label { - id: valueLabel - font.family: FixedFont - font.pixelSize: 15 - text: Config.formatSats(model.bc_value) - font.bold: true - color: model.incoming ? "#ff80ff80" : "#ffff8080" - } - Label { - font.pixelSize: 12 - text: model.date - } - Label { - font.pixelSize: 10 - text: 'fee: ' + (model.fee !== undefined ? model.fee : '0') - } + Layout.preferredHeight: txinfo.height + + GridLayout { + id: txinfo + columns: 3 + + x: constants.paddingSmall + width: delegate.width - 2*constants.paddingSmall + + Item { Layout.columnSpan: 3; Layout.preferredWidth: 1; Layout.preferredHeight: 1} + 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: constants.iconSizeLarge + Layout.preferredHeight: constants.iconSizeLarge + Layout.alignment: Qt.AlignVCenter + Layout.rowSpan: 2 + source: tx_icons[Math.min(6,model.confirmations)] + } - GridLayout { - id: extinfo - visible: false - columns: 2 - Layout.columnSpan: 3 - - Label { text: 'txid' } - Label { - font.pixelSize: 10 - text: model.txid - elide: Text.ElideMiddle - Layout.fillWidth: true - } - Label { text: 'height' } - Label { - font.pixelSize: 10 - 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.fontSizeLarge + Layout.fillWidth: true + text: model.label !== '' ? model.label : '' + color: model.label !== '' ? Material.accentColor : 'gray' + wrapMode: Text.Wrap + maximumLineCount: 2 + elide: Text.ElideRight + } + Label { + id: valueLabel + font.family: FixedFont + font.pixelSize: constants.fontSizeMedium + text: Config.formatSats(model.bc_value) + font.bold: true + color: model.incoming ? constants.colorCredit : constants.colorDebit } + 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, // hook up events that might change the appearance Connections {