2023-05-06 06:52:23 +03:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
2025-01-07 06:38:32 +03:00
|
|
|
import Qt5Compat.GraphicalEffects
|
2023-05-06 06:52:23 +03:00
|
|
|
|
2023-05-11 14:50:50 +08:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
2023-05-06 06:52:23 +03:00
|
|
|
import PageEnum 1.0
|
2023-05-11 14:50:50 +08:00
|
|
|
import ProtocolEnum 1.0
|
2023-05-22 00:10:51 +08:00
|
|
|
import ContainerProps 1.0
|
2023-06-23 15:24:40 +09:00
|
|
|
import ContainersModelFilters 1.0
|
2024-07-07 13:42:38 +03:00
|
|
|
import Style 1.0
|
2023-05-06 06:52:23 +03:00
|
|
|
|
|
|
|
|
import "./"
|
|
|
|
|
import "../Controls2"
|
|
|
|
|
import "../Controls2/TextTypes"
|
|
|
|
|
import "../Config"
|
2023-05-12 23:54:31 +08:00
|
|
|
import "../Components"
|
2023-05-06 06:52:23 +03:00
|
|
|
|
2023-05-25 15:40:17 +08:00
|
|
|
PageType {
|
2023-05-06 06:52:23 +03:00
|
|
|
id: root
|
|
|
|
|
|
2025-11-11 17:03:27 +03:00
|
|
|
Connections {
|
|
|
|
|
target: Qt.application
|
|
|
|
|
|
|
|
|
|
function onStateChanged() {
|
|
|
|
|
if (Qt.application.state !== Qt.ApplicationActive) {
|
|
|
|
|
if (drawer.isOpened) {
|
|
|
|
|
drawer.closeTriggered()
|
|
|
|
|
}
|
|
|
|
|
if (homeSplitTunnelingDrawer.isOpened) {
|
|
|
|
|
homeSplitTunnelingDrawer.closeTriggered()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-05 13:56:00 +05:00
|
|
|
Connections {
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "pageControllerConnections"
|
|
|
|
|
|
2023-10-05 13:56:00 +05:00
|
|
|
target: PageController
|
|
|
|
|
|
|
|
|
|
function onRestorePageHomeState(isContainerInstalled) {
|
2024-12-31 04:16:52 +01:00
|
|
|
drawer.openTriggered()
|
2023-10-05 13:56:00 +05:00
|
|
|
if (isContainerInstalled) {
|
2023-10-23 21:30:30 +05:00
|
|
|
containersDropDown.rootButtonClickedFunction()
|
2023-10-05 13:56:00 +05:00
|
|
|
}
|
|
|
|
|
}
|
2023-10-03 18:49:54 +05:00
|
|
|
}
|
|
|
|
|
|
2025-05-13 12:29:33 +08:00
|
|
|
|
2023-09-06 13:37:37 +05:00
|
|
|
Item {
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "homeColumnItem"
|
|
|
|
|
|
2023-10-01 20:35:05 -04:00
|
|
|
anchors.fill: parent
|
2024-02-16 15:24:06 +05:00
|
|
|
anchors.bottomMargin: drawer.collapsedHeight
|
2023-09-06 13:37:37 +05:00
|
|
|
|
2024-03-20 21:22:29 +07:00
|
|
|
ColumnLayout {
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "homeColumnLayout"
|
|
|
|
|
|
2024-03-20 21:22:29 +07:00
|
|
|
anchors.fill: parent
|
2025-11-04 11:43:36 +08:00
|
|
|
anchors.topMargin: 12 + SettingsController.safeAreaTopMargin
|
2025-01-07 06:38:32 +03:00
|
|
|
anchors.bottomMargin: 16
|
|
|
|
|
|
2024-03-20 21:22:29 +07:00
|
|
|
BasicButtonType {
|
2024-04-18 17:54:55 +04:00
|
|
|
id: loggingButton
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "loggingButton"
|
|
|
|
|
|
2024-03-20 21:22:29 +07:00
|
|
|
property bool isLoggingEnabled: SettingsController.isLoggingEnabled
|
2024-02-21 18:27:27 +07:00
|
|
|
|
2024-03-20 21:22:29 +07:00
|
|
|
Layout.alignment: Qt.AlignHCenter
|
2024-02-21 18:27:27 +07:00
|
|
|
|
2024-03-20 21:22:29 +07:00
|
|
|
implicitHeight: 36
|
2024-02-21 18:27:27 +07: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.mutedGray
|
2024-03-20 21:22:29 +07:00
|
|
|
borderWidth: 0
|
2024-02-21 18:27:27 +07:00
|
|
|
|
2024-03-20 21:22:29 +07:00
|
|
|
visible: isLoggingEnabled ? true : false
|
|
|
|
|
text: qsTr("Logging enabled")
|
2024-02-21 18:27:27 +07:00
|
|
|
|
2025-08-01 05:56:02 +02:00
|
|
|
Keys.onEnterPressed: this.clicked()
|
|
|
|
|
Keys.onReturnPressed: this.clicked()
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-03-20 21:22:29 +07:00
|
|
|
onClicked: {
|
|
|
|
|
PageController.goToPage(PageEnum.PageSettingsLogging)
|
|
|
|
|
}
|
2024-02-21 18:27:27 +07:00
|
|
|
}
|
|
|
|
|
|
2025-10-07 23:15:06 +08:00
|
|
|
BasicButtonType {
|
|
|
|
|
id: devGatewayButton
|
|
|
|
|
objectName: "devGatewayButton"
|
|
|
|
|
|
|
|
|
|
property bool isDevGatewayEnabled: SettingsController.isDevGatewayEnv
|
|
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
|
|
|
|
|
|
implicitHeight: 36
|
|
|
|
|
|
|
|
|
|
defaultColor: AmneziaStyle.color.transparent
|
|
|
|
|
hoveredColor: AmneziaStyle.color.translucentWhite
|
|
|
|
|
pressedColor: AmneziaStyle.color.sheerWhite
|
|
|
|
|
disabledColor: AmneziaStyle.color.mutedGray
|
|
|
|
|
textColor: AmneziaStyle.color.mutedGray
|
|
|
|
|
borderWidth: 0
|
|
|
|
|
|
|
|
|
|
visible: SettingsController.isDevModeEnabled && isDevGatewayEnabled
|
|
|
|
|
text: qsTr("Dev gateway enabled")
|
|
|
|
|
|
|
|
|
|
Keys.onEnterPressed: this.clicked()
|
|
|
|
|
Keys.onReturnPressed: this.clicked()
|
|
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
|
PageController.goToPage(PageEnum.PageDevMenu)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-20 21:22:29 +07:00
|
|
|
ConnectButton {
|
|
|
|
|
id: connectButton
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "connectButton"
|
|
|
|
|
|
2024-03-25 21:52:38 +05:00
|
|
|
Layout.fillHeight: true
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
2024-03-20 21:22:29 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BasicButtonType {
|
2024-04-18 17:54:55 +04:00
|
|
|
id: splitTunnelingButton
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "splitTunnelingButton"
|
2024-07-11 16:36:24 +07:00
|
|
|
|
2024-03-25 21:52:38 +05:00
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
2024-03-20 21:22:29 +07:00
|
|
|
leftPadding: 16
|
|
|
|
|
rightPadding: 16
|
|
|
|
|
|
|
|
|
|
implicitHeight: 36
|
|
|
|
|
|
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.mutedGray
|
2024-03-20 21:22:29 +07:00
|
|
|
borderWidth: 0
|
|
|
|
|
|
2024-07-11 16:36:24 +07:00
|
|
|
buttonTextLabel.lineHeight: 20
|
|
|
|
|
buttonTextLabel.font.pixelSize: 14
|
|
|
|
|
buttonTextLabel.font.weight: 500
|
|
|
|
|
|
2024-04-01 17:07:33 +05:00
|
|
|
property bool isSplitTunnelingEnabled: SitesModel.isTunnelingEnabled || AppSplitTunnelingModel.isTunnelingEnabled ||
|
2024-08-20 16:54:05 +07:00
|
|
|
ServersModel.isDefaultServerDefaultContainerHasSplitTunneling
|
2024-03-20 21:22:29 +07:00
|
|
|
|
|
|
|
|
text: isSplitTunnelingEnabled ? qsTr("Split tunneling enabled") : qsTr("Split tunneling disabled")
|
|
|
|
|
|
2024-11-12 10:22:34 +04:00
|
|
|
leftImageSource: isSplitTunnelingEnabled ? "qrc:/images/controls/split-tunneling.svg" : ""
|
2024-12-19 10:36:20 +03:00
|
|
|
leftImageColor: ""
|
2024-03-20 21:22:29 +07:00
|
|
|
rightImageSource: "qrc:/images/controls/chevron-down.svg"
|
|
|
|
|
|
2025-08-01 05:56:02 +02:00
|
|
|
Keys.onEnterPressed: this.clicked()
|
|
|
|
|
Keys.onReturnPressed: this.clicked()
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-03-20 21:22:29 +07:00
|
|
|
onClicked: {
|
2024-12-31 04:16:52 +01:00
|
|
|
homeSplitTunnelingDrawer.openTriggered()
|
2024-03-20 21:22:29 +07:00
|
|
|
}
|
2024-02-21 18:27:27 +07:00
|
|
|
|
2024-03-20 21:22:29 +07:00
|
|
|
HomeSplitTunnelingDrawer {
|
|
|
|
|
id: homeSplitTunnelingDrawer
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "homeSplitTunnelingDrawer"
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
parent: root
|
2024-03-20 21:22:29 +07:00
|
|
|
}
|
2024-02-21 18:27:27 +07:00
|
|
|
}
|
2025-11-03 10:26:22 +08:00
|
|
|
|
|
|
|
|
AdLabel {
|
|
|
|
|
id: adLabel
|
|
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: adLabel.contentHeight
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.rightMargin: 16
|
|
|
|
|
Layout.topMargin: 22
|
|
|
|
|
}
|
2024-02-21 18:27:27 +07:00
|
|
|
}
|
2023-05-12 23:54:31 +08:00
|
|
|
}
|
|
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
DrawerType2 {
|
|
|
|
|
id: drawer
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "drawerProtocol"
|
|
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
anchors.fill: parent
|
2023-10-21 14:17:45 +01:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
collapsedStateContent: Item {
|
|
|
|
|
objectName: "ProtocolDrawerCollapsedContent"
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
implicitHeight: Qt.platform.os !== "ios" ? root.height * 0.9 : screen.height * 0.77
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
|
drawer.expandedHeight = implicitHeight
|
2023-10-21 14:17:45 +01:00
|
|
|
}
|
2024-12-31 04:16:52 +01:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
ColumnLayout {
|
|
|
|
|
id: collapsed
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "collapsedColumnLayout"
|
2023-10-21 14:17:45 +01:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.right: parent.right
|
2024-11-12 10:22:34 +04:00
|
|
|
spacing: 0
|
2023-10-21 14:17:45 +01:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
Component.onCompleted: {
|
|
|
|
|
drawer.collapsedHeight = collapsed.implicitHeight
|
|
|
|
|
}
|
2023-05-06 06:52:23 +03:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
DividerType {
|
|
|
|
|
Layout.topMargin: 10
|
|
|
|
|
Layout.fillWidth: false
|
|
|
|
|
Layout.preferredWidth: 20
|
|
|
|
|
Layout.preferredHeight: 2
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
|
|
|
|
}
|
2023-10-01 20:35:05 -04:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
RowLayout {
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "rowLayout"
|
|
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
Layout.topMargin: 14
|
|
|
|
|
Layout.leftMargin: 24
|
|
|
|
|
Layout.rightMargin: 24
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
|
|
|
|
|
|
|
|
|
spacing: 0
|
2023-05-06 06:52:23 +03:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
Connections {
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "drawerConnections"
|
|
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
target: drawer
|
2024-12-31 04:16:52 +01:00
|
|
|
function onCursorEntered() {
|
|
|
|
|
if (drawer.isCollapsedStateActive) {
|
2024-03-30 16:10:37 +05:00
|
|
|
collapsedButtonChevron.backgroundColor = collapsedButtonChevron.hoveredColor
|
|
|
|
|
collapsedButtonHeader.opacity = 0.8
|
|
|
|
|
} else {
|
|
|
|
|
collapsedButtonHeader.opacity = 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
function onCursorExited() {
|
|
|
|
|
if (drawer.isCollapsedStateActive) {
|
2024-03-30 16:10:37 +05:00
|
|
|
collapsedButtonChevron.backgroundColor = collapsedButtonChevron.defaultColor
|
|
|
|
|
collapsedButtonHeader.opacity = 1
|
|
|
|
|
} else {
|
|
|
|
|
collapsedButtonHeader.opacity = 1
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onPressed(pressed, entered) {
|
2024-12-31 04:16:52 +01:00
|
|
|
if (drawer.isCollapsedStateActive) {
|
2024-03-30 16:10:37 +05:00
|
|
|
collapsedButtonChevron.backgroundColor = pressed ? collapsedButtonChevron.pressedColor : entered ? collapsedButtonChevron.hoveredColor : collapsedButtonChevron.defaultColor
|
|
|
|
|
collapsedButtonHeader.opacity = 0.7
|
|
|
|
|
} else {
|
|
|
|
|
collapsedButtonHeader.opacity = 1
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
}
|
2023-08-26 10:08:50 +03:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
Header1TextType {
|
|
|
|
|
id: collapsedButtonHeader
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "collapsedButtonHeader"
|
|
|
|
|
|
2024-04-03 13:02:31 +05:00
|
|
|
Layout.maximumWidth: drawer.width - 48 - 18 - 12
|
2023-05-06 06:52:23 +03:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
maximumLineCount: 2
|
|
|
|
|
elide: Qt.ElideRight
|
2023-10-19 09:27:39 +08:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
text: ServersModel.defaultServerName
|
|
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
2023-10-19 09:27:39 +08:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
Behavior on opacity {
|
|
|
|
|
PropertyAnimation { duration: 200 }
|
|
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
}
|
2023-10-19 09:27:39 +08:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
ImageButtonType {
|
|
|
|
|
id: collapsedButtonChevron
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "collapsedButtonChevron"
|
2023-10-19 09:27:39 +08:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
Layout.leftMargin: 8
|
2023-10-19 09:27:39 +08:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
visible: drawer.isCollapsedStateActive()
|
2023-10-19 09:27:39 +08:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
hoverEnabled: false
|
|
|
|
|
image: "qrc:/images/controls/chevron-down.svg"
|
2024-08-20 16:54:05 +07:00
|
|
|
imageColor: AmneziaStyle.color.paleGray
|
2023-10-19 09:27:39 +08:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
icon.width: 18
|
|
|
|
|
icon.height: 18
|
|
|
|
|
backgroundRadius: 16
|
|
|
|
|
horizontalPadding: 4
|
|
|
|
|
topPadding: 4
|
|
|
|
|
bottomPadding: 3
|
|
|
|
|
|
2025-08-01 05:56:02 +02:00
|
|
|
Keys.onEnterPressed: this.clicked()
|
|
|
|
|
Keys.onReturnPressed: this.clicked()
|
2024-04-18 17:54:55 +04:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
onClicked: {
|
2024-12-31 04:16:52 +01:00
|
|
|
if (drawer.isCollapsedStateActive()) {
|
|
|
|
|
drawer.openTriggered()
|
2024-03-30 16:10:37 +05:00
|
|
|
}
|
2024-02-16 15:24:06 +05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-19 09:27:39 +08:00
|
|
|
|
2024-08-20 16:54:05 +07:00
|
|
|
RowLayout {
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "rowLayoutLabel"
|
2024-03-30 16:10:37 +05:00
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
2024-11-12 10:22:34 +04:00
|
|
|
Layout.topMargin: 8
|
2025-01-08 09:12:55 +03:00
|
|
|
Layout.bottomMargin: drawer.isCollapsedStateActive ? 44 : ServersModel.isDefaultServerFromApi ? 61 : 16
|
2024-08-20 16:54:05 +07:00
|
|
|
spacing: 0
|
|
|
|
|
|
2024-11-12 10:22:34 +04:00
|
|
|
BasicButtonType {
|
2025-01-08 09:12:55 +03:00
|
|
|
enabled: (ServersModel.defaultServerImagePathCollapsed !== "") && drawer.isCollapsedStateActive
|
2024-11-12 10:22:34 +04:00
|
|
|
hoverEnabled: enabled
|
|
|
|
|
|
|
|
|
|
implicitHeight: 36
|
|
|
|
|
|
|
|
|
|
leftPadding: 16
|
|
|
|
|
rightPadding: 16
|
|
|
|
|
|
|
|
|
|
defaultColor: AmneziaStyle.color.transparent
|
|
|
|
|
hoveredColor: AmneziaStyle.color.translucentWhite
|
|
|
|
|
pressedColor: AmneziaStyle.color.sheerWhite
|
|
|
|
|
disabledColor: AmneziaStyle.color.transparent
|
|
|
|
|
textColor: AmneziaStyle.color.mutedGray
|
|
|
|
|
|
|
|
|
|
buttonTextLabel.lineHeight: 16
|
|
|
|
|
buttonTextLabel.font.pixelSize: 13
|
|
|
|
|
buttonTextLabel.font.weight: 400
|
2024-08-20 16:54:05 +07:00
|
|
|
|
2025-01-08 09:12:55 +03:00
|
|
|
text: drawer.isCollapsedStateActive ? ServersModel.defaultServerDescriptionCollapsed : ServersModel.defaultServerDescriptionExpanded
|
2024-11-12 10:22:34 +04:00
|
|
|
leftImageSource: ServersModel.defaultServerImagePathCollapsed
|
2025-01-08 09:12:55 +03:00
|
|
|
leftImageColor: ""
|
2024-11-12 10:22:34 +04:00
|
|
|
changeLeftImageSize: false
|
|
|
|
|
|
|
|
|
|
rightImageSource: hoverEnabled ? "qrc:/images/controls/chevron-down.svg" : ""
|
|
|
|
|
|
2025-08-01 05:56:02 +02:00
|
|
|
Keys.onEnterPressed: this.clicked()
|
|
|
|
|
Keys.onReturnPressed: this.clicked()
|
|
|
|
|
|
2024-11-12 10:22:34 +04:00
|
|
|
onClicked: {
|
|
|
|
|
ServersModel.processedIndex = ServersModel.defaultIndex
|
2025-01-31 10:06:35 +07:00
|
|
|
|
|
|
|
|
if (ServersModel.getProcessedServerData("isServerFromGatewayApi")) {
|
|
|
|
|
if (ServersModel.getProcessedServerData("isCountrySelectionAvailable")) {
|
|
|
|
|
PageController.goToPage(PageEnum.PageSettingsApiAvailableCountries)
|
|
|
|
|
} else {
|
2025-02-07 22:22:14 +07:00
|
|
|
PageController.showBusyIndicator(true)
|
2025-02-22 14:42:09 +07:00
|
|
|
let result = ApiSettingsController.getAccountInfo(false)
|
2025-02-07 22:22:14 +07:00
|
|
|
PageController.showBusyIndicator(false)
|
2025-02-10 15:10:59 +07:00
|
|
|
if (!result) {
|
|
|
|
|
return
|
|
|
|
|
}
|
2025-02-07 22:22:14 +07:00
|
|
|
|
2025-01-31 10:06:35 +07:00
|
|
|
PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
PageController.goToPage(PageEnum.PageSettingsServerInfo)
|
|
|
|
|
}
|
2024-11-12 10:22:34 +04:00
|
|
|
}
|
2024-08-20 16:54:05 +07:00
|
|
|
}
|
2024-03-30 16:10:37 +05:00
|
|
|
}
|
2023-10-21 14:17:45 +01:00
|
|
|
}
|
2023-10-19 09:27:39 +08:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
ColumnLayout {
|
|
|
|
|
id: serversMenuHeader
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "serversMenuHeader"
|
2023-10-19 09:27:39 +08:00
|
|
|
|
2024-03-30 16:10:37 +05:00
|
|
|
anchors.top: collapsed.bottom
|
2024-02-16 15:24:06 +05:00
|
|
|
anchors.right: parent.right
|
|
|
|
|
anchors.left: parent.left
|
2023-10-19 11:22:52 +08:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
RowLayout {
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
|
|
|
|
spacing: 8
|
|
|
|
|
|
2024-02-21 22:57:15 +05:00
|
|
|
visible: !ServersModel.isDefaultServerFromApi
|
|
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
DropDownType {
|
|
|
|
|
id: containersDropDown
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "containersDropDown"
|
2024-02-16 15:24:06 +05:00
|
|
|
|
2024-08-20 16:54:05 +07:00
|
|
|
rootButtonImageColor: AmneziaStyle.color.midnightBlack
|
|
|
|
|
rootButtonBackgroundColor: AmneziaStyle.color.paleGray
|
2024-11-06 09:57:39 +04:00
|
|
|
rootButtonBackgroundHoveredColor: AmneziaStyle.color.mistyGray
|
|
|
|
|
rootButtonBackgroundPressedColor: AmneziaStyle.color.cloudyGray
|
2024-07-07 13:42:38 +03:00
|
|
|
rootButtonHoveredBorderColor: AmneziaStyle.color.transparent
|
|
|
|
|
rootButtonDefaultBorderColor: AmneziaStyle.color.transparent
|
2024-02-16 15:24:06 +05:00
|
|
|
rootButtonTextTopMargin: 8
|
|
|
|
|
rootButtonTextBottomMargin: 8
|
|
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
enabled: drawer.isOpened
|
|
|
|
|
|
2024-02-19 19:54:15 +05:00
|
|
|
text: ServersModel.defaultServerDefaultContainerName
|
2024-08-20 16:54:05 +07:00
|
|
|
textColor: AmneziaStyle.color.midnightBlack
|
2024-02-16 15:24:06 +05:00
|
|
|
headerText: qsTr("VPN protocol")
|
|
|
|
|
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
|
|
|
|
|
|
|
|
|
|
rootButtonClickedFunction: function() {
|
2024-12-31 04:16:52 +01:00
|
|
|
containersDropDown.openTriggered()
|
2024-02-16 15:24:06 +05:00
|
|
|
}
|
2023-05-06 06:52:23 +03:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
drawerParent: root
|
2023-05-06 06:52:23 +03:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
listView: HomeContainersListView {
|
2024-04-18 17:54:55 +04:00
|
|
|
id: containersListView
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "containersListView"
|
|
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
rootWidth: root.width
|
2023-05-17 23:28:27 +08:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
Connections {
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "rowLayoutConnections"
|
|
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
target: ServersModel
|
2023-05-11 14:50:50 +08:00
|
|
|
|
2024-02-19 19:54:15 +05:00
|
|
|
function onDefaultServerIndexChanged() {
|
2024-02-16 15:24:06 +05:00
|
|
|
updateContainersModelFilters()
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-21 20:56:00 +09:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
function updateContainersModelFilters() {
|
2024-02-19 19:54:15 +05:00
|
|
|
if (ServersModel.isDefaultServerHasWriteAccess()) {
|
|
|
|
|
proxyDefaultServerContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
|
2024-02-16 15:24:06 +05:00
|
|
|
} else {
|
2024-02-19 19:54:15 +05:00
|
|
|
proxyDefaultServerContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
|
2024-02-16 15:24:06 +05:00
|
|
|
}
|
2023-06-21 20:56:00 +09:00
|
|
|
}
|
|
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
model: SortFilterProxyModel {
|
2024-02-19 19:54:15 +05:00
|
|
|
id: proxyDefaultServerContainersModel
|
|
|
|
|
sourceModel: DefaultServerContainersModel
|
2024-03-04 02:28:10 +03:00
|
|
|
|
2024-02-18 13:24:21 +05:00
|
|
|
sorters: [
|
|
|
|
|
RoleSorter { roleName: "isInstalled"; sortOrder: Qt.DescendingOrder }
|
|
|
|
|
]
|
2023-06-23 15:24:40 +09:00
|
|
|
}
|
2023-06-21 20:56:00 +09:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
Component.onCompleted: updateContainersModelFilters()
|
2023-06-07 13:17:48 +03:00
|
|
|
}
|
2023-05-11 14:50:50 +08:00
|
|
|
}
|
2023-05-06 06:52:23 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
Header2Type {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.topMargin: 48
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.rightMargin: 16
|
2023-05-06 06:52:23 +03:00
|
|
|
|
2024-02-16 15:24:06 +05:00
|
|
|
headerText: qsTr("Servers")
|
|
|
|
|
}
|
2023-10-01 20:35:05 -04:00
|
|
|
}
|
|
|
|
|
|
2024-03-25 22:30:44 +05:00
|
|
|
ButtonGroup {
|
|
|
|
|
id: serversRadioButtonGroup
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "serversRadioButtonGroup"
|
2024-03-25 22:30:44 +05:00
|
|
|
}
|
|
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
ServersListView {
|
2024-03-25 22:30:44 +05:00
|
|
|
id: serversMenuContent
|
2024-12-31 04:16:52 +01:00
|
|
|
objectName: "serversMenuContent"
|
2023-05-06 06:52:23 +03:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
isFocusable: false
|
2023-05-06 06:52:23 +03:00
|
|
|
|
2024-04-18 17:54:55 +04:00
|
|
|
Connections {
|
|
|
|
|
target: drawer
|
2023-05-06 06:52:23 +03:00
|
|
|
|
2024-12-31 04:16:52 +01:00
|
|
|
// this item shouldn't be focused when drawer is closed
|
|
|
|
|
function onIsOpenedChanged() {
|
|
|
|
|
serversMenuContent.isFocusable = drawer.isOpened
|
2023-05-06 06:52:23 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|