2020-08-25 18:44:29 +00:00
|
|
|
import QtQuick 2.3
|
|
|
|
import QtGraphicalEffects 1.13
|
|
|
|
import "../../../../../../shared"
|
2021-10-14 12:14:11 +00:00
|
|
|
import "../../../../../../shared/panels"
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-08-25 18:44:29 +00:00
|
|
|
|
|
|
|
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:
|
2021-09-28 15:04:06 +00:00
|
|
|
case Constants.addressRequested: return Style.svg("dotsLoadings")
|
|
|
|
case Constants.confirmed: return Style.svg("check")
|
2020-09-03 20:43:08 +00:00
|
|
|
case Constants.transactionDeclined:
|
2021-09-28 15:04:06 +00:00
|
|
|
case Constants.declined: return Style.svg("exclamation")
|
2020-08-25 18:44:29 +00:00
|
|
|
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}
|
|
|
|
}
|
|
|
|
##^##*/
|