Files
amnezia-client/client/ui/qml/Components/SettingsContainersListView.qml
T

91 lines
2.8 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerEnum 1.0
2023-07-14 13:14:50 +09:00
import ContainerProps 1.0
import "../Controls2"
import "../Controls2/TextTypes"
ListView {
id: root
2023-06-01 11:25:33 +08:00
width: parent.width
height: root.contentItem.height
clip: true
2024-12-31 04:16:52 +01:00
reuseItems: true
2024-12-31 04:16:52 +01:00
property bool isFocusable: false
2024-04-18 17:54:55 +04:00
delegate: Item {
2023-06-01 11:25:33 +08:00
implicitWidth: root.width
2023-08-16 22:45:05 +05:00
implicitHeight: delegateContent.implicitHeight
2023-08-16 22:45:05 +05:00
ColumnLayout {
id: delegateContent
2023-08-16 22:45:05 +05:00
anchors.fill: parent
2023-08-16 22:45:05 +05:00
LabelWithButtonType {
2024-04-18 17:54:55 +04:00
id: containerRadioButton
2023-08-16 22:45:05 +05:00
implicitWidth: parent.width
2023-08-16 22:45:05 +05:00
text: name
descriptionText: description
rightImageSource: isInstalled ? "qrc:/images/controls/chevron-right.svg" : "qrc:/images/controls/download.svg"
2023-08-16 22:45:05 +05:00
clickedFunction: function() {
if (isInstalled) {
var containerIndex = root.model.mapToSource(index)
ContainersModel.setProcessedContainerIndex(containerIndex)
2023-09-18 16:39:26 +05:00
if (serviceType !== ProtocolEnum.Other) {
if (config[ContainerProps.containerTypeToString(containerIndex)]["isThirdPartyConfig"]) {
ProtocolsModel.updateModel(config)
PageController.goToPage(PageEnum.PageProtocolRaw)
return
}
2023-08-16 22:45:05 +05:00
}
2023-08-16 22:45:05 +05:00
switch (containerIndex) {
case ContainerEnum.Ipsec: {
ProtocolsModel.updateModel(config)
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageProtocolRaw)
2023-08-16 22:45:05 +05:00
break
}
2023-09-18 16:39:26 +05:00
case ContainerEnum.Dns: {
PageController.goToPage(PageEnum.PageServiceDnsSettings)
break
}
default: {
2023-09-18 16:39:26 +05:00
ProtocolsModel.updateModel(config)
PageController.goToPage(PageEnum.PageSettingsServerProtocol)
2023-08-16 22:45:05 +05:00
}
}
2023-08-16 22:45:05 +05:00
} else {
ContainersModel.setProcessedContainerIndex(root.model.mapToSource(index))
2023-08-16 22:45:05 +05:00
InstallController.setShouldCreateServer(false)
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings)
}
}
2023-08-16 22:45:05 +05:00
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
enabled: false
}
}
2023-08-16 22:45:05 +05:00
DividerType {}
}
}
}