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/Pages2/PageDeinstalling.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>
</RCC>

View file

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

View file

@ -20,6 +20,7 @@ ListView {
height: menuContent.contentItem.height
clip: true
interactive: false
ButtonGroup {
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
clip: true
interactive: false
ButtonGroup {
id: containersRadioButtonGroup
@ -89,8 +90,7 @@ ListView {
onClicked: {
if (isInstalled) {
// isDefault = true
// root.currentIndex = index
goToPage(PageEnum.PageSettingsServerProtocol)
} else {
ContainersModel.setCurrentlyInstalledContainerIndex(root.model.mapToSource(index))
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.Layouts
import "TextTypes"
RadioButton {
id: root
@ -74,15 +76,9 @@ RadioButton {
anchors.fill: parent
spacing: 16
Text {
ButtonTextType {
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.rightMargin: 16
Layout.leftMargin: 16

View file

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

View file

@ -12,6 +12,7 @@ import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
import "../Components"
PageType {
id: root
@ -83,53 +84,11 @@ PageType {
text: "Network protocol"
}
Rectangle {
id: transportProtoBackground
TransportProtoSelector {
id: transportProtoSelector
implicitWidth: transportProtoButtonGroup.implicitWidth
implicitHeight: transportProtoButtonGroup.implicitHeight
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
}
Layout.fillWidth: true
rootWidth: root.width
}
TextFieldWithHeaderType {
@ -143,7 +102,7 @@ PageType {
Rectangle {
// todo make it dynamic
implicitHeight: root.height - port.implicitHeight -
transportProtoBackground.implicitHeight - transportProtoHeader.implicitHeight -
transportProtoSelector.implicitHeight - transportProtoHeader.implicitHeight -
header.implicitHeight - backButton.implicitHeight - installButton.implicitHeight - 116
color: "transparent"
@ -159,7 +118,7 @@ PageType {
onClicked: function() {
goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.install(dockerContainer, port.textFieldText, transportProtoButtonGroup.currentIndex)
InstallController.install(dockerContainer, port.textFieldText, transportProtoSelector.currentIndex)
}
}
@ -172,10 +131,10 @@ PageType {
} else {
port.textFieldText = ProtocolProps.defaultPort(defaultContainerProto)
}
transportProtoButtonGroup.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto)
transportProtoSelector.currentIndex = ProtocolProps.defaultTransportProto(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 {
isSelected: tabBar.currentIndex === 1
image: "qrc:/images/controls/share-2.svg"
onClicked: {}
}
TabImageButtonType {
isSelected: tabBar.currentIndex === 2