added protocol settings page and openvpn settings page

This commit is contained in:
vladimir.kuznetsov 2023-06-07 18:28:32 +08:00
parent 80fca589af
commit 1fd48a1cf8
12 changed files with 209 additions and 67 deletions

View file

@ -254,5 +254,8 @@
<file>ui/qml/Components/QuestionDrawer.qml</file> <file>ui/qml/Components/QuestionDrawer.qml</file>
<file>ui/qml/Pages2/PageDeinstalling.qml</file> <file>ui/qml/Pages2/PageDeinstalling.qml</file>
<file>ui/qml/Controls2/BackButtonType.qml</file> <file>ui/qml/Controls2/BackButtonType.qml</file>
<file>ui/qml/Pages2/PageSettingsServerProtocol.qml</file>
<file>ui/qml/Components/Protocols/OpenVpnSettings.qml</file>
<file>ui/qml/Components/TransportProtoSelector.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -9,14 +9,30 @@
namespace PageLoader namespace PageLoader
{ {
Q_NAMESPACE Q_NAMESPACE
enum class PageEnum { PageStart = 0, PageHome, PageShare, PageDeinstalling, enum class PageEnum {
PageStart = 0,
PageHome,
PageShare,
PageDeinstalling,
PageSettingsServersList, PageSettings, PageSettingsServerData, PageSettingsServerInfo, PageSettingsServersList,
PageSettingsServerProtocols, PageSettingsServerServices, PageSettings,
PageSettingsServerData,
PageSettingsServerInfo,
PageSettingsServerProtocols,
PageSettingsServerServices,
PageSettingsServerProtocol,
PageSetupWizardStart, PageTest, PageSetupWizardCredentials, PageSetupWizardProtocols, PageSetupWizardEasy, PageSetupWizardStart,
PageSetupWizardProtocolSettings, PageSetupWizardInstalling, PageSetupWizardConfigSource, PageTest,
PageSetupWizardTextKey, PageSetupWizardViewConfig PageSetupWizardCredentials,
PageSetupWizardProtocols,
PageSetupWizardEasy,
PageSetupWizardProtocolSettings,
PageSetupWizardInstalling,
PageSetupWizardConfigSource,
PageSetupWizardTextKey,
PageSetupWizardViewConfig
}; };
Q_ENUM_NS(PageEnum) Q_ENUM_NS(PageEnum)

View file

@ -20,6 +20,7 @@ ListView {
height: menuContent.contentItem.height height: menuContent.contentItem.height
clip: true clip: true
interactive: false
ButtonGroup { ButtonGroup {
id: containersRadioButtonGroup id: containersRadioButtonGroup

View file

@ -0,0 +1,81 @@
import QtQuick 2.15
import QtQuick.Controls
import QtQuick.Layouts
import "../../Controls2"
import "../../Controls2/TextTypes"
import "../../Components"
Item {
id: root
ColumnLayout {
anchors.fill: parent
anchors.leftMargin: 16
anchors.rightMargin: 16
spacing: 16
Header2TextType {
Layout.fillWidth: true
text: "OpenVpn"
}
TextFieldWithHeaderType {
Layout.fillWidth: true
headerText: qsTr("VPN Addresses Subnet")
}
ParagraphTextType {
Layout.fillWidth: true
text: qsTr("Network protocol")
}
TransportProtoSelector {
Layout.fillWidth: true
}
TextFieldWithHeaderType {
Layout.fillWidth: true
headerText: qsTr("Port")
}
SwitcherType {
Layout.fillWidth: true
text: qsTr("Auto-negotiate encryption")
}
DropDownType {
Layout.fillWidth: true
}
DropDownType {
Layout.fillWidth: true
}
CheckBoxType {
Layout.fillWidth: true
text: qsTr("TLS auth")
}
CheckBoxType {
Layout.fillWidth: true
text: qsTr("Block DNS requests outside of VPN")
}
SwitcherType {
Layout.fillWidth: true
text: qsTr("Additional configuration commands")
}
}
}

View file

@ -18,6 +18,7 @@ ListView {
height: root.contentItem.height height: root.contentItem.height
clip: true clip: true
interactive: false
ButtonGroup { ButtonGroup {
id: containersRadioButtonGroup id: containersRadioButtonGroup
@ -89,8 +90,7 @@ ListView {
onClicked: { onClicked: {
if (isInstalled) { if (isInstalled) {
// isDefault = true goToPage(PageEnum.PageSettingsServerProtocol)
// root.currentIndex = index
} else { } else {
ContainersModel.setCurrentlyInstalledContainerIndex(root.model.mapToSource(index)) ContainersModel.setCurrentlyInstalledContainerIndex(root.model.mapToSource(index))
InstallController.setShouldCreateServer(false) InstallController.setShouldCreateServer(false)

View file

@ -0,0 +1,59 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import "../Controls2"
import "../Controls2/TextTypes"
Rectangle {
id: root
property var rootWidth: root.width
property int currentIndex
property alias mouseArea: transportProtoButtonMouseArea
implicitWidth: transportProtoButtonGroup.implicitWidth
implicitHeight: transportProtoButtonGroup.implicitHeight
color: "#1C1D21"
radius: 16
RowLayout {
id: transportProtoButtonGroup
spacing: 0
HorizontalRadioButton {
checked: root.currentIndex === 0
implicitWidth: (rootWidth - 32) / 2
text: "UDP"
hoverEnabled: !transportProtoButtonMouseArea.enabled
onClicked: {
root.currentIndex = 0
}
}
HorizontalRadioButton {
checked: root.currentIndex === 1
implicitWidth: (rootWidth - 32) / 2
text: "TCP"
hoverEnabled: !transportProtoButtonMouseArea.enabled
onClicked: {
root.currentIndex = 1
}
}
}
MouseArea {
id: transportProtoButtonMouseArea
anchors.fill: parent
}
}

View file

@ -2,6 +2,8 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import "TextTypes"
RadioButton { RadioButton {
id: root id: root
@ -74,15 +76,9 @@ RadioButton {
anchors.fill: parent anchors.fill: parent
spacing: 16 spacing: 16
Text { ButtonTextType {
text: root.text text: root.text
wrapMode: Text.WordWrap
color: "#D7D8DB"
font.pixelSize: 16
font.weight: 400
font.family: "PT Root UI VF"
height: 24
Layout.fillWidth: true Layout.fillWidth: true
Layout.rightMargin: 16 Layout.rightMargin: 16
Layout.leftMargin: 16 Layout.leftMargin: 16

View file

@ -164,7 +164,7 @@ PageType {
text: root.currentContainerName text: root.currentContainerName
textColor: "#0E0E11" textColor: "#0E0E11"
headerText: "Протокол подключения" headerText: qsTr("Протокол подключения")
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg" headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
onRootButtonClicked: function() { onRootButtonClicked: function() {
@ -198,7 +198,7 @@ PageType {
actionButtonImage: "qrc:/images/controls/plus.svg" actionButtonImage: "qrc:/images/controls/plus.svg"
headerText: "Серверы" headerText: qsTr("Servers")
actionButtonFunction: function() { actionButtonFunction: function() {
menu.visible = false menu.visible = false
@ -237,6 +237,7 @@ PageType {
currentIndex: ServersModel.getDefaultServerIndex() currentIndex: ServersModel.getDefaultServerIndex()
clip: true clip: true
interactive: false
delegate: Item { delegate: Item {
id: menuContentDelegate id: menuContentDelegate

View file

@ -0,0 +1,24 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
import "../Components"
import "../Components/Protocols"
PageType {
id: root
OpenVpnSettings {
anchors.fill: parent
}
}

View file

@ -67,6 +67,7 @@ PageType {
model: ServersModel model: ServersModel
clip: true clip: true
interactive: false
delegate: Item { delegate: Item {
implicitWidth: servers.width implicitWidth: servers.width

View file

@ -12,6 +12,7 @@ import "./"
import "../Controls2" import "../Controls2"
import "../Controls2/TextTypes" import "../Controls2/TextTypes"
import "../Config" import "../Config"
import "../Components"
PageType { PageType {
id: root id: root
@ -83,53 +84,11 @@ PageType {
text: "Network protocol" text: "Network protocol"
} }
Rectangle { TransportProtoSelector {
id: transportProtoBackground id: transportProtoSelector
implicitWidth: transportProtoButtonGroup.implicitWidth Layout.fillWidth: true
implicitHeight: transportProtoButtonGroup.implicitHeight rootWidth: root.width
color: "#1C1D21"
radius: 16
RowLayout {
id: transportProtoButtonGroup
property int currentIndex
spacing: 0
HorizontalRadioButton {
checked: transportProtoButtonGroup.currentIndex === 0
implicitWidth: (root.width - 32) / 2
text: "UDP"
hoverEnabled: !transportProtoButtonMouseArea.enabled
onClicked: {
transportProtoButtonGroup.currentIndex = 0
}
}
HorizontalRadioButton {
checked: transportProtoButtonGroup.currentIndex === 1
implicitWidth: (root.width - 32) / 2
text: "TCP"
hoverEnabled: !transportProtoButtonMouseArea.enabled
onClicked: {
transportProtoButtonGroup.currentIndex = 1
}
}
}
MouseArea {
id: transportProtoButtonMouseArea
anchors.fill: parent
}
} }
TextFieldWithHeaderType { TextFieldWithHeaderType {
@ -143,7 +102,7 @@ PageType {
Rectangle { Rectangle {
// todo make it dynamic // todo make it dynamic
implicitHeight: root.height - port.implicitHeight - implicitHeight: root.height - port.implicitHeight -
transportProtoBackground.implicitHeight - transportProtoHeader.implicitHeight - transportProtoSelector.implicitHeight - transportProtoHeader.implicitHeight -
header.implicitHeight - backButton.implicitHeight - installButton.implicitHeight - 116 header.implicitHeight - backButton.implicitHeight - installButton.implicitHeight - 116
color: "transparent" color: "transparent"
@ -159,7 +118,7 @@ PageType {
onClicked: function() { onClicked: function() {
goToPage(PageEnum.PageSetupWizardInstalling); goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.install(dockerContainer, port.textFieldText, transportProtoButtonGroup.currentIndex) InstallController.install(dockerContainer, port.textFieldText, transportProtoSelector.currentIndex)
} }
} }
@ -172,10 +131,10 @@ PageType {
} else { } else {
port.textFieldText = ProtocolProps.defaultPort(defaultContainerProto) port.textFieldText = ProtocolProps.defaultPort(defaultContainerProto)
} }
transportProtoButtonGroup.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto) transportProtoSelector.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto)
port.enabled = ProtocolProps.defaultPortChangeable(defaultContainerProto) port.enabled = ProtocolProps.defaultPortChangeable(defaultContainerProto)
transportProtoButtonMouseArea.enabled = !ProtocolProps.defaultTransportProtoChangeable(defaultContainerProto) transportProtoSelector.mouseArea.enabled = !ProtocolProps.defaultTransportProtoChangeable(defaultContainerProto)
} }
} }
} }

View file

@ -78,6 +78,7 @@ PageType {
TabImageButtonType { TabImageButtonType {
isSelected: tabBar.currentIndex === 1 isSelected: tabBar.currentIndex === 1
image: "qrc:/images/controls/share-2.svg" image: "qrc:/images/controls/share-2.svg"
onClicked: {}
} }
TabImageButtonType { TabImageButtonType {
isSelected: tabBar.currentIndex === 2 isSelected: tabBar.currentIndex === 2