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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
2023-04-26 15:53:49 +00:00
|
|
|
import "../stores/NetworkSelectPopup"
|
|
|
|
import "../controls"
|
|
|
|
import "../views"
|
2023-04-05 11:10:44 +00:00
|
|
|
|
|
|
|
StatusDialog {
|
2022-11-12 09:18:18 +00:00
|
|
|
id: root
|
2023-04-05 11:10:44 +00:00
|
|
|
|
2022-02-15 13:19:45 +00:00
|
|
|
modal: false
|
2023-04-05 11:10:44 +00:00
|
|
|
standardButtons: Dialog.NoButton
|
|
|
|
|
|
|
|
anchors.centerIn: undefined
|
|
|
|
|
|
|
|
padding: 4
|
2022-02-15 13:19:45 +00:00
|
|
|
width: 360
|
2023-04-05 11:10:44 +00:00
|
|
|
implicitHeight: Math.min(432, scrollView.contentHeight + root.padding * 2)
|
|
|
|
|
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
|
|
|
|
|
|
|
required property var layer1Networks
|
|
|
|
required property var layer2Networks
|
|
|
|
property var testNetworks: null
|
|
|
|
|
|
|
|
/// Grouped properties for single selection state. \c singleSelection.enabled is \c false by default
|
|
|
|
/// \see SingleSelectionInfo
|
|
|
|
property alias singleSelection: d.singleSelection
|
2022-08-05 12:07:03 +00:00
|
|
|
|
2023-04-05 11:10:44 +00:00
|
|
|
property bool useEnabledRole: true
|
2022-08-05 12:07:03 +00:00
|
|
|
|
2023-04-05 11:10:44 +00:00
|
|
|
/// \c network is a network.model.nim entry. \c model and \c index for the current selection
|
|
|
|
/// It is called for every toggled network if \c singleSelection.enabled is \c false
|
|
|
|
/// If \c singleSelection.enabled is \c true, it is called only for the selected network when the selection changes
|
|
|
|
/// \see SingleSelectionInfo
|
|
|
|
signal toggleNetwork(var network, var model, int index)
|
2022-02-17 09:15:37 +00:00
|
|
|
|
2023-04-05 11:10:44 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
2022-11-12 09:18:18 +00:00
|
|
|
|
2023-04-05 11:10:44 +00:00
|
|
|
property SingleSelectionInfo singleSelection: SingleSelectionInfo {}
|
|
|
|
}
|
2023-02-22 17:11:13 +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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-26 15:53:49 +00:00
|
|
|
contentItem: NetworkSelectionView {
|
2022-02-15 13:19:45 +00:00
|
|
|
id: scrollView
|
2022-11-12 09:18:18 +00:00
|
|
|
width: root.width
|
|
|
|
height: root.height
|
2023-04-26 15:53:49 +00:00
|
|
|
layer1Networks: root.layer1Networks
|
|
|
|
layer2Networks: root.layer2Networks
|
|
|
|
testNetworks: root.testNetworks
|
|
|
|
useEnabledRole: root.useEnabledRole
|
|
|
|
singleSelection: d.singleSelection
|
|
|
|
onToggleNetwork: {
|
|
|
|
root.toggleNetwork(network, model, index)
|
|
|
|
if(d.singleSelection.enabled)
|
|
|
|
close()
|
2022-02-17 09:15:37 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-15 13:19:45 +00:00
|
|
|
}
|