Merge branch 'feature/new-gui' into fixbug/not_hide_topright_corner_button

This commit is contained in:
ronoaer 2023-09-22 06:28:02 +08:00 committed by GitHub
commit 81b77c9688
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 2309 additions and 79 deletions

View file

@ -43,10 +43,12 @@ ListView {
var containerIndex = root.model.mapToSource(index)
ContainersModel.setCurrentlyProcessedContainerIndex(containerIndex)
if (config[ContainerProps.containerTypeToString(containerIndex)]["isThirdPartyConfig"]) {
ProtocolsModel.updateModel(config)
PageController.goToPage(PageEnum.PageProtocolRaw)
return
if (serviceType !== ProtocolEnum.Other) {
if (config[ContainerProps.containerTypeToString(containerIndex)]["isThirdPartyConfig"]) {
ProtocolsModel.updateModel(config)
PageController.goToPage(PageEnum.PageProtocolRaw)
return
}
}
switch (containerIndex) {
@ -78,12 +80,13 @@ ListView {
PageController.goToPage(PageEnum.PageServiceTorWebsiteSettings)
break
}
default: {
if (serviceType !== ProtocolEnum.Other) { //todo disable settings for dns container
ProtocolsModel.updateModel(config)
PageController.goToPage(PageEnum.PageSettingsServerProtocol)
}
case ContainerEnum.Dns: {
PageController.goToPage(PageEnum.PageServiceDnsSettings)
break
}
default: { // go to the settings page of the container with multiple protocols
ProtocolsModel.updateModel(config)
PageController.goToPage(PageEnum.PageSettingsServerProtocol)
}
}

View file

@ -2,7 +2,9 @@ import QtQuick
import QtQuick.Controls
Drawer {
id: drawer
property bool needCloseButton: true
property bool isOpened: false
Connections {
target: PageController
@ -51,12 +53,16 @@ Drawer {
}
onOpened: {
isOpened = true
if (needCloseButton) {
PageController.drawerOpen()
}
}
onClosed: {
isOpened = false
if (needCloseButton) {
PageController.drawerClose()
}
@ -66,4 +72,27 @@ Drawer {
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
}
}
onPositionChanged: {
if (isOpened && (position <= 0.99 && position >= 0.95)) {
mouseArea.canceled()
drawer.close()
mouseArea.exited()
dropArea.exited()
}
}
DropArea {
id: dropArea
}
MouseArea {
id: mouseArea
anchors.fill: parent
onPressed: {
isOpened = true
}
}
}

View file

@ -0,0 +1,95 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
import "../Components"
PageType {
id: root
ColumnLayout {
id: backButton
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20
BackButtonType {
}
}
FlickableType {
id: fl
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
contentHeight: content.implicitHeight
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
HeaderType {
id: header
Layout.fillWidth: true
Layout.rightMargin: 16
Layout.leftMargin: 16
headerText: "Amnezia DNS"
descriptionText: qsTr("A DNS service is installed on your server, and it is only accessible via VPN.\n") +
qsTr("The DNS address is the same as the address of your server. You can configure DNS in the settings, under the connections tab.")
}
LabelWithButtonType {
id: removeButton
Layout.topMargin: 24
width: parent.width
text: qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName()
textColor: "#EB5757"
clickedFunction: function() {
questionDrawer.headerText = qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName() + qsTr(" from server?")
questionDrawer.yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.visible = false
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeCurrentlyProcessedContainer()
}
questionDrawer.noButtonFunction = function() {
questionDrawer.visible = false
}
questionDrawer.visible = true
}
MouseArea {
anchors.fill: removeButton
cursorShape: Qt.PointingHandCursor
enabled: false
}
}
DividerType {}
QuestionDrawer {
id: questionDrawer
}
}
}
}

View file

@ -8,6 +8,7 @@ import "./"
import "../Controls2"
import "../Config"
import "../Controls2/TextTypes"
import "../Components"
PageType {
id: root
@ -72,6 +73,38 @@ PageType {
}
}
BasicButtonType {
Layout.fillWidth: true
defaultColor: "transparent"
hoveredColor: Qt.rgba(1, 1, 1, 0.08)
pressedColor: Qt.rgba(1, 1, 1, 0.12)
disabledColor: "#878B91"
textColor: "#D7D8DB"
borderWidth: 1
text: qsTr("Restore default")
onClicked: function() {
questionDrawer.headerText = qsTr("Restore default DNS settings?")
questionDrawer.yesButtonText = qsTr("Continue")
questionDrawer.noButtonText = qsTr("Cancel")
questionDrawer.yesButtonFunction = function() {
questionDrawer.visible = false
SettingsController.primaryDns = "1.1.1.1"
primaryDns.textFieldText = SettingsController.primaryDns
SettingsController.secondaryDns = "1.0.0.1"
secondaryDns.textFieldText = SettingsController.secondaryDns
PageController.showNotificationMessage(qsTr("Settings have been reset"))
}
questionDrawer.noButtonFunction = function() {
questionDrawer.visible = false
}
questionDrawer.visible = true
}
}
BasicButtonType {
Layout.fillWidth: true
@ -84,8 +117,12 @@ PageType {
if (secondaryDns.textFieldText !== SettingsController.secondaryDns) {
SettingsController.secondaryDns = secondaryDns.textFieldText
}
PageController.showNotificationMessage(qsTr("Settings saved"))
}
}
}
QuestionDrawer {
id: questionDrawer
}
}
}

View file

@ -27,7 +27,7 @@ PageType {
}
]
sorters: RoleSorter {
roleName: "dockerContainer"
roleName: "easySetupOrder"
sortOrder: Qt.DescendingOrder
}
}