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 "../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
|
|
|
|
2024-03-13 17:38:16 +00:00
|
|
|
property var flatNetworks
|
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
|
2024-03-13 17:38:16 +00:00
|
|
|
signal toggleNetwork(var network, 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
|
2024-03-13 17:38:16 +00:00
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
2023-05-31 20:58:23 +00:00
|
|
|
anchors.fill: parent
|
2024-03-13 17:38:16 +00:00
|
|
|
flatNetworks: root.flatNetworks
|
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: {
|
2024-03-13 17:38:16 +00:00
|
|
|
root.toggleNetwork(network, index)
|
2023-04-26 15:53:49 +00:00
|
|
|
if(d.singleSelection.enabled)
|
|
|
|
close()
|
2022-02-17 09:15:37 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-15 13:19:45 +00:00
|
|
|
}
|