2020-08-13 08:24:51 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtGraphicalEffects 1.13
|
|
|
|
import "../imports"
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
2020-08-20 04:45:29 +00:00
|
|
|
property var fromAccount
|
|
|
|
property var toAccount
|
|
|
|
property var asset
|
|
|
|
property var amount
|
2020-08-13 08:24:51 +00:00
|
|
|
property string currency: "USD"
|
2020-08-20 04:45:29 +00:00
|
|
|
property var gas
|
2020-08-21 07:56:42 +00:00
|
|
|
height: content.height
|
2020-08-20 04:45:29 +00:00
|
|
|
property var reset: function() {}
|
|
|
|
|
|
|
|
function resetInternal() {
|
|
|
|
fromAccount = undefined
|
|
|
|
toAccount = undefined
|
|
|
|
asset = undefined
|
|
|
|
amount = undefined
|
|
|
|
gas = undefined
|
|
|
|
}
|
2020-08-13 08:24:51 +00:00
|
|
|
|
|
|
|
Column {
|
2020-08-21 07:56:42 +00:00
|
|
|
id: content
|
2020-08-13 08:24:51 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
LabelValueRow {
|
|
|
|
id: itmFrom
|
2020-08-26 15:52:26 +00:00
|
|
|
//% "From"
|
|
|
|
label: qsTrId("from")
|
2020-08-13 08:24:51 +00:00
|
|
|
value: Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
2020-08-20 04:45:29 +00:00
|
|
|
text: root.fromAccount ? root.fromAccount.name : ""
|
2020-08-13 08:24:51 +00:00
|
|
|
elide: Text.ElideRight
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: imgFromWallet.left
|
2020-08-20 04:45:29 +00:00
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
2020-08-13 08:24:51 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
SVGImage {
|
|
|
|
id: imgFromWallet
|
|
|
|
sourceSize.height: 18
|
|
|
|
sourceSize.width: 18
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: "../app/img/walletIcon.svg"
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: imgFromWallet
|
|
|
|
source: imgFromWallet
|
2020-08-20 04:45:29 +00:00
|
|
|
color: root.fromAccount ? root.fromAccount.iconColor : Style.current.blue
|
2020-08-13 08:24:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LabelValueRow {
|
|
|
|
id: itmTo
|
2020-08-26 15:52:26 +00:00
|
|
|
//% "Recipient"
|
|
|
|
label: qsTrId("recipient")
|
2020-08-13 08:24:51 +00:00
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "Address"
|
2020-08-20 04:45:29 +00:00
|
|
|
when: !!root.toAccount && root.toAccount.type === RecipientSelector.Type.Address
|
2020-08-13 08:24:51 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: txtToPrimary
|
2020-08-20 04:45:29 +00:00
|
|
|
text: root.toAccount ? root.toAccount.address : ""
|
2020-08-13 08:24:51 +00:00
|
|
|
elide: Text.ElideMiddle
|
|
|
|
anchors.leftMargin: 190
|
2020-09-01 03:49:05 +00:00
|
|
|
anchors.right: parent.right
|
2020-08-13 08:24:51 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: txtToSecondary
|
|
|
|
width: 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "Contact"
|
2020-08-20 04:45:29 +00:00
|
|
|
when: !!root.toAccount && root.toAccount.type === RecipientSelector.Type.Contact && !!root.toAccount.address
|
2020-08-13 08:24:51 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: metSecondary
|
|
|
|
text: root.toAccount.ensVerified ? root.toAccount.alias : root.toAccount.address
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: txtToSecondary
|
2020-09-01 03:49:05 +00:00
|
|
|
anchors.right: idtToContact.left
|
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
2020-08-13 08:24:51 +00:00
|
|
|
width: metSecondary.elidedWidth
|
|
|
|
text: metSecondary.elidedText
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: idtToContact
|
|
|
|
source: root.toAccount.identicon
|
|
|
|
visible: true
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: txtToPrimary
|
|
|
|
text: Utils.removeStatusEns(root.toAccount.name)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "Account"
|
2020-08-20 04:45:29 +00:00
|
|
|
when: !!root.toAccount && root.toAccount.type === RecipientSelector.Type.Account && !!root.toAccount.address
|
2020-08-13 08:24:51 +00:00
|
|
|
PropertyChanges {
|
|
|
|
target: metSecondary
|
|
|
|
text: root.toAccount.address
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: txtToSecondary
|
2020-09-01 03:49:05 +00:00
|
|
|
anchors.right: imgToWallet.left
|
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
2020-08-13 08:24:51 +00:00
|
|
|
text: metSecondary.elidedText
|
|
|
|
width: metSecondary.elidedWidth
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: imgToWallet
|
|
|
|
visible: true
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: ovlToWallet
|
|
|
|
visible: true
|
|
|
|
color: root.toAccount.iconColor
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: txtToPrimary
|
|
|
|
text: root.toAccount.name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
value: Item {
|
|
|
|
id: recipientRoot
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: txtToPrimary
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: txtToSeparator.left
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: txtToSeparator
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
text: " • "
|
|
|
|
visible: txtToSecondary.visible && txtToSecondary.width > 0
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
anchors.right: txtToSecondary.left
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: txtToSecondary
|
|
|
|
visible: true
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
TextMetrics {
|
|
|
|
id: metSecondary
|
|
|
|
elideWidth: 102
|
|
|
|
elide: Text.ElideMiddle
|
|
|
|
}
|
|
|
|
SVGImage {
|
|
|
|
id: imgToWallet
|
|
|
|
visible: false
|
|
|
|
sourceSize.height: 18
|
|
|
|
sourceSize.width: 18
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: "../app/img/walletIcon.svg"
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
id: ovlToWallet
|
|
|
|
anchors.fill: imgToWallet
|
|
|
|
visible: false
|
|
|
|
source: imgToWallet
|
|
|
|
}
|
|
|
|
Identicon {
|
|
|
|
id: idtToContact
|
|
|
|
visible: false
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: 32
|
|
|
|
height: 32
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LabelValueRow {
|
|
|
|
id: itmAsset
|
2020-08-26 15:52:26 +00:00
|
|
|
//% "Asset"
|
|
|
|
label: qsTrId("wallet-asset")
|
2020-08-13 08:24:51 +00:00
|
|
|
value: Item {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
text: (root.asset && root.asset.name) ? root.asset.name : ""
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: txtAssetSymbol.left
|
2020-08-20 04:45:29 +00:00
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
2020-08-13 08:24:51 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: txtAssetSymbol
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
text: (root.asset && root.asset.symbol) ? root.asset.symbol : ""
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
anchors.right: imgAsset.left
|
2020-08-20 04:45:29 +00:00
|
|
|
anchors.rightMargin: Style.current.halfPadding
|
2020-08-13 08:24:51 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
Image {
|
|
|
|
id: imgAsset
|
|
|
|
sourceSize.height: 32
|
|
|
|
sourceSize.width: 32
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: "../app/img/tokens/" + ((root.asset && root.asset.symbol) ? root.asset.symbol : "ETH") + ".png"
|
|
|
|
onStatusChanged: {
|
|
|
|
if (status == Image.Error) {
|
|
|
|
source = "../app/img/tokens/0-native.png"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LabelValueRow {
|
|
|
|
id: itmAmount
|
2020-08-26 15:52:26 +00:00
|
|
|
//% "Amount"
|
|
|
|
label: qsTrId("amount")
|
2020-08-13 08:24:51 +00:00
|
|
|
value: Item {
|
|
|
|
id: amountRoot
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
2020-08-20 04:45:29 +00:00
|
|
|
text: (root.amount && root.amount.value) ? Utils.stripTrailingZeros(root.amount.value) : ""
|
2020-08-13 08:24:51 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: txtAmountSymbol.left
|
|
|
|
anchors.rightMargin: 5
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: txtAmountSymbol
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
text: ((root.asset && root.asset.symbol) ? root.asset.symbol : "") + " •"
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
anchors.right: txtAmountFiat.left
|
|
|
|
anchors.rightMargin: 5
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: txtAmountFiat
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
2020-08-20 04:45:29 +00:00
|
|
|
text: "~" + (root.amount && root.amount.fiatValue ? root.amount.fiatValue : "0.00")
|
2020-08-13 08:24:51 +00:00
|
|
|
anchors.right: txtAmountCurrency.left
|
|
|
|
anchors.rightMargin: 5
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: txtAmountCurrency
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
text: root.currency.toUpperCase()
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LabelValueRow {
|
|
|
|
id: itmNetworkFee
|
2020-08-26 15:52:26 +00:00
|
|
|
//% "Network fee"
|
|
|
|
label: qsTrId("network-fee")
|
2020-08-13 08:24:51 +00:00
|
|
|
value: Item {
|
|
|
|
id: networkFeeRoot
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
text: (root.gas && root.gas.value) ? Utils.stripTrailingZeros(root.gas.value) : ""
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: txtFeeSymbol.left
|
|
|
|
anchors.rightMargin: 5
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: txtFeeSymbol
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
text: ((root.gas && root.gas.symbol) ? root.gas.symbol : "") + " •"
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
anchors.right: txtFeeFiat.left
|
|
|
|
anchors.rightMargin: 5
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: txtFeeFiat
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
text: "~" + ((root.gas && root.gas.fiatValue) ? root.gas.fiatValue : "0.00")
|
|
|
|
anchors.right: txtFeeCurrency.left
|
|
|
|
anchors.rightMargin: 5
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: txtFeeCurrency
|
|
|
|
font.pixelSize: 15
|
|
|
|
height: 22
|
|
|
|
text: root.currency.toUpperCase()
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
horizontalAlignment: Text.AlignRight
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|