added display of amnesia dns container activity on the main page

This commit is contained in:
vladimir.kuznetsov 2023-06-27 19:07:42 +09:00
parent 2ef53c6df9
commit 795405c47d
21 changed files with 238 additions and 85 deletions

View file

@ -17,6 +17,8 @@ Button {
text: ConnectionController.connectionStateText
enabled: !ConnectionController.isConnectionInProgress
background: Item {
clip: true

View file

@ -76,7 +76,6 @@ DrawerType {
}
}
BasicButtonType {
Layout.fillWidth: true
Layout.topMargin: 8

View file

@ -0,0 +1,10 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "../Controls2"
import "../Controls2/TextTypes"
Item {
}

View file

@ -8,11 +8,9 @@ import "../Controls2/TextTypes"
Rectangle {
id: root
property var rootWidth: root.width
property real rootWidth: root.width
property int currentIndex
property alias mouseArea: transportProtoButtonMouseArea
implicitWidth: transportProtoButtonGroup.implicitWidth
implicitHeight: transportProtoButtonGroup.implicitHeight
@ -30,8 +28,6 @@ Rectangle {
implicitWidth: (rootWidth - 32) / 2
text: "UDP"
hoverEnabled: !transportProtoButtonMouseArea.enabled
onClicked: {
root.currentIndex = 0
}
@ -43,17 +39,9 @@ Rectangle {
implicitWidth: (rootWidth - 32) / 2
text: "TCP"
hoverEnabled: !transportProtoButtonMouseArea.enabled
onClicked: {
root.currentIndex = 1
}
}
}
MouseArea {
id: transportProtoButtonMouseArea
anchors.fill: parent
}
}

View file

@ -19,7 +19,6 @@ Item {
property string rootButtonImage: "qrc:/images/controls/chevron-down.svg"
property string rootButtonImageColor: "#D7D8DB"
property string rootButtonBackgroundColor: "#1C1D21"
property int rootButtonMaximumWidth: 0
property string rootButtonHoveredBorderColor: "#494B50"
property string rootButtonDefaultBorderColor: "transparent"
@ -88,8 +87,6 @@ Item {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
Layout.maximumWidth: rootButtonMaximumWidth ? rootButtonMaximumWidth : implicitWidth
color: root.textColor
text: root.text

View file

@ -88,4 +88,10 @@ RadioButton {
horizontalAlignment: Qt.AlignHCenter
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
enabled: false
}
}

View file

@ -95,13 +95,20 @@ PageType {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
text: {
var string = ""
if (SettingsController.isAmneziaDnsEnabled()) {
string += "Amnezia DNS | "
var description = ""
if (ServersModel.isDefaultServerHasWriteAccess()) {
if (SettingsController.isAmneziaDnsEnabled()
&& ContainersModel.isAmneziaDnsContainerInstalled(ServersModel.getDefaultServerIndex())) {
description += "Amnezia DNS | "
}
} else {
if (ServersModel.isDefaultServerConfigContainsAmneziaDns) {
description += "Amnezia DNS | "
}
}
string += root.currentContainerName + " | " + root.currentServerHostName
return string
description += root.currentContainerName + " | " + root.currentServerHostName
return description
}
}
}
@ -153,7 +160,6 @@ PageType {
rootButtonBorderWidth: 0
rootButtonImageColor: "#0E0E11"
rootButtonMaximumWidth: 150 //todo make it dynamic
rootButtonBackgroundColor: "#D7D8DB"
text: root.currentContainerName
@ -194,14 +200,6 @@ PageType {
currentIndex: ContainersModel.getDefaultContainer()
}
}
BasicButtonType {
id: dnsButton
implicitHeight: 40
text: "Amnezia DNS"
}
}
Header2Type {
@ -277,7 +275,21 @@ PageType {
Layout.fillWidth: true
text: name
descriptionText: hostName
descriptionText: {
var description = ""
if (hasWriteAccess) {
if (SettingsController.isAmneziaDnsEnabled()
&& ContainersModel.isAmneziaDnsContainerInstalled(index)) {
description += "AmneziaDNS | "
}
} else {
if (containsAmneziaDns) {
description += "AmneziaDNS | "
}
}
return description += hostName
}
checked: index === serversMenuContent.currentIndex

View file

@ -21,11 +21,12 @@ PageType {
property var installedProtocolsCount
SettingsContainersListView {
id: settingsContainersListView
Connections {
target: ServersModel
function onCurrentlyProcessedServerIndexChanged() {
updateContainersModelFilters()
settingsContainersListView.updateContainersModelFilters()
}
}

View file

@ -21,11 +21,12 @@ PageType {
property var installedServicesCount
SettingsContainersListView {
id: settingsContainersListView
Connections {
target: ServersModel
function onCurrentlyProcessedServerIndexChanged() {
updateContainersModelFilters()
settingsContainersListView.updateContainersModelFilters()
}
}

View file

@ -121,18 +121,18 @@ PageType {
var hasEmptyField = false
if (hostname.textFieldText === "") {
hostname.errorText = qsTr("ip address cannot be empty")
hostname.errorText = qsTr("Ip address cannot be empty")
hasEmptyField = true
} else if (!hostname.textField.acceptableInput) {
hostname.errorText = qsTr("Enter the address in the format 255.255.255.255:88")
}
if (username.textFieldText === "") {
username.errorText = qsTr("login cannot be empty")
username.errorText = qsTr("Login cannot be empty")
hasEmptyField = true
}
if (secretData.textFieldText === "") {
secretData.errorText = qsTr("password/private key cannot be empty")
secretData.errorText = qsTr("Password/private key cannot be empty")
hasEmptyField = true
}
return !hasEmptyField

View file

@ -29,7 +29,6 @@ PageType {
}
FlickableType {
id: fl
anchors.fill: parent
contentHeight: content.height
@ -41,18 +40,17 @@ PageType {
anchors.right: parent.right
ListView {
// todo change id naming
id: containers
id: processedContainerListView
width: parent.width
height: containers.contentItem.height
height: contentItem.height
currentIndex: -1
clip: true
interactive: false
model: proxyContainersModel
delegate: Item {
implicitWidth: containers.width
implicitHeight: delegateContent.implicitHeight
implicitWidth: processedContainerListView.width
implicitHeight: (delegateContent.implicitHeight > root.height) ? delegateContent.implicitHeight : root.height
ColumnLayout {
id: delegateContent
@ -72,8 +70,122 @@ PageType {
Layout.fillWidth: true
headerText: "Установка " + name
descriptionText: "Эти настройки можно будет изменить позже"
headerText: qsTr("Installing ") + name
descriptionText: qsTr("protocol description")
}
BasicButtonType {
id: showDetailsButton
Layout.topMargin: 16
Layout.leftMargin: -8
implicitHeight: 32
defaultColor: "transparent"
hoveredColor: Qt.rgba(1, 1, 1, 0.08)
pressedColor: Qt.rgba(1, 1, 1, 0.12)
disabledColor: "#878B91"
textColor: "#FBB26A"
text: qsTr("More detailed")
onClicked: {
showDetailsDrawer.open()
}
}
DrawerType {
id: showDetailsDrawer
width: parent.width
height: parent.height * 0.9
BackButtonType {
id: showDetailsBackButton
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 16
anchors.leftMargin: 16
anchors.topMargin: 16
backButtonFunction: function() {
showDetailsDrawer.close()
}
}
FlickableType {
anchors.top: showDetailsBackButton.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
contentHeight: {
var emptySpaceHeight = parent.height - showDetailsBackButton.implicitHeight - showDetailsBackButton.anchors.topMargin
return (showDetailsDrawerContent.implicitHeight > emptySpaceHeight) ?
showDetailsDrawerContent.implicitHeight : emptySpaceHeight
}
ColumnLayout {
id: showDetailsDrawerContent
anchors.fill: parent
anchors.rightMargin: 16
anchors.leftMargin: 16
Header2Type {
id: showDetailsDrawerHeader
Layout.fillWidth: true
Layout.topMargin: 16
headerText: name
}
TextField {
Layout.fillWidth: true
Layout.topMargin: 16
Layout.bottomMargin: 16
padding: 0
leftPadding: 0
height: 24
color: "#D7D8DB"
font.pixelSize: 16
font.weight: Font.Medium
font.family: "PT Root UI VF"
text: qsTr("detailed protocol description")
wrapMode: Text.WordWrap
readOnly: true
background: Rectangle {
anchors.fill: parent
color: "transparent"
}
}
Rectangle {
Layout.fillHeight: true
color: "transparent"
}
BasicButtonType {
Layout.fillWidth: true
Layout.bottomMargin: 32
text: qsTr("Close")
onClicked: function() {
showDetailsDrawer.close()
}
}
}
}
}
ParagraphTextType {
@ -96,15 +208,12 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 16
headerText: "Port"
}
Rectangle {
// todo make it dynamic
implicitHeight: root.height - port.implicitHeight -
transportProtoSelector.implicitHeight - transportProtoHeader.implicitHeight -
header.implicitHeight - backButton.implicitHeight - installButton.implicitHeight - 116
Layout.fillHeight: true
color: "transparent"
}
@ -134,7 +243,9 @@ PageType {
transportProtoSelector.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto)
port.enabled = ProtocolProps.defaultPortChangeable(defaultContainerProto)
transportProtoSelector.mouseArea.enabled = !ProtocolProps.defaultTransportProtoChangeable(defaultContainerProto)
var protocolSelectorVisible = ProtocolProps.defaultTransportProtoChangeable(defaultContainerProto)
transportProtoSelector.visible = protocolSelectorVisible
transportProtoHeader.visible = protocolSelectorVisible
}
}
}

View file

@ -260,12 +260,12 @@ PageType {
}
function fillConnectionTypeModel() {
connectionTypesModel = [amneziaConnectionFormat]
root.connectionTypesModel = [amneziaConnectionFormat]
if (currentIndex === ContainerProps.containerFromString("OpenVpn")) {
connectionTypesModel.push(openVpnConnectionFormat)
root.connectionTypesModel.push(openVpnConnectionFormat)
} else if (currentIndex === ContainerProps.containerFromString("wireGuardConnectionType")) {
connectionTypesModel.push(amneziaConnectionFormat)
root.connectionTypesModel.push(amneziaConnectionFormat)
}
}
}
@ -287,7 +287,7 @@ PageType {
drawerHeight: 0.4375
visible: accessTypeSelector.currentIndex === 0
enabled: connectionTypesModel.length > 1
enabled: root.connectionTypesModel.length > 1
descriptionText: qsTr("Connection format")
headerText: qsTr("Connection format")
@ -298,7 +298,7 @@ PageType {
imageSource: "qrc:/images/controls/chevron-right.svg"
model: connectionTypesModel
model: root.connectionTypesModel
currentIndex: 0
clickedFunction: function() {
@ -326,7 +326,7 @@ PageType {
onClicked: {
if (accessTypeSelector.currentIndex === 0) {
connectionTypesModel[connectionTypeSelector.currentIndex].func()
root.connectionTypesModel[accessTypeSelector.currentIndex].func()
} else {
ExportController.generateConfig(true)
}

View file

@ -77,8 +77,8 @@ PageType {
isSelected: tabBar.currentIndex === 0
image: "qrc:/images/controls/home.svg"
onClicked: {
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
}
}
TabImageButtonType {
@ -94,7 +94,7 @@ PageType {
}
visible: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
width: visible ? undefined : 0
width: ServersModel.isCurrentlyProcessedServerHasWriteAccess() ? undefined : 0
isSelected: tabBar.currentIndex === 1
image: "qrc:/images/controls/share-2.svg"