2023-05-27 22:46:41 +08:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
|
|
|
|
import PageEnum 1.0
|
|
|
|
|
import ProtocolEnum 1.0
|
2023-07-13 11:29:26 +09:00
|
|
|
import ContainerEnum 1.0
|
2023-07-14 13:14:50 +09:00
|
|
|
import ContainerProps 1.0
|
2023-05-27 22:46:41 +08:00
|
|
|
|
|
|
|
|
import "../Controls2"
|
|
|
|
|
import "../Controls2/TextTypes"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
|
id: root
|
|
|
|
|
|
2023-06-01 11:25:33 +08:00
|
|
|
width: parent.width
|
2023-05-27 22:46:41 +08:00
|
|
|
height: root.contentItem.height
|
|
|
|
|
|
|
|
|
|
clip: true
|
2023-06-07 18:28:32 +08:00
|
|
|
interactive: false
|
2023-05-27 22:46:41 +08: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-05-27 22:46:41 +08:00
|
|
|
|
2023-08-16 22:45:05 +05:00
|
|
|
ColumnLayout {
|
|
|
|
|
id: delegateContent
|
2023-05-27 22:46:41 +08:00
|
|
|
|
2023-08-16 22:45:05 +05:00
|
|
|
anchors.fill: parent
|
2023-05-27 22:46:41 +08:00
|
|
|
|
2023-08-16 22:45:05 +05:00
|
|
|
LabelWithButtonType {
|
|
|
|
|
implicitWidth: parent.width
|
2023-05-27 22:46:41 +08:00
|
|
|
|
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-05-27 22:46:41 +08:00
|
|
|
|
2023-08-16 22:45:05 +05:00
|
|
|
clickedFunction: function() {
|
|
|
|
|
if (isInstalled) {
|
|
|
|
|
var containerIndex = root.model.mapToSource(index)
|
|
|
|
|
ContainersModel.setCurrentlyProcessedContainerIndex(containerIndex)
|
2023-05-27 22:46:41 +08:00
|
|
|
|
2023-08-16 22:45:05 +05:00
|
|
|
if (config[ContainerProps.containerTypeToString(containerIndex)]["isThirdPartyConfig"]) {
|
|
|
|
|
ProtocolsModel.updateModel(config)
|
2023-09-06 13:37:37 +05:00
|
|
|
PageController.goToPage(PageEnum.PageProtocolRaw)
|
2023-08-16 22:45:05 +05:00
|
|
|
return
|
|
|
|
|
}
|
2023-05-27 22:46:41 +08: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.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-05-27 22:46:41 +08:00
|
|
|
|
2023-08-16 22:45:05 +05:00
|
|
|
default: {
|
|
|
|
|
if (serviceType !== ProtocolEnum.Other) { //todo disable settings for dns container
|
|
|
|
|
ProtocolsModel.updateModel(config)
|
2023-09-06 13:37:37 +05:00
|
|
|
PageController.goToPage(PageEnum.PageSettingsServerProtocol)
|
2023-08-16 22:45:05 +05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-27 22:46:41 +08: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-05-27 22:46:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-16 22:45:05 +05:00
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
enabled: false
|
2023-05-27 22:46:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-16 22:45:05 +05:00
|
|
|
DividerType {}
|
2023-05-27 22:46:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|