2023-04-05 11:10:44 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
2022-02-15 13:19:45 +00:00
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
|
2024-03-13 17:38:16 +00:00
|
|
|
import StatusQ 0.1
|
2022-02-15 13:19:45 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-04-05 11:10:44 +00:00
|
|
|
import StatusQ.Popups.Dialog 0.1
|
2022-02-15 13:19:45 +00:00
|
|
|
|
2024-03-13 17:38:16 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
2022-02-15 13:19:45 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2023-04-26 15:53:49 +00:00
|
|
|
import "../controls"
|
|
|
|
import "../views"
|
2023-04-05 11:10:44 +00:00
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
Popup {
|
2022-11-12 09:18:18 +00:00
|
|
|
id: root
|
2023-04-05 11:10:44 +00:00
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
required property var flatNetworks
|
2023-04-05 11:10:44 +00:00
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
property bool showSelectionIndicator: true
|
|
|
|
property bool selectionAllowed: true
|
|
|
|
property bool multiSelection: false
|
|
|
|
property var selection: []
|
2022-08-05 12:07:03 +00:00
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
signal toggleNetwork(int chainId, int index)
|
2022-08-05 12:07:03 +00:00
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
onSelectionChanged: {
|
|
|
|
if (root.selection !== scrollView.selection) {
|
|
|
|
scrollView.selection = root.selection
|
|
|
|
}
|
2023-04-05 11:10:44 +00:00
|
|
|
}
|
2023-02-22 17:11:13 +00:00
|
|
|
|
2023-07-21 08:41:24 +00:00
|
|
|
modal: false
|
|
|
|
|
|
|
|
padding: 4
|
2024-06-15 21:33:12 +00:00
|
|
|
implicitWidth: 300
|
2023-07-21 08:41:24 +00:00
|
|
|
|
2022-02-15 13:19:45 +00:00
|
|
|
background: Rectangle {
|
|
|
|
radius: Style.current.radius
|
|
|
|
color: Style.current.background
|
|
|
|
border.color: Style.current.border
|
|
|
|
layer.enabled: true
|
2023-04-26 15:53:49 +00:00
|
|
|
layer.effect: DropShadow {
|
2022-02-15 13:19:45 +00:00
|
|
|
verticalOffset: 3
|
|
|
|
radius: 8
|
|
|
|
samples: 15
|
|
|
|
fast: true
|
|
|
|
cached: true
|
|
|
|
color: "#22000000"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-15 21:33:12 +00:00
|
|
|
contentItem: NetworkSelectorView {
|
2022-02-15 13:19:45 +00:00
|
|
|
id: scrollView
|
2024-06-15 21:33:12 +00:00
|
|
|
|
|
|
|
model: root.flatNetworks
|
|
|
|
interactive: root.selectionAllowed
|
|
|
|
multiSelection: root.multiSelection
|
|
|
|
showIndicator: root.showSelectionIndicator
|
|
|
|
selection: root.selection
|
|
|
|
|
|
|
|
onSelectionChanged: {
|
|
|
|
if (root.selection !== scrollView.selection) {
|
|
|
|
root.selection = scrollView.selection
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onToggleNetwork: {
|
|
|
|
if (!root.multiSelection && root.closePolicy !== Popup.NoAutoClose)
|
|
|
|
root.close()
|
|
|
|
root.toggleNetwork(chainId, index)
|
2022-02-17 09:15:37 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-15 13:19:45 +00:00
|
|
|
}
|