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
|
|
|
|
|
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
|
|
|
|
|
anchors.topMargin: 20
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 19:31:10 +03:00
|
|
|
FlickableType {
|
|
|
|
|
id: fl
|
2023-06-05 15:49:10 +08:00
|
|
|
anchors.top: backButton.bottom
|
2023-06-20 10:25:24 +09:00
|
|
|
anchors.bottom: parent.bottom
|
2023-08-28 14:18:41 +03:00
|
|
|
contentHeight: content.implicitHeight + setupLaterButton.anchors.bottomMargin
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
Column {
|
2023-04-14 19:31:10 +03:00
|
|
|
id: content
|
|
|
|
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.rightMargin: 16
|
|
|
|
|
anchors.leftMargin: 16
|
|
|
|
|
|
|
|
|
|
spacing: 16
|
|
|
|
|
|
2025-05-02 23:54:36 -07:00
|
|
|
BaseHeaderType {
|
2023-05-25 15:40:17 +08:00
|
|
|
id: header
|
|
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
implicitWidth: parent.width
|
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
|
|
|
}
|
|
|
|
|
|
2023-07-31 20:38:13 +09:00
|
|
|
ButtonGroup {
|
|
|
|
|
id: buttonGroup
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
ListView {
|
|
|
|
|
id: containers
|
|
|
|
|
width: parent.width
|
|
|
|
|
height: containers.contentItem.height
|
|
|
|
|
spacing: 16
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2025-03-30 12:53:26 +07:00
|
|
|
currentIndex: 0
|
2023-05-22 00:10:51 +08:00
|
|
|
clip: true
|
|
|
|
|
interactive: false
|
|
|
|
|
model: proxyContainersModel
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
property int dockerContainer
|
|
|
|
|
property int containerDefaultPort
|
|
|
|
|
property int containerDefaultTransportProto
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
property bool isFocusable: true
|
|
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
delegate: Item {
|
|
|
|
|
implicitWidth: containers.width
|
|
|
|
|
implicitHeight: delegateContent.implicitHeight
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
ColumnLayout {
|
|
|
|
|
id: delegateContent
|
|
|
|
|
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
CardType {
|
|
|
|
|
id: card
|
2023-04-14 19:31:10 +03:00
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
headerText: easySetupHeader
|
|
|
|
|
bodyText: easySetupDescription
|
|
|
|
|
|
|
|
|
|
ButtonGroup.group: buttonGroup
|
|
|
|
|
|
|
|
|
|
onClicked: function() {
|
2023-07-31 20:38:13 +09:00
|
|
|
isEasySetup = true
|
2023-05-22 00:10:51 +08:00
|
|
|
var defaultContainerProto = ContainerProps.defaultProtocol(dockerContainer)
|
|
|
|
|
|
|
|
|
|
containers.dockerContainer = dockerContainer
|
2024-01-24 12:27:11 +07:00
|
|
|
containers.containerDefaultPort = ProtocolProps.getPortForInstall(defaultContainerProto)
|
2023-05-22 00:10:51 +08:00
|
|
|
containers.containerDefaultTransportProto = ProtocolProps.defaultTransportProto(defaultContainerProto)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-20 23:28:20 +07:00
|
|
|
}
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2024-01-20 23:28:20 +07:00
|
|
|
Component.onCompleted: {
|
|
|
|
|
var item = containers.itemAtIndex(containers.currentIndex)
|
|
|
|
|
if (item !== null) {
|
|
|
|
|
var button = item.children[0].children[0]
|
|
|
|
|
button.checked = true
|
|
|
|
|
button.clicked()
|
2023-05-22 00:10:51 +08:00
|
|
|
}
|
|
|
|
|
}
|
2023-07-31 20:38:13 +09:00
|
|
|
}
|
|
|
|
|
|
2023-08-28 14:18:41 +03:00
|
|
|
DividerType {
|
|
|
|
|
implicitWidth: parent.width
|
|
|
|
|
}
|
2023-08-20 13:36:54 +05:00
|
|
|
|
2023-07-31 20:38:13 +09:00
|
|
|
CardType {
|
|
|
|
|
implicitWidth: parent.width
|
|
|
|
|
|
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
|
2023-05-22 00:10:51 +08:00
|
|
|
}
|
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
|
|
|
|
2023-05-22 00:10:51 +08:00
|
|
|
implicitWidth: parent.width
|
|
|
|
|
|
|
|
|
|
text: qsTr("Continue")
|
2024-12-31 04:16:52 +01:00
|
|
|
|
2024-04-18 17:54:55 +04:00
|
|
|
parentFlickable: fl
|
2023-05-22 00:10:51 +08:00
|
|
|
|
2024-02-17 23:09:05 +02:00
|
|
|
clickedFunc: function() {
|
2023-07-31 20:38:13 +09:00
|
|
|
if (root.isEasySetup) {
|
2024-04-01 20:20:02 +07:00
|
|
|
ContainersModel.setProcessedContainerIndex(containers.dockerContainer)
|
2023-09-06 13:37:37 +05:00
|
|
|
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
|
2023-07-31 20:38:13 +09:00
|
|
|
InstallController.install(containers.dockerContainer,
|
|
|
|
|
containers.containerDefaultPort,
|
|
|
|
|
containers.containerDefaultTransportProto)
|
|
|
|
|
} 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
|
|
|
|
|
|
2023-08-20 13:36:54 +05:00
|
|
|
implicitWidth: parent.width
|
|
|
|
|
anchors.topMargin: 8
|
|
|
|
|
anchors.bottomMargin: 24
|
|
|
|
|
|
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
|
|
|
|
|
|
2024-04-18 17:54:55 +04:00
|
|
|
Keys.onTabPressed: lastItemTabClicked(focusItem)
|
|
|
|
|
parentFlickable: fl
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|