2020-08-04 22:22:51 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import "../../../../../imports"
|
|
|
|
import "../../../../../shared"
|
2020-09-29 08:51:16 +00:00
|
|
|
import "../../../../../shared/status"
|
2020-08-04 22:22:51 +00:00
|
|
|
|
|
|
|
Item {
|
2020-08-26 21:13:26 +00:00
|
|
|
property string username: ""
|
|
|
|
|
|
|
|
signal backBtnClicked();
|
2020-08-27 16:06:53 +00:00
|
|
|
signal usernameRegistered(userName: string);
|
2020-08-26 21:13:26 +00:00
|
|
|
|
2020-08-04 22:22:51 +00:00
|
|
|
StyledText {
|
|
|
|
id: sectionTitle
|
|
|
|
//% "ENS usernames"
|
|
|
|
text: qsTrId("ens-usernames")
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 24
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 24
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 20
|
|
|
|
}
|
|
|
|
|
2020-11-03 10:29:56 +00:00
|
|
|
Loader {
|
2020-08-27 16:06:53 +00:00
|
|
|
id: transactionDialog
|
2020-11-03 10:29:56 +00:00
|
|
|
function open() {
|
|
|
|
this.active = true
|
|
|
|
this.item.open()
|
|
|
|
}
|
|
|
|
function closed() {
|
|
|
|
this.active = false // kill an opened instance
|
|
|
|
}
|
|
|
|
sourceComponent: RegisterENSModal {
|
|
|
|
onClosed: {
|
|
|
|
transactionDialog.closed()
|
|
|
|
}
|
|
|
|
ensUsername: username
|
2021-04-20 16:10:04 +00:00
|
|
|
width: 425
|
|
|
|
height: 425
|
2020-11-03 10:29:56 +00:00
|
|
|
}
|
2020-08-27 16:06:53 +00:00
|
|
|
}
|
|
|
|
|
2020-08-26 21:13:26 +00:00
|
|
|
ModalPopup {
|
|
|
|
id: popup
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "Terms of name registration"
|
|
|
|
title: qsTrId("ens-terms-header")
|
2020-08-26 21:13:26 +00:00
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
|
|
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
|
|
|
clip: true
|
|
|
|
|
|
|
|
Column {
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
height: childrenRect.height
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "Funds are deposited for 1 year. Your SNT will be locked, but not spent."
|
|
|
|
text: qsTrId("ens-terms-point-1")
|
2020-08-26 21:13:26 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "After 1 year, you can release the name and get your deposit back, or take no action to keep the name."
|
|
|
|
text: qsTrId("ens-terms-point-2")
|
2020-08-26 21:13:26 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "If terms of the contract change — e.g. Status makes contract upgrades — user has the right to release the username regardless of time held."
|
|
|
|
text: qsTrId("ens-terms-point-3")
|
2020-08-26 21:13:26 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "The contract controller cannot access your deposited funds. They can only be moved back to the address that sent them."
|
|
|
|
text: qsTrId("ens-terms-point-4")
|
2020-08-26 21:13:26 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "Your address(es) will be publicly associated with your ENS name."
|
|
|
|
text: qsTrId("ens-terms-point-5")
|
2020-08-26 21:13:26 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "Usernames are created as subdomain nodes of stateofus.eth and are subject to the ENS smart contract terms."
|
|
|
|
text: qsTrId("ens-terms-point-6")
|
2020-08-26 21:13:26 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "You authorize the contract to transfer SNT on your behalf. This can only occur when you approve a transaction to authorize the transfer."
|
|
|
|
text: qsTrId("ens-terms-point-7")
|
2020-08-26 21:13:26 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "These terms are guaranteed by the smart contract logic at addresses:"
|
|
|
|
text: qsTrId("ens-terms-point-8")
|
2020-08-26 21:13:26 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
font.weight: Font.Bold
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "%1 (Status UsernameRegistrar)."
|
|
|
|
text: qsTrId("-1--status-usernameregistrar--").arg(profileModel.ens.getUsernameRegistrar())
|
2020-08-26 21:13:26 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
font.family: Style.current.fontHexRegular.name
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "<a href='%1%2'>Look up on Etherscan</a>"
|
|
|
|
text: qsTrId("-a-href---1-2--look-up-on-etherscan--a-").arg(walletModel.etherscanLink.replace("/tx", "/address")).arg(profileModel.ens.getUsernameRegistrar())
|
2020-08-26 21:13:26 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-12-29 20:33:54 +00:00
|
|
|
onLinkActivated: appMain.openLink(link)
|
2020-08-26 21:13:26 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text
|
|
|
|
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "%1 (ENS Registry)."
|
|
|
|
text: qsTrId("-1--ens-registry--").arg(profileModel.ens.getENSRegistry())
|
2020-08-26 21:13:26 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
font.family: Style.current.fontHexRegular.name
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "<a href='%1%2'>Look up on Etherscan</a>"
|
|
|
|
text: qsTrId("-a-href---1-2--look-up-on-etherscan--a-").arg(walletModel.etherscanLink.replace("/tx", "/address")).arg(profileModel.ens.getENSRegistry())
|
2020-08-26 21:13:26 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-12-29 20:33:54 +00:00
|
|
|
onLinkActivated: appMain.openLink(link)
|
2020-08-26 21:13:26 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text
|
|
|
|
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-04 22:22:51 +00:00
|
|
|
ScrollView {
|
|
|
|
id: sview
|
|
|
|
clip: true
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
|
|
contentHeight: contentItem.childrenRect.height
|
|
|
|
anchors.top: sectionTitle.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.bottom: startBtn.top
|
|
|
|
anchors.bottomMargin: Style.current.padding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: contentItem
|
|
|
|
anchors.right: parent.right;
|
|
|
|
anchors.left: parent.left;
|
|
|
|
|
2020-08-26 21:13:26 +00:00
|
|
|
Rectangle {
|
|
|
|
id: circleAt
|
2020-08-04 22:22:51 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 24
|
2020-08-26 21:13:26 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: 60
|
|
|
|
height: 60
|
|
|
|
radius: 120
|
|
|
|
color: Style.current.blue
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
text: "@"
|
|
|
|
opacity: 0.7
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 18
|
|
|
|
color: Style.current.white
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: ensUsername
|
|
|
|
text: username + ".stateofus.eth"
|
2020-08-04 22:22:51 +00:00
|
|
|
font.weight: Font.Bold
|
2020-08-26 21:13:26 +00:00
|
|
|
font.pixelSize: 18
|
|
|
|
anchors.top: circleAt.bottom
|
|
|
|
anchors.topMargin: 24
|
2020-08-04 22:22:51 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2020-08-26 21:13:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TextWithLabel {
|
|
|
|
id: walletAddressLbl
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "Wallet address"
|
|
|
|
label: qsTrId("wallet-address")
|
2020-08-26 21:13:26 +00:00
|
|
|
text: walletModel.getDefaultAddress()
|
|
|
|
textToCopy: profileModel.profile.address
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 24
|
|
|
|
anchors.top: ensUsername.bottom
|
|
|
|
anchors.topMargin: 24
|
|
|
|
}
|
|
|
|
|
|
|
|
TextWithLabel {
|
|
|
|
id: keyLbl
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "Key"
|
|
|
|
label: qsTrId("key")
|
2020-08-26 21:13:26 +00:00
|
|
|
text: {
|
|
|
|
let pubKey = profileModel.profile.pubKey;
|
|
|
|
return pubKey.substring(0, 20) + "..." + pubKey.substring(pubKey.length - 20);
|
|
|
|
}
|
|
|
|
textToCopy: profileModel.profile.pubKey
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 24
|
|
|
|
anchors.top: walletAddressLbl.bottom
|
|
|
|
anchors.topMargin: 24
|
|
|
|
}
|
|
|
|
|
2020-11-27 19:32:49 +00:00
|
|
|
StatusCheckBox {
|
2020-08-26 21:13:26 +00:00
|
|
|
id: termsAndConditionsCheckbox
|
|
|
|
anchors.top: keyLbl.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 24
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "Agree to <a href=\"#\">Terms of name registration.</a> I understand that my wallet address will be publicly connected to my username."
|
|
|
|
text: qsTrId("agree-to--a-href-------terms-of-name-registration---a--i-understand-that-my-wallet-address-will-be-publicly-connected-to-my-username-")
|
2020-08-26 21:13:26 +00:00
|
|
|
anchors.left: termsAndConditionsCheckbox.right
|
|
|
|
anchors.right: parent.right
|
2020-08-04 22:22:51 +00:00
|
|
|
wrapMode: Text.WordWrap
|
2020-08-26 21:13:26 +00:00
|
|
|
anchors.top: termsAndConditionsCheckbox.top
|
|
|
|
onLinkActivated: popup.open()
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text
|
|
|
|
cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
}
|
2020-08-04 22:22:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-29 08:51:16 +00:00
|
|
|
StatusButton {
|
2020-08-26 21:13:26 +00:00
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: Style.current.padding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "Back"
|
2020-09-29 08:51:16 +00:00
|
|
|
text: qsTrId("back")
|
2020-08-26 21:13:26 +00:00
|
|
|
onClicked: backBtnClicked()
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
anchors.top: startBtn.top
|
|
|
|
anchors.right: startBtn.left
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
width: childrenRect.width
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id: image1
|
|
|
|
height: 50
|
|
|
|
width: 50
|
|
|
|
sourceSize.width: width
|
|
|
|
sourceSize.height: height
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: "../../../../../shared/img/status-logo.png"
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: ensPriceLbl
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "10 SNT"
|
|
|
|
text: qsTrId("ens-10-SNT")
|
2020-08-26 21:13:26 +00:00
|
|
|
anchors.left: image1.right
|
|
|
|
anchors.leftMargin: 5
|
|
|
|
anchors.top: image1.top
|
|
|
|
color: Style.current.textColor
|
|
|
|
font.pixelSize: 14
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "Deposit"
|
|
|
|
text: qsTrId("ens-deposit")
|
2020-08-26 21:13:26 +00:00
|
|
|
anchors.left: image1.right
|
|
|
|
anchors.leftMargin: 5
|
|
|
|
anchors.topMargin: 5
|
|
|
|
anchors.top: ensPriceLbl.bottom
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
font.pixelSize: 14
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-29 08:51:16 +00:00
|
|
|
StatusButton {
|
2020-08-04 22:22:51 +00:00
|
|
|
id: startBtn
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: Style.current.padding
|
2020-08-26 21:13:26 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
2020-09-29 08:51:16 +00:00
|
|
|
text: parseFloat(utilsModel.getSNTBalance()) < 10 ?
|
2020-09-14 12:12:47 +00:00
|
|
|
//% "Not enough SNT"
|
|
|
|
qsTrId("not-enough-snt") :
|
|
|
|
//% "Register"
|
|
|
|
qsTrId("ens-register")
|
2020-09-29 08:51:16 +00:00
|
|
|
enabled: parseFloat(utilsModel.getSNTBalance()) >= 10 && termsAndConditionsCheckbox.checked
|
2020-08-27 16:06:53 +00:00
|
|
|
onClicked: transactionDialog.open()
|
2020-08-04 22:22:51 +00:00
|
|
|
}
|
2020-09-14 12:12:47 +00:00
|
|
|
}
|