Files
amnezia-client/client/ui/qml/Pages/Protocols/PageProtoOpenVPN.qml
T

273 lines
7.8 KiB
QML
Raw Normal View History

2021-07-28 16:13:29 +07:00
import QtQuick 2.12
import QtQuick.Controls 2.12
2021-09-16 19:49:50 +03:00
import ProtocolEnum 1.0
2021-09-14 00:39:07 +03:00
import "../"
2021-09-06 12:30:26 +03:00
import "../../Controls"
import "../../Config"
2021-07-28 16:13:29 +07:00
2021-09-16 19:49:50 +03:00
PageProtocolBase {
2021-07-28 16:13:29 +07:00
id: root
2021-09-16 19:49:50 +03:00
protocol: ProtocolEnum.OpenVpn
logic: UiLogic.protocolLogic(protocol)
2021-09-14 00:39:07 +03:00
2021-09-08 15:09:16 +03:00
BackButton {
2021-07-28 16:13:29 +07:00
id: back
}
Item {
x: 0
y: 40
width: 380
height: 600
2021-09-19 14:31:38 +03:00
enabled: logic.pageEnabled
2021-07-28 16:13:29 +07:00
CheckBoxType {
x: 30
y: 280
width: 321
height: 21
text: qsTr("Auto-negotiate encryption")
2021-09-16 19:49:50 +03:00
checked: logic.checkBoxProtoOpenVpnAutoEncryptionChecked
2021-07-28 16:13:29 +07:00
onCheckedChanged: {
2021-09-16 19:49:50 +03:00
logic.checkBoxProtoOpenVpnAutoEncryptionChecked = checked
2021-07-28 16:13:29 +07:00
}
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-16 19:49:50 +03:00
logic.checkBoxProtoOpenVpnAutoEncryptionClicked()
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
CheckBoxType {
x: 30
y: 430
width: 321
height: 21
text: qsTr("Block DNS requests outside of VPN")
2021-09-16 19:49:50 +03:00
checked: logic.checkBoxProtoOpenVpnBlockDnsChecked
2021-07-28 16:13:29 +07:00
onCheckedChanged: {
2021-09-16 19:49:50 +03:00
logic.checkBoxProtoOpenVpnBlockDnsChecked = checked
2021-07-28 16:13:29 +07:00
}
}
CheckBoxType {
x: 30
y: 390
width: 321
height: 21
text: qsTr("Enable TLS auth")
2021-09-16 19:49:50 +03:00
checked: logic.checkBoxProtoOpenVpnTlsAuthChecked
2021-07-28 16:13:29 +07:00
onCheckedChanged: {
2021-09-16 19:49:50 +03:00
logic.checkBoxProtoOpenVpnTlsAuthChecked = checked
2021-07-28 16:13:29 +07:00
}
}
ComboBoxType {
x: 30
y: 340
width: 151
height: 31
model: [
qsTr("AES-256-GCM"),
qsTr("AES-192-GCM"),
qsTr("AES-128-GCM"),
qsTr("AES-256-CBC"),
qsTr("AES-192-CBC"),
qsTr("AES-128-CBC"),
qsTr("ChaCha20-Poly1305"),
qsTr("ARIA-256-CBC"),
qsTr("CAMELLIA-256-CBC"),
qsTr("none")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
2021-09-16 19:49:50 +03:00
if (logic.comboBoxProtoOpenVpnCipherText === model[i]) {
2021-07-28 16:13:29 +07:00
return i
}
}
return -1
}
onCurrentTextChanged: {
2021-09-16 19:49:50 +03:00
logic.comboBoxProtoOpenVpnCipherText = currentText
2021-07-28 16:13:29 +07:00
}
2021-09-16 19:49:50 +03:00
enabled: logic.comboBoxProtoOpenVpnCipherEnabled
2021-07-28 16:13:29 +07:00
}
ComboBoxType {
x: 200
y: 340
width: 151
height: 31
model: [
qsTr("SHA512"),
qsTr("SHA384"),
qsTr("SHA256"),
qsTr("SHA3-512"),
qsTr("SHA3-384"),
qsTr("SHA3-256"),
qsTr("whirlpool"),
qsTr("BLAKE2b512"),
qsTr("BLAKE2s256"),
qsTr("SHA1")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
2021-09-16 19:49:50 +03:00
if (logic.comboBoxProtoOpenVpnHashText === model[i]) {
2021-07-28 16:13:29 +07:00
return i
}
}
return -1
}
onCurrentTextChanged: {
2021-09-16 19:49:50 +03:00
logic.comboBoxProtoOpenVpnHashText = currentText
2021-07-28 16:13:29 +07:00
}
2021-09-16 19:49:50 +03:00
enabled: logic.comboBoxProtoOpenVpnHashEnabled
2021-07-28 16:13:29 +07:00
}
Rectangle {
x: 30
y: 140
width: 321
height: 71
border.width: 1
border.color: "lightgray"
radius: 2
RadioButtonType {
x: 10
y: 40
width: 171
height: 19
text: qsTr("TCP")
2021-09-16 19:49:50 +03:00
enabled: logic.radioButtonProtoOpenVpnTcpEnabled
checked: logic.radioButtonProtoOpenVpnTcpChecked
2021-08-09 00:41:52 +07:00
onCheckedChanged: {
2021-09-08 14:23:02 +03:00
UiLogic.radioButtonProtoOpenVpnTcpChecked = checked
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
RadioButtonType {
x: 10
y: 10
width: 171
height: 19
text: qsTr("UDP")
2021-09-16 19:49:50 +03:00
checked: logic.radioButtonProtoOpenVpnUdpChecked
2021-07-28 16:13:29 +07:00
onCheckedChanged: {
2021-09-16 19:49:50 +03:00
logic.radioButtonProtoOpenVpnUdpChecked = checked
2021-07-28 16:13:29 +07:00
}
2021-09-16 19:49:50 +03:00
enabled: logic.radioButtonProtoOpenVpnUdpEnabled
2021-07-28 16:13:29 +07:00
}
}
LabelType {
x: 30
y: 110
width: 151
height: 21
text: qsTr("Network protocol")
}
LabelType {
x: 30
y: 230
width: 151
height: 31
text: qsTr("Port")
}
Text {
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 24
color: "#100A44"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("OpenVPN Settings")
x: 10
y: 0
width: 340
height: 30
}
LabelType {
x: 200
y: 310
width: 151
height: 21
text: qsTr("Hash")
}
LabelType {
x: 30
y: 40
width: 291
height: 21
text: qsTr("VPN Addresses Subnet")
}
LabelType {
x: 30
y: 310
width: 151
height: 21
text: qsTr("Cipher")
}
LabelType {
id: label_proto_openvpn_info
x: 30
y: 550
width: 321
height: 41
2021-09-16 19:49:50 +03:00
visible: logic.labelProtoOpenVpnInfoVisible
text: logic.labelProtoOpenVpnInfoText
2021-07-28 16:13:29 +07:00
}
TextFieldType {
id: lineEdit_proto_openvpn_port
x: 200
y: 230
width: 151
height: 31
2021-09-16 19:49:50 +03:00
text: logic.lineEditProtoOpenVpnPortText
2021-07-28 16:13:29 +07:00
onEditingFinished: {
2021-09-16 19:49:50 +03:00
logic.lineEditProtoOpenVpnPortText = text
2021-07-28 16:13:29 +07:00
}
2021-09-16 19:49:50 +03:00
enabled: logic.lineEditProtoOpenVpnPortEnabled
2021-07-28 16:13:29 +07:00
}
TextFieldType {
id: lineEdit_proto_openvpn_subnet
x: 30
y: 65
width: 321
height: 31
2021-09-16 19:49:50 +03:00
text: logic.lineEditProtoOpenVpnSubnetText
2021-07-28 16:13:29 +07:00
onEditingFinished: {
2021-09-16 19:49:50 +03:00
logic.lineEditProtoOpenVpnSubnetText = text
2021-07-28 16:13:29 +07:00
}
}
ProgressBar {
id: progressBar_proto_openvpn_reset
anchors.horizontalCenter: parent.horizontalCenter
y: 500
width: 321
height: 40
from: 0
2021-09-16 19:49:50 +03:00
to: logic.progressBarProtoOpenVpnResetMaximium
value: logic.progressBarProtoOpenVpnResetValue
visible: logic.progressBarProtoOpenVpnResetVisible
2021-07-28 16:13:29 +07:00
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: progressBar_proto_openvpn_reset.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 500
width: 321
height: 40
text: qsTr("Save and restart VPN")
2021-09-16 19:49:50 +03:00
visible: logic.pushButtonOpenvpnSaveVisible
2021-08-09 00:41:52 +07:00
onClicked: {
2021-09-16 19:49:50 +03:00
logic.onPushButtonProtoOpenVpnSaveClicked()
2021-08-09 00:41:52 +07:00
}
2021-07-28 16:13:29 +07:00
}
}
}