2020-08-25 18:44:29 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import QtGraphicalEffects 1.13
|
|
|
|
import "../../../../../../shared"
|
|
|
|
import "../../../../../../imports"
|
|
|
|
|
|
|
|
Rectangle {
|
2020-09-03 20:43:08 +00:00
|
|
|
property int state: Constants.pending
|
|
|
|
property bool outgoing: true
|
2020-08-25 18:44:29 +00:00
|
|
|
|
|
|
|
id: root
|
2020-09-03 20:43:08 +00:00
|
|
|
width: childrenRect.width + 24
|
|
|
|
height: 28
|
2020-08-25 18:44:29 +00:00
|
|
|
border.width: 1
|
|
|
|
border.color: Style.current.border
|
|
|
|
radius: 24
|
2020-10-16 07:37:07 +00:00
|
|
|
color: Style.current.background
|
2020-08-25 18:44:29 +00:00
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: stateImage
|
|
|
|
source: {
|
|
|
|
switch (root.state) {
|
|
|
|
case Constants.pending:
|
|
|
|
case Constants.addressReceived:
|
2020-09-03 20:43:08 +00:00
|
|
|
case Constants.transactionRequested:
|
2020-08-25 18:44:29 +00:00
|
|
|
case Constants.addressRequested: return "../../../../../img/dotsLoadings.svg"
|
|
|
|
case Constants.confirmed: return "../../../../../img/check.svg"
|
2020-09-03 20:43:08 +00:00
|
|
|
case Constants.transactionDeclined:
|
2020-08-25 18:44:29 +00:00
|
|
|
case Constants.declined: return "../../../../../img/exclamation.svg"
|
|
|
|
default: return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
width: 16
|
|
|
|
height: 16
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.halfPadding
|
|
|
|
anchors.verticalCenter: stateText.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: stateImage
|
|
|
|
source: stateImage
|
2020-09-03 20:43:08 +00:00
|
|
|
color: state === Constants.confirmed ? Style.current.transparent : Style.current.textColor
|
2020-08-25 18:44:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: stateText
|
|
|
|
color: {
|
|
|
|
if (root.state === Constants.unknown || root.state === Constants.failure) {
|
|
|
|
return Style.current.danger
|
|
|
|
}
|
|
|
|
if (root.state === Constants.confirmed || root.state === Constants.declined) {
|
2020-09-03 20:43:08 +00:00
|
|
|
return Style.current.textColor
|
2020-08-25 18:44:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return Style.current.secondaryText
|
|
|
|
}
|
|
|
|
text: {
|
|
|
|
switch (root.state) {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Pending"
|
|
|
|
case Constants.pending: return qsTrId("invite-chat-pending")
|
|
|
|
//% "Confirmed"
|
|
|
|
case Constants.confirmed: return qsTrId("status-confirmed")
|
|
|
|
//% "Unknown token"
|
|
|
|
case Constants.unknown: return qsTrId("unknown-token")
|
|
|
|
//% "Address requested"
|
|
|
|
case Constants.addressRequested: return qsTrId("address-requested")
|
|
|
|
//% "Waiting to accept"
|
|
|
|
case Constants.transactionRequested: return qsTrId("waiting-to-accept")
|
2020-10-07 02:47:21 +00:00
|
|
|
case Constants.addressReceived: return (!root.outgoing ?
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Address shared"
|
|
|
|
qsTrId("address-shared") :
|
|
|
|
//% "Address received"
|
|
|
|
qsTrId("address-received"))
|
2020-09-03 20:43:08 +00:00
|
|
|
case Constants.transactionDeclined:
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Transaction declined"
|
|
|
|
case Constants.declined: return qsTrId("transaction-declined")
|
|
|
|
//% "failure"
|
|
|
|
case Constants.failure: return qsTrId("failure")
|
|
|
|
//% "Unknown state"
|
|
|
|
default: return qsTrId("unknown-state")
|
2020-08-25 18:44:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
font.weight: Font.Medium
|
|
|
|
anchors.left: stateImage.right
|
|
|
|
anchors.leftMargin: 4
|
2020-09-03 20:43:08 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-08-25 18:44:29 +00:00
|
|
|
font.pixelSize: 13
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;formeditorColor:"#808080";formeditorZoom:2}
|
|
|
|
}
|
|
|
|
##^##*/
|