added display of vpn containers and services on the settings page

- added PageSettingsData and implementation of 'remove all containers'  button
This commit is contained in:
vladimir.kuznetsov 2023-05-27 22:46:41 +08:00
parent e00656d757
commit 1e180489a4
19 changed files with 393 additions and 102 deletions

View file

@ -37,21 +37,6 @@ PageType {
}
}
Connections {
target: InstallController
function onInstallContainerFinished() {
goToStartPage()
menu.visible = true
containersDropDown.menuVisible = true
}
function onInstallServerFinished() {
goToStartPage()
menu.visible = true
}
}
Rectangle {
id: buttonBackground
anchors.fill: buttonContent
@ -166,6 +151,10 @@ PageType {
ValueFilter {
roleName: "serviceType"
value: ProtocolEnum.Vpn
},
ValueFilter {
roleName: "isSupported"
value: true
}
]
}

View file

@ -5,6 +5,7 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import ProtocolProps 1.0
@ -12,6 +13,7 @@ import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
import "../Components"
PageType {
id: root
@ -27,35 +29,28 @@ PageType {
]
}
FlickableType {
id: fl
anchors.fill: parent
contentHeight: content.height
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.fill: parent
spacing: 16
Repeater {
id: header
model: proxyServersModel
delegate: HeaderType {
id: header
Layout.fillWidth: true
Layout.topMargin: 20
Layout.leftMargin: 16
Layout.rightMargin: 16
actionButtonImage: "qrc:/images/controls/plus.svg"
actionButtonImage: "qrc:/images/controls/edit-3.svg"
backButtonImage: "qrc:/images/controls/arrow-left.svg"
headerText: name
descriptionText: hostName
actionButtonFunction: function() {
connectionTypeSelection.visible = true
@ -66,6 +61,82 @@ PageType {
}
}
}
TabBar {
id: tabBar
Layout.fillWidth: true
background: Rectangle {
color: "transparent"
}
TabButtonType {
isSelected: tabBar.currentIndex === 0
text: qsTr("Protocols")
}
TabButtonType {
isSelected: tabBar.currentIndex === 1
text: qsTr("Services")
}
TabButtonType {
isSelected: tabBar.currentIndex === 2
text: qsTr("Data")
}
}
StackLayout {
id: stackLayout
currentIndex: tabBar.currentIndex
Layout.fillWidth: true
height: root.height
StackView {
id: protocolsStackView
initialItem: PageSettingsContainersListView {
model: SortFilterProxyModel {
sourceModel: ContainersModel
filters: [
ValueFilter {
roleName: "serviceType"
value: ProtocolEnum.Vpn
},
ValueFilter {
roleName: "isSupported"
value: true
}
]
}
}
}
StackView {
id: servicesStackView
initialItem: PageSettingsContainersListView {
model: SortFilterProxyModel {
sourceModel: ContainersModel
filters: [
ValueFilter {
roleName: "serviceType"
value: ProtocolEnum.Other
},
ValueFilter {
roleName: "isSupported"
value: true
}
]
}
}
}
StackView {
id: dataStackView
initialItem: PageSettingsData {
}
}
}
}
}
// }
}

View file

@ -0,0 +1,67 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import "../Controls2"
import "../Controls2/TextTypes"
PageType {
id: root
FlickableType {
id: fl
anchors.top: root.top
anchors.bottom: root.bottom
contentHeight: content.height
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
LabelWithButtonType {
Layout.fillWidth: true
text: "Clear Amnezia cache"
descriptionText: "May be needed when changing other settings"
clickedFunction: function() {
}
}
DividerType {}
LabelWithButtonType {
Layout.fillWidth: true
text: "Remove server from application"
textColor: "#EB5757"
clickedFunction: function() {
}
}
DividerType {}
LabelWithButtonType {
Layout.fillWidth: true
text: "Clear server from Amnezia software"
textColor: "#EB5757"
clickedFunction: function() {
ContainersModel.removeAllContainers()
}
}
DividerType {}
}
}
}

View file

@ -57,11 +57,6 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 16
anchors.rightMargin: 16
spacing: 16
ListView {
id: servers
width: parent.width
@ -85,8 +80,6 @@ PageType {
LabelWithButtonType {
id: server
Layout.fillWidth: true
Layout.topMargin: 16
Layout.bottomMargin: 16
text: name
descriptionText: hostName
@ -98,11 +91,7 @@ PageType {
}
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#2C2D30"
}
DividerType {}
}
}
}

View file

@ -33,14 +33,12 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 16
anchors.leftMargin: 16
spacing: 16
HeaderType {
Layout.fillWidth: true
Layout.topMargin: 20
Layout.rightMargin: 16
Layout.leftMargin: 16
backButtonImage: "qrc:/images/controls/arrow-left.svg"
@ -52,6 +50,8 @@ PageType {
Header2TextType {
Layout.fillWidth: true
Layout.topMargin: 32
Layout.rightMargin: 16
Layout.leftMargin: 16
text: "Что у вас есть?"
}
@ -75,11 +75,8 @@ PageType {
}
}
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#2C2D30"
}
DividerType {}
//todo ifdef mobile platforms
LabelWithButtonType {
@ -93,11 +90,7 @@ PageType {
}
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#2C2D30"
}
DividerType {}
LabelWithButtonType {
Layout.fillWidth: true
@ -111,11 +104,7 @@ PageType {
}
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#2C2D30"
}
DividerType {}
}
}
}

View file

@ -23,6 +23,14 @@ PageType {
closePage()
PageController.showErrorMessage(errorMessage)
}
function onInstallContainerFinished() {
goToStartPage()
}
function onInstallServerFinished() {
goToStartPage()
}
}
SortFilterProxyModel {

View file

@ -75,12 +75,12 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: -16
anchors.leftMargin: -16
LabelWithButtonType {
id: container
Layout.fillWidth: true
Layout.topMargin: 16
Layout.bottomMargin: 16
text: name
descriptionText: description
@ -92,11 +92,7 @@ PageType {
}
}
Rectangle {
Layout.fillWidth: true
height: 1
color: "#2C2D30"
}
DividerType {}
}
}
}

View file

@ -26,8 +26,9 @@ PageType {
target: InstallController
function onInstallServerFinished() {
//todo add smt like changeStartPage
goToStartPage()
// goToPage(PageEnum.PageStart)
goToPage(PageEnum.PageStart)
}
}

View file

@ -38,8 +38,9 @@ PageType {
height: root.height - tabBar.implicitHeight
StackView {
id: homeStackView
initialItem: "PageHome.qml" //PageController.getPagePath(PageEnum.PageSettingsServersList)
initialItem: PageHome {
id: pageHome
}
}
Item {
@ -47,8 +48,9 @@ PageType {
}
StackView {
id: settingsStackView
initialItem: "PageSettingsServersList.qml" //PageController.getPagePath(PageEnum.PageSettingsServersList)
initialItem: PageSettingsServersList {
id: pageSettingsServersList
}
}
}
@ -72,6 +74,9 @@ PageType {
TabImageButtonType {
isSelected: tabBar.currentIndex === 0
image: "qrc:/images/controls/home.svg"
onClicked: {
pageSettingsServersList.goToStartPage()
}
}
TabImageButtonType {
isSelected: tabBar.currentIndex === 1
@ -80,6 +85,9 @@ PageType {
TabImageButtonType {
isSelected: tabBar.currentIndex === 2
image: "qrc:/images/controls/settings-2.svg"
onClicked: {
pageHome.goToStartPage()
}
}
}