2023-06-01 11:25:33 +08:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
|
|
import PageEnum 1.0
|
|
|
|
|
import ProtocolEnum 1.0
|
|
|
|
|
import ContainerProps 1.0
|
2023-06-23 15:24:40 +09:00
|
|
|
import ContainersModelFilters 1.0
|
2024-08-20 16:54:05 +07:00
|
|
|
import Style 1.0
|
2023-06-01 11:25:33 +08:00
|
|
|
|
|
|
|
|
import "./"
|
|
|
|
|
import "../Controls2"
|
|
|
|
|
import "../Controls2/TextTypes"
|
|
|
|
|
import "../Config"
|
|
|
|
|
import "../Components"
|
|
|
|
|
|
|
|
|
|
PageType {
|
|
|
|
|
id: root
|
|
|
|
|
|
2023-06-23 15:24:40 +09:00
|
|
|
property var installedProtocolsCount
|
2023-06-01 11:25:33 +08:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
function resetView() {
|
|
|
|
|
settingsContainersListView.positionViewAtBeginning()
|
|
|
|
|
}
|
2023-06-23 15:24:40 +09:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
SettingsContainersListView {
|
|
|
|
|
id: settingsContainersListView
|
2023-06-23 15:24:40 +09:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
anchors.fill: parent
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
Connections {
|
|
|
|
|
target: ServersModel
|
2023-06-23 15:24:40 +09:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
function onProcessedServerIndexChanged() {
|
|
|
|
|
settingsContainersListView.updateContainersModelFilters()
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-30 13:45:11 +09:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
function updateContainersModelFilters() {
|
|
|
|
|
if (ServersModel.isProcessedServerHasWriteAccess()) {
|
|
|
|
|
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
|
|
|
|
|
} else {
|
|
|
|
|
proxyContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
|
|
|
|
|
}
|
|
|
|
|
root.installedProtocolsCount = proxyContainersModel.count
|
|
|
|
|
}
|
2023-06-30 13:45:11 +09:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
model: SortFilterProxyModel {
|
|
|
|
|
id: proxyContainersModel
|
|
|
|
|
sourceModel: ContainersModel
|
|
|
|
|
sorters: [
|
|
|
|
|
RoleSorter { roleName: "isInstalled"; sortOrder: Qt.DescendingOrder },
|
|
|
|
|
RoleSorter { roleName: "installPageOrder"; sortOrder: Qt.AscendingOrder }
|
|
|
|
|
]
|
|
|
|
|
}
|
2023-06-30 13:45:11 +09:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
Component.onCompleted: {
|
|
|
|
|
settingsContainersListView.isFocusable = true
|
|
|
|
|
settingsContainersListView.interactive = true
|
|
|
|
|
updateContainersModelFilters()
|
2023-06-30 13:45:11 +09:00
|
|
|
}
|
2023-06-01 11:25:33 +08:00
|
|
|
}
|
|
|
|
|
}
|