amnezia-client/client/ui/qml/Pages2/PageSettingsConnection.qml
Cyril Anisimov 7d187bf881 replace FlickableType and ListView with
`ListViewType`
2025-06-17 09:28:56 +02:00

152 lines
4 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import PageEnum 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Config"
PageType {
id: root
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
}
ListViewType {
id: listView
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
header: ColumnLayout {
width: listView.width
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 {
width: listView.width
SwitcherType {
id: amneziaDnsSwitch
Layout.fillWidth: true
Layout.margins: 16
text: qsTr("Use AmneziaDNS")
descriptionText: qsTr("If AmneziaDNS is installed on the server")
checked: SettingsController.isAmneziaDnsEnabled()
onCheckedChanged: {
if (checked !== SettingsController.isAmneziaDnsEnabled()) {
SettingsController.toggleAmneziaDns(checked)
}
}
}
DividerType {}
LabelWithButtonType {
id: dnsServersButton
Layout.fillWidth: true
text: qsTr("DNS servers")
descriptionText: qsTr("When AmneziaDNS is not used or installed")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
PageController.goToPage(PageEnum.PageSettingsDns)
}
}
DividerType {}
LabelWithButtonType {
id: splitTunnelingButton
Layout.fillWidth: true
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() {
PageController.goToPage(PageEnum.PageSettingsSplitTunneling)
}
}
DividerType {}
}
footer: ColumnLayout {
width: listView.width
LabelWithButtonType {
id: splitTunnelingButton2
visible: root.isAppSplitTinnelingEnabled
Layout.fillWidth: true
text: qsTr("App-based split tunneling")
descriptionText: qsTr("Allows you to use the VPN only for certain Apps")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
PageController.goToPage(PageEnum.PageSettingsAppSplitTunneling)
}
}
DividerType {
visible: root.isAppSplitTinnelingEnabled
}
LabelWithButtonType {
id: killSwitchButton
visible: !GC.isMobile()
Layout.fillWidth: true
text: qsTr("KillSwitch")
descriptionText: qsTr("Blocks network connections without VPN")
rightImageSource: "qrc:/images/controls/chevron-right.svg"
parentFlickable: fl
clickedFunction: function() {
PageController.goToPage(PageEnum.PageSettingsKillSwitch)
}
}
DividerType {
visible: GC.isDesktop()
}
}
}
}