2023-04-14 19:31:10 +03:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
2023-04-14 19:31:10 +03:00
|
|
|
import PageEnum 1.0
|
2023-05-22 00:10:51 +08:00
|
|
|
import ContainerProps 1.0
|
|
|
|
|
import ProtocolProps 1.0
|
2024-07-07 13:42:38 +03:00
|
|
|
import Style 1.0
|
2023-04-14 19:31:10 +03:00
|
|
|
|
|
|
|
|
import "./"
|
|
|
|
|
import "../Controls2"
|
|
|
|
|
import "../Config"
|
|
|
|
|
|
2023-05-25 15:40:17 +08:00
|
|
|
PageType {
|
2023-04-14 19:31:10 +03:00
|
|
|
id: root
|
|
|
|
|
|
2023-07-31 20:38:13 +09:00
|
|
|
property bool isEasySetup: true
|
|
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
SortFilterProxyModel {
|
|
|
|
|
id: proxyContainersModel
|
2025-08-06 04:35:51 +02:00
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
sourceModel: ContainersModel
|
|
|
|
|
filters: [
|
|
|
|
|
ValueFilter {
|
|
|
|
|
roleName: "isEasySetupContainer"
|
|
|
|
|
value: true
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
sorters: RoleSorter {
|
2023-09-18 21:06:10 +05:00
|
|
|
roleName: "easySetupOrder"
|
2023-05-22 00:10:51 +08:00
|
|
|
sortOrder: Qt.DescendingOrder
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
BackButtonType {
|
|
|
|
|
id: backButton
|
|
|
|
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
2025-11-04 11:43:36 +08:00
|
|
|
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
|
2025-08-06 04:35:51 +02:00
|
|
|
|
|
|
|
|
onActiveFocusChanged: {
|
|
|
|
|
if(backButton.enabled && backButton.activeFocus) {
|
|
|
|
|
listView.positionViewAtBeginning()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ButtonGroup {
|
|
|
|
|
id: buttonGroup
|
2023-06-05 15:49:10 +08:00
|
|
|
}
|
|
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
ListViewType {
|
|
|
|
|
id: listView
|
|
|
|
|
|
|
|
|
|
property int dockerContainer
|
|
|
|
|
property int containerDefaultPort
|
|
|
|
|
property int containerDefaultTransportProto
|
|
|
|
|
|
2023-06-05 15:49:10 +08:00
|
|
|
anchors.top: backButton.bottom
|
2023-06-20 10:25:24 +09:00
|
|
|
anchors.bottom: parent.bottom
|
2025-08-06 04:35:51 +02:00
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
spacing: 16
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
header: ColumnLayout {
|
|
|
|
|
width: listView.width
|
2023-04-14 19:31:10 +03:00
|
|
|
|
|
|
|
|
spacing: 16
|
|
|
|
|
|
2025-05-02 23:54:36 -07:00
|
|
|
BaseHeaderType {
|
2023-05-25 15:40:17 +08:00
|
|
|
id: header
|
|
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.rightMargin: 16
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.bottomMargin: 16
|
|
|
|
|
|
2023-10-02 16:31:50 +05:00
|
|
|
headerTextMaximumLineCount: 10
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2025-02-04 15:53:40 +00:00
|
|
|
headerText: qsTr("Choose Installation Type")
|
2023-04-14 19:31:10 +03:00
|
|
|
}
|
2025-08-06 04:35:51 +02:00
|
|
|
}
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
model: proxyContainersModel
|
|
|
|
|
currentIndex: 0
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
delegate: ColumnLayout {
|
|
|
|
|
width: listView.width
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
CardType {
|
|
|
|
|
id: card
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.rightMargin: 16
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.bottomMargin: 16
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
headerText: easySetupHeader
|
|
|
|
|
bodyText: easySetupDescription
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
ButtonGroup.group: buttonGroup
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
onClicked: function() {
|
|
|
|
|
isEasySetup = true
|
2026-01-30 06:42:29 +02:00
|
|
|
checked = true
|
2025-08-06 04:35:51 +02:00
|
|
|
var defaultContainerProto = ContainerProps.defaultProtocol(dockerContainer)
|
2025-08-01 05:56:02 +02:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
listView.dockerContainer = dockerContainer
|
|
|
|
|
listView.containerDefaultPort = ProtocolProps.getPortForInstall(defaultContainerProto)
|
|
|
|
|
listView.containerDefaultTransportProto = ProtocolProps.defaultTransportProto(defaultContainerProto)
|
2024-01-20 23:28:20 +07:00
|
|
|
}
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
Keys.onReturnPressed: this.clicked()
|
|
|
|
|
Keys.onEnterPressed: this.clicked()
|
2023-07-31 20:38:13 +09:00
|
|
|
}
|
2025-08-06 04:35:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
footer: ColumnLayout {
|
|
|
|
|
width: listView.width
|
|
|
|
|
spacing: 16
|
2023-07-31 20:38:13 +09:00
|
|
|
|
2023-08-28 14:18:41 +03:00
|
|
|
DividerType {
|
2025-08-06 04:35:51 +02:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.rightMargin: 16
|
2023-08-28 14:18:41 +03:00
|
|
|
}
|
2023-08-20 13:36:54 +05:00
|
|
|
|
2023-07-31 20:38:13 +09:00
|
|
|
CardType {
|
2025-08-06 04:35:51 +02:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.rightMargin: 16
|
2023-07-31 20:38:13 +09:00
|
|
|
|
2025-02-04 15:53:40 +00:00
|
|
|
headerText: qsTr("Manual")
|
|
|
|
|
bodyText: qsTr("Choose a VPN protocol")
|
2023-07-31 20:38:13 +09:00
|
|
|
|
|
|
|
|
ButtonGroup.group: buttonGroup
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2023-07-31 20:38:13 +09:00
|
|
|
onClicked: function() {
|
|
|
|
|
isEasySetup = false
|
2025-08-06 04:35:51 +02:00
|
|
|
checked = true
|
2023-05-22 00:10:51 +08:00
|
|
|
}
|
2025-08-01 05:56:02 +02:00
|
|
|
|
|
|
|
|
Keys.onEnterPressed: this.clicked()
|
|
|
|
|
Keys.onReturnPressed: this.clicked()
|
2023-04-14 19:31:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BasicButtonType {
|
2023-06-05 15:49:10 +08:00
|
|
|
id: continueButton
|
2023-05-25 15:40:17 +08:00
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.rightMargin: 16
|
2023-05-22 00:10:51 +08:00
|
|
|
|
|
|
|
|
text: qsTr("Continue")
|
|
|
|
|
|
2024-02-17 23:09:05 +02:00
|
|
|
clickedFunc: function() {
|
2023-07-31 20:38:13 +09:00
|
|
|
if (root.isEasySetup) {
|
2025-08-06 04:35:51 +02:00
|
|
|
ContainersModel.setProcessedContainerIndex(listView.dockerContainer)
|
2023-09-06 13:37:37 +05:00
|
|
|
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
|
2025-08-06 04:35:51 +02:00
|
|
|
InstallController.install(listView.dockerContainer,
|
|
|
|
|
listView.containerDefaultPort,
|
|
|
|
|
listView.containerDefaultTransportProto)
|
2023-07-31 20:38:13 +09:00
|
|
|
} else {
|
2023-09-06 13:37:37 +05:00
|
|
|
PageController.goToPage(PageEnum.PageSetupWizardProtocols)
|
2023-07-31 20:38:13 +09:00
|
|
|
}
|
2023-05-22 00:10:51 +08:00
|
|
|
}
|
2023-04-14 19:31:10 +03:00
|
|
|
}
|
2023-08-20 13:36:54 +05:00
|
|
|
|
|
|
|
|
BasicButtonType {
|
2023-08-28 14:18:41 +03:00
|
|
|
id: setupLaterButton
|
|
|
|
|
|
2025-08-06 04:35:51 +02:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.topMargin: 8
|
|
|
|
|
Layout.bottomMargin: 24
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.rightMargin: 16
|
2023-08-20 13:36:54 +05:00
|
|
|
|
2024-07-07 13:42:38 +03:00
|
|
|
defaultColor: AmneziaStyle.color.transparent
|
2024-08-20 16:54:05 +07:00
|
|
|
hoveredColor: AmneziaStyle.color.translucentWhite
|
|
|
|
|
pressedColor: AmneziaStyle.color.sheerWhite
|
|
|
|
|
disabledColor: AmneziaStyle.color.mutedGray
|
|
|
|
|
textColor: AmneziaStyle.color.paleGray
|
2023-08-20 13:36:54 +05:00
|
|
|
borderWidth: 1
|
|
|
|
|
|
2023-10-01 12:11:13 +08:00
|
|
|
visible: {
|
2023-10-03 22:38:17 +05:00
|
|
|
if (PageController.isTriggeredByConnectButton()) {
|
2024-02-29 17:22:17 +07:00
|
|
|
PageController.setTriggeredByConnectButton(false)
|
|
|
|
|
return false
|
2023-10-01 12:11:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
}
|
2023-09-25 07:22:11 +08:00
|
|
|
|
2024-03-26 20:05:04 +02:00
|
|
|
text: qsTr("Skip setup")
|
2023-08-20 13:36:54 +05:00
|
|
|
|
2024-02-17 23:09:05 +02:00
|
|
|
clickedFunc: function() {
|
2023-09-06 13:37:37 +05:00
|
|
|
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
|
2023-08-20 13:36:54 +05:00
|
|
|
InstallController.addEmptyServer()
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-14 19:31:10 +03:00
|
|
|
}
|
2025-08-06 04:35:51 +02:00
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
var item = listView.itemAtIndex(listView.currentIndex)
|
|
|
|
|
if (item !== null) {
|
|
|
|
|
var button = item.children[0]
|
|
|
|
|
button.checked = true
|
|
|
|
|
button.clicked()
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-04-14 19:31:10 +03:00
|
|
|
}
|
|
|
|
|
}
|
2025-08-06 04:35:51 +02:00
|
|
|
|