2020-09-10 19:56:05 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtGraphicalEffects 1.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import "../imports"
|
2020-09-11 15:36:22 +00:00
|
|
|
import "."
|
2020-09-10 19:56:05 +00:00
|
|
|
|
|
|
|
Popup {
|
|
|
|
property url source: "../app/img/check-circle.svg"
|
2020-09-14 14:58:21 +00:00
|
|
|
property color iconColor: Style.current.primary
|
|
|
|
property bool iconRotates: false
|
2020-09-10 19:56:05 +00:00
|
|
|
property string title: "Transaction pending..."
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "View on Etherscan"
|
|
|
|
readonly property string defaultLinkText: qsTrId("view-on-etherscan")
|
2020-09-11 15:18:10 +00:00
|
|
|
property string link: "https://etherscan.io/"
|
2020-09-21 19:19:05 +00:00
|
|
|
property string linkText: defaultLinkText
|
2020-09-10 19:56:05 +00:00
|
|
|
|
|
|
|
id: root
|
2020-09-11 15:36:22 +00:00
|
|
|
closePolicy: Popup.NoAutoClose
|
2020-09-10 19:56:05 +00:00
|
|
|
height: 68
|
|
|
|
padding: 0
|
|
|
|
margins: 0
|
2020-10-26 17:10:14 +00:00
|
|
|
width: Math.max(Math.max(titleText.width, linkText.width) + toastImage.width + 12 * 4, 343)
|
2020-09-10 19:56:05 +00:00
|
|
|
x: parent.width - width - Style.current.bigPadding
|
|
|
|
y: parent.height - height - Style.current.bigPadding
|
|
|
|
|
2020-09-11 15:36:22 +00:00
|
|
|
onOpened: {
|
|
|
|
timer.setTimeout(function() {
|
|
|
|
root.close()
|
|
|
|
}, 4000);
|
|
|
|
}
|
2020-09-14 14:58:21 +00:00
|
|
|
onClosed: {
|
|
|
|
// Reset props
|
|
|
|
iconColor = Style.current.primary
|
|
|
|
iconRotates = false
|
2020-10-27 08:18:03 +00:00
|
|
|
root.linkText = defaultLinkText
|
2020-09-14 14:58:21 +00:00
|
|
|
}
|
2020-09-11 15:36:22 +00:00
|
|
|
|
|
|
|
Timer {
|
|
|
|
id: timer
|
|
|
|
}
|
|
|
|
|
2020-09-10 19:56:05 +00:00
|
|
|
background: Rectangle {
|
2020-09-11 15:18:10 +00:00
|
|
|
id: container
|
2020-09-10 19:56:05 +00:00
|
|
|
radius: Style.current.radius
|
|
|
|
color: Style.current.background
|
|
|
|
|
|
|
|
layer.enabled: true
|
|
|
|
layer.effect: DropShadow{
|
|
|
|
width: container.width
|
|
|
|
height: container.height
|
|
|
|
x: container.x
|
|
|
|
y: container.y + 10
|
|
|
|
visible: container.visible
|
|
|
|
source: container
|
|
|
|
horizontalOffset: 0
|
|
|
|
verticalOffset: 2
|
|
|
|
radius: 10
|
|
|
|
samples: 15
|
|
|
|
color: "#22000000"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RoundedIcon {
|
|
|
|
id: toastImage
|
|
|
|
width: 32
|
|
|
|
height: 32
|
|
|
|
iconHeight: 20
|
|
|
|
iconWidth: 20
|
2020-09-14 14:58:21 +00:00
|
|
|
color: Utils.setColorAlpha(root.iconColor, 0.1)
|
2020-09-10 19:56:05 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.left: parent.left
|
|
|
|
source: root.source
|
|
|
|
anchors.leftMargin: 12
|
2020-09-14 14:58:21 +00:00
|
|
|
iconColor: root.iconColor
|
|
|
|
rotates: root.iconRotates
|
2020-09-10 19:56:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: titleText
|
|
|
|
text: root.title
|
|
|
|
anchors.left: toastImage.right
|
|
|
|
anchors.top: parent.top
|
|
|
|
font.pixelSize: 13
|
|
|
|
font.weight: Font.Medium
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.leftMargin: 12
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-29 21:13:34 +00:00
|
|
|
id: linkText
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "<a href='%1' style='color:%2;text-decoration:none;'>%3</a>"
|
|
|
|
text: qsTrId("-a-href---1--style--color--2-text-decoration-none----3--a-")
|
|
|
|
.arg(Style.current.textColorTertiary)
|
2020-09-11 15:18:10 +00:00
|
|
|
.arg(root.link)
|
|
|
|
.arg(root.linkText)
|
2020-09-10 19:56:05 +00:00
|
|
|
color: Style.current.textColorTertiary
|
2020-09-11 15:18:10 +00:00
|
|
|
textFormat: Text.RichText
|
2020-09-10 19:56:05 +00:00
|
|
|
anchors.left: toastImage.right
|
|
|
|
anchors.top: titleText.bottom
|
|
|
|
font.pixelSize: 13
|
|
|
|
font.weight: Font.Medium
|
|
|
|
anchors.leftMargin: 12
|
2020-09-11 15:18:10 +00:00
|
|
|
onLinkActivated: {
|
2020-12-29 20:33:54 +00:00
|
|
|
appMain.openLink(root.link)
|
2020-09-11 15:18:10 +00:00
|
|
|
root.close()
|
|
|
|
}
|
2020-09-10 19:56:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: closeImage
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: parent.top
|
|
|
|
source: "../app/img/plusSign.svg"
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
width: 9
|
|
|
|
height: 9
|
|
|
|
rotation: 45
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: closeImage
|
|
|
|
source: closeImage
|
|
|
|
rotation: 45
|
|
|
|
color: Style.current.textColor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;formeditorColor:"#4c4e50";formeditorZoom:1.5;height:68;width:343}
|
|
|
|
}
|
|
|
|
##^##*/
|