-
Notifications
You must be signed in to change notification settings - Fork 1
/
TxsList.qml
80 lines (67 loc) · 1.86 KB
/
TxsList.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import QtQuick 2.12
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import QtQuick.Controls.Universal 2.3
import "accs.js" as Accs
import "rpc.js" as Rpc
import "fmt.js" as Fmt
ListView {
id: txsList
property var txs: []
property string account: ""
onAccountChanged: reload()
property string balance
anchors.margins: 10
spacing: 5
function getTxDescr(receive, bind) {
return receive ? (bind ? "Receiving" : "Received") : (bind ? "Sending" : "Sent")
}
header: Label {
id: balanceLabel
text: qsTr("Balance ") + Fmt.fmt(txsList.balance)
padding: 20
color: Universal.foreground
}
delegate: RowLayout {
id: txRow
property var tx: index < txs.length ? txs[index] : {type: "", binding: "", date: "", binding: ""}
property bool receive: "receive" == tx.type
Rectangle {
width: height
height: txSymbolTxt.height
radius: height / 2
color: receive ? "lightBlue" : "red"
Text {
id: txSymbolTxt
anchors.centerIn: parent
text: receive ? "+" : "-"
font.bold: true
opacity: tx.binding ? 0.5 : 1.0
}
}
// Label {
// text: tx.date
// color: Universal.foreground
// }
Label {
text: Fmt.fmt(tx.amount)
color: Universal.foreground
}
Label {
text: tx["account"]
color: Universal.foreground
Layout.fillWidth: true
}
}
Timer {
repeat: true
running: parent.visible
interval: 60 * 1000
onTriggered: reload()
}
function reload() {
Rpc.recvPendingAll(wallet);
txs = Rpc.account_history(account);
txsList.model = txs.length;
}
}