Share WireGuard page

Share IKEv2 page
This commit is contained in:
pokamest 2021-11-15 18:17:28 +03:00
parent c6efc5b212
commit 25428c9165
28 changed files with 907 additions and 238 deletions

View file

@ -83,7 +83,6 @@ PageBase {
height: 40
width: tb_c.width - 10
onClicked: UiLogic.onGotoShareProtocolPage(proxyProtocolsModel.mapToSource(index))
}
}
}

View file

@ -9,12 +9,6 @@ import "../../Config"
PageShareProtocolBase {
id: root
protocol: ProtocolEnum.Any
logic: ShareConnectionLogic
readonly property string generateConfigText: qsTr("Generate config")
readonly property string generatingConfigText: qsTr("Generating config...")
readonly property string showConfigText: qsTr("Show config")
property bool genConfigProcess: false
BackButton {
id: back
@ -66,7 +60,6 @@ New encryption keys pair will be generated.")
}
ShareConnectionButtonType {
id: pb_gen
Layout.topMargin: 20
Layout.fillWidth: true
Layout.preferredHeight: 40
@ -102,15 +95,12 @@ New encryption keys pair will be generated.")
ShareConnectionButtonCopyType {
id: pb_copy
Layout.bottomMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
enabled: tfShareCode.textArea.length > 0
visible: tfShareCode.textArea.length > 0
copyText: tfShareCode.textArea.text
}
ShareConnectionButtonType {
id: pb_save
Layout.bottomMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
@ -135,7 +125,7 @@ New encryption keys pair will be generated.")
LabelType {
height: 20
text: qsTr("Config to long to be displayed as QR code")
text: qsTr("Config too long to be displayed as QR code")
visible: ShareConnectionLogic.shareAmneziaQrCodeText.length == 0 && tfShareCode.textArea.length > 0
}
}

View file

@ -9,7 +9,6 @@ import "../../Config"
PageShareProtocolBase {
id: root
protocol: ProtocolEnum.Cloak
logic: UiLogic.protocolLogic(protocol)
BackButton {
id: back
@ -19,25 +18,93 @@ PageShareProtocolBase {
text: qsTr("Share Cloak Settings")
}
TextAreaType {
Flickable {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: pb_save.top
anchors.bottomMargin: 20
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
textArea.readOnly: true
textArea.text: ShareConnectionLogic.textEditShareCloakText
}
ShareConnectionButtonCopyType {
id: pb_save
anchors.bottom: root.bottom
anchors.bottomMargin: 10
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
//enabled: ShareConnectionLogic.pushButtonShareCloakCopyEnabled
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
enabled: logic.pageEnabled
anchors.top: content.bottom
anchors.topMargin: 20
anchors.left: parent.left
anchors.right: parent.right
LabelType {
id: lb_desc
Layout.fillWidth: true
Layout.topMargin: 10
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: qsTr("Note: Cloak protocol using same password for all connections")
}
ShareConnectionButtonType {
Layout.topMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
text: genConfigProcess ? generatingConfigText : generateConfigText
onClicked: {
enabled = false
genConfigProcess = true
ShareConnectionLogic.onPushButtonShareCloakGenerateClicked()
enabled = true
genConfigProcess = false
}
}
TextAreaType {
id: tfShareCode
Layout.topMargin: 20
Layout.bottomMargin: 20
Layout.fillWidth: true
Layout.preferredHeight: 200
textArea.readOnly: true
textArea.text: ShareConnectionLogic.textEditShareCloakText
visible: tfShareCode.textArea.length > 0
}
ShareConnectionButtonCopyType {
Layout.bottomMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
copyText: tfShareCode.textArea.text
}
ShareConnectionButtonType {
Layout.bottomMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
text: qsTr("Save to file")
enabled: tfShareCode.textArea.length > 0
visible: tfShareCode.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Save AmneziaVPN config"), "*.json", tfShareCode.textArea.text)
}
}
}
}
}

View file

@ -0,0 +1,141 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.15
import ProtocolEnum 1.0
import "../"
import "../../Controls"
import "../../Config"
PageShareProtocolBase {
id: root
protocol: ProtocolEnum.Ikev2
BackButton {
id: back
}
Caption {
id: caption
text: qsTr("Share IKEv2 Settings")
}
TextAreaType {
id: tfCert
textArea.readOnly: true
textArea.text: ShareConnectionLogic.textEditShareIkev2CertText
visible: false
}
TextAreaType {
id: tfMobileConfig
textArea.readOnly: true
textArea.text: ShareConnectionLogic.textEditShareIkev2MobileConfigText
visible: false
}
TextAreaType {
id: tfStrongSwanConfig
textArea.readOnly: true
textArea.text: ShareConnectionLogic.textEditShareIkev2StrongSwanConfigText
visible: false
}
Flickable {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
enabled: logic.pageEnabled
anchors.top: content.bottom
anchors.topMargin: 20
anchors.left: parent.left
anchors.right: parent.right
// LabelType {
// id: lb_desc
// Layout.fillWidth: true
// Layout.topMargin: 10
// horizontalAlignment: Text.AlignHCenter
// wrapMode: Text.Wrap
// text: qsTr("Note: ShadowSocks protocol using same password for all connections")
// }
ShareConnectionButtonType {
Layout.topMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
text: genConfigProcess ? generatingConfigText : generateConfigText
onClicked: {
enabled = false
genConfigProcess = true
ShareConnectionLogic.onPushButtonShareIkev2GenerateClicked()
enabled = true
genConfigProcess = false
}
}
ShareConnectionButtonType {
Layout.topMargin: 30
Layout.bottomMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
width: parent.width - 60
text: qsTr("Export p12 certificate")
enabled: tfCert.textArea.length > 0
visible: tfCert.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Export p12 certificate"), "*.p12", tfCert.textArea.text)
}
}
ShareConnectionButtonType {
Layout.bottomMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
width: parent.width - 60
text: qsTr("Export config for Apple")
enabled: tfMobileConfig.textArea.length > 0
visible: tfMobileConfig.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Export config for Apple"), "*.plist", tfMobileConfig.textArea.text)
}
}
ShareConnectionButtonType {
Layout.bottomMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
width: parent.width - 60
text: qsTr("Export config for StrongSwan")
enabled: tfStrongSwanConfig.textArea.length > 0
visible: tfStrongSwanConfig.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Export config for StrongSwan"), "*.profile", tfStrongSwanConfig.textArea.text)
}
}
}
}
}

View file

@ -9,7 +9,6 @@ import "../../Config"
PageShareProtocolBase {
id: root
protocol: ProtocolEnum.OpenVpn
logic: ShareConnectionLogic
BackButton {
id: back
@ -19,58 +18,90 @@ PageShareProtocolBase {
text: qsTr("Share OpenVPN Settings")
}
TextAreaType {
id: tfShareCode
Flickable {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: pb_gen.top
anchors.bottomMargin: 20
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
textArea.readOnly: true
textArea.verticalAlignment: Text.AlignTop
textArea.text: ShareConnectionLogic.textEditShareOpenVpnCodeText
}
ShareConnectionButtonType {
id: pb_gen
anchors.bottom: pb_copy.top
anchors.bottomMargin: 10
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
text: ShareConnectionLogic.pushButtonShareOpenVpnGenerateText
onClicked: {
enabled = false
ShareConnectionLogic.onPushButtonShareOpenVpnGenerateClicked()
enabled = true
}
}
ShareConnectionButtonCopyType {
id: pb_copy
anchors.bottom: pb_save.top
anchors.bottomMargin: 10
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
enabled: tfShareCode.textArea.length > 0
}
ShareConnectionButtonType {
id: pb_save
anchors.bottom: root.bottom
anchors.bottomMargin: 10
anchors.horizontalCenter: root.horizontalCenter
width: parent.width - 60
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
text: qsTr("Save to file")
enabled: tfShareCode.textArea.length > 0
contentHeight: content.height
clip: true
onClicked: {
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "*.ovpn", tfShareCode.textArea.text)
ColumnLayout {
id: content
enabled: logic.pageEnabled
anchors.top: content.bottom
anchors.topMargin: 20
anchors.left: parent.left
anchors.right: parent.right
LabelType {
id: lb_desc
Layout.fillWidth: true
Layout.topMargin: 10
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: qsTr("New encryption keys pair will be generated.")
}
ShareConnectionButtonType {
Layout.topMargin: 20
Layout.fillWidth: true
Layout.preferredHeight: 40
text: genConfigProcess ? generatingConfigText : generateConfigText
onClicked: {
enabled = false
genConfigProcess = true
ShareConnectionLogic.onPushButtonShareOpenVpnGenerateClicked()
genConfigProcess = false
enabled = true
}
}
TextAreaType {
id: tfShareCode
Layout.topMargin: 20
Layout.preferredHeight: 200
Layout.fillWidth: true
textArea.readOnly: true
textArea.verticalAlignment: Text.AlignTop
textArea.text: ShareConnectionLogic.textEditShareOpenVpnCodeText
visible: tfShareCode.textArea.length > 0
}
ShareConnectionButtonCopyType {
Layout.preferredHeight: 40
Layout.fillWidth: true
copyText: tfShareCode.textArea.text
}
ShareConnectionButtonType {
Layout.bottomMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
width: parent.width - 60
text: qsTr("Save to file")
enabled: tfShareCode.textArea.length > 0
visible: tfShareCode.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "*.ovpn", tfShareCode.textArea.text)
}
}
}
}
}

View file

@ -8,7 +8,6 @@ import "../../Config"
PageShareProtocolBase {
id: root
protocol: ProtocolEnum.Sftp
logic: UiLogic.protocolLogic(protocol)
BackButton {
id: back

View file

@ -9,7 +9,6 @@ import "../../Config"
PageShareProtocolBase {
id: root
protocol: ProtocolEnum.ShadowSocks
logic: UiLogic.protocolLogic(protocol)
BackButton {
id: back
@ -31,73 +30,69 @@ PageShareProtocolBase {
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height + content2.height + 40
contentHeight: content.height
clip: true
GridLayout {
id: content
enabled: logic.pageEnabled
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
columns: 2
//
LabelType {
height: 20
text: qsTr("Server:")
}
TextFieldType {
height: 20
text: ShareConnectionLogic.labelShareShadowSocksServerText
readOnly: true
}
//
LabelType {
height: 20
text: qsTr("Port:")
}
TextFieldType {
height: 20
text: ShareConnectionLogic.labelShareShadowSocksPortText
readOnly: true
}
//
LabelType {
height: 20
text: qsTr("Password")
}
TextFieldType {
height: 20
text: ShareConnectionLogic.labelShareShadowSocksPasswordText
readOnly: true
}
//
LabelType {
height: 20
text: qsTr("Encryption:")
}
TextFieldType {
height: 20
text: ShareConnectionLogic.labelShareShadowSocksMethodText
readOnly: true
}
}
ColumnLayout {
id: content2
id: content
enabled: logic.pageEnabled
anchors.top: content.bottom
anchors.topMargin: 20
anchors.left: parent.left
anchors.right: parent.right
LabelType {
id: lb_desc
Layout.fillWidth: true
Layout.topMargin: 10
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: qsTr("Note: ShadowSocks protocol using same password for all connections")
}
ShareConnectionButtonType {
Layout.topMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
text: genConfigProcess ? generatingConfigText : generateConfigText
onClicked: {
enabled = false
genConfigProcess = true
ShareConnectionLogic.onPushButtonShareShadowSocksGenerateClicked()
enabled = true
genConfigProcess = false
}
}
TextAreaType {
id: tfShareCode
Layout.topMargin: 20
Layout.preferredHeight: 200
Layout.fillWidth: true
textArea.readOnly: true
textArea.wrapMode: TextEdit.WrapAnywhere
textArea.verticalAlignment: Text.AlignTop
textArea.text: ShareConnectionLogic.textEditShareShadowSocksText
visible: tfShareCode.textArea.length > 0
}
ShareConnectionButtonCopyType {
Layout.preferredHeight: 40
Layout.fillWidth: true
Layout.bottomMargin: 20
start_text: qsTr("Copy config")
copyText: tfShareCode.textArea.text
}
LabelType {
height: 20
visible: tfConnString.length > 0
text: qsTr("Connection string")
}
TextFieldType {
@ -106,12 +101,15 @@ PageShareProtocolBase {
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
text: ShareConnectionLogic.lineEditShareShadowSocksStringText
visible: tfConnString.length > 0
readOnly: true
}
ShareConnectionButtonCopyType {
Layout.preferredHeight: 40
Layout.fillWidth: true
enabled: tfConnString.length > 0
start_text: qsTr("Copy string")
copyText: tfConnString.text
}
Image {

View file

@ -8,7 +8,6 @@ import "../../Config"
PageShareProtocolBase {
id: root
protocol: ProtocolEnum.TorWebSite
logic: UiLogic.protocolLogic(protocol)
BackButton {
id: back

View file

@ -0,0 +1,113 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.15
import ProtocolEnum 1.0
import "../"
import "../../Controls"
import "../../Config"
PageShareProtocolBase {
id: root
protocol: ProtocolEnum.WireGuard
BackButton {
id: back
}
Caption {
id: caption
text: qsTr("Share WireGuard Settings")
}
Flickable {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
enabled: logic.pageEnabled
anchors.top: content.bottom
anchors.topMargin: 20
anchors.left: parent.left
anchors.right: parent.right
LabelType {
id: lb_desc
Layout.fillWidth: true
Layout.topMargin: 10
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: qsTr("New encryption keys pair will be generated.")
}
ShareConnectionButtonType {
Layout.topMargin: 10
Layout.fillWidth: true
Layout.preferredHeight: 40
text: genConfigProcess ? generatingConfigText : generateConfigText
onClicked: {
enabled = false
genConfigProcess = true
ShareConnectionLogic.onPushButtonShareWireGuardGenerateClicked()
enabled = true
genConfigProcess = false
}
}
TextAreaType {
id: tfShareCode
Layout.topMargin: 20
Layout.preferredHeight: 200
Layout.fillWidth: true
textArea.readOnly: true
textArea.wrapMode: TextEdit.WrapAnywhere
textArea.verticalAlignment: Text.AlignTop
textArea.text: ShareConnectionLogic.textEditShareWireGuardCodeText
visible: tfShareCode.textArea.length > 0
}
ShareConnectionButtonCopyType {
Layout.preferredHeight: 40
Layout.fillWidth: true
copyText: tfShareCode.textArea.text
}
ShareConnectionButtonType {
Layout.preferredHeight: 40
Layout.fillWidth: true
text: qsTr("Save to file")
enabled: tfShareCode.textArea.length > 0
visible: tfShareCode.textArea.length > 0
onClicked: {
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "*.conf", tfShareCode.textArea.text)
}
}
Image {
Layout.topMargin: 20
Layout.fillWidth: true
Layout.preferredHeight: width
smooth: false
source: ShareConnectionLogic.shareWireGuardQrCodeText
}
}
}
}

View file

@ -9,5 +9,11 @@ import "../../Config"
PageBase {
id: root
property var protocol: ProtocolEnum.Any
page: PageEnum.ProtocolSettings
page: PageEnum.ProtocolShare
logic: ShareConnectionLogic
readonly property string generateConfigText: qsTr("Generate config")
readonly property string generatingConfigText: qsTr("Generating config...")
readonly property string showConfigText: qsTr("Show config")
property bool genConfigProcess: false
}