2024-06-19 13:13:32 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2024-09-03 12:57:07 +00:00
|
|
|
import QtQml.Models 2.15
|
2024-06-19 13:13:32 +00:00
|
|
|
|
2024-09-03 12:57:07 +00:00
|
|
|
import utils 1.0
|
2024-06-19 13:13:32 +00:00
|
|
|
import shared.controls 1.0
|
|
|
|
import shared.popups.walletconnect 1.0
|
2024-07-04 13:32:04 +00:00
|
|
|
import shared.popups.walletconnect.controls 1.0
|
2024-06-19 13:13:32 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
2024-09-03 12:57:07 +00:00
|
|
|
import StatusQ.Popups.Dialog 0.1
|
2024-06-19 13:13:32 +00:00
|
|
|
import StatusQ.Components.private 0.1 as SQP
|
|
|
|
|
|
|
|
ComboBox {
|
|
|
|
id: root
|
2024-10-25 19:28:45 +00:00
|
|
|
|
|
|
|
property bool walletConnectEnabled: true
|
|
|
|
property bool connectorEnabled: true
|
2024-06-19 13:13:32 +00:00
|
|
|
|
|
|
|
signal dappsListReady
|
|
|
|
signal pairDapp
|
2024-06-24 21:26:53 +00:00
|
|
|
signal disconnectDapp(string dappUrl)
|
2024-06-19 13:13:32 +00:00
|
|
|
|
|
|
|
implicitHeight: 38
|
|
|
|
implicitWidth: 38
|
|
|
|
|
|
|
|
background: SQP.StatusComboboxBackground {
|
|
|
|
objectName: "dappsBackground"
|
|
|
|
active: root.down || root.hovered
|
|
|
|
}
|
|
|
|
|
|
|
|
indicator: null
|
|
|
|
|
|
|
|
contentItem: Item {
|
|
|
|
objectName: "dappsContentItem"
|
|
|
|
StatusBadge {
|
|
|
|
objectName: "dappBadge"
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.margins: 5
|
|
|
|
width: 6
|
|
|
|
height: 6
|
|
|
|
visible: root.delegateModel.count > 0
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusIcon {
|
|
|
|
objectName: "dappIcon"
|
|
|
|
anchors.centerIn: parent
|
|
|
|
width: 16
|
|
|
|
height: 16
|
|
|
|
icon: "dapp"
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delegate: DAppDelegate {
|
|
|
|
width: ListView.view.width
|
2024-06-24 21:26:53 +00:00
|
|
|
|
|
|
|
onDisconnectDapp: (dappUrl) => {
|
|
|
|
root.disconnectDapp(dappUrl)
|
|
|
|
}
|
2024-06-19 13:13:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
popup: DAppsListPopup {
|
|
|
|
objectName: "dappsListPopup"
|
2024-06-24 21:26:53 +00:00
|
|
|
|
2024-06-19 13:13:32 +00:00
|
|
|
x: root.width - width
|
|
|
|
y: root.height + 4
|
|
|
|
|
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
|
|
|
|
|
|
|
delegateModel: root.delegateModel
|
|
|
|
|
2024-09-03 12:57:07 +00:00
|
|
|
onConnectDapp: {
|
|
|
|
dappConnectSelectComponent.createObject(root).open()
|
2024-06-19 13:13:32 +00:00
|
|
|
this.close()
|
|
|
|
}
|
|
|
|
|
|
|
|
onOpened: {
|
|
|
|
root.dappsListReady()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-03 12:57:07 +00:00
|
|
|
Component {
|
|
|
|
id: dappConnectSelectComponent
|
|
|
|
StatusDialog {
|
|
|
|
id: dappConnectSelect
|
2024-10-25 19:28:45 +00:00
|
|
|
objectName: "dappConnectSelect"
|
2024-09-03 12:57:07 +00:00
|
|
|
width: 480
|
2024-10-15 19:26:12 +00:00
|
|
|
topPadding: Theme.bigPadding
|
|
|
|
leftPadding: Theme.padding
|
|
|
|
rightPadding: Theme.padding
|
2024-09-03 12:57:07 +00:00
|
|
|
bottomPadding: 4
|
|
|
|
destroyOnClose: true
|
|
|
|
|
|
|
|
title: qsTr("Connect a dApp")
|
|
|
|
footer: StatusDialogFooter {
|
|
|
|
rightButtons: ObjectModel {
|
|
|
|
StatusButton {
|
|
|
|
text: qsTr("Cancel")
|
|
|
|
onClicked: dappConnectSelect.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: ColumnLayout {
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
2024-10-15 19:26:12 +00:00
|
|
|
Layout.leftMargin: Theme.padding
|
2024-09-03 12:57:07 +00:00
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
text: qsTr("How would you like to connect?")
|
|
|
|
}
|
|
|
|
StatusListItem {
|
2024-10-25 19:28:45 +00:00
|
|
|
objectName: "btnStatusConnector"
|
2024-09-03 12:57:07 +00:00
|
|
|
title: "Status Connector"
|
2024-10-15 19:26:12 +00:00
|
|
|
asset.name: Theme.png("status-logo")
|
2024-09-03 12:57:07 +00:00
|
|
|
asset.isImage: true
|
2024-10-25 19:28:45 +00:00
|
|
|
enabled: root.connectorEnabled
|
2024-09-03 12:57:07 +00:00
|
|
|
components: [
|
|
|
|
StatusIcon {
|
|
|
|
icon: "external-link"
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
onClicked: {
|
|
|
|
dappConnectSelect.close()
|
|
|
|
Global.openLink("https://chromewebstore.google.com/detail/a-wallet-connector-by-sta/kahehnbpamjplefhpkhafinaodkkenpg")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StatusListItem {
|
|
|
|
objectName: "btnWalletConnect"
|
|
|
|
title: "Wallet Connect"
|
2024-10-15 19:26:12 +00:00
|
|
|
asset.name: Theme.svg("walletconnect")
|
2024-09-03 12:57:07 +00:00
|
|
|
asset.isImage: true
|
2024-10-25 19:28:45 +00:00
|
|
|
enabled: root.walletConnectEnabled
|
2024-09-03 12:57:07 +00:00
|
|
|
components: [
|
|
|
|
StatusIcon {
|
|
|
|
icon: "next"
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
onClicked: {
|
|
|
|
dappConnectSelect.close()
|
|
|
|
root.pairDapp()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-19 13:13:32 +00:00
|
|
|
StatusToolTip {
|
|
|
|
id: tooltip
|
|
|
|
objectName: "dappTooltip"
|
|
|
|
visible: root.hovered && !root.down
|
|
|
|
text: qsTr("dApp connections")
|
|
|
|
orientation: StatusToolTip.Orientation.Bottom
|
|
|
|
y: root.height + 14
|
|
|
|
}
|
|
|
|
}
|