2020-08-14 19:19:08 +00:00
|
|
|
import QtQuick 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
|
2022-11-11 09:24:26 +00:00
|
|
|
import QtQuick.Controls 2.14
|
2023-06-28 09:16:30 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
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.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-11-11 09:24:26 +00:00
|
|
|
import shared.popups 1.0
|
2022-03-15 19:34:28 +00:00
|
|
|
|
2023-04-05 11:10:44 +00:00
|
|
|
import AppLayouts.stores 1.0
|
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 {
|
2022-11-12 09:18:18 +00:00
|
|
|
id: root
|
2020-08-14 19:19:08 +00:00
|
|
|
|
2023-05-23 08:44:35 +00:00
|
|
|
property string address: RootStore.selectedReceiveAccount.address
|
|
|
|
property string chainShortNames: ""
|
|
|
|
|
|
|
|
property string description: qsTr("Your Address")
|
|
|
|
|
|
|
|
property bool readOnly: false
|
|
|
|
|
2023-04-24 18:35:34 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
property string completeAddressWithNetworkPrefix
|
2022-05-18 21:58:07 +00:00
|
|
|
}
|
2022-03-15 19:34:28 +00:00
|
|
|
|
2023-05-23 12:46:16 +00:00
|
|
|
headerSettings.title: qsTr("Receive")
|
2022-03-15 19:34:28 +00:00
|
|
|
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
|
2022-11-11 09:24:26 +00:00
|
|
|
advancedHeaderComponent: AccountsModalHeader {
|
2023-06-28 09:16:30 +00:00
|
|
|
model: SortFilterProxyModel {
|
|
|
|
sourceModel: RootStore.receiveAccounts
|
|
|
|
|
|
|
|
sorters: RoleSorter { roleName: "position"; sortOrder: Qt.AscendingOrder }
|
|
|
|
}
|
|
|
|
|
2023-05-04 12:55:39 +00:00
|
|
|
selectedAccount: RootStore.selectedReceiveAccount
|
|
|
|
onSelectedIndexChanged: RootStore.switchReceiveAccount(selectedIndex)
|
2022-05-18 21:58:07 +00:00
|
|
|
}
|
|
|
|
|
2022-03-15 19:34:28 +00:00
|
|
|
contentItem: Column {
|
|
|
|
id: layout
|
2022-11-12 09:18:18 +00:00
|
|
|
width: root.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
|
2023-06-13 10:56:16 +00:00
|
|
|
currentIndex: 1
|
2022-05-18 21:58:07 +00:00
|
|
|
StatusSwitchTabButton {
|
|
|
|
text: qsTr("Legacy")
|
|
|
|
}
|
|
|
|
StatusSwitchTabButton {
|
|
|
|
text: qsTr("Multichain")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
width: parent.width
|
|
|
|
height: qrCodeBox.height
|
|
|
|
id: centralLayout
|
|
|
|
|
|
|
|
Grid {
|
|
|
|
id: multiChainList
|
|
|
|
property bool need2Columns: RootStore.enabledNetworks.count >= 9
|
|
|
|
|
2022-07-21 08:40:49 +00:00
|
|
|
anchors.left: need2Columns ? undefined: qrCodeBox.right
|
|
|
|
anchors.leftMargin: need2Columns ?undefined : Style.current.halfPadding
|
|
|
|
anchors.centerIn: need2Columns ? parent : undefined
|
2022-05-18 21:58:07 +00:00
|
|
|
height: qrCodeBox.height
|
|
|
|
|
|
|
|
columnSpacing: need2Columns ? qrCodeBox.width + Style.current.bigPadding : 0
|
|
|
|
flow: Grid.TopToBottom
|
|
|
|
columns: need2Columns ? 2 : 1
|
|
|
|
spacing: 5
|
2023-04-05 11:10:44 +00:00
|
|
|
property var networkProxies: [layer1NetworksClone, layer2NetworksClone]
|
2022-05-18 21:58:07 +00:00
|
|
|
Repeater {
|
2022-11-12 09:18:18 +00:00
|
|
|
model: multiChainList.networkProxies.length
|
|
|
|
delegate: Repeater {
|
|
|
|
model: multiChainList.networkProxies[index]
|
|
|
|
delegate: InformationTag {
|
|
|
|
tagPrimaryLabel.text: model.shortName
|
|
|
|
tagPrimaryLabel.color: model.chainColor
|
|
|
|
image.source: Style.svg("tiny/" + model.iconUrl)
|
2023-04-05 11:10:44 +00:00
|
|
|
visible: model.isEnabled
|
2022-11-12 09:18:18 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
2023-05-23 08:44:35 +00:00
|
|
|
cursorShape: root.readOnly ? Qt.ArrowCursor : Qt.PointingHandCursor
|
|
|
|
enabled: !root.readOnly
|
2022-11-12 09:18:18 +00:00
|
|
|
onClicked: selectPopup.open()
|
|
|
|
}
|
2022-05-18 21:58:07 +00:00
|
|
|
}
|
2022-03-15 19:34:28 +00:00
|
|
|
}
|
2022-05-18 21:58:07 +00:00
|
|
|
}
|
2022-07-13 14:32:06 +00:00
|
|
|
StatusRoundButton {
|
2023-04-05 11:10:44 +00:00
|
|
|
id: editButton
|
2022-07-13 14:32:06 +00:00
|
|
|
width: 32
|
|
|
|
height: 32
|
2022-05-18 21:58:07 +00:00
|
|
|
icon.name: "edit_pencil"
|
2022-07-13 14:32:06 +00:00
|
|
|
color: Theme.palette.primaryColor3
|
2023-05-23 08:44:35 +00:00
|
|
|
visible: !root.readOnly
|
2022-07-13 14:32:06 +00:00
|
|
|
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
|
2023-04-24 18:35:34 +00:00
|
|
|
source: RootStore.getQrCode(d.completeAddressWithNetworkPrefix)
|
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
|
2022-07-13 14:32:06 +00:00
|
|
|
icon: "status-logo-icon"
|
2022-05-18 21:58:07 +00:00
|
|
|
}
|
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
|
2023-05-23 08:44:35 +00:00
|
|
|
text: root.description
|
2022-03-15 19:34:28 +00:00
|
|
|
}
|
2022-05-18 21:58:07 +00:00
|
|
|
RowLayout {
|
|
|
|
id: networksLabel
|
|
|
|
spacing: -1
|
|
|
|
Repeater {
|
2022-11-12 09:18:18 +00:00
|
|
|
model: multiChainList.networkProxies.length
|
|
|
|
delegate: Repeater {
|
|
|
|
model: multiChainList.networkProxies[index]
|
|
|
|
delegate: StatusBaseText {
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: chainColor
|
|
|
|
text: shortName + ":"
|
2023-04-05 11:10:44 +00:00
|
|
|
visible: model.isEnabled
|
2022-11-12 09:18:18 +00:00
|
|
|
onVisibleChanged: {
|
2023-05-23 08:44:35 +00:00
|
|
|
if (root.readOnly)
|
|
|
|
return
|
2022-11-12 09:18:18 +00:00
|
|
|
if (visible) {
|
2023-05-23 08:44:35 +00:00
|
|
|
root.chainShortNames += text
|
2022-11-12 09:18:18 +00:00
|
|
|
} else {
|
2023-05-23 08:44:35 +00:00
|
|
|
root.chainShortNames = root.chainShortNames.replace(text, "")
|
2022-11-12 09:18:18 +00:00
|
|
|
}
|
|
|
|
}
|
2022-05-18 21:58:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-03-15 19:34:28 +00:00
|
|
|
StatusAddress {
|
|
|
|
id: txtWalletAddress
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.pixelSize: 15
|
2023-05-23 08:44:35 +00:00
|
|
|
text: root.address
|
2022-03-15 19:34:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
|
textToCopy: txtWalletAddress.text
|
2023-02-20 12:55:39 +00:00
|
|
|
onCopyClicked: RootStore.copyToClipboard(textToCopy)
|
2022-03-15 19:34:28 +00:00
|
|
|
}
|
|
|
|
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
|
2022-11-12 09:18:18 +00:00
|
|
|
|
2023-04-05 11:10:44 +00:00
|
|
|
x: multiChainList.x + editButton.width + 9
|
|
|
|
y: tabBar.y + tabBar.height
|
2022-11-12 09:18:18 +00:00
|
|
|
|
2023-04-05 11:10:44 +00:00
|
|
|
layer1Networks: layer1NetworksClone
|
|
|
|
layer2Networks: layer2NetworksClone
|
2022-05-18 21:58:07 +00:00
|
|
|
|
2022-11-12 09:18:18 +00:00
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
2023-04-05 11:10:44 +00:00
|
|
|
|
|
|
|
onToggleNetwork: (network, networkModel, index) => {
|
|
|
|
network.isEnabled = !network.isEnabled
|
|
|
|
}
|
|
|
|
|
|
|
|
CloneModel {
|
|
|
|
id: layer1NetworksClone
|
|
|
|
|
|
|
|
sourceModel: RootStore.layer1Networks
|
|
|
|
roles: ["layer", "chainId", "chainColor", "chainName","shortName", "iconUrl", "isEnabled"]
|
|
|
|
// rowData used to clone returns string. Convert it to bool for bool arithmetics
|
|
|
|
rolesOverride: [{
|
|
|
|
role: "isEnabled",
|
2023-05-23 08:44:35 +00:00
|
|
|
transform: (modelData) => root.readOnly ? root.chainShortNames.includes(modelData.shortName) : Boolean(modelData.isEnabled)
|
2023-04-05 11:10:44 +00:00
|
|
|
}]
|
|
|
|
}
|
|
|
|
|
|
|
|
CloneModel {
|
|
|
|
id: layer2NetworksClone
|
|
|
|
|
|
|
|
sourceModel: RootStore.layer2Networks
|
|
|
|
roles: layer1NetworksClone.roles
|
|
|
|
rolesOverride: layer1NetworksClone.rolesOverride
|
|
|
|
}
|
2022-05-18 21:58:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
2023-04-24 18:35:34 +00:00
|
|
|
target: d
|
2023-05-23 08:44:35 +00:00
|
|
|
completeAddressWithNetworkPrefix: root.address
|
2022-05-18 21:58:07 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
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
|
2023-05-23 08:44:35 +00:00
|
|
|
textToCopy: root.chainShortNames + txtWalletAddress.text
|
2022-05-18 21:58:07 +00:00
|
|
|
}
|
|
|
|
PropertyChanges {
|
2023-04-24 18:35:34 +00:00
|
|
|
target: d
|
2023-05-23 08:44:35 +00:00
|
|
|
completeAddressWithNetworkPrefix: root.chainShortNames + root.address
|
2022-05-18 21:58:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2020-08-14 19:19:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|