2023-04-05 11:10:44 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
import StatusQ 0.1
|
2023-04-05 11:10:44 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import AppLayouts.Wallet.popups 1.0
|
|
|
|
import AppLayouts.Wallet.controls 1.0
|
2024-06-12 08:52:11 +00:00
|
|
|
import AppLayouts.Wallet.views 1.0
|
2023-04-05 11:10:44 +00:00
|
|
|
import AppLayouts.stores 1.0
|
|
|
|
|
|
|
|
import Models 1.0
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
SplitView {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
Pane {
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: controlLayout
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
// Leave some space so that the popup will be opened without accounting for Layer
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.maximumHeight: 50
|
|
|
|
}
|
|
|
|
|
|
|
|
NetworkFilter {
|
|
|
|
id: networkFilter
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
flatNetworks: availableNetworks
|
2023-04-05 11:10:44 +00:00
|
|
|
multiSelection: multiSelectionCheckbox.checked
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dummy item to make space for popup
|
|
|
|
Item {
|
|
|
|
id: popupPlaceholder
|
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
Layout.preferredWidth: networkSelectPopup.implicitWidth
|
|
|
|
Layout.preferredHeight: networkSelectPopup.implicitHeight
|
2023-04-05 11:10:44 +00:00
|
|
|
|
|
|
|
NetworkSelectPopup {
|
|
|
|
id: networkSelectPopup
|
2024-06-15 21:33:12 +00:00
|
|
|
flatNetworks: availableNetworks
|
|
|
|
multiSelection: multiSelectionCheckbox.checked
|
2023-04-05 11:10:44 +00:00
|
|
|
closePolicy: Popup.NoAutoClose
|
2024-06-15 21:33:12 +00:00
|
|
|
visible: true
|
2023-04-05 11:10:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.preferredHeight: 30
|
|
|
|
Layout.maximumHeight: 30
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
Button {
|
|
|
|
text: "Single Selection Popup"
|
|
|
|
onClicked: selectPopupLoader.active = true
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id: lastSingleSelectionLabel
|
2024-06-15 21:33:12 +00:00
|
|
|
text: selectedEntry.available ? `[${selectedEntry.item.chainName}] - ID: ${selectedEntry.item.chainId}, Icon: ${selectedEntry.item.iconUrl}` : "-"
|
|
|
|
}
|
|
|
|
|
|
|
|
ModelEntry {
|
|
|
|
id: selectedEntry
|
|
|
|
sourceModel: availableNetworks
|
|
|
|
key: "chainId"
|
2023-04-05 11:10:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: singleSelectionPopupPlaceholder
|
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
Layout.preferredWidth: selectPopupLoader.item ? selectPopupLoader.item.implicitWidth : 0
|
|
|
|
Layout.preferredHeight: selectPopupLoader.item ? selectPopupLoader.item.implicitHeight : 0
|
2023-04-05 11:10:44 +00:00
|
|
|
|
2024-03-13 17:38:16 +00:00
|
|
|
property var currentModel: networkFilter.flatNetworks
|
2023-04-05 11:10:44 +00:00
|
|
|
property int currentIndex: 0
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: selectPopupLoader
|
|
|
|
|
|
|
|
active: false
|
|
|
|
|
|
|
|
sourceComponent: NetworkSelectPopup {
|
2024-06-15 21:33:12 +00:00
|
|
|
flatNetworks: availableNetworks
|
|
|
|
selection: selectedEntry.available ? [selectedEntry.value] : []
|
|
|
|
onClosed: selectPopupLoader.active = false
|
2023-04-05 11:10:44 +00:00
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
onSelectionChanged: {
|
|
|
|
if (selectedEntry.value !== selection[0]) {
|
|
|
|
selectedEntry.value = selection[0]
|
|
|
|
}
|
2023-04-05 11:10:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onLoaded: item.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Vertical separator
|
|
|
|
ColumnLayout {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Pane {
|
|
|
|
SplitView.minimumWidth: 300
|
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.minimumHeight: 300
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: allNetworksListView
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
model: availableNetworks
|
2023-04-05 11:10:44 +00:00
|
|
|
|
|
|
|
delegate: ItemDelegate {
|
2024-06-15 21:33:12 +00:00
|
|
|
required property var model
|
|
|
|
|
2023-04-05 11:10:44 +00:00
|
|
|
width: allNetworksListView.width
|
|
|
|
implicitHeight: delegateRowLayout.implicitHeight
|
|
|
|
|
|
|
|
highlighted: ListView.isCurrentItem
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
id: delegateRowLayout
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
Column {
|
|
|
|
Layout.margins: 5
|
|
|
|
|
|
|
|
spacing: 3
|
|
|
|
|
|
|
|
Label { text: model.chainName }
|
|
|
|
|
|
|
|
Row {
|
|
|
|
spacing: 5
|
|
|
|
Label { text: `<b>${model.shortName}</b>` }
|
|
|
|
Label { text: `ID <b>${model.chainId}</b>` }
|
|
|
|
CheckBox {
|
2024-06-15 21:33:12 +00:00
|
|
|
checkState: networkSelectPopup.selection.includes(model.chainId) ? Qt.Checked : Qt.Unchecked
|
|
|
|
onToggled: {
|
|
|
|
let currentSelection = networkSelectPopup.selection
|
|
|
|
if (checkState === Qt.Checked && !currentSelection.includes(model.chainId)) {
|
|
|
|
currentSelection.push(model.chainId)
|
|
|
|
} else {
|
|
|
|
currentSelection = currentSelection.filter(id => id !== model.chainId)
|
|
|
|
}
|
|
|
|
networkSelectPopup.selection = [...currentSelection]
|
2023-04-05 11:10:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: multiSelectionCheckbox
|
|
|
|
|
|
|
|
Layout.margins: 5
|
|
|
|
|
|
|
|
text: "Multi Selection"
|
|
|
|
checked: true
|
|
|
|
}
|
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
id: testModeCheckbox
|
|
|
|
|
|
|
|
Layout.margins: 5
|
|
|
|
|
|
|
|
text: "Test Networks Mode"
|
|
|
|
checked: false
|
2024-06-15 21:33:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CheckBox {
|
|
|
|
id: allowSelection
|
|
|
|
Layout.margins: 5
|
|
|
|
|
|
|
|
text: "Allow Selection"
|
|
|
|
checked: networkSelectPopup.selectionAllowed
|
|
|
|
onToggled: networkSelectPopup.selectionAllowed = checked
|
2023-04-05 11:10:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SortFilterProxyModel {
|
|
|
|
id: availableNetworks
|
|
|
|
|
2024-03-13 17:38:16 +00:00
|
|
|
sourceModel: NetworksModel.flatNetworks
|
2023-04-05 11:10:44 +00:00
|
|
|
filters: ValueFilter { roleName: "isTest"; value: testModeCheckbox.checked; }
|
|
|
|
}
|
|
|
|
}
|
2023-07-31 12:21:14 +00:00
|
|
|
|
|
|
|
// category: Popups
|
2023-10-03 11:56:30 +00:00
|
|
|
|
|
|
|
// https://www.figma.com/file/FkFClTCYKf83RJWoifWgoX/Wallet-v2?node-id=13200-352357&t=jKciSCy3BVlrZmBs-0
|
|
|
|
// https://www.figma.com/file/FkFClTCYKf83RJWoifWgoX/Wallet-v2?node-id=13185-350333&t=b2AclcJgxjXDL6Wl-0
|
|
|
|
// https://www.figma.com/file/FkFClTCYKf83RJWoifWgoX/Wallet-v2?node-id=13187-359097&t=b2AclcJgxjXDL6Wl-0
|