Merge branch 'dev' into qt_migration

This commit is contained in:
pokamest 2022-10-15 19:46:26 +03:00
commit 442e7eb015
127 changed files with 5657 additions and 1619 deletions

View file

@ -107,7 +107,7 @@ PageBase {
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 15
Layout.topMargin: 10
Layout.preferredHeight: 41
text: qsTr("Export logs")
onClicked: {
@ -117,7 +117,7 @@ PageBase {
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 15
Layout.topMargin: 10
Layout.preferredHeight: 41
property string start_text: qsTr("Clear logs")
@ -135,6 +135,31 @@ PageBase {
AppSettingsLogic.onPushButtonClearLogsClicked()
}
}
LabelType {
Layout.fillWidth: true
Layout.topMargin: 30
text: qsTr("Backup and restore configuration")
}
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 10
Layout.preferredHeight: 41
text: qsTr("Backup app config")
onClicked: {
AppSettingsLogic.onPushButtonBackupAppConfigClicked()
}
}
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 10
Layout.preferredHeight: 41
text: qsTr("Restore app config")
onClicked: {
AppSettingsLogic.onPushButtonRestoreAppConfigClicked()
}
}
}
}

View file

@ -87,7 +87,7 @@ If AmneziaDNS service is not installed on the same server, or this option is unc
anchors.topMargin: 20
width: parent.width - 60
height: 21
text: qsTr("Secondray DNS server")
text: qsTr("Secondary DNS server")
}
TextFieldType {
id: dns2

View file

@ -1,462 +1,439 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.1
import QtQuick.Layouts 1.15
import SortFilterProxyModel 0.2
import ContainerProps 1.0
import ProtocolProps 1.0
import PageEnum 1.0
import ProtocolEnum 1.0
import "./"
import "../Controls"
import "../Config"
import "InstallSettings"
PageBase {
id: root
page: PageEnum.ServerContainers
logic: ServerContainersLogic
enabled: ServerContainersLogic.pageEnabled
function resetPage() {
container_selector.selectedIndex = -1
}
Connections {
target: logic
function onUpdatePage() {
root.resetPage()
}
}
BackButton {
id: back
}
Caption {
id: caption
text: container_selector.selectedIndex > 0 ? qsTr("Install new service") : qsTr("Installed services")
}
SelectContainer {
id: container_selector
onAboutToHide: {
pageLoader.focus = true
}
onContainerSelected: {
var containerProto = ContainerProps.defaultProtocol(c_index)
if (ProtocolProps.defaultPort(containerProto) < 0) {
tf_port_num.enabled = false
tf_port_num.text = qsTr("Default")
}
else tf_port_num.text = ProtocolProps.defaultPort(containerProto)
cb_port_proto.currentIndex = ProtocolProps.defaultTransportProto(containerProto)
tf_port_num.enabled = ProtocolProps.defaultPortChangeable(containerProto)
cb_port_proto.enabled = ProtocolProps.defaultTransportProtoChangeable(containerProto)
}
}
Column {
id: c1
visible: container_selector.selectedIndex > 0
width: parent.width
anchors.top: caption.bottom
anchors.topMargin: 10
Caption {
font.pixelSize: 22
text: UiLogic.containerName(container_selector.selectedIndex)
}
Text {
width: parent.width
anchors.topMargin: 10
padding: 10
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: UiLogic.containerDesc(container_selector.selectedIndex)
}
}
Rectangle {
id: frame_settings
visible: container_selector.selectedIndex > 0
width: parent.width
anchors.top: c1.bottom
anchors.topMargin: 10
border.width: 1
border.color: "lightgray"
anchors.bottomMargin: 5
anchors.horizontalCenter: parent.horizontalCenter
radius: 2
Grid {
id: grid
visible: container_selector.selectedIndex > 0
anchors.fill: parent
columns: 2
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
topPadding: 5
leftPadding: 10
spacing: 5
LabelType {
width: 130
text: qsTr("Port")
}
TextFieldType {
id: tf_port_num
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
}
LabelType {
width: 130
text: qsTr("Network Protocol")
}
ComboBoxType {
id: cb_port_proto
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
model: [
qsTr("udp"),
qsTr("tcp"),
]
}
}
}
BlueButtonType {
id: pb_cancel_add
visible: container_selector.selectedIndex > 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: pb_continue_add.top
anchors.bottomMargin: 20
width: parent.width - 40
height: 40
text: qsTr("Cancel")
font.pixelSize: 16
onClicked: container_selector.selectedIndex = -1
}
BlueButtonType {
id: pb_continue_add
visible: container_selector.selectedIndex > 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
width: parent.width - 40
height: 40
text: qsTr("Continue")
font.pixelSize: 16
onClicked: {
let cont = container_selector.selectedIndex
let tp = ProtocolProps.transportProtoFromString(cb_port_proto.currentText)
let port = tf_port_num.text
ServerContainersLogic.onPushButtonContinueClicked(cont, port, tp)
}
}
Flickable {
visible: container_selector.selectedIndex <= 0
clip: true
width: parent.width
anchors.top: caption.bottom
anchors.bottom: pb_add_container.top
contentHeight: col.height
Column {
visible: container_selector.selectedIndex <= 0
id: col
anchors {
left: parent.left;
right: parent.right;
}
topPadding: 20
spacing: 10
Caption {
id: cap1
text: qsTr("Installed Protocols and Services")
font.pixelSize: 20
}
SortFilterProxyModel {
id: proxyContainersModel
sourceModel: UiLogic.containersModel
filters: ValueFilter {
roleName: "is_installed_role"
value: true
}
}
SortFilterProxyModel {
id: proxyProtocolsModel
sourceModel: UiLogic.protocolsModel
filters: ValueFilter {
roleName: "is_installed_role"
value: true
}
}
ListView {
id: tb_c
x: 10
width: parent.width - 10
height: tb_c.contentItem.height
currentIndex: -1
spacing: 5
clip: true
interactive: false
model: proxyContainersModel
delegate: Item {
implicitWidth: tb_c.width - 10
implicitHeight: c_item.height
Item {
id: c_item
width: parent.width
height: row_container.height + tb_p.height
anchors.left: parent.left
Rectangle {
anchors.top: parent.top
width: parent.width
height: 1
color: "lightgray"
visible: index !== tb_c.currentIndex
}
Rectangle {
anchors.top: row_container.top
anchors.bottom: row_container.bottom
anchors.left: parent.left
anchors.right: parent.right
color: "#63B4FB"
visible: index === tb_c.currentIndex
}
RowLayout {
id: row_container
//width: parent.width
anchors.left: parent.left
anchors.right: parent.right
// anchors.top: lb_container_name.top
// anchors.bottom: lb_container_name.bottom
Text {
id: lb_container_name
text: name_role
font.pixelSize: 17
//font.bold: true
color: "#100A44"
topPadding: 5
bottomPadding: 5
leftPadding: 10
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
Layout.fillWidth: true
MouseArea {
enabled: col.visible
anchors.top: lb_container_name.top
anchors.bottom: lb_container_name.bottom
anchors.left: parent.left
anchors.right: parent.right
propagateComposedEvents: true
onClicked: {
if (tb_c.currentIndex === index) tb_c.currentIndex = -1
else tb_c.currentIndex = index
UiLogic.protocolsModel.setSelectedDockerContainer(proxyContainersModel.mapToSource(index))
}
}
}
ImageButtonType {
id: button_remove
visible: index === tb_c.currentIndex
Layout.alignment: Qt.AlignRight
checkable: true
icon.source: "qrc:/images/delete.png"
implicitWidth: 30
implicitHeight: 30
checked: default_role
MessageDialog {
id: dialogRemove
standardButtons: StandardButton.Yes | StandardButton.Cancel
title: "AmneziaVPN"
text: qsTr("Remove container") + " " + name_role + "?" + "\n" + qsTr("This action will erase all data of this container on the server.")
onAccepted: {
tb_c.currentIndex = -1
ServerContainersLogic.onPushButtonRemoveClicked(proxyContainersModel.mapToSource(index))
}
}
onClicked: dialogRemove.open()
VisibleBehavior on visible { }
}
ImageButtonType {
id: button_share
visible: index === tb_c.currentIndex
Layout.alignment: Qt.AlignRight
icon.source: "qrc:/images/share.png"
implicitWidth: 30
implicitHeight: 30
onClicked: {
ServerContainersLogic.onPushButtonShareClicked(proxyContainersModel.mapToSource(index))
}
VisibleBehavior on visible { }
}
ImageButtonType {
id: button_default
visible: service_type_role == ProtocolEnum.Vpn
Layout.alignment: Qt.AlignRight
checkable: true
img.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
implicitWidth: 30
implicitHeight: 30
checked: default_role
onClicked: {
ServerContainersLogic.onPushButtonDefaultClicked(proxyContainersModel.mapToSource(index))
}
}
}
ListView {
id: tb_p
currentIndex: -1
visible: index === tb_c.currentIndex
x: 10
anchors.top: row_container.bottom
width: parent.width - 40
height: visible ? tb_p.contentItem.height : 0
spacing: 0
clip: true
interactive: false
model: proxyProtocolsModel
VisibleBehavior on visible { }
delegate: Item {
id: dp_item
implicitWidth: tb_p.width - 10
implicitHeight: p_item.height
Item {
id: p_item
width: parent.width
height: lb_protocol_name.height
anchors.left: parent.left
Rectangle {
anchors.top: parent.top
width: parent.width
height: 1
color: "lightgray"
visible: index !== tb_p.currentIndex
}
// Rectangle {
// anchors.top: lb_protocol_name.top
// anchors.bottom: lb_protocol_name.bottom
// width: parent.width
// color: "#63B4FB"
// visible: index === tb_p.currentIndex
// }
// Text {
// id: lb_protocol_name
// text: name_role
// font.pixelSize: 16
// topPadding: 5
// bottomPadding: 5
// leftPadding: 10
// verticalAlignment: Text.AlignVCenter
// wrapMode: Text.WordWrap
// }
SettingButtonType {
id: lb_protocol_name
// anchors.top: lb_protocol_name.top
// anchors.bottom: lb_protocol_name.bottom
topPadding: 10
bottomPadding: 10
leftPadding: 10
anchors.left: parent.left
width: parent.width
height: 30
text: qsTr(name_role + " settings")
textItem.font.pixelSize: 16
icon.source: "qrc:/images/settings.png"
onClicked: {
tb_p.currentIndex = index
ServerContainersLogic.onPushButtonProtoSettingsClicked(
proxyContainersModel.mapToSource(tb_c.currentIndex),
proxyProtocolsModel.mapToSource(tb_p.currentIndex))
}
}
}
}
}
}
}
}
}
}
BlueButtonType {
id: pb_add_container
visible: container_selector.selectedIndex < 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.topMargin: 10
anchors.bottomMargin: 20
width: parent.width - 40
height: 40
text: qsTr("Install new protocols container")
font.pixelSize: 16
onClicked: container_selector.visible ? container_selector.close() : container_selector.open()
}
}
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.1
import QtQuick.Layouts 1.15
import SortFilterProxyModel 0.2
import ContainerProps 1.0
import ProtocolProps 1.0
import PageEnum 1.0
import ProtocolEnum 1.0
import "./"
import "../Controls"
import "../Config"
import "InstallSettings"
PageBase {
id: root
page: PageEnum.ServerContainers
logic: ServerContainersLogic
enabled: ServerContainersLogic.pageEnabled
function resetPage() {
container_selector.selectedIndex = -1
}
Connections {
target: logic
function onUpdatePage() {
root.resetPage()
}
}
BackButton {
id: back
}
Caption {
id: caption
text: container_selector.selectedIndex > 0 ? qsTr("Install new service") : qsTr("Installed services")
}
SelectContainer {
id: container_selector
onAboutToHide: {
pageLoader.focus = true
}
onContainerSelected: {
var containerProto = ContainerProps.defaultProtocol(c_index)
if (ProtocolProps.defaultPort(containerProto) < 0) {
tf_port_num.enabled = false
tf_port_num.text = qsTr("Default")
}
else tf_port_num.text = ProtocolProps.defaultPort(containerProto)
cb_port_proto.currentIndex = ProtocolProps.defaultTransportProto(containerProto)
tf_port_num.enabled = ProtocolProps.defaultPortChangeable(containerProto)
cb_port_proto.enabled = ProtocolProps.defaultTransportProtoChangeable(containerProto)
}
}
Column {
id: c1
visible: container_selector.selectedIndex > 0
width: parent.width
anchors.top: caption.bottom
anchors.topMargin: 10
Caption {
font.pixelSize: 22
text: UiLogic.containerName(container_selector.selectedIndex)
}
Text {
width: parent.width
anchors.topMargin: 10
padding: 10
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: UiLogic.containerDesc(container_selector.selectedIndex)
}
}
Rectangle {
id: frame_settings
visible: container_selector.selectedIndex > 0
width: parent.width
anchors.top: c1.bottom
anchors.topMargin: 10
border.width: 1
border.color: "lightgray"
anchors.bottomMargin: 5
anchors.horizontalCenter: parent.horizontalCenter
radius: 2
Grid {
id: grid
visible: container_selector.selectedIndex > 0
anchors.fill: parent
columns: 2
horizontalItemAlignment: Grid.AlignHCenter
verticalItemAlignment: Grid.AlignVCenter
topPadding: 5
leftPadding: 10
spacing: 5
LabelType {
width: 130
text: qsTr("Port")
}
TextFieldType {
id: tf_port_num
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
}
LabelType {
width: 130
text: qsTr("Network Protocol")
}
ComboBoxType {
id: cb_port_proto
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
model: [
qsTr("udp"),
qsTr("tcp"),
]
}
}
}
BlueButtonType {
id: pb_cancel_add
visible: container_selector.selectedIndex > 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: pb_continue_add.top
anchors.bottomMargin: 20
width: parent.width - 40
height: 40
text: qsTr("Cancel")
font.pixelSize: 16
onClicked: container_selector.selectedIndex = -1
}
BlueButtonType {
id: pb_continue_add
visible: container_selector.selectedIndex > 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
width: parent.width - 40
height: 40
text: qsTr("Continue")
font.pixelSize: 16
onClicked: {
let cont = container_selector.selectedIndex
let tp = ProtocolProps.transportProtoFromString(cb_port_proto.currentText)
let port = tf_port_num.text
ServerContainersLogic.onPushButtonContinueClicked(cont, port, tp)
}
}
Flickable {
visible: container_selector.selectedIndex <= 0
clip: true
width: parent.width
anchors.top: caption.bottom
anchors.bottom: pb_add_container.top
contentHeight: col.height
Column {
visible: container_selector.selectedIndex <= 0
id: col
anchors {
left: parent.left;
right: parent.right;
}
topPadding: 20
spacing: 10
Caption {
id: cap1
text: qsTr("Installed Protocols and Services")
font.pixelSize: 20
}
SortFilterProxyModel {
id: proxyContainersModel
sourceModel: UiLogic.containersModel
filters: ValueFilter {
roleName: "is_installed_role"
value: true
}
}
SortFilterProxyModel {
id: proxyProtocolsModel
sourceModel: UiLogic.protocolsModel
filters: ValueFilter {
roleName: "is_installed_role"
value: true
}
}
ListView {
id: tb_c
x: 10
width: parent.width - 10
height: tb_c.contentItem.height
currentIndex: -1
spacing: 5
clip: true
interactive: false
model: proxyContainersModel
delegate: Item {
implicitWidth: tb_c.width - 10
implicitHeight: c_item.height
Item {
id: c_item
width: parent.width
height: row_container.height + tb_p.height
anchors.left: parent.left
Rectangle {
anchors.top: parent.top
width: parent.width
height: 1
color: "lightgray"
visible: index !== tb_c.currentIndex
}
Rectangle {
anchors.top: row_container.top
anchors.bottom: row_container.bottom
anchors.left: parent.left
anchors.right: parent.right
color: "#63B4FB"
visible: index === tb_c.currentIndex
}
RowLayout {
id: row_container
anchors.left: parent.left
anchors.right: parent.right
Text {
id: lb_container_name
text: name_role
font.pixelSize: 17
color: "#100A44"
topPadding: 16
bottomPadding: 12
leftPadding: 10
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
Layout.fillWidth: true
MouseArea {
enabled: col.visible
anchors.top: lb_container_name.top
anchors.bottom: lb_container_name.bottom
anchors.left: parent.left
anchors.right: parent.right
propagateComposedEvents: true
onClicked: {
if (tb_c.currentIndex === index) tb_c.currentIndex = -1
else tb_c.currentIndex = index
UiLogic.protocolsModel.setSelectedDockerContainer(proxyContainersModel.mapToSource(index))
}
}
}
ImageButtonType {
id: button_remove
visible: index === tb_c.currentIndex
Layout.alignment: Qt.AlignRight
checkable: true
icon.source: "qrc:/images/delete.png"
implicitWidth: 30
implicitHeight: 30
checked: default_role
MessageDialog {
id: dialogRemove
standardButtons: StandardButton.Yes | StandardButton.Cancel
title: "AmneziaVPN"
text: qsTr("Remove container") + " " + name_role + "?" + "\n" + qsTr("This action will erase all data of this container on the server.")
onAccepted: {
tb_c.currentIndex = -1
ServerContainersLogic.onPushButtonRemoveClicked(proxyContainersModel.mapToSource(index))
}
}
onClicked: dialogRemove.open()
VisibleBehavior on visible { }
}
ImageButtonType {
id: button_share
visible: index === tb_c.currentIndex
Layout.alignment: Qt.AlignRight
icon.source: "qrc:/images/share.png"
implicitWidth: 30
implicitHeight: 30
onClicked: {
ServerContainersLogic.onPushButtonShareClicked(proxyContainersModel.mapToSource(index))
}
VisibleBehavior on visible { }
}
ImageButtonType {
id: button_default
visible: service_type_role == ProtocolEnum.Vpn
Layout.alignment: Qt.AlignRight
checkable: true
img.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
implicitWidth: 30
implicitHeight: 30
checked: default_role
onClicked: {
ServerContainersLogic.onPushButtonDefaultClicked(proxyContainersModel.mapToSource(index))
}
}
}
ListView {
id: tb_p
currentIndex: -1
x: 10
anchors.top: row_container.bottom
width: parent.width - 40
height: index === tb_c.currentIndex ? tb_p.contentItem.height : 0
implicitHeight: height
spacing: 0
clip: true
interactive: false
model: proxyProtocolsModel
Behavior on height {
NumberAnimation {
duration: 200
}
}
delegate: Item {
id: dp_item
implicitWidth: tb_p.width - 10
implicitHeight: p_item.height
Item {
id: p_item
width: parent.width
height: lb_protocol_name.height
anchors.left: parent.left
Rectangle {
anchors.top: parent.top
width: parent.width
height: 1
color: "lightgray"
visible: index > 0
}
SettingButtonType {
id: lb_protocol_name
topPadding: 10
bottomPadding: 10
anchors.left: parent.left
anchors.leftMargin: 10
width: parent.width
height: 45
text: qsTr(name_role + " settings")
textItem.font.pixelSize: 16
icon.source: "qrc:/images/settings.png"
onClicked: {
tb_p.currentIndex = index
ServerContainersLogic.onPushButtonProtoSettingsClicked(
proxyContainersModel.mapToSource(tb_c.currentIndex),
proxyProtocolsModel.mapToSource(tb_p.currentIndex))
}
}
}
}
}
}
}
}
}
}
BlueButtonType {
id: pb_add_container
visible: container_selector.selectedIndex < 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.topMargin: 10
anchors.bottomMargin: 20
width: parent.width - 40
height: 40
text: qsTr("Install new protocols container")
font.pixelSize: 16
onClicked: container_selector.visible ? container_selector.close() : container_selector.open()
}
}

View file

@ -59,7 +59,7 @@ PageBase {
text: qsTr("Share for Amnezia")
height: 40
width: tb_c.width - 10
onClicked: UiLogic.onGotoShareProtocolPage(ProtocolEnum.Any)
onClicked: UiLogic.goToShareProtocolPage(ProtocolEnum.Any)
}
ListView {
@ -82,7 +82,7 @@ PageBase {
text: qsTr("Share for ") + name_role
height: 40
width: tb_c.width - 10
onClicked: UiLogic.onGotoShareProtocolPage(proxyProtocolsModel.mapToSource(index))
onClicked: UiLogic.goToShareProtocolPage(proxyProtocolsModel.mapToSource(index))
}
}
}

View file

@ -119,7 +119,6 @@ PageBase {
anchors.topMargin: 40
text: qsTr("Open file")
visible: StartPageLogic.pushButtonConnectVisible
onClicked: {
StartPageLogic.onPushButtonImportOpenFile()
}
@ -128,12 +127,12 @@ PageBase {
BlueButtonType {
id: qr_code_import
visible: GC.isMobile()
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: qr_code_import_open.bottom
anchors.topMargin: 10
text: qsTr("Scan QR code")
visible: StartPageLogic.pushButtonConnectVisible
onClicked: {
if (Qt.platform.os == "ios") {
UiLogic.goToPage(PageEnum.QrDecoderIos)
@ -144,7 +143,19 @@ PageBase {
enabled: StartPageLogic.pushButtonConnectEnabled
}
BlueButtonType {
id: btn_restore_cfg
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: qr_code_import.bottom
anchors.topMargin: 30
visible: UiLogic.pagesStackDepth == 1
enabled: StartPageLogic.pushButtonConnectEnabled
text: qsTr("Restore app config")
onClicked: {
AppSettingsLogic.onPushButtonRestoreAppConfigClicked()
}
}
}
@ -270,7 +281,6 @@ PageBase {
anchors.topMargin: 10
text: StartPageLogic.pushButtonConnectText
visible: StartPageLogic.pushButtonConnectVisible
onClicked: {
StartPageLogic.onPushButtonConnect()
}

View file

@ -0,0 +1,148 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.15
import PageEnum 1.0
import "./"
import "../Controls"
import "../Config"
PageBase {
id: root
page: PageEnum.ViewConfig
logic: ViewConfigLogic
readonly property double rowHeight: ta_last_config.contentHeight / ta_last_config.textArea.lineCount
BackButton {}
Caption {
id: caption
text: qsTr("Check config")
}
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: parent.top
anchors.left: parent.left
anchors.right: parent.right
TextAreaType {
id: ta_config
Layout.topMargin: 5
Layout.bottomMargin: 20
Layout.fillWidth: true
Layout.leftMargin: 1
Layout.rightMargin: 1
Layout.preferredHeight: ViewConfigLogic.warningActive ? 250 : fl.height - 70
flickableDirection: Flickable.AutoFlickIfNeeded
textArea.readOnly: true
textArea.text: logic.configText
}
LabelType {
id: lb_att
visible: ViewConfigLogic.warningActive
text: qsTr("Attention!
The config above contains cached OpenVPN connection profile.
AmneziaVPN detected this profile may contain malicious scripts. Please, carefully review the config and import this config only if you completely trust it.")
Layout.fillWidth: true
}
LabelType {
visible: ViewConfigLogic.warningActive
text: qsTr("Suspicious string:")
Layout.fillWidth: true
}
TextAreaType {
id: ta_mal
visible: ViewConfigLogic.warningActive
Layout.topMargin: 5
Layout.bottomMargin: 20
Layout.fillWidth: true
Layout.leftMargin: 1
Layout.rightMargin: 1
Layout.preferredHeight: 60
flickableDirection: Flickable.AutoFlickIfNeeded
textArea.readOnly: true
textArea.text: logic.openVpnMalStrings
textArea.textFormat: TextEdit.RichText
}
LabelType {
visible: ViewConfigLogic.warningActive
text: qsTr("Cached connection profile:")
Layout.fillWidth: true
}
TextAreaType {
id: ta_last_config
visible: ViewConfigLogic.warningActive
Layout.topMargin: 5
Layout.bottomMargin: 20
Layout.fillWidth: true
Layout.leftMargin: 1
Layout.rightMargin: 1
Layout.preferredHeight: 350
flickableDirection: Flickable.AutoFlickIfNeeded
textArea.readOnly: true
textArea.text: logic.openVpnLastConfigs
textArea.textFormat: TextEdit.RichText
Connections {
target: logic
function onWarningStringNumberChanged(n) {
ta_last_config.contentY = rowHeight * n - ta_last_config.height / 2
}
}
}
RowLayout {
id: btns_row
BasicButtonType {
Layout.preferredWidth: (content.width - parent.spacing) /2
Layout.preferredHeight: 41
font.pixelSize: btn_import.font.pixelSize
text: qsTr("Cancel")
onClicked: {
UiLogic.closePage()
}
}
BlueButtonType {
id: btn_import
Layout.preferredWidth: (content.width - parent.spacing) /2
Layout.preferredHeight: 41
text: qsTr("Import config")
onClicked: {
logic.importConfig()
}
}
}
}
}
}