You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wowlet/src/vr/qml/wallet/HistoryTable.qml

188 lines
7.0 KiB

import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.2
import wowlet.Wallet 1.0
import wowlet.WalletManager 1.0
import wowlet.TransactionHistory 1.0
import wowlet.TransactionInfo 1.0
import wowlet.TransactionHistoryModel 1.0
import wowlet.TransactionHistoryProxyModel 1.0
import "../common"
Item {
id: root
3 years ago
property var txModel
property int txCount: 0
property var txModelData: []
property int sideMargin: 20
ListModel { id: txListViewModel }
ColumnLayout {
anchors.fill: parent
spacing: 0
3 years ago
MyText {
visible: txCount == 0
opacity: 0.75
text: "No transactions to display."
}
ListView {
id: listView
visible: true
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 10
3 years ago
model: txModel
interactive: false
delegate: Rectangle {
3 years ago
id: delegate
anchors.left: parent ? parent.left : undefined
anchors.right: parent ? parent.right : undefined
height: 54
color: "#2c435d"
property bool isout: false;
property string amount: "0";
property string description: "";
property string date: "2021-13-37";
property bool confirmed: false
property bool failed: false
property bool pending: false
property int confirmations: 0
property int confirmationsRequired: 0
Component.onCompleted: {
isout = getTxData(index, TransactionHistoryModel.TransactionIsOutRole);
amount = getTxData(index, TransactionHistoryModel.Amount);
description = getTxData(index, TransactionHistoryModel.Description);
date = getTxData(index, TransactionHistoryModel.Date);
failed = getTxData(index, TransactionHistoryModel.TransactionFailedRole);
pending = getTxData(index, TransactionHistoryModel.TransactionPendingRole);
confirmations = getTxData(index, TransactionHistoryModel.TransactionConfirmationsRole);
confirmationsRequired = getTxData(index, TransactionHistoryModel.TransactionConfirmationsRequiredRole);
confirmed = confirmations >= confirmationsRequired;
3 years ago
root.txCount = index;
}
RowLayout {
spacing: 0
clip: true
height: parent.height
anchors.left: parent.left
anchors.right: parent.right
Rectangle {
3 years ago
Layout.preferredWidth: 56
Layout.fillHeight: true
color: "#406288"
Image {
width: 32
height: 32
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
source: {
if(failed) return "qrc:/assets/images/warning.png"
else if(pending) return "qrc:/assets/images/unconfirmed.png"
else if(!confirmed) return "qrc:/assets/images/clock1.png"
else return "qrc:/assets/images/confirmed.png"
//confirmed ? "qrc:/checkmark_icon" : "qrc:/expired_icon"
}
3 years ago
}
}
Rectangle {
3 years ago
Layout.preferredWidth: 300
Layout.leftMargin: 10
Layout.rightMargin: 10
Layout.fillHeight: true
color: "transparent"
3 years ago
MyText {
// date
3 years ago
anchors.verticalCenter: parent.verticalCenter
fontSize: 12
fontColor: "white"
3 years ago
text: date
3 years ago
Component.onCompleted: {
parent.Layout.preferredWidth = width;
}
}
}
Rectangle {
3 years ago
Layout.fillHeight: true
Layout.leftMargin: 10
color: "transparent"
MyText {
anchors.verticalCenter: parent.verticalCenter
fontSize: 14
text: description !== "" ? description : "..."
fontColor: description !== "" ? "white" : "#cccccc"
3 years ago
Component.onCompleted: {
parent.Layout.preferredWidth = width;
}
}
}
Item {
3 years ago
Layout.fillWidth: true
}
Rectangle {
3 years ago
Layout.preferredWidth: 420
Layout.fillHeight: true
color: "#406288"
MyText {
anchors.right: parent.right
anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter
fontSize: 14
fontBold: true
text: amount
fontColor: !isout ? "#00d304" : "red"
}
}
3 years ago
}
}
}
3 years ago
Item {
Layout.fillHeight: true
}
}
3 years ago
Rectangle {
z: parent.z - 1
color: "transparent"
anchors.fill: parent
}
3 years ago
function getTxData(x, y) {
var idx = txModel.index(x, y);
return txModel.data(idx, 0);
}
function onPageCompleted() {
if(currentWallet == null || typeof currentWallet.history === "undefined" ) return;
3 years ago
root.txCount = 0;
root.txModel = appWindow.currentWallet.historyModel;
//root.model.sortRole = TransactionHistoryModel.TransactionBlockHeightRole;
//root.model.sort(0, Qt.DescendingOrder);
}
}