2022-12-19 21:01:07 +01:00
|
|
|
/*
|
|
|
|
|
* This file is part of the Flowee project
|
2025-02-04 15:50:24 +01:00
|
|
|
* Copyright (C) 2022-2025 Tom Zander <tom@flowee.org>
|
2022-12-19 21:01:07 +01:00
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls as QQC2
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import "../Flowee" as Flowee
|
|
|
|
|
import Flowee.org.pay;
|
|
|
|
|
|
|
|
|
|
Page {
|
|
|
|
|
id: root
|
2025-02-04 15:50:24 +01:00
|
|
|
required property QtObject wallet;
|
|
|
|
|
required property int txIndex;
|
|
|
|
|
readonly property QtObject infoObject: wallet.txInfo(txIndex, root)
|
2022-12-19 21:01:07 +01:00
|
|
|
headerText: qsTr("Transaction Details")
|
|
|
|
|
|
2024-01-15 19:27:33 +01:00
|
|
|
property QtObject openInExplorer: QQC2.Action {
|
|
|
|
|
text: qsTr("Open in Explorer")
|
2025-02-04 15:50:24 +01:00
|
|
|
onTriggered: Pay.openInExplorer(root.infoObject.txid);
|
2024-01-15 19:27:33 +01:00
|
|
|
}
|
|
|
|
|
menuItems: [ openInExplorer ]
|
|
|
|
|
|
2023-05-06 17:27:24 +02:00
|
|
|
Flickable {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
contentHeight: content.height
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
id: content
|
|
|
|
|
width: parent.width
|
2023-05-09 19:25:06 +02:00
|
|
|
spacing: 10
|
|
|
|
|
|
|
|
|
|
PageTitledBox {
|
|
|
|
|
title: qsTr("Transaction Hash")
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
implicitHeight: txidLabel.implicitHeight
|
|
|
|
|
width: parent.width
|
2024-01-15 19:27:33 +01:00
|
|
|
|
2023-05-09 19:25:06 +02:00
|
|
|
Flowee.Label {
|
|
|
|
|
id: txidLabel
|
2025-02-04 15:50:24 +01:00
|
|
|
text: root.infoObject.txid
|
2023-05-09 19:25:06 +02:00
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: copyIcon.left
|
|
|
|
|
anchors.rightMargin: 10
|
|
|
|
|
wrapMode: Text.WrapAnywhere
|
2024-02-11 17:52:54 +01:00
|
|
|
font.pixelSize: root.font.pixelSize * 0.9
|
2024-01-15 19:27:33 +01:00
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: txidHighlight
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
color: palette.mid
|
|
|
|
|
opacity: 0
|
|
|
|
|
visible: opacity > 0
|
|
|
|
|
Timer {
|
|
|
|
|
running: parent.visible
|
|
|
|
|
onTriggered: parent.opacity = 0;
|
|
|
|
|
interval: 500
|
|
|
|
|
}
|
|
|
|
|
Behavior on opacity { NumberAnimation { duration: 250 } }
|
|
|
|
|
}
|
2023-05-09 19:25:06 +02:00
|
|
|
}
|
|
|
|
|
Image {
|
|
|
|
|
id: copyIcon
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
width: 20
|
|
|
|
|
height: 20
|
|
|
|
|
source: "qrc:/edit-copy" + (Pay.useDarkSkin ? "-light" : "") + ".svg"
|
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.margins: -15
|
2024-01-15 19:27:33 +01:00
|
|
|
onClicked: {
|
|
|
|
|
txidHighlight.opacity = 0.6
|
|
|
|
|
Pay.copyToClipboard(txidLabel.text)
|
|
|
|
|
}
|
2023-05-09 19:25:06 +02:00
|
|
|
}
|
2023-05-06 17:01:51 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-15 13:41:15 +01:00
|
|
|
PageTitledBox {
|
|
|
|
|
title: qsTr("First Seen")
|
|
|
|
|
Flowee.Label {
|
|
|
|
|
Layout.fillWidth: true
|
2025-02-04 15:50:24 +01:00
|
|
|
text: Qt.formatDateTime(root.infoObject.date);
|
2024-01-15 13:41:15 +01:00
|
|
|
}
|
|
|
|
|
}
|
2023-05-09 19:25:06 +02:00
|
|
|
|
|
|
|
|
PageTitledBox {
|
|
|
|
|
title: {
|
2025-02-04 15:50:24 +01:00
|
|
|
var h = root.infoObject.minedHeight;
|
2023-05-06 17:27:24 +02:00
|
|
|
if (h === -2)
|
|
|
|
|
return qsTr("Rejected")
|
|
|
|
|
if (h === -1)
|
2025-02-04 15:50:24 +01:00
|
|
|
return qsTr("Waiting for block")
|
2023-05-09 19:25:06 +02:00
|
|
|
return qsTr("Mined at")
|
2023-05-06 17:27:24 +02:00
|
|
|
}
|
|
|
|
|
Flowee.Label {
|
2023-05-09 19:25:06 +02:00
|
|
|
visible: text !== ""
|
2023-05-06 17:27:24 +02:00
|
|
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
2023-05-09 19:25:06 +02:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
text: {
|
2025-02-04 15:50:24 +01:00
|
|
|
let txHeight = root.infoObject.minedHeight;
|
2024-02-12 15:43:04 +01:00
|
|
|
if (txHeight < 1)
|
2023-05-09 19:25:06 +02:00
|
|
|
return "";
|
|
|
|
|
|
2024-02-12 15:43:04 +01:00
|
|
|
var answer = txHeight + "\n" + Pay.formatBlockTime(txHeight)
|
2024-01-15 19:27:33 +01:00
|
|
|
let blockAge = Pay.chainHeight - txHeight + 1;
|
2023-05-09 19:25:06 +02:00
|
|
|
answer += "\n";
|
|
|
|
|
answer += qsTr("%1 blocks ago", "", blockAge).arg(blockAge);
|
|
|
|
|
return answer;
|
2023-05-06 17:27:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-09 19:25:06 +02:00
|
|
|
PageTitledBox {
|
|
|
|
|
title: qsTr("Transaction comment")
|
|
|
|
|
|
2023-05-16 18:06:10 +02:00
|
|
|
EditableLabel {
|
|
|
|
|
id: editableLabel
|
2023-05-09 19:25:06 +02:00
|
|
|
width: parent.width
|
2025-02-04 15:50:24 +01:00
|
|
|
text: root.infoObject.userComment
|
|
|
|
|
editable: infoObject.commentEditable
|
|
|
|
|
onEdited: infoObject.userComment = text
|
2023-05-09 19:25:06 +02:00
|
|
|
}
|
2023-05-06 17:27:24 +02:00
|
|
|
}
|
2023-05-09 19:25:06 +02:00
|
|
|
|
2024-02-11 18:34:32 +01:00
|
|
|
PageTitledBox {
|
2024-02-28 11:45:16 +01:00
|
|
|
visible: fiatPrices.visible
|
2024-02-12 17:52:45 +01:00
|
|
|
Flowee.FiatTxInfo {
|
2024-02-28 11:45:16 +01:00
|
|
|
id: fiatPrices
|
2025-02-04 15:50:24 +01:00
|
|
|
txInfo: root.infoObject
|
2024-02-11 18:34:32 +01:00
|
|
|
width: parent.width
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-09 19:25:06 +02:00
|
|
|
PageTitledBox {
|
|
|
|
|
Flowee.Label {
|
2025-02-04 15:50:24 +01:00
|
|
|
text: qsTr("Size: %1 bytes").arg(infoObject.size)
|
2023-05-09 19:25:06 +02:00
|
|
|
}
|
|
|
|
|
Flowee.Label {
|
|
|
|
|
text: qsTr("Coinbase")
|
2025-02-04 15:50:24 +01:00
|
|
|
visible: root.infoObject.isCoinbase
|
2023-05-09 19:25:06 +02:00
|
|
|
}
|
2023-05-06 17:27:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// We can't calculate the fees of just any transaction, only for the ones
|
|
|
|
|
// this account created.
|
2023-05-09 19:25:06 +02:00
|
|
|
PageTitledBox {
|
|
|
|
|
title: qsTr("Fees paid")
|
2025-02-04 15:50:24 +01:00
|
|
|
visible: infoObject.fees > 0
|
2023-05-09 19:25:06 +02:00
|
|
|
Flowee.Label {
|
2025-02-04 15:50:24 +01:00
|
|
|
text: qsTr("%1 Satoshi / 1000 bytes").arg((infoObject.fees * 1000 / infoObject.size).toFixed(0))
|
2023-05-09 19:25:06 +02:00
|
|
|
}
|
|
|
|
|
Flowee.BitcoinAmountLabel {
|
2025-02-04 15:50:24 +01:00
|
|
|
value: infoObject.fees
|
|
|
|
|
fiatTimestamp: root.infoObject.date
|
2023-05-09 19:25:06 +02:00
|
|
|
colorize: false
|
|
|
|
|
}
|
2023-05-06 17:27:24 +02:00
|
|
|
}
|
|
|
|
|
|
2023-05-09 19:25:06 +02:00
|
|
|
PageTitledBox {
|
2024-02-11 17:52:54 +01:00
|
|
|
spacing: 10
|
2023-05-09 19:25:06 +02:00
|
|
|
title: {
|
2023-11-06 12:23:41 +01:00
|
|
|
if (infoObject.isFused)
|
2023-05-09 19:25:06 +02:00
|
|
|
return qsTr("Fused from my addresses");
|
2023-05-06 19:35:47 +02:00
|
|
|
if (infoObject.createdByUs)
|
2023-05-09 19:25:06 +02:00
|
|
|
return qsTr("Sent from my addresses");
|
2023-11-06 12:23:41 +01:00
|
|
|
if (infoObject.isFused)
|
2023-05-09 19:25:06 +02:00
|
|
|
return qsTr("Sent from addresses");
|
2023-05-06 19:35:47 +02:00
|
|
|
return "";
|
|
|
|
|
}
|
2023-05-09 19:25:06 +02:00
|
|
|
|
2023-05-06 18:32:54 +02:00
|
|
|
Repeater {
|
|
|
|
|
/*
|
|
|
|
|
* We only have the one transaction, which means we only have the previous txid and we have
|
|
|
|
|
* no details about which address or anything else these funds come from if we didn't
|
|
|
|
|
* create the Tx. So just don't show anything.
|
|
|
|
|
*/
|
2025-02-04 15:50:24 +01:00
|
|
|
model: infoObject.knownInputs
|
2023-05-06 18:32:54 +02:00
|
|
|
delegate: Item {
|
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
|
width: content.width
|
|
|
|
|
height: {
|
2024-02-28 11:51:15 +01:00
|
|
|
var neededWidth = inAddress.implicitWidth + 10 + amount.implicitWidth;
|
|
|
|
|
if (fusedIcon.visible)
|
|
|
|
|
neededWidth += 6 + fusedIcon.width
|
|
|
|
|
if (neededWidth < content.width)
|
2023-05-06 18:32:54 +02:00
|
|
|
return inAddress.height + 10;
|
|
|
|
|
return inAddress.height + amount.height + 16;
|
|
|
|
|
}
|
2024-02-03 23:52:27 +01:00
|
|
|
Flowee.CFIcon {
|
|
|
|
|
id: fusedIcon
|
|
|
|
|
visible: modelData.fromFused
|
|
|
|
|
}
|
2024-01-28 14:42:53 +01:00
|
|
|
Flowee.AddressLabel {
|
2023-05-06 18:32:54 +02:00
|
|
|
id: inAddress
|
2024-01-28 14:42:53 +01:00
|
|
|
txInfo: modelData
|
2024-02-03 23:52:27 +01:00
|
|
|
x: fusedIcon.visible ? fusedIcon.width + 6 : 0
|
|
|
|
|
width: Math.min(implicitWidth, parent.width - (fusedIcon.visible ? fusedIcon.width: 0))
|
2023-05-06 18:32:54 +02:00
|
|
|
}
|
|
|
|
|
Flowee.BitcoinAmountLabel {
|
|
|
|
|
id: amount
|
2024-02-12 17:52:45 +01:00
|
|
|
value: -1 * modelData.value
|
2025-02-04 15:50:24 +01:00
|
|
|
fiatTimestamp: root.infoObject.date
|
2023-05-06 18:32:54 +02:00
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.bottomMargin: 10
|
2023-05-09 19:25:06 +02:00
|
|
|
font.pixelSize: root.font.pixelSize * 0.9
|
2023-05-06 17:27:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-09 19:25:06 +02:00
|
|
|
PageTitledBox {
|
2024-02-11 17:52:54 +01:00
|
|
|
spacing: 10
|
2023-05-09 19:25:06 +02:00
|
|
|
title: {
|
2023-11-06 12:23:41 +01:00
|
|
|
if (infoObject.isFused)
|
2023-05-09 19:25:06 +02:00
|
|
|
return qsTr("Fused into my addresses");
|
2023-05-06 18:32:54 +02:00
|
|
|
if (infoObject.createdByUs)
|
2023-05-09 19:25:06 +02:00
|
|
|
return qsTr("Received at addresses");
|
|
|
|
|
return qsTr("Received at my addresses");
|
2023-05-06 18:32:54 +02:00
|
|
|
}
|
2024-01-28 14:42:53 +01:00
|
|
|
|
2023-05-06 18:32:54 +02:00
|
|
|
Repeater {
|
2025-02-04 15:50:24 +01:00
|
|
|
model: infoObject.knownOutputs
|
2023-05-06 18:32:54 +02:00
|
|
|
delegate: Item {
|
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
|
width: content.width
|
|
|
|
|
height: {
|
2024-03-07 10:41:41 +01:00
|
|
|
var neededWidth = outAddress.implicitWidth + 10 + outAmount.implicitWidth;
|
|
|
|
|
if (ctIcon.visible)
|
|
|
|
|
neededWidth += 6 + ctIcon.width
|
|
|
|
|
if (neededWidth < width)
|
2023-05-06 18:32:54 +02:00
|
|
|
return outAmount.height + 10;
|
|
|
|
|
return outAddress.height + outAmount.height + 16;
|
2024-03-07 10:41:41 +01:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Image {
|
|
|
|
|
id: ctIcon
|
|
|
|
|
visible: modelData.hasCashToken
|
|
|
|
|
source: "qrc:/CashTokens.svg";
|
|
|
|
|
width: 24
|
|
|
|
|
height: 24
|
2023-05-06 18:32:54 +02:00
|
|
|
}
|
2024-01-28 14:42:53 +01:00
|
|
|
Flowee.AddressLabel {
|
2023-05-06 18:32:54 +02:00
|
|
|
id: outAddress
|
2024-01-28 14:42:53 +01:00
|
|
|
txInfo: modelData
|
2024-03-07 10:41:41 +01:00
|
|
|
x: ctIcon.visible ? ctIcon.width + 6 : 0
|
2024-01-28 14:42:53 +01:00
|
|
|
highlight: modelData.forMe
|
2024-03-07 10:41:41 +01:00
|
|
|
width: Math.min(implicitWidth, parent.width - (ctIcon.visible ? ctIcon.width: 0))
|
2023-05-06 18:32:54 +02:00
|
|
|
}
|
2024-01-28 14:42:53 +01:00
|
|
|
|
2023-05-06 18:32:54 +02:00
|
|
|
Flowee.BitcoinAmountLabel {
|
|
|
|
|
id: outAmount
|
2024-01-28 14:42:53 +01:00
|
|
|
value: modelData.value
|
2025-02-04 15:50:24 +01:00
|
|
|
fiatTimestamp: root.infoObject.date
|
2024-01-28 14:42:53 +01:00
|
|
|
colorize: modelData.forMe
|
2023-05-06 18:32:54 +02:00
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
anchors.bottomMargin: 10
|
2023-05-09 19:25:06 +02:00
|
|
|
font.pixelSize: root.font.pixelSize * 0.9
|
2023-05-06 17:27:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-19 21:01:07 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|