forked from 0x20/tab-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TransferView.qml
180 lines (146 loc) · 4.82 KB
/
TransferView.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
import QtQuick 2.0
import QtQuick.Layouts 1.3
import "Colors.js" as Colors
import "controls"
Rectangle {
color: "black"
id: view
signal accepted(string from, string to, int amount)
signal canceled
function reset() {
fromSelector.selectedIndex = -1
toSelector.selectedIndex = -1
amount.reset()
}
MemberList {
id: fromSelector
anchors.right: parent.right
anchors.top: parent.top
// border.color: "white"
selectionEnabled: true
height: (parent.height - buttonHeight) / 2
width: application.buttonWidth * 3 + 40
}
MemberList {
id: toSelector
anchors.right: parent.right
anchors.bottom: parent.bottom
selectionEnabled: true
height: (parent.height - buttonHeight) / 2 + 10
width: application.buttonWidth * 3 + 40
}
Text {
anchors.bottom: toSelector.top
anchors.horizontalCenter: toSelector.horizontalCenter
font.pixelSize: fontSize
text: "Transfer to"
color: "white"
}
Text {
anchors.top: fromSelector.bottom
anchors.horizontalCenter: fromSelector.horizontalCenter
font.pixelSize: fontSize
text: "Transfer from"
color: "white"
}
Item {
id: rest
anchors.left: parent.left
anchors.right: fromSelector.left
anchors.top: parent.top
anchors.bottom: parent.bottom
Text {
id: pageTitle
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.margins: 10
font.pixelSize: 40
color: "white"
text: "Transfer"
}
NumberEntry {
id: amount
anchors.horizontalCenter: rest.horizontalCenter
anchors.top: pageTitle.bottom
anchors.topMargin: 10
}
GridLayout {
property int colWidth: buttonWidth * 1.5 + 10
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
id: pendingDisplay
columns: 2
columnSpacing: 10
width: colWidth * 2 + 10
Text {
Layout.alignment: Qt.AlignRight
text: "Will transfer "
horizontalAlignment: Text.AlignRight
color: "white"
font.pixelSize: application.fontSize
font.family: application.fontFace
width: pendingDisplay.colWidth
}
Text {
text: application.formatCurrency(amount.value)
color: "white"
font.pixelSize: application.fontSize
font.family: application.fontFace
width: pendingDisplay.colWidth
}
Text {
Layout.alignment: Qt.AlignRight
text: "from "
horizontalAlignment: Text.AlignRight
font.pixelSize: application.fontSize
font.family: application.fontFace
color: "white"
width: pendingDisplay.colWidth
}
Text {
text: members.get(fromSelector.selectedName).name
color: "white"
font.pixelSize: application.fontSize
font.family: application.fontFace
width: pendingDisplay.colWidth
}
Text {
Layout.alignment: Qt.AlignRight
text: "to "
horizontalAlignment: Text.AlignRight
color: "white"
font.pixelSize: application.fontSize
font.family: application.fontFace
width: pendingDisplay.colWidth
}
Text {
text: members.get(toSelector.selectedName).name
color: "white"
font.pixelSize: fontSize
font.family: application.fontFace
width: pendingDisplay.colWidth
}
TqButton {
implicitWidth: pendingDisplay.colWidth
bgColor: Colors.secondary1[0]
text: "Cancel"
onClicked: {
console.log("cancel")
view.canceled()
reset()
}
}
TqButton {
implicitWidth: pendingDisplay.colWidth
bgColor: Colors.secondary2[0]
enabled: fromSelector.hasSelection && toSelector.hasSelection && amount.value > 0
text: "Do it!"
onClicked: {
accepted(fromSelector.selectedName, toSelector.selectedName, amount.value)
reset()
}
}
}
}
}