Files
amnezia-client/client/ui/qml/Pages2/PageSettingsConnection.qml
T

157 lines
4.3 KiB
QML
Raw Normal View History

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import PageEnum 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Config"
PageType {
id: root
2024-04-01 18:45:00 +07:00
property bool isAppSplitTinnelingEnabled: Qt.platform.os === "windows" || Qt.platform.os === "android"
BackButtonType {
id: backButton
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
listView.positionViewAtBeginning()
}
}
}
ListViewType {
id: listView
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
header: ColumnLayout {
width: listView.width
2025-05-02 23:54:36 -07:00
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Connection")
}
}
model: 1 // fake model to force the ListView to be created without a model
delegate: ColumnLayout { // TODO(CyAn84): add DelegateChooser when have migrated to 6.9
width: listView.width
SwitcherType {
2024-04-18 17:54:55 +04:00
id: amneziaDnsSwitch
Layout.fillWidth: true
2023-08-24 14:53:52 +05:00
Layout.margins: 16
2023-10-04 15:48:35 +08:00
text: qsTr("Use AmneziaDNS")
descriptionText: qsTr("If AmneziaDNS is installed on the server")
checked: SettingsController.isAmneziaDnsEnabled()
2025-08-20 13:01:09 +08:00
onToggled: function() {
if (checked !== SettingsController.isAmneziaDnsEnabled()) {
2023-08-08 19:10:14 +05:00
SettingsController.toggleAmneziaDns(checked)
}
}
}
DividerType {}
LabelWithButtonType {
2024-04-18 17:54:55 +04:00
id: dnsServersButton
Layout.fillWidth: true
text: qsTr("DNS servers")
2024-01-30 20:27:01 +02:00
descriptionText: qsTr("When AmneziaDNS is not used or installed")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageSettingsDns)
}
}
DividerType {}
LabelWithButtonType {
2024-04-18 17:54:55 +04:00
id: splitTunnelingButton
Layout.fillWidth: true
2023-10-12 01:15:05 +01:00
text: qsTr("Site-based split tunneling")
descriptionText: qsTr("Allows you to select which sites you want to access through the VPN")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
2023-09-06 13:37:37 +05:00
PageController.goToPage(PageEnum.PageSettingsSplitTunneling)
}
}
2025-05-02 23:54:36 -07:00
DividerType {}
}
footer: ColumnLayout { // TODO(CyAn84): move to delegate,add DelegateChooser when have migrated to 6.9
width: listView.width
LabelWithButtonType {
2024-04-18 17:54:55 +04:00
id: splitTunnelingButton2
2024-04-01 18:45:00 +07:00
visible: root.isAppSplitTinnelingEnabled
Layout.fillWidth: true
2023-10-12 01:15:05 +01:00
text: qsTr("App-based split tunneling")
2024-01-30 20:27:01 +02:00
descriptionText: qsTr("Allows you to use the VPN only for certain Apps")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
2024-04-01 18:45:00 +07:00
PageController.goToPage(PageEnum.PageSettingsAppSplitTunneling)
}
}
DividerType {
2024-04-01 18:45:00 +07:00
visible: root.isAppSplitTinnelingEnabled
}
2024-04-25 20:01:00 +07:00
2025-05-02 23:54:36 -07:00
LabelWithButtonType {
id: killSwitchButton
visible: !GC.isMobile()
2024-04-25 20:01:00 +07:00
Layout.fillWidth: true
text: qsTr("KillSwitch")
2025-05-02 23:54:36 -07:00
descriptionText: qsTr("Blocks network connections without VPN")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
2024-04-25 20:01:00 +07:00
2025-05-02 23:54:36 -07:00
clickedFunction: function() {
PageController.goToPage(PageEnum.PageSettingsKillSwitch)
2024-04-25 20:01:00 +07:00
}
}
DividerType {
visible: GC.isDesktop()
}
}
}
}