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
|
|
|
|
|
|
|
required property var layer1Networks
|
|
|
|
required property var layer2Networks
|
2023-07-21 08:41:24 +00:00
|
|
|
property var preferredSharingNetworks: []
|
|
|
|
property bool preferredNetworksMode: false
|
2023-04-05 11:10:44 +00:00
|
|
|
|
|
|
|
/// 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
|
|
|
|
2023-07-21 08:41:24 +00:00
|
|
|
modal: false
|
|
|
|
standardButtons: Dialog.NoButton
|
|
|
|
|
|
|
|
anchors.centerIn: undefined
|
|
|
|
|
|
|
|
padding: 4
|
|
|
|
width: 360
|
|
|
|
implicitHeight: Math.min(432, scrollView.contentHeight + root.padding * 2)
|
|
|
|
|
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
|
|
|
|
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-05-31 20:58:23 +00:00
|
|
|
NetworkSelectionView {
|
2022-02-15 13:19:45 +00:00
|
|
|
id: scrollView
|
2023-05-31 20:58:23 +00:00
|
|
|
anchors.fill: parent
|
2023-04-26 15:53:49 +00:00
|
|
|
layer1Networks: root.layer1Networks
|
|
|
|
layer2Networks: root.layer2Networks
|
2023-07-21 08:41:24 +00:00
|
|
|
preferredNetworksMode: root.preferredNetworksMode
|
|
|
|
preferredSharingNetworks: root.preferredSharingNetworks
|
2023-04-26 15:53:49 +00:00
|
|
|
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
|
|
|
}
|