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

116 lines
4.4 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
interactive: false
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 {
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.setCurrentlyProcessedContainerIndex(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.OpenVpn: {
OpenVpnConfigModel.updateModel(config)
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageProtocolOpenVpnSettings)
2023-08-16 22:45:05 +05:00
break
}
case ContainerEnum.WireGuard: {
ProtocolsModel.updateModel(config)
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageProtocolRaw)
2023-08-16 22:45:05 +05:00
// WireGuardConfigModel.updateModel(config)
// goToPage(PageEnum.PageProtocolWireGuardSettings)
break
}
case ContainerEnum.AmneziaWireGuard: {
AmneziaWireGuardConfigModel.updateModel(config)
PageController.goToPage(PageEnum.PageProtocolAmneziaWireGuardSettings)
break
}
2023-08-16 22:45:05 +05:00
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
// Ikev2ConfigModel.updateModel(config)
// goToPage(PageEnum.PageProtocolIKev2Settings)
break
}
case ContainerEnum.Sftp: {
SftpConfigModel.updateModel(config)
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageServiceSftpSettings)
2023-08-16 22:45:05 +05:00
break
}
case ContainerEnum.TorWebSite: {
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageServiceTorWebsiteSettings)
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: { // go to the settings page of the container with multiple protocols
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.setCurrentlyProcessedContainerIndex(root.model.mapToSource(index))
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 {}
}
}
}