2020-08-14 19:19:08 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
2022-03-15 19:34:28 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2022-05-18 21:58:07 +00:00
|
|
|
import QtQuick.Layouts 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2022-03-15 19:34:28 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2021-10-27 10:25:42 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2022-03-15 19:34:28 +00:00
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
import StatusQ.Components 0.1
|
2022-05-18 21:58:07 +00:00
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Core.Utils 0.1
|
2021-10-27 10:25:42 +00:00
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.controls 1.0
|
2022-03-15 19:34:28 +00:00
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
import "../stores"
|
2020-08-14 19:19:08 +00:00
|
|
|
|
2022-03-15 19:34:28 +00:00
|
|
|
StatusModal {
|
2020-08-14 19:19:08 +00:00
|
|
|
id: popup
|
|
|
|
|
2022-05-18 21:58:07 +00:00
|
|
|
property var selectedAccount
|
|
|
|
property string networkPrefix: ""
|
|
|
|
property string completeAddressWithNetworkPrefix
|
|
|
|
|
|
|
|
onSelectedAccountChanged: {
|
|
|
|
if (selectedAccount.address) {
|
|
|
|
txtWalletAddress.text = selectedAccount.address
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onCompleteAddressWithNetworkPrefixChanged: {
|
|
|
|
qrCodeImage.source = RootStore.getQrCode(completeAddressWithNetworkPrefix)
|
|
|
|
}
|
2022-03-15 19:34:28 +00:00
|
|
|
|
2020-08-26 15:52:26 +00:00
|
|
|
//% "Receive"
|
2022-03-15 19:34:28 +00:00
|
|
|
header.title: qsTrId("receive")
|
|
|
|
contentHeight: layout.implicitHeight
|
|
|
|
width: 556
|
2020-08-14 19:19:08 +00:00
|
|
|
|
2022-05-18 21:58:07 +00:00
|
|
|
showHeader: false
|
|
|
|
showAdvancedHeader: true
|
|
|
|
|
|
|
|
hasFloatingButtons: true
|
|
|
|
advancedHeaderComponent: StatusFloatingButtonsSelector {
|
|
|
|
id: floatingHeader
|
|
|
|
model: RootStore.accounts
|
|
|
|
delegate: Rectangle {
|
|
|
|
width: button.width
|
|
|
|
height: button.height
|
|
|
|
radius: 8
|
|
|
|
visible: floatingHeader.visibleIndices.includes(index)
|
|
|
|
StatusButton {
|
|
|
|
id: button
|
|
|
|
topPadding: 8
|
|
|
|
bottomPadding: 0
|
|
|
|
implicitHeight: 32
|
|
|
|
defaultLeftPadding: 4
|
|
|
|
text: name
|
|
|
|
icon.emoji: !!emoji ? emoji: ""
|
|
|
|
icon.emojiSize: Emoji.size.middle
|
|
|
|
icon.name: !emoji ? "filled-account": ""
|
|
|
|
normalColor: "transparent"
|
|
|
|
highlighted: index === floatingHeader.currentIndex
|
|
|
|
onClicked: {
|
|
|
|
popup.selectedAccount = model
|
|
|
|
floatingHeader.currentIndex = index
|
|
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
|
|
// On startup make the preseected wallet in the floating menu
|
|
|
|
if(name === popup.selectedAccount.name)
|
|
|
|
floatingHeader.currentIndex = index
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
popupMenuDelegate: StatusListItem {
|
|
|
|
implicitWidth: 272
|
|
|
|
title: name
|
|
|
|
subTitle: currencyBalance
|
|
|
|
icon.emoji: !!emoji ? emoji: ""
|
|
|
|
icon.color: model.color
|
|
|
|
icon.name: !emoji ? "filled-account": ""
|
|
|
|
icon.letterSize: 14
|
|
|
|
icon.isLetterIdenticon: !!model.emoji
|
|
|
|
icon.background.color: Theme.palette.indirectColor1
|
|
|
|
onClicked: {
|
|
|
|
popup.selectedAccount = model
|
|
|
|
floatingHeader.itemSelected(index)
|
|
|
|
}
|
|
|
|
visible: !floatingHeader.visibleIndices.includes(index)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-15 19:34:28 +00:00
|
|
|
contentItem: Column {
|
|
|
|
id: layout
|
|
|
|
width: popup.width
|
2020-08-14 19:19:08 +00:00
|
|
|
|
2022-05-18 21:58:07 +00:00
|
|
|
topPadding: Style.current.xlPadding
|
2022-03-15 19:34:28 +00:00
|
|
|
spacing: Style.current.bigPadding
|
2020-08-14 19:19:08 +00:00
|
|
|
|
2022-05-18 21:58:07 +00:00
|
|
|
StatusSwitchTabBar {
|
|
|
|
id: tabBar
|
2020-08-14 19:19:08 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2022-05-18 21:58:07 +00:00
|
|
|
StatusSwitchTabButton {
|
|
|
|
text: qsTr("Legacy")
|
|
|
|
}
|
|
|
|
StatusSwitchTabButton {
|
|
|
|
text: qsTr("Multichain")
|
|
|
|
enabled: localAccountSensitiveSettings.isMultiNetworkEnabled
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
width: parent.width
|
|
|
|
height: qrCodeBox.height
|
|
|
|
id: centralLayout
|
|
|
|
|
|
|
|
Grid {
|
|
|
|
id: multiChainList
|
|
|
|
property bool need2Columns: RootStore.enabledNetworks.count >= 9
|
|
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
anchors.horizontalCenterOffset: need2Columns ? 0 : qrCodeBox.width/2 + Style.current.xlPadding + Style.current.halfPadding
|
|
|
|
height: qrCodeBox.height
|
|
|
|
|
|
|
|
columnSpacing: need2Columns ? qrCodeBox.width + Style.current.bigPadding : 0
|
|
|
|
flow: Grid.TopToBottom
|
|
|
|
columns: need2Columns ? 2 : 1
|
|
|
|
spacing: 5
|
|
|
|
Repeater {
|
|
|
|
model: RootStore.enabledNetworks
|
|
|
|
delegate: StatusListItemTag {
|
|
|
|
image.source: Style.png(iconUrl)
|
|
|
|
title: shortName
|
|
|
|
titleText.color: chainColor
|
|
|
|
closeButtonVisible: false
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: selectPopup.open()
|
|
|
|
}
|
2022-03-15 19:34:28 +00:00
|
|
|
}
|
2022-05-18 21:58:07 +00:00
|
|
|
}
|
|
|
|
StatusListItemTag {
|
|
|
|
closeButtonVisible: false
|
|
|
|
icon.name: "edit_pencil"
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
|
|
|
selectPopup.open()
|
|
|
|
}
|
2022-03-15 19:34:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-18 21:58:07 +00:00
|
|
|
Rectangle {
|
|
|
|
id: qrCodeBox
|
|
|
|
height: 339
|
|
|
|
width: 339
|
2022-03-15 19:34:28 +00:00
|
|
|
anchors.centerIn: parent
|
2022-05-18 21:58:07 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
layer.enabled: true
|
|
|
|
layer.effect: OpacityMask {
|
|
|
|
maskSource: Item {
|
|
|
|
width: qrCodeBox.width
|
|
|
|
height: qrCodeBox.height
|
|
|
|
Rectangle {
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
width: qrCodeBox.width
|
|
|
|
height: qrCodeBox.height
|
|
|
|
radius: Style.current.bigPadding
|
|
|
|
border.width: 1
|
|
|
|
border.color: Style.current.border
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.right: parent.right
|
|
|
|
width: Style.current.bigPadding
|
|
|
|
height: Style.current.bigPadding
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
width: Style.current.bigPadding
|
|
|
|
height: Style.current.bigPadding
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-03-15 19:34:28 +00:00
|
|
|
|
2022-05-18 21:58:07 +00:00
|
|
|
Image {
|
|
|
|
id: qrCodeImage
|
2022-03-15 19:34:28 +00:00
|
|
|
anchors.centerIn: parent
|
2022-05-18 21:58:07 +00:00
|
|
|
height: parent.height
|
|
|
|
width: parent.width
|
|
|
|
asynchronous: true
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
mipmap: true
|
|
|
|
smooth: false
|
2022-03-15 19:34:28 +00:00
|
|
|
}
|
2020-08-14 19:19:08 +00:00
|
|
|
|
2022-05-18 21:58:07 +00:00
|
|
|
Rectangle {
|
|
|
|
anchors.centerIn: qrCodeImage
|
|
|
|
width: 78
|
|
|
|
height: 78
|
|
|
|
color: "white"
|
|
|
|
StatusIcon {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
anchors.margins: 2
|
|
|
|
width: 78
|
|
|
|
height: 78
|
|
|
|
source: Style.svg("status-logo-icon")
|
|
|
|
}
|
2022-03-15 19:34:28 +00:00
|
|
|
}
|
2020-08-20 04:45:29 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-14 19:19:08 +00:00
|
|
|
|
2022-03-15 19:34:28 +00:00
|
|
|
Item {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: parent.width
|
|
|
|
height: addressLabel.height + copyButton.height
|
|
|
|
Column {
|
|
|
|
id: addressLabel
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.bigPadding
|
|
|
|
StatusBaseText {
|
|
|
|
id: contactsLabel
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
text: qsTr("Your Address")
|
|
|
|
}
|
2022-05-18 21:58:07 +00:00
|
|
|
RowLayout {
|
|
|
|
id: networksLabel
|
|
|
|
spacing: -1
|
|
|
|
Repeater {
|
|
|
|
model: RootStore.enabledNetworks
|
|
|
|
delegate: StatusBaseText {
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: chainColor
|
|
|
|
text: shortName + ":"
|
|
|
|
Component.onCompleted: {
|
|
|
|
if(index === 0)
|
|
|
|
popup.networkPrefix = ""
|
|
|
|
popup.networkPrefix +=text
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-03-15 19:34:28 +00:00
|
|
|
StatusAddress {
|
|
|
|
id: txtWalletAddress
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Column {
|
|
|
|
id: copyButton
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.bigPadding
|
|
|
|
spacing: 5
|
|
|
|
CopyToClipBoardButton {
|
2022-05-18 21:58:07 +00:00
|
|
|
id: copyToClipBoard
|
2022-03-15 19:34:28 +00:00
|
|
|
store: RootStore
|
|
|
|
textToCopy: txtWalletAddress.text
|
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
font.pixelSize: 13
|
|
|
|
color: Theme.palette.primaryColor1
|
|
|
|
text: qsTr("Copy")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-05-18 21:58:07 +00:00
|
|
|
|
|
|
|
NetworkSelectPopup {
|
|
|
|
id: selectPopup
|
|
|
|
x: multiChainList.x + Style.current.xlPadding + Style.current.halfPadding
|
|
|
|
y: centralLayout.y
|
|
|
|
layer1Networks: RootStore.layer1Networks
|
|
|
|
layer2Networks: RootStore.layer2Networks
|
|
|
|
testNetworks: RootStore.testNetworks
|
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
|
|
|
|
|
|
|
onToggleNetwork: {
|
|
|
|
RootStore.toggleNetwork(chainId)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "legacy"
|
|
|
|
when: tabBar.currentIndex === 0
|
|
|
|
PropertyChanges {
|
|
|
|
target: multiChainList
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: contactsLabel
|
|
|
|
visible: true
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: networksLabel
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: copyToClipBoard
|
|
|
|
textToCopy: txtWalletAddress.text
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: popup
|
|
|
|
completeAddressWithNetworkPrefix: popup.selectedAccount.address
|
|
|
|
}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "multichain"
|
|
|
|
when: tabBar.currentIndex === 1
|
|
|
|
PropertyChanges {
|
|
|
|
target: multiChainList
|
|
|
|
visible: true
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: contactsLabel
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: networksLabel
|
|
|
|
visible: true
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: copyToClipBoard
|
|
|
|
textToCopy: popup.networkPrefix + txtWalletAddress.text
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: popup
|
|
|
|
completeAddressWithNetworkPrefix: popup.networkPrefix + popup.selectedAccount.address
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2020-08-14 19:19:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|