Various types containers support

This commit is contained in:
pokamest 2021-09-20 21:51:28 +03:00
parent 0d9f1ba95b
commit 157d7c4f23
39 changed files with 609 additions and 479 deletions

View file

@ -3,7 +3,6 @@ import QtQuick.Controls 2.12
Image {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 30
// width: GC.trW(150)
// height: GC.trH(22)

View file

@ -1,14 +1,15 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import SortFilterProxyModel 0.2
import ProtocolEnum 1.0
import "./"
import "../../Controls"
import "../../Config"
Drawer {
id: root
signal containerSelected(int id)
property alias selectedIndex: tb.currentIndex
signal containerSelected(int c_index)
property int selectedIndex: -1
property alias modelFilters: proxyModel.filters
z: -3
@ -30,8 +31,22 @@ Drawer {
roleName: "is_installed_role"
value: false },
ValueFilter {
roleName: "is_vpn_role"
value: true }
roleName: "service_type_role"
value: ProtocolEnum.Vpn }
]
}
SortFilterProxyModel {
id: proxyModel_other
sourceModel: UiLogic.containersModel
filters: [
ValueFilter {
roleName: "is_installed_role"
value: false },
ValueFilter {
roleName: "service_type_role"
value: ProtocolEnum.Other }
]
}
@ -60,7 +75,8 @@ Drawer {
ListView {
id: tb
x: 10
width: parent.width - 40
currentIndex: -1
width: parent.width - 20
height: contentItem.height
spacing: 0
@ -104,7 +120,9 @@ Drawer {
anchors.fill: parent
onClicked: {
tb.currentIndex = index
containerSelected(index)
tb_other.currentIndex = -1
containerSelected(proxyModel.mapToSource(index))
selectedIndex = proxyModel.mapToSource(index)
root.close()
}
}
@ -112,64 +130,68 @@ Drawer {
}
// Caption {
// id: cap2
// text: qsTr("Other containers")
// }
Caption {
id: cap2
font.pixelSize: 20
text: qsTr("Other containers")
}
// ListView {
// id: tb_other
// x: 10
// //y: 20
// width: parent.width - 40
// height: contentItem.height
ListView {
id: tb_other
x: 10
currentIndex: -1
width: parent.width - 20
height: contentItem.height
// spacing: 1
// clip: true
// interactive: false
// property int currentRow: -1
// model: UiLogic.containersModel
spacing: 0
clip: true
interactive: false
model: proxyModel_other
// delegate: Item {
// implicitWidth: 170 * 2
// implicitHeight: 30
// Item {
// width: parent.width
// height: 30
// anchors.left: parent.left
// id: c1_other
// Rectangle {
// anchors.top: parent.top
// width: parent.width
// height: 1
// color: "lightgray"
// visible: index !== tb_other.currentRow
// }
// Rectangle {
// anchors.fill: parent
// color: "#63B4FB"
// visible: index === tb_other.currentRow
delegate: Item {
implicitWidth: 170 * 2
implicitHeight: 30
Item {
width: parent.width
height: 30
anchors.left: parent.left
id: c1_other
Rectangle {
anchors.top: parent.top
width: parent.width
height: 1
color: "lightgray"
visible: index !== tb_other.currentIndex
}
Rectangle {
anchors.fill: parent
color: "#63B4FB"
visible: index === tb_other.currentIndex
// }
// Text {
// id: text_name_other
// text: name
// font.pixelSize: 16
// anchors.fill: parent
// leftPadding: 10
// verticalAlignment: Text.AlignVCenter
// wrapMode: Text.WordWrap
// }
// }
}
Text {
id: text_name_other
text: name_role
font.pixelSize: 16
anchors.fill: parent
leftPadding: 10
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
}
}
// MouseArea {
// anchors.fill: parent
// onClicked: {
// tb_other.currentRow = index
// }
// }
// }
// }
MouseArea {
anchors.fill: parent
onClicked: {
tb_other.currentIndex = index
tb.currentIndex = -1
containerSelected(proxyModel_other.mapToSource(index))
selectedIndex = proxyModel_other.mapToSource(index)
root.close()
}
}
}
}
}

View file

@ -10,6 +10,8 @@ Item {
property var page: PageEnum.Start
property var logic: UiLogic
signal activated(bool reset)
// width: GC.screenWidth
// height: GC.screenHeight

View file

@ -57,5 +57,6 @@ PageBase {
}
Logo {
anchors.bottom: parent.bottom
}
}

View file

@ -1,71 +0,0 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import PageEnum 1.0
import "./"
import "../Controls"
import "../Config"
PageBase {
id: root
page: PageEnum.ServerConfiguring
logic: NewServerConfiguringLogic
enabled: NewServerConfiguringLogic.pageEnabled
Caption {
text: qsTr("Configuring...")
}
LabelType {
x: 30
y: 90
width: 321
height: 31
text: qsTr("Please wait.")
}
LabelType {
x: 40
y: 560
width: 301
height: 41
text: NewServerConfiguringLogic.labelWaitInfoText
visible: NewServerConfiguringLogic.labelWaitInfoVisible
}
ProgressBar {
id: pr
anchors.horizontalCenter: parent.horizontalCenter
y: 510
width: 301
height: 40
from: 0
to: NewServerConfiguringLogic.progressBarMaximium
value: NewServerConfiguringLogic.progressBarValue
visible: NewServerConfiguringLogic.progressBarVisible
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: pr.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
LabelType {
anchors.fill: parent
text: NewServerConfiguringLogic.progressBarText
horizontalAlignment: Text.AlignHCenter
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#D4D4D4"
visible: NewServerConfiguringLogic.progressBarTextVisible
}
}
}

View file

@ -1,6 +1,8 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.3
import ContainerProps 1.0
import ProtocolProps 1.0
import PageEnum 1.0
import "./"
import "../Controls"
@ -12,6 +14,11 @@ PageBase {
page: PageEnum.NewServerProtocols
logic: NewServerProtocolsLogic
onActivated: {
container_selector.selectedIndex = -1
UiLogic.containersModel.setSelectedServerIndex(-1)
}
BackButton {
id: back
}
@ -29,7 +36,10 @@ PageBase {
height: 40
text: qsTr("Setup server")
onClicked: {
NewServerProtocolsLogic.pushButtonConfigureClicked()
let cont = container_selector.selectedIndex
let tp = ProtocolProps.transportProtoFromString(cb_port_proto.currentText)
let port = tf_port_num.text
NewServerProtocolsLogic.onPushButtonConfigureClicked(cont, port, tp)
}
}
@ -49,6 +59,15 @@ PageBase {
SelectContainer {
id: container_selector
onContainerSelected: {
var containerProto = ContainerProps.defaultProtocol(c_index)
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 {
@ -108,36 +127,23 @@ PageBase {
LabelType {
width: 130
text: qsTr("Port (TCP/UDP)")
text: qsTr("Port")
}
TextFieldType {
id: tf_port_num
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
text: NewServerProtocolsLogic.lineEditOpenvpnPortText
onEditingFinished: {
NewServerProtocolsLogic.lineEditOpenvpnPortText = text
}
}
LabelType {
width: 130
text: qsTr("Protocol")
text: qsTr("Network Protocol")
}
ComboBoxType {
id: cb_port_proto
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
model: [
qsTr("udp"),
qsTr("tcp"),
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (NewServerProtocolsLogic.comboBoxOpenvpnProtoText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
NewServerProtocolsLogic.comboBoxOpenvpnProtoText = currentText
}
}
}
}

View file

@ -0,0 +1,93 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import PageEnum 1.0
import "./"
import "../Controls"
import "../Config"
PageBase {
id: root
page: PageEnum.ServerConfiguringProgress
logic: ServerConfiguringProgressLogic
enabled: ServerConfiguringProgressLogic.pageEnabled
Caption {
id: caption
text: qsTr("Configuring...")
}
LabelType {
id: label
x: 0
anchors.top: caption.bottom
anchors.topMargin: 10
width: parent.width
height: 31
text: qsTr("Please wait.")
horizontalAlignment: Text.AlignHCenter
}
LabelType {
anchors.bottom: pr.top
anchors.bottomMargin: 20
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
width: parent.width - 40
height: 41
text: ServerConfiguringProgressLogic.labelWaitInfoText
visible: ServerConfiguringProgressLogic.labelWaitInfoVisible
}
ProgressBar {
id: pr
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: logo.bottom
anchors.bottomMargin: 40
width: parent.width - 40
height: 40
from: 0
to: ServerConfiguringProgressLogic.progressBarMaximium
value: ServerConfiguringProgressLogic.progressBarValue
visible: ServerConfiguringProgressLogic.progressBarVisible
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: pr.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
LabelType {
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
text: ServerConfiguringProgressLogic.progressBarText
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#D4D4D4"
visible: ServerConfiguringProgressLogic.progressBarTextVisible
}
}
Logo {
id : logo
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
}
}

View file

@ -23,6 +23,7 @@ PageBase {
Logo {
id: logo
anchors.bottom: parent.bottom
}
BasicButtonType {

View file

@ -41,8 +41,8 @@ Window {
if (page === PageEnum.WizardHigh) {
WizardLogic.updatePage();
}
if (page === PageEnum.ServerConfiguring) {
ServerConfiguringLogic.progressBarValue = 0;
if (page === PageEnum.ServerConfiguringProgress) {
ServerConfiguringProgressLogic.progressBarValue = 0;
}
if (page === PageEnum.GeneralSettings) {
GeneralSettingsLogic.updatePage();
@ -79,6 +79,8 @@ Window {
} else {
pageLoader.push(pages[page], {}, StackView.Immediate)
}
pages[page].activated(reset)
}
function gotoProtocolPage(protocol, reset, slide) {
@ -91,6 +93,8 @@ Window {
} else {
pageLoader.push(protocolPages[protocol], {}, StackView.Immediate)
}
protocolPages[protocol].activated(reset)
}
function close_page() {