From 384ce9853b92b99f060a566257f1e0b701f9272d Mon Sep 17 00:00:00 2001 From: ronoaer Date: Sat, 14 Oct 2023 23:00:31 +0800 Subject: [PATCH 01/47] added new drawer2type for replacing drawertype --- client/resources.qrc | 1 + .../ConnectionTypeSelectionDrawer.qml | 2 +- client/ui/qml/Components/QuestionDrawer.qml | 2 +- .../qml/Components/SelectLanguageDrawer.qml | 2 +- .../qml/Components/ShareConnectionDrawer.qml | 11 +- client/ui/qml/Controls2/Drawer2Type.qml | 266 ++++++++++++++++++ client/ui/qml/Controls2/DropDownType.qml | 5 +- .../Pages2/PageProtocolOpenVpnSettings.qml | 7 +- client/ui/qml/Pages2/PageProtocolRaw.qml | 10 +- .../ui/qml/Pages2/PageServiceDnsSettings.qml | 7 +- .../ui/qml/Pages2/PageServiceSftpSettings.qml | 7 +- .../Pages2/PageServiceTorWebsiteSettings.qml | 7 +- .../ui/qml/Pages2/PageSettingsApplication.qml | 8 +- client/ui/qml/Pages2/PageSettingsBackup.qml | 6 +- client/ui/qml/Pages2/PageSettingsDns.qml | 7 +- client/ui/qml/Pages2/PageSettingsLogging.qml | 7 +- .../ui/qml/Pages2/PageSettingsServerData.qml | 12 +- .../ui/qml/Pages2/PageSettingsServerInfo.qml | 6 +- .../qml/Pages2/PageSettingsServerProtocol.qml | 6 +- .../qml/Pages2/PageSettingsSplitTunneling.qml | 15 +- .../PageSetupWizardProtocolSettings.qml | 4 +- client/ui/qml/Pages2/PageSetupWizardStart.qml | 3 +- client/ui/qml/Pages2/PageShare.qml | 1 + client/ui/qml/Pages2/PageStart.qml | 4 +- 24 files changed, 350 insertions(+), 56 deletions(-) create mode 100644 client/ui/qml/Controls2/Drawer2Type.qml diff --git a/client/resources.qrc b/client/resources.qrc index f0494852..d7f8ff7a 100644 --- a/client/resources.qrc +++ b/client/resources.qrc @@ -216,5 +216,6 @@ ui/qml/Pages2/PageServiceDnsSettings.qml ui/qml/Controls2/TopCloseButtonType.qml images/controls/x-circle.svg + ui/qml/Controls2/Drawer2Type.qml diff --git a/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml b/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml index ecde1554..a368d45c 100644 --- a/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml +++ b/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml @@ -8,7 +8,7 @@ import "../Controls2" import "../Controls2/TextTypes" import "../Config" -DrawerType { +Drawer2Type { id: root width: parent.width diff --git a/client/ui/qml/Components/QuestionDrawer.qml b/client/ui/qml/Components/QuestionDrawer.qml index a79f9140..06f4ae24 100644 --- a/client/ui/qml/Components/QuestionDrawer.qml +++ b/client/ui/qml/Components/QuestionDrawer.qml @@ -5,7 +5,7 @@ import QtQuick.Layouts import "../Controls2" import "../Controls2/TextTypes" -DrawerType { +Drawer2Type { id: root property string headerText diff --git a/client/ui/qml/Components/SelectLanguageDrawer.qml b/client/ui/qml/Components/SelectLanguageDrawer.qml index d318aab8..f27fce6c 100644 --- a/client/ui/qml/Components/SelectLanguageDrawer.qml +++ b/client/ui/qml/Components/SelectLanguageDrawer.qml @@ -5,7 +5,7 @@ import QtQuick.Layouts import "../Controls2" import "../Controls2/TextTypes" -DrawerType { +Drawer2Type { id: root width: parent.width diff --git a/client/ui/qml/Components/ShareConnectionDrawer.qml b/client/ui/qml/Components/ShareConnectionDrawer.qml index 1158dadc..cb74f42e 100644 --- a/client/ui/qml/Components/ShareConnectionDrawer.qml +++ b/client/ui/qml/Components/ShareConnectionDrawer.qml @@ -16,7 +16,7 @@ import "../Controls2/TextTypes" import "../Config" import "../Components" -DrawerType { +Drawer2Type { id: root property alias headerText: header.headerText @@ -30,7 +30,7 @@ DrawerType { width: parent.width height: parent.height * 0.9 - onClosed: { + onClose: { configExtension = ".vpn" configCaption = qsTr("Save AmneziaVPN config") configFileName = "amnezia_config" @@ -126,13 +126,14 @@ DrawerType { text: qsTr("Show connection settings") onClicked: { - configContentDrawer.visible = true + configContentDrawer.open() } } - DrawerType { + Drawer2Type { id: configContentDrawer + parent: root width: parent.width height: parent.height * 0.9 @@ -145,7 +146,7 @@ DrawerType { anchors.topMargin: 16 backButtonFunction: function() { - configContentDrawer.visible = false + configContentDrawer.close() } } diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml new file mode 100644 index 00000000..eae28846 --- /dev/null +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -0,0 +1,266 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import QtQuick.Shapes + +Item { + id: root + + Connections { + target: PageController + + function onForceCloseDrawer() { + root.state = "closed" + } + } + + visible: false + + parent: Overlay.overlay + + signal close() + + property bool needCloseButton: true + + property string defaultColor: "#1C1D21" + property string borderColor: "#2C2D30" + property int collapsedHeight: 0 + + property bool needCollapsed: false + + + y: parent.height - root.height + + state: "closed" + + Rectangle { + id: draw2Background + + anchors { left: root.left; right: root.right; top: root.top } + height: root.height + radius: 16 + color: root.defaultColor + border.color: root.borderColor + border.width: 1 + + Rectangle { + width: parent.radius + height: parent.radius + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.left: parent.left + color: parent.color + } + } + + MouseArea { + anchors.fill: parent + enabled: (root.state === "expanded" || root.state === "opened") + onClicked: { + if (root.state === "expanded") { + root.state = "collapsed" + return + } + + if (root.state === "opened") { + root.state = "closed" + return + } + } + } + + Drag.active: dragArea.drag.active + + MouseArea { + id: dragArea + + anchors.fill: parent + cursorShape: (root.state === "opened" || root.state === "expanded") ? Qt.PointingHandCursor : Qt.ArrowCursor + hoverEnabled: true + + drag.target: parent + drag.axis: Drag.YAxis + drag.maximumY: parent.height + drag.minimumY: parent.height - root.height + + /** If drag area is released at any point other than min or max y, transition to the other state */ + onReleased: { + if (root.state === "closed" && root.y < dragArea.drag.maximumY) { + root.state = "opened" + PageController.drawerOpen() + return + } + + if (root.state === "opened" && root.y > dragArea.drag.minimumY) { + root.state = "closed" + PageController.drawerClose() + return + } + + if (root.state === "collapsed" && root.y < dragArea.drag.maximumY) { + root.state = "expanded" + return + } + if (root.state === "expanded" && root.y > dragArea.drag.minimumY) { + root.state = "collapsed" + return + } + } + + onClicked: { + if (root.state === "opened") { + root.state = "closed" + } + + if (root.state == "expanded") { + root.state == "collapsed" + } + } + } + + onStateChanged: { + if (root.state === "closed" || root.state === "collapsed") { + var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor() + if (initialPageNavigationBarColor !== 0xFF1C1D21) { + PageController.updateNavigationBarColor(initialPageNavigationBarColor) + } + + PageController.drawerClose() + return + } + if (root.state === "expanded" || root.state === "opened") { + if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) { + PageController.updateNavigationBarColor(0xFF1C1D21) + } + PageController.drawerOpen() + return + } + } + + /** Two states of buttonContent, great place to add any future animations for the drawer */ + states: [ + State { + name: "collapsed" + PropertyChanges { + target: root + y: root.height - collapsedHeight + } + }, + State { + name: "expanded" + PropertyChanges { + target: root + y: dragArea.drag.minimumY + } + }, + + State { + name: "closed" + PropertyChanges { + target: root + y: parent.height + } + }, + + State { + name: "opend" + PropertyChanges { + target: root + y: dragArea.drag.minimumY + } + } + ] + + transitions: [ + Transition { + from: "collapsed" + to: "expanded" + PropertyAnimation { + target: root + properties: "y" + duration: 200 + } + }, + Transition { + from: "expanded" + to: "collapsed" + PropertyAnimation { + target: root + properties: "y" + duration: 200 + } + }, + + Transition { + from: "opened" + to: "closed" + PropertyAnimation { + target: root + properties: "y" + duration: 200 + } + }, + + Transition { + from: "closed" + to: "opened" + PropertyAnimation { + target: root + properties: "y" + duration: 200 + } + } + ] + + NumberAnimation { + id: animationVisible + target: root + property: "y" + from: parent.height + to: parent.height - root.height + duration: 200 + } + + function open() { + if (root.visible && root.state !== "closed") { + return + } + + root.state = "opened" + root.visible = true + root.y = parent.height - root.height + + dragArea.drag.maximumY = parent.height + dragArea.drag.minimumY = parent.height - root.height + + + animationVisible.running = true + + if (needCloseButton) { + PageController.drawerOpen() + } + + if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) { + PageController.updateNavigationBarColor(0xFF1C1D21) + } + } + + function onClose() { + if (needCloseButton) { + PageController.drawerClose() + } + + var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor() + if (initialPageNavigationBarColor !== 0xFF1C1D21) { + PageController.updateNavigationBarColor(initialPageNavigationBarColor) + } + + root.visible = false + } + + onVisibleChanged: { + if (!visible) { + close() + } + } +} diff --git a/client/ui/qml/Controls2/DropDownType.qml b/client/ui/qml/Controls2/DropDownType.qml index b91f0b7a..cab2ef4e 100644 --- a/client/ui/qml/Controls2/DropDownType.qml +++ b/client/ui/qml/Controls2/DropDownType.qml @@ -156,17 +156,20 @@ Item { if (rootButtonClickedFunction && typeof rootButtonClickedFunction === "function") { rootButtonClickedFunction() } else { - menu.visible = true + menu.open() } } } + // Drawer2Type { DrawerType { id: menu width: parent.width height: parent.height * drawerHeight + // parent: root.parent.parent + ColumnLayout { id: header diff --git a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml index c8469dcb..f03cfc07 100644 --- a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml @@ -365,14 +365,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } } @@ -397,6 +397,7 @@ PageType { QuestionDrawer { id: questionDrawer + parent: root } } } diff --git a/client/ui/qml/Pages2/PageProtocolRaw.qml b/client/ui/qml/Pages2/PageProtocolRaw.qml index 2324c091..3e0fe5ab 100644 --- a/client/ui/qml/Pages2/PageProtocolRaw.qml +++ b/client/ui/qml/Pages2/PageProtocolRaw.qml @@ -90,8 +90,9 @@ PageType { DividerType {} - DrawerType { + Drawer2Type { id: configContentDrawer + parent: root width: parent.width height: parent.height * 0.9 @@ -179,14 +180,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } MouseArea { @@ -201,6 +202,7 @@ PageType { QuestionDrawer { id: questionDrawer + parent: root } } } diff --git a/client/ui/qml/Pages2/PageServiceDnsSettings.qml b/client/ui/qml/Pages2/PageServiceDnsSettings.qml index 10fe6f56..70aba8e2 100644 --- a/client/ui/qml/Pages2/PageServiceDnsSettings.qml +++ b/client/ui/qml/Pages2/PageServiceDnsSettings.qml @@ -68,14 +68,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } MouseArea { @@ -89,6 +89,7 @@ PageType { QuestionDrawer { id: questionDrawer + parent: root } } } diff --git a/client/ui/qml/Pages2/PageServiceSftpSettings.qml b/client/ui/qml/Pages2/PageServiceSftpSettings.qml index 61ba663d..0af47cdd 100644 --- a/client/ui/qml/Pages2/PageServiceSftpSettings.qml +++ b/client/ui/qml/Pages2/PageServiceSftpSettings.qml @@ -265,14 +265,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } } } @@ -282,6 +282,7 @@ PageType { QuestionDrawer { id: questionDrawer + parent: root } } } diff --git a/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml b/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml index 04d7076c..deff35eb 100644 --- a/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml +++ b/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml @@ -143,20 +143,21 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } } } QuestionDrawer { id: questionDrawer + parent: root } } } diff --git a/client/ui/qml/Pages2/PageSettingsApplication.qml b/client/ui/qml/Pages2/PageSettingsApplication.qml index c5536fdb..225e2b14 100644 --- a/client/ui/qml/Pages2/PageSettingsApplication.qml +++ b/client/ui/qml/Pages2/PageSettingsApplication.qml @@ -119,6 +119,7 @@ PageType { SelectLanguageDrawer { id: selectLanguageDrawer + parent: root } @@ -151,14 +152,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() SettingsController.clearSettings() PageController.replaceStartPage() } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } } @@ -166,6 +167,7 @@ PageType { QuestionDrawer { id: questionDrawer + parent: root } } } diff --git a/client/ui/qml/Pages2/PageSettingsBackup.qml b/client/ui/qml/Pages2/PageSettingsBackup.qml index 96214893..61370dab 100644 --- a/client/ui/qml/Pages2/PageSettingsBackup.qml +++ b/client/ui/qml/Pages2/PageSettingsBackup.qml @@ -138,15 +138,15 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() PageController.showBusyIndicator(true) SettingsController.restoreAppConfig(filePath) PageController.showBusyIndicator(false) } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } QuestionDrawer { diff --git a/client/ui/qml/Pages2/PageSettingsDns.qml b/client/ui/qml/Pages2/PageSettingsDns.qml index 58ec0783..917c6992 100644 --- a/client/ui/qml/Pages2/PageSettingsDns.qml +++ b/client/ui/qml/Pages2/PageSettingsDns.qml @@ -91,7 +91,7 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() SettingsController.primaryDns = "1.1.1.1" primaryDns.textFieldText = SettingsController.primaryDns SettingsController.secondaryDns = "1.0.0.1" @@ -99,9 +99,9 @@ PageType { PageController.showNotificationMessage(qsTr("Settings have been reset")) } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } } @@ -123,6 +123,7 @@ PageType { } QuestionDrawer { id: questionDrawer + parent: root } } } diff --git a/client/ui/qml/Pages2/PageSettingsLogging.qml b/client/ui/qml/Pages2/PageSettingsLogging.qml index 4141f51f..1532d1dc 100644 --- a/client/ui/qml/Pages2/PageSettingsLogging.qml +++ b/client/ui/qml/Pages2/PageSettingsLogging.qml @@ -146,16 +146,16 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() PageController.showBusyIndicator(true) SettingsController.clearLogs() PageController.showBusyIndicator(false) PageController.showNotificationMessage(qsTr("Logs have been cleaned up")) } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } } @@ -171,6 +171,7 @@ PageType { QuestionDrawer { id: questionDrawer + parent: root } } } diff --git a/client/ui/qml/Pages2/PageSettingsServerData.qml b/client/ui/qml/Pages2/PageSettingsServerData.qml index 3eb07ce9..c90e66b3 100644 --- a/client/ui/qml/Pages2/PageSettingsServerData.qml +++ b/client/ui/qml/Pages2/PageSettingsServerData.qml @@ -94,15 +94,15 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() PageController.showBusyIndicator(true) SettingsController.clearCachedProfiles() PageController.showBusyIndicator(false) } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } } @@ -172,7 +172,7 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() PageController.goToPage(PageEnum.PageDeinstalling) if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) { ConnectionController.closeConnection() @@ -180,9 +180,9 @@ PageType { InstallController.removeAllContainers() } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } } diff --git a/client/ui/qml/Pages2/PageSettingsServerInfo.qml b/client/ui/qml/Pages2/PageSettingsServerInfo.qml index e2e7868c..d534b509 100644 --- a/client/ui/qml/Pages2/PageSettingsServerInfo.qml +++ b/client/ui/qml/Pages2/PageSettingsServerInfo.qml @@ -71,13 +71,14 @@ PageType { } actionButtonFunction: function() { - serverNameEditDrawer.visible = true + serverNameEditDrawer.open() } } - DrawerType { + Drawer2Type { id: serverNameEditDrawer + parent: root width: root.width height: root.height * 0.35 @@ -95,6 +96,7 @@ PageType { anchors.leftMargin: 16 anchors.rightMargin: 16 + TextFieldWithHeaderType { id: serverName diff --git a/client/ui/qml/Pages2/PageSettingsServerProtocol.qml b/client/ui/qml/Pages2/PageSettingsServerProtocol.qml index 30758da4..594e4520 100644 --- a/client/ui/qml/Pages2/PageSettingsServerProtocol.qml +++ b/client/ui/qml/Pages2/PageSettingsServerProtocol.qml @@ -119,14 +119,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } MouseArea { diff --git a/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml b/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml index b79d5d22..406fae66 100644 --- a/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml +++ b/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml @@ -200,13 +200,13 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() SitesController.removeSite(index) } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.onClose() } - questionDrawer.visible = true + questionDrawer.open() } } @@ -214,6 +214,7 @@ PageType { QuestionDrawer { id: questionDrawer + parent: root } } } @@ -259,12 +260,14 @@ PageType { } } - DrawerType { + Drawer2Type { id: moreActionsDrawer width: parent.width height: parent.height * 0.4375 + parent: root + FlickableType { anchors.fill: parent contentHeight: moreActionsDrawerContent.height @@ -324,12 +327,14 @@ PageType { } } - DrawerType { + Drawer2Type { id: importSitesDrawer width: parent.width height: parent.height * 0.4375 + parent: root + BackButtonType { id: importSitesDrawerBackButton diff --git a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml index 7535464a..794ec90b 100644 --- a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml +++ b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml @@ -97,12 +97,14 @@ PageType { } } - DrawerType { + Drawer2Type { id: showDetailsDrawer width: parent.width height: parent.height * 0.9 + parent: root + BackButtonType { id: showDetailsBackButton diff --git a/client/ui/qml/Pages2/PageSetupWizardStart.qml b/client/ui/qml/Pages2/PageSetupWizardStart.qml index 9f5e57a5..17aa860f 100644 --- a/client/ui/qml/Pages2/PageSetupWizardStart.qml +++ b/client/ui/qml/Pages2/PageSetupWizardStart.qml @@ -115,7 +115,7 @@ PageType { text: qsTr("I have the data to connect") onClicked: { - connectionTypeSelection.visible = true + connectionTypeSelection.open() } } @@ -140,6 +140,7 @@ PageType { ConnectionTypeSelectionDrawer { id: connectionTypeSelection + parent: root } } diff --git a/client/ui/qml/Pages2/PageShare.qml b/client/ui/qml/Pages2/PageShare.qml index 2fa5e4a1..6c641ea6 100644 --- a/client/ui/qml/Pages2/PageShare.qml +++ b/client/ui/qml/Pages2/PageShare.qml @@ -371,6 +371,7 @@ PageType { ShareConnectionDrawer { id: shareConnectionDrawer + parent: root } BasicButtonType { diff --git a/client/ui/qml/Pages2/PageStart.qml b/client/ui/qml/Pages2/PageStart.qml index 4af774fa..923d1e79 100644 --- a/client/ui/qml/Pages2/PageStart.qml +++ b/client/ui/qml/Pages2/PageStart.qml @@ -135,6 +135,8 @@ PageType { var pagePath = PageController.getPagePath(PageEnum.PageHome) ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex tabBarStackView.push(pagePath, { "objectName" : pagePath }) + + connectionTypeSelection.parent = tabBarStackView } onWidthChanged: { @@ -243,7 +245,7 @@ PageType { ConnectionTypeSelectionDrawer { id: connectionTypeSelection - onAboutToHide: { + onClose: function() { tabBar.setCurrentIndex(tabBar.previousIndex) } } From 8c1835950bf64ebdf188769359bc908d501ba6d1 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Sun, 15 Oct 2023 15:17:04 +0800 Subject: [PATCH 02/47] added transparent-background, for blocking clicked event --- .../ConnectionTypeSelectionDrawer.qml | 5 +- client/ui/qml/Components/QuestionDrawer.qml | 7 +- .../qml/Components/SelectLanguageDrawer.qml | 6 +- .../qml/Components/ShareConnectionDrawer.qml | 16 ++++- client/ui/qml/Controls2/Drawer2Type.qml | 64 ++++++++++++++----- client/ui/qml/Controls2/DropDownType.qml | 17 +++-- .../qml/Pages2/PageProtocolCloakSettings.qml | 2 + .../Pages2/PageProtocolOpenVpnSettings.qml | 4 ++ client/ui/qml/Pages2/PageProtocolRaw.qml | 5 +- .../PageProtocolShadowSocksSettings.qml | 2 + .../ui/qml/Pages2/PageSettingsServerData.qml | 8 ++- .../ui/qml/Pages2/PageSettingsServerInfo.qml | 5 +- .../qml/Pages2/PageSettingsSplitTunneling.qml | 14 +++- .../PageSetupWizardProtocolSettings.qml | 7 +- client/ui/qml/Pages2/PageShare.qml | 6 ++ 15 files changed, 134 insertions(+), 34 deletions(-) diff --git a/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml b/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml index a368d45c..ac04e444 100644 --- a/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml +++ b/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml @@ -12,9 +12,12 @@ Drawer2Type { id: root width: parent.width - height: parent.height * 0.4375 + height: parent.height + contentHeight: parent.height * 0.4375 ColumnLayout { + parent: root.contentParent + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Components/QuestionDrawer.qml b/client/ui/qml/Components/QuestionDrawer.qml index 06f4ae24..edc8df9e 100644 --- a/client/ui/qml/Components/QuestionDrawer.qml +++ b/client/ui/qml/Components/QuestionDrawer.qml @@ -17,9 +17,12 @@ Drawer2Type { property var noButtonFunction width: parent.width - height: parent.height * 0.5 + height: parent.height + contentHeight: parent.height * 0.5 ColumnLayout { + parent: root.contentParent + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -27,6 +30,8 @@ Drawer2Type { anchors.rightMargin: 16 anchors.leftMargin: 16 + // visible: false + spacing: 8 Header2TextType { diff --git a/client/ui/qml/Components/SelectLanguageDrawer.qml b/client/ui/qml/Components/SelectLanguageDrawer.qml index f27fce6c..e6fdc2b5 100644 --- a/client/ui/qml/Components/SelectLanguageDrawer.qml +++ b/client/ui/qml/Components/SelectLanguageDrawer.qml @@ -9,11 +9,14 @@ Drawer2Type { id: root width: parent.width - height: parent.height * 0.9 + height: parent.height + contentHeight: parent.height * 0.9 ColumnLayout { id: backButton + parent: root.contentParent + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -28,6 +31,7 @@ Drawer2Type { } FlickableType { + parent: root.contentParent anchors.top: backButton.bottom anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Components/ShareConnectionDrawer.qml b/client/ui/qml/Components/ShareConnectionDrawer.qml index cb74f42e..22c567a8 100644 --- a/client/ui/qml/Components/ShareConnectionDrawer.qml +++ b/client/ui/qml/Components/ShareConnectionDrawer.qml @@ -28,7 +28,8 @@ Drawer2Type { property string configFileName: "amnezia_config.vpn" width: parent.width - height: parent.height * 0.9 + height: parent.height + contentHeight: parent.height * 0.9 onClose: { configExtension = ".vpn" @@ -41,6 +42,9 @@ Drawer2Type { Header2Type { id: header + + parent: root.contentParent + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -50,6 +54,8 @@ Drawer2Type { } FlickableType { + parent: root.contentParent + anchors.top: header.bottom anchors.bottom: parent.bottom contentHeight: content.height + 32 @@ -135,11 +141,15 @@ Drawer2Type { parent: root width: parent.width - height: parent.height * 0.9 + height: parent.height + + contentHeight: parent.height * 0.9 BackButtonType { id: backButton + parent: configContentDrawer.contentParent + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -151,6 +161,8 @@ Drawer2Type { } FlickableType { + parent: configContentDrawer.contentParent + anchors.top: backButton.bottom anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml index eae28846..3f877900 100644 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -16,8 +16,6 @@ Item { visible: false - parent: Overlay.overlay - signal close() property bool needCloseButton: true @@ -27,7 +25,10 @@ Item { property int collapsedHeight: 0 property bool needCollapsed: false - + property double scaely + property int contentHeight: 0 + property Item contentParent: contentArea + // property bool inContentArea: false y: parent.height - root.height @@ -37,23 +38,49 @@ Item { id: draw2Background anchors { left: root.left; right: root.right; top: root.top } - height: root.height + height: root.parent.height + width: parent.width radius: 16 - color: root.defaultColor - border.color: root.borderColor + color: "transparent" + border.color: "transparent" //"green" border.width: 1 + visible: true Rectangle { - width: parent.radius - height: parent.radius - anchors.bottom: parent.bottom + id: semiArea + anchors.top: parent.top + height: parent.height - contentHeight anchors.right: parent.right anchors.left: parent.left - color: parent.color + visible: true + color: "transparent" + } + + Rectangle { + id: contentArea + anchors.top: semiArea.bottom + height: contentHeight + radius: 16 + color: root.defaultColor + border.width: 1 + border.color: root.borderColor + width: parent.width + visible: true + + Rectangle { + width: parent.radius + height: parent.radius + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.left: parent.left + color: parent.color + } } } + MouseArea { + id: fullArea anchors.fill: parent enabled: (root.state === "expanded" || root.state === "opened") onClicked: { @@ -75,6 +102,7 @@ Item { id: dragArea anchors.fill: parent + cursorShape: (root.state === "opened" || root.state === "expanded") ? Qt.PointingHandCursor : Qt.ArrowCursor hoverEnabled: true @@ -108,12 +136,14 @@ Item { } onClicked: { - if (root.state === "opened") { - root.state = "closed" + if (root.state === "expanded") { + root.state = "collapsed" + return } - if (root.state == "expanded") { - root.state == "collapsed" + if (root.state === "opened") { + root.state = "closed" + return } } } @@ -217,7 +247,7 @@ Item { target: root property: "y" from: parent.height - to: parent.height - root.height + to: 0 duration: 200 } @@ -226,9 +256,11 @@ Item { return } + root.y = 0 root.state = "opened" root.visible = true - root.y = parent.height - root.height + root.height = parent.height + contentArea.height = contentHeight dragArea.drag.maximumY = parent.height dragArea.drag.minimumY = parent.height - root.height diff --git a/client/ui/qml/Controls2/DropDownType.qml b/client/ui/qml/Controls2/DropDownType.qml index cab2ef4e..83518bef 100644 --- a/client/ui/qml/Controls2/DropDownType.qml +++ b/client/ui/qml/Controls2/DropDownType.qml @@ -40,6 +40,8 @@ Item { property alias menuVisible: menu.visible + property Item drawerParent: root + implicitWidth: rootButtonContent.implicitWidth implicitHeight: rootButtonContent.implicitHeight @@ -161,18 +163,21 @@ Item { } } - // Drawer2Type { - DrawerType { + //DrawerType { + Drawer2Type { id: menu - width: parent.width - height: parent.height * drawerHeight + parent: drawerParent - // parent: root.parent.parent + width: parent.width + height: parent.height + contentHeight: parent.height * drawerHeight ColumnLayout { id: header + parent: menu.contentParent + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -187,6 +192,8 @@ Item { } FlickableType { + parent: menu.contentParent + anchors.top: header.bottom anchors.topMargin: 16 contentHeight: col.implicitHeight diff --git a/client/ui/qml/Pages2/PageProtocolCloakSettings.qml b/client/ui/qml/Pages2/PageProtocolCloakSettings.qml index 78e666a7..b0f36971 100644 --- a/client/ui/qml/Pages2/PageProtocolCloakSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolCloakSettings.qml @@ -117,6 +117,8 @@ PageType { Layout.fillWidth: true Layout.topMargin: 16 + drawerParent: root + descriptionText: qsTr("Cipher") headerText: qsTr("Cipher") diff --git a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml index f03cfc07..2861ece3 100644 --- a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml @@ -156,6 +156,8 @@ PageType { Layout.fillWidth: true Layout.topMargin: 20 + drawerParent: root + enabled: !autoNegotiateEncryprionSwitcher.checked descriptionText: qsTr("Hash") @@ -202,6 +204,8 @@ PageType { Layout.fillWidth: true Layout.topMargin: 16 + drawerParent: root + enabled: !autoNegotiateEncryprionSwitcher.checked descriptionText: qsTr("Cipher") diff --git a/client/ui/qml/Pages2/PageProtocolRaw.qml b/client/ui/qml/Pages2/PageProtocolRaw.qml index 3e0fe5ab..f2a17686 100644 --- a/client/ui/qml/Pages2/PageProtocolRaw.qml +++ b/client/ui/qml/Pages2/PageProtocolRaw.qml @@ -95,11 +95,14 @@ PageType { parent: root width: parent.width - height: parent.height * 0.9 + height: parent.height + contentHeight: parent.height * 0.9 BackButtonType { id: backButton + parent: configContentDrawer.contentParent + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml b/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml index 2453281f..75853d1f 100644 --- a/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml @@ -95,6 +95,8 @@ PageType { Layout.fillWidth: true Layout.topMargin: 20 + drawerParent: root + descriptionText: qsTr("Cipher") headerText: qsTr("Cipher") diff --git a/client/ui/qml/Pages2/PageSettingsServerData.qml b/client/ui/qml/Pages2/PageSettingsServerData.qml index c90e66b3..5e3f1939 100644 --- a/client/ui/qml/Pages2/PageSettingsServerData.qml +++ b/client/ui/qml/Pages2/PageSettingsServerData.qml @@ -141,7 +141,7 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.close() PageController.showBusyIndicator(true) if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) { ConnectionController.closeConnection() @@ -150,9 +150,9 @@ PageType { PageController.showBusyIndicator(false) } questionDrawer.noButtonFunction = function() { - questionDrawer.visible = false + questionDrawer.close() } - questionDrawer.visible = true + questionDrawer.open() } } @@ -192,6 +192,8 @@ PageType { QuestionDrawer { id: questionDrawer + + parent: root } } } diff --git a/client/ui/qml/Pages2/PageSettingsServerInfo.qml b/client/ui/qml/Pages2/PageSettingsServerInfo.qml index d534b509..f6d569dd 100644 --- a/client/ui/qml/Pages2/PageSettingsServerInfo.qml +++ b/client/ui/qml/Pages2/PageSettingsServerInfo.qml @@ -80,7 +80,8 @@ PageType { parent: root width: root.width - height: root.height * 0.35 + height: root.height // * 0.35 + contentHeight: root.height * 0.35 onVisibleChanged: { if (serverNameEditDrawer.visible) { @@ -89,6 +90,8 @@ PageType { } ColumnLayout { + parent: serverNameEditDrawer.contentParent + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml b/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml index 406fae66..a88c576b 100644 --- a/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml +++ b/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml @@ -108,6 +108,8 @@ PageType { DropDownType { id: selector + drawerParent: root + Layout.fillWidth: true Layout.topMargin: 32 Layout.leftMargin: 16 @@ -264,11 +266,14 @@ PageType { id: moreActionsDrawer width: parent.width - height: parent.height * 0.4375 + height: parent.height + contentHeight: parent.height * 0.4375 parent: root FlickableType { + parent: moreActionsDrawer.contentParent + anchors.fill: parent contentHeight: moreActionsDrawerContent.height ColumnLayout { @@ -331,13 +336,16 @@ PageType { id: importSitesDrawer width: parent.width - height: parent.height * 0.4375 + height: parent.height + contentHeight: parent.height * 0.4375 parent: root BackButtonType { id: importSitesDrawerBackButton + parent: importSitesDrawer.contentParent + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -349,6 +357,8 @@ PageType { } FlickableType { + parent: importSitesDrawer.contentParent + anchors.top: importSitesDrawerBackButton.bottom anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml index 794ec90b..6cdda364 100644 --- a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml +++ b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml @@ -101,13 +101,16 @@ PageType { id: showDetailsDrawer width: parent.width - height: parent.height * 0.9 + height: parent.height + contentHeight: parent.height * 0.9 parent: root BackButtonType { id: showDetailsBackButton + parent: showDetailsDrawer.contentParent + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -119,6 +122,8 @@ PageType { } FlickableType { + parent: showDetailsDrawer.contentParent + anchors.top: showDetailsBackButton.bottom anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Pages2/PageShare.qml b/client/ui/qml/Pages2/PageShare.qml index 6c641ea6..96399153 100644 --- a/client/ui/qml/Pages2/PageShare.qml +++ b/client/ui/qml/Pages2/PageShare.qml @@ -179,6 +179,8 @@ PageType { DropDownType { id: serverSelector + drawerParent: root + signal severSelectorIndexChanged property int currentIndex: 0 @@ -241,6 +243,8 @@ PageType { DropDownType { id: protocolSelector + drawerParent: root + visible: accessTypeSelector.currentIndex === 0 Layout.fillWidth: true @@ -330,6 +334,8 @@ PageType { DropDownType { id: exportTypeSelector + drawerParent: root + property int currentIndex: 0 Layout.fillWidth: true From a75bd07cd8b604bbe5f6894ac8e861f57efe8df5 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Sun, 15 Oct 2023 15:54:05 +0800 Subject: [PATCH 03/47] fixed the clicked event --- client/ui/qml/Controls2/Drawer2Type.qml | 170 +++++++++++++----------- 1 file changed, 89 insertions(+), 81 deletions(-) diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml index 3f877900..2f10ec5d 100644 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -34,6 +34,8 @@ Item { state: "closed" + Drag.active: dragArea.drag.active + Rectangle { id: draw2Background @@ -46,104 +48,110 @@ Item { border.width: 1 visible: true - Rectangle { - id: semiArea - anchors.top: parent.top - height: parent.height - contentHeight - anchors.right: parent.right - anchors.left: parent.left - visible: true - color: "transparent" - } + MouseArea { + id: fullArea + anchors.fill: parent + enabled: (root.state === "expanded" || root.state === "opened") + onClicked: { + if (root.state === "expanded") { + root.state = "collapsed" + return + } - Rectangle { - id: contentArea - anchors.top: semiArea.bottom - height: contentHeight - radius: 16 - color: root.defaultColor - border.width: 1 - border.color: root.borderColor - width: parent.width - visible: true + if (root.state === "opened") { + root.state = "closed" + return + } + } Rectangle { - width: parent.radius - height: parent.radius - anchors.bottom: parent.bottom + id: semiArea + anchors.top: parent.top + height: parent.height - contentHeight anchors.right: parent.right anchors.left: parent.left - color: parent.color - } - } - } - - - MouseArea { - id: fullArea - anchors.fill: parent - enabled: (root.state === "expanded" || root.state === "opened") - onClicked: { - if (root.state === "expanded") { - root.state = "collapsed" - return + visible: true + color: "transparent" } - if (root.state === "opened") { - root.state = "closed" - return - } - } - } + Rectangle { + id: contentArea - Drag.active: dragArea.drag.active + anchors.top: semiArea.bottom + height: contentHeight + radius: 16 + color: root.defaultColor + border.width: 1 + border.color: root.borderColor + width: parent.width + visible: true - MouseArea { - id: dragArea + Rectangle { + width: parent.radius + height: parent.radius + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.left: parent.left + color: parent.color + } - anchors.fill: parent + MouseArea { + id: dragArea - cursorShape: (root.state === "opened" || root.state === "expanded") ? Qt.PointingHandCursor : Qt.ArrowCursor - hoverEnabled: true + anchors.fill: parent - drag.target: parent - drag.axis: Drag.YAxis - drag.maximumY: parent.height - drag.minimumY: parent.height - root.height + cursorShape: (root.state === "opened" || root.state === "expanded") ? Qt.PointingHandCursor : Qt.ArrowCursor + hoverEnabled: true - /** If drag area is released at any point other than min or max y, transition to the other state */ - onReleased: { - if (root.state === "closed" && root.y < dragArea.drag.maximumY) { - root.state = "opened" - PageController.drawerOpen() - return - } + drag.target: root + drag.axis: Drag.YAxis + drag.maximumY: root.height + drag.minimumY: root.height - root.height - if (root.state === "opened" && root.y > dragArea.drag.minimumY) { - root.state = "closed" - PageController.drawerClose() - return - } + /** If drag area is released at any point other than min or max y, transition to the other state */ + onReleased: { + if (root.state === "closed" && root.y < dragArea.drag.maximumY) { + root.state = "opened" + PageController.drawerOpen() + return + } - if (root.state === "collapsed" && root.y < dragArea.drag.maximumY) { - root.state = "expanded" - return - } - if (root.state === "expanded" && root.y > dragArea.drag.minimumY) { - root.state = "collapsed" - return - } - } + if (root.state === "opened" && root.y > dragArea.drag.minimumY) { + root.state = "closed" + PageController.drawerClose() + return + } - onClicked: { - if (root.state === "expanded") { - root.state = "collapsed" - return - } + if (root.state === "collapsed" && root.y < dragArea.drag.maximumY) { + root.state = "expanded" + return + } + if (root.state === "expanded" && root.y > dragArea.drag.minimumY) { + root.state = "collapsed" + return + } + } - if (root.state === "opened") { - root.state = "closed" - return + onClicked: { + if (root.state === "expanded") { + root.state = "collapsed" + return + } + + if (root.state === "opened") { + root.state = "closed" + return + } + } + +// onEntered: { +// fullArea.enabled = false +// } + +// onExited: { +// fullArea.enabled = true +// } + } } } } From d0f83584313d60c4c0507b60d5d78118ffb9cbdf Mon Sep 17 00:00:00 2001 From: ronoaer Date: Sun, 15 Oct 2023 17:29:22 +0800 Subject: [PATCH 04/47] removed invalid code, and fixed top button hidden-shown --- client/ui/qml/Controls2/Drawer2Type.qml | 67 +++++++++---------- .../Pages2/PageProtocolOpenVpnSettings.qml | 4 +- client/ui/qml/Pages2/PageProtocolRaw.qml | 4 +- .../ui/qml/Pages2/PageServiceDnsSettings.qml | 4 +- .../ui/qml/Pages2/PageServiceSftpSettings.qml | 4 +- .../Pages2/PageServiceTorWebsiteSettings.qml | 4 +- .../ui/qml/Pages2/PageSettingsApplication.qml | 4 +- client/ui/qml/Pages2/PageSettingsBackup.qml | 4 +- client/ui/qml/Pages2/PageSettingsDns.qml | 4 +- client/ui/qml/Pages2/PageSettingsLogging.qml | 4 +- .../ui/qml/Pages2/PageSettingsServerData.qml | 8 +-- .../qml/Pages2/PageSettingsServerProtocol.qml | 4 +- .../qml/Pages2/PageSettingsSplitTunneling.qml | 4 +- client/ui/qml/Pages2/PageStart.qml | 2 +- 14 files changed, 58 insertions(+), 63 deletions(-) diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml index 2f10ec5d..2daae742 100644 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -14,9 +14,9 @@ Item { } } - visible: false + signal closed - signal close() + visible: false property bool needCloseButton: true @@ -28,7 +28,6 @@ Item { property double scaely property int contentHeight: 0 property Item contentParent: contentArea - // property bool inContentArea: false y: parent.height - root.height @@ -44,7 +43,7 @@ Item { width: parent.width radius: 16 color: "transparent" - border.color: "transparent" //"green" + border.color: "transparent" border.width: 1 visible: true @@ -52,6 +51,8 @@ Item { id: fullArea anchors.fill: parent enabled: (root.state === "expanded" || root.state === "opened") + hoverEnabled: true + onClicked: { if (root.state === "expanded") { root.state = "collapsed" @@ -65,7 +66,7 @@ Item { } Rectangle { - id: semiArea + id: placeAreaHolder anchors.top: parent.top height: parent.height - contentHeight anchors.right: parent.right @@ -77,7 +78,7 @@ Item { Rectangle { id: contentArea - anchors.top: semiArea.bottom + anchors.top: placeAreaHolder.bottom height: contentHeight radius: 16 color: root.defaultColor @@ -112,13 +113,13 @@ Item { onReleased: { if (root.state === "closed" && root.y < dragArea.drag.maximumY) { root.state = "opened" - PageController.drawerOpen() + // PageController.drawerOpen() return } if (root.state === "opened" && root.y > dragArea.drag.minimumY) { root.state = "closed" - PageController.drawerClose() + // PageController.drawerClose() return } @@ -134,23 +135,17 @@ Item { onClicked: { if (root.state === "expanded") { + // PageController.drawerOpen() root.state = "collapsed" return } if (root.state === "opened") { + // PageController.drawerClose() root.state = "closed" return } } - -// onEntered: { -// fullArea.enabled = false -// } - -// onExited: { -// fullArea.enabled = true -// } } } } @@ -163,14 +158,23 @@ Item { PageController.updateNavigationBarColor(initialPageNavigationBarColor) } - PageController.drawerClose() + if (needCloseButton) { + PageController.drawerClose() + } + + closed() + return } if (root.state === "expanded" || root.state === "opened") { if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) { PageController.updateNavigationBarColor(0xFF1C1D21) } - PageController.drawerOpen() + + if (needCloseButton) { + PageController.drawerOpen() + } + return } } @@ -275,31 +279,22 @@ Item { animationVisible.running = true - - if (needCloseButton) { - PageController.drawerOpen() - } - - if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) { - PageController.updateNavigationBarColor(0xFF1C1D21) - } } - function onClose() { - if (needCloseButton) { - PageController.drawerClose() - } - - var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor() - if (initialPageNavigationBarColor !== 0xFF1C1D21) { - PageController.updateNavigationBarColor(initialPageNavigationBarColor) - } - + function close() { root.visible = false + root.state = "closed" } onVisibleChanged: { + // e.g cancel, ...... if (!visible) { + if (root.state === "opened") { + if (needCloseButton) { + PageController.drawerClose() + } + } + close() } } diff --git a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml index 2861ece3..3e75474b 100644 --- a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml @@ -369,12 +369,12 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageProtocolRaw.qml b/client/ui/qml/Pages2/PageProtocolRaw.qml index f2a17686..23f192c7 100644 --- a/client/ui/qml/Pages2/PageProtocolRaw.qml +++ b/client/ui/qml/Pages2/PageProtocolRaw.qml @@ -183,12 +183,12 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageServiceDnsSettings.qml b/client/ui/qml/Pages2/PageServiceDnsSettings.qml index 70aba8e2..9ad3b289 100644 --- a/client/ui/qml/Pages2/PageServiceDnsSettings.qml +++ b/client/ui/qml/Pages2/PageServiceDnsSettings.qml @@ -68,12 +68,12 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageServiceSftpSettings.qml b/client/ui/qml/Pages2/PageServiceSftpSettings.qml index 0af47cdd..189267af 100644 --- a/client/ui/qml/Pages2/PageServiceSftpSettings.qml +++ b/client/ui/qml/Pages2/PageServiceSftpSettings.qml @@ -265,12 +265,12 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml b/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml index deff35eb..b69f5f63 100644 --- a/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml +++ b/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml @@ -143,12 +143,12 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageSettingsApplication.qml b/client/ui/qml/Pages2/PageSettingsApplication.qml index 225e2b14..bd602636 100644 --- a/client/ui/qml/Pages2/PageSettingsApplication.qml +++ b/client/ui/qml/Pages2/PageSettingsApplication.qml @@ -152,12 +152,12 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() SettingsController.clearSettings() PageController.replaceStartPage() } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageSettingsBackup.qml b/client/ui/qml/Pages2/PageSettingsBackup.qml index 61370dab..1fb160a1 100644 --- a/client/ui/qml/Pages2/PageSettingsBackup.qml +++ b/client/ui/qml/Pages2/PageSettingsBackup.qml @@ -138,13 +138,13 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() PageController.showBusyIndicator(true) SettingsController.restoreAppConfig(filePath) PageController.showBusyIndicator(false) } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageSettingsDns.qml b/client/ui/qml/Pages2/PageSettingsDns.qml index 917c6992..553eeacd 100644 --- a/client/ui/qml/Pages2/PageSettingsDns.qml +++ b/client/ui/qml/Pages2/PageSettingsDns.qml @@ -91,7 +91,7 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() SettingsController.primaryDns = "1.1.1.1" primaryDns.textFieldText = SettingsController.primaryDns SettingsController.secondaryDns = "1.0.0.1" @@ -99,7 +99,7 @@ PageType { PageController.showNotificationMessage(qsTr("Settings have been reset")) } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageSettingsLogging.qml b/client/ui/qml/Pages2/PageSettingsLogging.qml index 1532d1dc..9b9899ab 100644 --- a/client/ui/qml/Pages2/PageSettingsLogging.qml +++ b/client/ui/qml/Pages2/PageSettingsLogging.qml @@ -146,14 +146,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() PageController.showBusyIndicator(true) SettingsController.clearLogs() PageController.showBusyIndicator(false) PageController.showNotificationMessage(qsTr("Logs have been cleaned up")) } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageSettingsServerData.qml b/client/ui/qml/Pages2/PageSettingsServerData.qml index 5e3f1939..b130eef9 100644 --- a/client/ui/qml/Pages2/PageSettingsServerData.qml +++ b/client/ui/qml/Pages2/PageSettingsServerData.qml @@ -94,13 +94,13 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() PageController.showBusyIndicator(true) SettingsController.clearCachedProfiles() PageController.showBusyIndicator(false) } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } @@ -172,7 +172,7 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() PageController.goToPage(PageEnum.PageDeinstalling) if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) { ConnectionController.closeConnection() @@ -180,7 +180,7 @@ PageType { InstallController.removeAllContainers() } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageSettingsServerProtocol.qml b/client/ui/qml/Pages2/PageSettingsServerProtocol.qml index 594e4520..d1c8b22b 100644 --- a/client/ui/qml/Pages2/PageSettingsServerProtocol.qml +++ b/client/ui/qml/Pages2/PageSettingsServerProtocol.qml @@ -119,12 +119,12 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml b/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml index a88c576b..5bbd1003 100644 --- a/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml +++ b/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml @@ -202,11 +202,11 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() SitesController.removeSite(index) } questionDrawer.noButtonFunction = function() { - questionDrawer.onClose() + questionDrawer.close() } questionDrawer.open() } diff --git a/client/ui/qml/Pages2/PageStart.qml b/client/ui/qml/Pages2/PageStart.qml index 923d1e79..55795465 100644 --- a/client/ui/qml/Pages2/PageStart.qml +++ b/client/ui/qml/Pages2/PageStart.qml @@ -245,7 +245,7 @@ PageType { ConnectionTypeSelectionDrawer { id: connectionTypeSelection - onClose: function() { + onClosed: { tabBar.setCurrentIndex(tabBar.previousIndex) } } From 29b4966119a57bb4631bb8ea289a5a27444471d6 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Sun, 15 Oct 2023 17:34:35 +0800 Subject: [PATCH 05/47] shown ConnectionTypeSelectionDrawer on top level alway --- client/ui/qml/Pages2/PageStart.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/ui/qml/Pages2/PageStart.qml b/client/ui/qml/Pages2/PageStart.qml index 55795465..8afad392 100644 --- a/client/ui/qml/Pages2/PageStart.qml +++ b/client/ui/qml/Pages2/PageStart.qml @@ -245,6 +245,8 @@ PageType { ConnectionTypeSelectionDrawer { id: connectionTypeSelection + z: 1 + onClosed: { tabBar.setCurrentIndex(tabBar.previousIndex) } From cb5c09d9679753785ecf3159e23a66bd877c9773 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Sun, 15 Oct 2023 21:29:01 +0800 Subject: [PATCH 06/47] adapted questionDrawer --- client/ui/qml/Components/QuestionDrawer.qml | 3 ++- client/ui/qml/Components/ShareConnectionDrawer.qml | 2 +- client/ui/qml/Pages2/PageSettingsBackup.qml | 1 + client/ui/qml/Pages2/PageSettingsServerData.qml | 2 ++ client/ui/qml/Pages2/PageSettingsServerProtocol.qml | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/ui/qml/Components/QuestionDrawer.qml b/client/ui/qml/Components/QuestionDrawer.qml index edc8df9e..72067f97 100644 --- a/client/ui/qml/Components/QuestionDrawer.qml +++ b/client/ui/qml/Components/QuestionDrawer.qml @@ -15,10 +15,11 @@ Drawer2Type { property var yesButtonFunction property var noButtonFunction + property real drawerHeight: 0.5 width: parent.width height: parent.height - contentHeight: parent.height * 0.5 + contentHeight: parent.height * drawerHeight ColumnLayout { parent: root.contentParent diff --git a/client/ui/qml/Components/ShareConnectionDrawer.qml b/client/ui/qml/Components/ShareConnectionDrawer.qml index 22c567a8..ae0df0e2 100644 --- a/client/ui/qml/Components/ShareConnectionDrawer.qml +++ b/client/ui/qml/Components/ShareConnectionDrawer.qml @@ -31,7 +31,7 @@ Drawer2Type { height: parent.height contentHeight: parent.height * 0.9 - onClose: { + onClosed: { configExtension = ".vpn" configCaption = qsTr("Save AmneziaVPN config") configFileName = "amnezia_config" diff --git a/client/ui/qml/Pages2/PageSettingsBackup.qml b/client/ui/qml/Pages2/PageSettingsBackup.qml index 1fb160a1..2caaf914 100644 --- a/client/ui/qml/Pages2/PageSettingsBackup.qml +++ b/client/ui/qml/Pages2/PageSettingsBackup.qml @@ -151,5 +151,6 @@ PageType { QuestionDrawer { id: questionDrawer + parent: root } } diff --git a/client/ui/qml/Pages2/PageSettingsServerData.qml b/client/ui/qml/Pages2/PageSettingsServerData.qml index b130eef9..2e401c67 100644 --- a/client/ui/qml/Pages2/PageSettingsServerData.qml +++ b/client/ui/qml/Pages2/PageSettingsServerData.qml @@ -193,6 +193,8 @@ PageType { QuestionDrawer { id: questionDrawer + drawerHeight: 0.8 + parent: root } } diff --git a/client/ui/qml/Pages2/PageSettingsServerProtocol.qml b/client/ui/qml/Pages2/PageSettingsServerProtocol.qml index d1c8b22b..a518167c 100644 --- a/client/ui/qml/Pages2/PageSettingsServerProtocol.qml +++ b/client/ui/qml/Pages2/PageSettingsServerProtocol.qml @@ -141,6 +141,7 @@ PageType { QuestionDrawer { id: questionDrawer + parent: root } } } From 221d45f564d10347e50b612813c60e38eee6168c Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Mon, 16 Oct 2023 13:32:56 +0500 Subject: [PATCH 07/47] fixed pageSettingsDns width --- client/ui/qml/Pages2/PageSettingsDns.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/client/ui/qml/Pages2/PageSettingsDns.qml b/client/ui/qml/Pages2/PageSettingsDns.qml index 58ec0783..5670464f 100644 --- a/client/ui/qml/Pages2/PageSettingsDns.qml +++ b/client/ui/qml/Pages2/PageSettingsDns.qml @@ -46,6 +46,7 @@ PageType { } ParagraphTextType { + Layout.fillWidth: true text: qsTr("If AmneziaDNS is not used or installed") } From 8e0eef3316c5f0ed90cd044dea514c4b284821a6 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Mon, 16 Oct 2023 13:40:43 +0500 Subject: [PATCH 08/47] fixed selection of default container after installing a new container --- client/ui/controllers/installController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ui/controllers/installController.cpp b/client/ui/controllers/installController.cpp index 6eec9c6b..bb10d39c 100644 --- a/client/ui/controllers/installController.cpp +++ b/client/ui/controllers/installController.cpp @@ -184,7 +184,7 @@ void InstallController::installContainer(DockerContainer container, QJsonObject } if (ContainerProps::containerService(container) == ServiceType::Vpn) { - m_containersModel->setData(m_containersModel->index(0, 0), container, ContainersModel::Roles::IsDefaultRole); + m_containersModel->setData(m_containersModel->index(container), true, ContainersModel::Roles::IsDefaultRole); } emit installContainerFinished(finishMessage, ContainerProps::containerService(container) == ServiceType::Other); return; From cdb18de305771e6a5c2f6e1c48ad1ab1db0392f7 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Mon, 16 Oct 2023 13:43:27 +0500 Subject: [PATCH 09/47] brought back the ability to share wireguard native format configs --- client/ui/qml/Pages2/PageShare.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ui/qml/Pages2/PageShare.qml b/client/ui/qml/Pages2/PageShare.qml index aa04a1fe..25aad3de 100644 --- a/client/ui/qml/Pages2/PageShare.qml +++ b/client/ui/qml/Pages2/PageShare.qml @@ -320,7 +320,7 @@ PageType { if (index === ContainerProps.containerFromString("amnezia-openvpn")) { root.connectionTypesModel.push(openVpnConnectionFormat) - } else if (index === ContainerProps.containerFromString("amnezia-awg")) { + } else if (index === ContainerProps.containerFromString("amnezia-wireguard")) { root.connectionTypesModel.push(wireGuardConnectionFormat) } } From e01b1db706501d499f29c7f832d8791db2cd3f45 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Mon, 16 Oct 2023 14:34:03 +0500 Subject: [PATCH 10/47] text corrections --- client/translations/amneziavpn_ru.ts | 38 +++++++++++++------ client/translations/amneziavpn_zh_CN.ts | 38 +++++++++++++------ .../ui/qml/Pages2/PageSettingsApplication.qml | 2 +- 3 files changed, 53 insertions(+), 25 deletions(-) diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index 7bb59a7e..8d9e5e92 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -984,9 +984,13 @@ Already installed containers were found on the server. All installed containers Авто-запуск - Launch the application every time %1 starts - Запускать приложение при каждом включении %1 + Запускать приложение при каждом включении %1 + + + + Launch the application every time the device is starts + Запускать приложение при каждом включении устройства @@ -1184,52 +1188,52 @@ Already installed containers were found on the server. All installed containers DNS сервер - + If AmneziaDNS is not used or installed Эти адреса будут использоваться, если не включен или не установлен AmneziaDNS - + Primary DNS Первичный DNS - + Secondary DNS Вторичный DNS - + Restore default Восстановить по умолчанию - + Restore default DNS settings? Восстановить настройки DNS по умолчанию? - + Continue Продолжить - + Cancel Отменить - + Settings have been reset Настройки сброшены - + Save Сохранить - + Settings saved Сохранить настройки @@ -2638,6 +2642,16 @@ This means that AmneziaWG keeps the fast performance of the original while addin error 0x%1: %2 error 0x%1: %2 + + + WireGuard Configuration Highlighter + + + + + &Randomize colors + + SelectLanguageDrawer diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 576112de..60e03307 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -1046,9 +1046,13 @@ And if you don't like the app, all the more support it - the donation will 启动时自动运行运用程序 - Launch the application every time %1 starts - 运行应用软件在%1系统启动时 + 运行应用软件在%1系统启动时 + + + + Launch the application every time the device is starts + @@ -1266,52 +1270,52 @@ And if you don't like the app, all the more support it - the donation will DNS服务器 - + If AmneziaDNS is not used or installed 如果未使用或未安装AmneziaDNS - + Primary DNS 首选 DNS - + Secondary DNS 备用 DNS - + Restore default 恢复默认配置 - + Restore default DNS settings? 是否恢复默认DNS配置? - + Continue 继续 - + Cancel 取消 - + Settings have been reset 已重置 - + Save 保存 - + Settings saved 配置已保存 @@ -2771,6 +2775,16 @@ While it offers a blend of security, stability, and speed, it's essential t error 0x%1: %2 错误 0x%1: %2 + + + WireGuard Configuration Highlighter + + + + + &Randomize colors + + SelectLanguageDrawer diff --git a/client/ui/qml/Pages2/PageSettingsApplication.qml b/client/ui/qml/Pages2/PageSettingsApplication.qml index 49e3a5d9..05e468f0 100644 --- a/client/ui/qml/Pages2/PageSettingsApplication.qml +++ b/client/ui/qml/Pages2/PageSettingsApplication.qml @@ -70,7 +70,7 @@ PageType { Layout.margins: 16 text: qsTr("Auto start") - descriptionText: qsTr("Launch the application every time %1 starts").arg(Qt.platform.os) + descriptionText: qsTr("Launch the application every time the device is starts") checked: SettingsController.isAutoStartEnabled() onCheckedChanged: { From 7cc0f39d3ca12fd05fde3d7b6c06030d66e01c55 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Mon, 16 Oct 2023 22:21:01 +0800 Subject: [PATCH 11/47] adapted pagehome by new custom drawer type --- client/resources.qrc | 1 + .../qml/Components/HomeContainersListView.qml | 2 +- .../ui/qml/Components/HomeRootMenuButton.qml | 140 ++++++++++ client/ui/qml/Controls2/Drawer2Type.qml | 68 +---- client/ui/qml/Controls2/DropDownType.qml | 9 +- client/ui/qml/Pages2/PageHome.qml | 242 +++--------------- 6 files changed, 194 insertions(+), 268 deletions(-) create mode 100644 client/ui/qml/Components/HomeRootMenuButton.qml diff --git a/client/resources.qrc b/client/resources.qrc index d7f8ff7a..ac6e5a6d 100644 --- a/client/resources.qrc +++ b/client/resources.qrc @@ -217,5 +217,6 @@ ui/qml/Controls2/TopCloseButtonType.qml images/controls/x-circle.svg ui/qml/Controls2/Drawer2Type.qml + ui/qml/Components/HomeRootMenuButton.qml diff --git a/client/ui/qml/Components/HomeContainersListView.qml b/client/ui/qml/Components/HomeContainersListView.qml index 86a755c1..1436c747 100644 --- a/client/ui/qml/Components/HomeContainersListView.qml +++ b/client/ui/qml/Components/HomeContainersListView.qml @@ -69,7 +69,7 @@ ListView { isDefault = true menuContent.currentIndex = index - containersDropDown.menuVisible = false + containersDropDown.menu.state = "closed" if (needReconnected && diff --git a/client/ui/qml/Components/HomeRootMenuButton.qml b/client/ui/qml/Components/HomeRootMenuButton.qml new file mode 100644 index 00000000..b2ca98dc --- /dev/null +++ b/client/ui/qml/Components/HomeRootMenuButton.qml @@ -0,0 +1,140 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +import "../Controls2/TextTypes" +import "../Controls2" + +Item { + id: root + + property string text + property int textMaximumLineCount: 2 + property int textElide: Qt.ElideRight + + property string descriptionText + + property var clickedFunction + + property string rightImageSource + + property string textColor: "#d7d8db" + property string descriptionColor: "#878B91" + property real textOpacity: 1.0 + + property string rightImageColor: "#d7d8db" + + property bool descriptionOnTop: false + + property string defaultServerHostName + property string defaultContainerName + + implicitWidth: content.implicitWidth + content.anchors.topMargin + content.anchors.bottomMargin + implicitHeight: content.implicitHeight + content.anchors.leftMargin + content.anchors.rightMargin + + ColumnLayout { + id: content + + anchors.right: parent.right + anchors.left: parent.left + anchors.bottom: parent.bottom + + RowLayout { + Layout.topMargin: 24 + Layout.leftMargin: 24 + Layout.rightMargin: 24 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + + Header1TextType { + Layout.maximumWidth: root.width - 48 - 18 - 12 // todo + + maximumLineCount: 2 + elide: Qt.ElideRight + + text: root.text + Layout.alignment: Qt.AlignLeft + } + + + ImageButtonType { + id: rightImage + + hoverEnabled: false + image: rightImageSource + imageColor: rightImageColor + visible: rightImageSource ? true : false + +// implicitSize: 18 +// backGroudRadius: 5 + horizontalPadding: 0 + padding: 0 + spacing: 0 + + + Rectangle { + id: rightImageBackground + anchors.fill: parent + radius: 16 + color: "transparent" + + Behavior on color { + PropertyAnimation { duration: 200 } + } + } + } + } + + LabelTextType { + Layout.bottomMargin: 44 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + + text: { + var description = "" + if (ServersModel.isDefaultServerHasWriteAccess()) { + if (SettingsController.isAmneziaDnsEnabled() + && ContainersModel.isAmneziaDnsContainerInstalled(ServersModel.getDefaultServerIndex())) { + description += "Amnezia DNS | " + } + } else { + if (ServersModel.isDefaultServerConfigContainsAmneziaDns()) { + description += "Amnezia DNS | " + } + } + + description += root.defaultContainerName + " | " + root.defaultServerHostName + return description + } + } + } + + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + hoverEnabled: true + + onEntered: { + rightImageBackground.color = rightImage.hoveredColor + + root.textOpacity = 0.8 + } + + onExited: { + rightImageBackground.color = rightImage.defaultColor + + root.textOpacity = 1 + } + + onPressedChanged: { + rightImageBackground.color = pressed ? rightImage.pressedColor : entered ? rightImage.hoveredColor : rightImage.defaultColor + + root.textOpacity = 0.7 + } + + onClicked: { + if (clickedFunction && typeof clickedFunction === "function") { + clickedFunction() + } + } + } +} diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml index 2daae742..3f3cf54b 100644 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -22,10 +22,9 @@ Item { property string defaultColor: "#1C1D21" property string borderColor: "#2C2D30" - property int collapsedHeight: 0 property bool needCollapsed: false - property double scaely + property int contentHeight: 0 property Item contentParent: contentArea @@ -50,15 +49,10 @@ Item { MouseArea { id: fullArea anchors.fill: parent - enabled: (root.state === "expanded" || root.state === "opened") + enabled: (root.state === "opened") hoverEnabled: true onClicked: { - if (root.state === "expanded") { - root.state = "collapsed" - return - } - if (root.state === "opened") { root.state = "closed" return @@ -101,7 +95,7 @@ Item { anchors.fill: parent - cursorShape: (root.state === "opened" || root.state === "expanded") ? Qt.PointingHandCursor : Qt.ArrowCursor + cursorShape: (root.state === "opened") ? Qt.PointingHandCursor : Qt.ArrowCursor hoverEnabled: true drag.target: root @@ -113,35 +107,17 @@ Item { onReleased: { if (root.state === "closed" && root.y < dragArea.drag.maximumY) { root.state = "opened" - // PageController.drawerOpen() return } if (root.state === "opened" && root.y > dragArea.drag.minimumY) { root.state = "closed" - // PageController.drawerClose() - return - } - - if (root.state === "collapsed" && root.y < dragArea.drag.maximumY) { - root.state = "expanded" - return - } - if (root.state === "expanded" && root.y > dragArea.drag.minimumY) { - root.state = "collapsed" return } } onClicked: { - if (root.state === "expanded") { - // PageController.drawerOpen() - root.state = "collapsed" - return - } - if (root.state === "opened") { - // PageController.drawerClose() root.state = "closed" return } @@ -152,7 +128,7 @@ Item { } onStateChanged: { - if (root.state === "closed" || root.state === "collapsed") { + if (root.state === "closed") { var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor() if (initialPageNavigationBarColor !== 0xFF1C1D21) { PageController.updateNavigationBarColor(initialPageNavigationBarColor) @@ -166,7 +142,7 @@ Item { return } - if (root.state === "expanded" || root.state === "opened") { + if (root.state === "opened") { if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) { PageController.updateNavigationBarColor(0xFF1C1D21) } @@ -181,21 +157,6 @@ Item { /** Two states of buttonContent, great place to add any future animations for the drawer */ states: [ - State { - name: "collapsed" - PropertyChanges { - target: root - y: root.height - collapsedHeight - } - }, - State { - name: "expanded" - PropertyChanges { - target: root - y: dragArea.drag.minimumY - } - }, - State { name: "closed" PropertyChanges { @@ -214,25 +175,6 @@ Item { ] transitions: [ - Transition { - from: "collapsed" - to: "expanded" - PropertyAnimation { - target: root - properties: "y" - duration: 200 - } - }, - Transition { - from: "expanded" - to: "collapsed" - PropertyAnimation { - target: root - properties: "y" - duration: 200 - } - }, - Transition { from: "opened" to: "closed" diff --git a/client/ui/qml/Controls2/DropDownType.qml b/client/ui/qml/Controls2/DropDownType.qml index 83518bef..0506bdc7 100644 --- a/client/ui/qml/Controls2/DropDownType.qml +++ b/client/ui/qml/Controls2/DropDownType.qml @@ -42,6 +42,8 @@ Item { property Item drawerParent: root + property Drawer2Type menu: menu + implicitWidth: rootButtonContent.implicitWidth implicitHeight: rootButtonContent.implicitHeight @@ -157,13 +159,12 @@ Item { onClicked: { if (rootButtonClickedFunction && typeof rootButtonClickedFunction === "function") { rootButtonClickedFunction() - } else { - menu.open() } + + menu.open() } } - //DrawerType { Drawer2Type { id: menu @@ -186,7 +187,7 @@ Item { BackButtonType { backButtonImage: root.headerBackButtonImage backButtonFunction: function() { - root.menuVisible = false + menu.state = "closed" } } } diff --git a/client/ui/qml/Pages2/PageHome.qml b/client/ui/qml/Pages2/PageHome.qml index 519c17a5..dafa3bdc 100644 --- a/client/ui/qml/Pages2/PageHome.qml +++ b/client/ui/qml/Pages2/PageHome.qml @@ -30,13 +30,13 @@ PageType { target: PageController function onRestorePageHomeState(isContainerInstalled) { - buttonContent.state = "expanded" + menu.close() if (isContainerInstalled) { containersDropDown.menuVisible = true } } function onForceCloseDrawer() { - buttonContent.state = "collapsed" + menu.close() } } @@ -69,79 +69,27 @@ PageType { } } - collapsedServerMenuDescription.text = description + root.defaultContainerName + " | " + root.defaultServerHostName + // collapsedServerMenuDescription.text = description + root.defaultContainerName + " | " + root.defaultServerHostName expandedServersMenuDescription.text = description + root.defaultServerHostName } - Component.onCompleted: updateDescriptions() - - MouseArea { - anchors.fill: parent - enabled: buttonContent.state === "expanded" - onClicked: { - buttonContent.state = "collapsed" - } + Component.onCompleted: { + updateDescriptions() } Item { anchors.fill: parent - anchors.bottomMargin: buttonContent.collapsedHeight + anchors.bottomMargin: defaultServerInfo.implicitHeight ConnectButton { anchors.centerIn: parent } } - MouseArea { - id: dragArea - - anchors.fill: buttonBackground - cursorShape: buttonContent.state === "collapsed" ? Qt.PointingHandCursor : Qt.ArrowCursor - hoverEnabled: true - - drag.target: buttonContent - drag.axis: Drag.YAxis - drag.maximumY: root.height - buttonContent.collapsedHeight - drag.minimumY: root.height - root.height * 0.9 - - /** If drag area is released at any point other than min or max y, transition to the other state */ - onReleased: { - if (buttonContent.state === "collapsed" && buttonContent.y < dragArea.drag.maximumY) { - buttonContent.state = "expanded" - return - } - if (buttonContent.state === "expanded" && buttonContent.y > dragArea.drag.minimumY) { - buttonContent.state = "collapsed" - return - } - } - - onEntered: { - collapsedButtonChevron.backgroundColor = collapsedButtonChevron.hoveredColor - collapsedButtonHeader.opacity = 0.8 - } - onExited: { - collapsedButtonChevron.backgroundColor = collapsedButtonChevron.defaultColor - collapsedButtonHeader.opacity = 1 - } - onPressedChanged: { - collapsedButtonChevron.backgroundColor = pressed ? collapsedButtonChevron.pressedColor : entered ? collapsedButtonChevron.hoveredColor : collapsedButtonChevron.defaultColor - collapsedButtonHeader.opacity = 0.7 - } - - - onClicked: { - if (buttonContent.state === "collapsed") { - buttonContent.state = "expanded" - } - } - } - Rectangle { id: buttonBackground + anchors.fill: defaultServerInfo - anchors { left: buttonContent.left; right: buttonContent.right; top: buttonContent.top } - height: root.height radius: 16 color: root.defaultColor border.color: root.borderColor @@ -157,151 +105,40 @@ PageType { } } - ColumnLayout { - id: buttonContent + HomeRootMenuButton { + id: defaultServerInfo + anchors.right: parent.right + anchors.left: parent.left + anchors.bottom: parent.bottom - /** Initial height of button content */ - property int collapsedHeight: 0 - /** True when expanded objects should be visible */ - property bool expandedVisibility: buttonContent.state === "expanded" || (buttonContent.state === "collapsed" && dragArea.drag.active === true) - /** True when collapsed objects should be visible */ - property bool collapsedVisibility: buttonContent.state === "collapsed" && dragArea.drag.active === false + text: root.defaultServerName + rightImageSource: "qrc:/images/controls/chevron-down.svg" - Drag.active: dragArea.drag.active - anchors.right: root.right - anchors.left: root.left - y: root.height - buttonContent.height + defaultContainerName: root.defaultContainerName + defaultServerHostName: root.defaultServerHostName - Component.onCompleted: { - buttonContent.state = "collapsed" + clickedFunction: function() { + menu.open() } + } - /** Set once based on first implicit height change once all children are layed out */ - onImplicitHeightChanged: { - if (buttonContent.state === "collapsed" && collapsedHeight == 0) { - collapsedHeight = implicitHeight - } - } + Drawer2Type { + id: menu + parent: root - onStateChanged: { - if (buttonContent.state === "collapsed") { - var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor() - if (initialPageNavigationBarColor !== 0xFF1C1D21) { - PageController.updateNavigationBarColor(initialPageNavigationBarColor) - } - PageController.drawerClose() - return - } - if (buttonContent.state === "expanded") { - if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) { - PageController.updateNavigationBarColor(0xFF1C1D21) - } - PageController.drawerOpen() - return - } - } + width: parent.width + height: parent.height + contentHeight: parent.height * 0.9 - /** Two states of buttonContent, great place to add any future animations for the drawer */ - states: [ - State { - name: "collapsed" - PropertyChanges { - target: buttonContent - y: root.height - collapsedHeight - } - }, - State { - name: "expanded" - PropertyChanges { - target: buttonContent - y: dragArea.drag.minimumY - - } - } - ] - - transitions: [ - Transition { - from: "collapsed" - to: "expanded" - PropertyAnimation { - target: buttonContent - properties: "y" - duration: 200 - } - }, - Transition { - from: "expanded" - to: "collapsed" - PropertyAnimation { - target: buttonContent - properties: "y" - duration: 200 - } - } - ] - - RowLayout { - Layout.topMargin: 24 - Layout.leftMargin: 24 - Layout.rightMargin: 24 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - visible: buttonContent.collapsedVisibility - - spacing: 0 - - Header1TextType { - id: collapsedButtonHeader - Layout.maximumWidth: buttonContent.width - 48 - 18 - 12 // todo - - maximumLineCount: 2 - elide: Qt.ElideRight - - text: root.defaultServerName - horizontalAlignment: Qt.AlignHCenter - - Behavior on opacity { - PropertyAnimation { duration: 200 } - } - } - - ImageButtonType { - id: collapsedButtonChevron - - Layout.leftMargin: 8 - - hoverEnabled: false - image: "qrc:/images/controls/chevron-down.svg" - imageColor: "#d7d8db" - - icon.width: 18 - icon.height: 18 - backgroundRadius: 16 - horizontalPadding: 4 - topPadding: 4 - bottomPadding: 3 - - onClicked: { - if (buttonContent.state === "collapsed") { - buttonContent.state = "expanded" - } - } - } - } - - LabelTextType { - id: collapsedServerMenuDescription - Layout.bottomMargin: 44 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - visible: buttonContent.collapsedVisibility - } ColumnLayout { id: serversMenuHeader - Layout.alignment: Qt.AlignTop | Qt.AlignHCenter - Layout.fillWidth: true - visible: buttonContent.expandedVisibility + parent: menu.contentParent + + anchors.top: parent.top + anchors.right: parent.right + anchors.left: parent.left Header1TextType { Layout.fillWidth: true @@ -330,6 +167,8 @@ PageType { DropDownType { id: containersDropDown + drawerParent: root + rootButtonImageColor: "#0E0E11" rootButtonBackgroundColor: "#D7D8DB" rootButtonBackgroundHoveredColor: Qt.rgba(215, 216, 219, 0.8) @@ -383,7 +222,6 @@ PageType { Layout.topMargin: 48 Layout.leftMargin: 16 Layout.rightMargin: 16 - visible: buttonContent.expandedVisibility headerText: qsTr("Servers") } @@ -391,12 +229,16 @@ PageType { Flickable { id: serversContainer - Layout.alignment: Qt.AlignTop | Qt.AlignHCenter - Layout.fillWidth: true - Layout.topMargin: 16 + + parent: menu.contentParent + + anchors.top: serversMenuHeader.bottom + anchors.right: parent.right + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.topMargin: 16 contentHeight: col.implicitHeight - implicitHeight: root.height - (root.height * 0.1) - serversMenuHeader.implicitHeight - 52 //todo 52 is tabbar height - visible: buttonContent.expandedVisibility + clip: true ScrollBar.vertical: ScrollBar { @@ -500,7 +342,7 @@ PageType { onClicked: function() { ServersModel.currentlyProcessedIndex = index PageController.goToPage(PageEnum.PageSettingsServerInfo) - buttonContent.state = "collapsed" + menu.close() } } } From 36ba3758db6b3f16e4c5dc11e8e8f581177a33ca Mon Sep 17 00:00:00 2001 From: pokamest Date: Mon, 16 Oct 2023 15:27:26 +0100 Subject: [PATCH 12/47] Translation updates --- client/translations/amneziavpn_ru.ts | 101 ++++++++++++++++-------- client/translations/amneziavpn_zh_CN.ts | 10 --- 2 files changed, 70 insertions(+), 41 deletions(-) diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index 8d9e5e92..857d390f 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -611,7 +611,7 @@ Already installed containers were found on the server. All installed containers All users who you shared a connection with will no longer be able to connect to it. - Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. + Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. @@ -765,7 +765,7 @@ Already installed containers were found on the server. All installed containers Remove SFTP and all data stored there? - Удалить SFTP-хранилище и все хранящиеся на нем данные? + Удалить SFTP-хранилище и все хранящиеся на нем данные? @@ -983,14 +983,10 @@ Already installed containers were found on the server. All installed containers Auto start Авто-запуск - - Launch the application every time %1 starts - Запускать приложение при каждом включении %1 - Launch the application every time the device is starts - Запускать приложение при каждом включении устройства + Запускать приложение при каждом включении @@ -1089,7 +1085,7 @@ Already installed containers were found on the server. All installed containers Backup file saved - + Бэкап файл сохранен @@ -1248,7 +1244,7 @@ Already installed containers were found on the server. All installed containers Save logs - Сохранить логи + Сохранять логи @@ -1268,7 +1264,7 @@ Already installed containers were found on the server. All installed containers Logs file saved - + Файл с логами сохранен @@ -1704,12 +1700,12 @@ and will not be shared or disclosed to the Amnezia or any third parties Amnezia has detected that your server is currently - + Amnezia обнаружила, что ваш сервер в настоящее время busy installing other software. Amnezia installation - + занят установкой другого программного обеспечения. Установка Amnezia @@ -2428,7 +2424,15 @@ While it offers a blend of security, stability, and speed, it's essential t * Minimal configuration * Recognised by DPI analysis systems * Works over UDP network protocol, ports 500 and 4500. - + IKEv2 в сочетании с уровнем шифрования IPSec это современный и стабильный протокол VPN. +Он может быстро переключаться между сетями и устройствами, что делает его особенно адаптивным в динамичных сетевых средах. +Несмотря на сочетание безопасности, стабильности и скорости, необходимо отметить, что IKEv2 легко обнаруживается и подвержен блокировке. + +* Доступно в AmneziaVPN только для Windows. +* Низкое энергопотребление, на мобильных устройствах +* Минимальная конфигурация +* Распознается системами DPI-анализа +* Работает по сетевому протоколу UDP, порты 500 и 4500. @@ -2474,7 +2478,7 @@ While it offers a blend of security, stability, and speed, it's essential t AmneziaWG - Special protocol from Amnezia, based on WireGuard. It's fast like WireGuard, but very resistant to blockages. Recommended for regions with high levels of censorship. - + AmneziaWG - Специальный протокол от Amnezia, основанный на протоколе WireGuard. Он такой же быстрый, как WireGuard, но очень устойчив к блокировкам. Рекомендуется для регионов с высоким уровнем цензуры. @@ -2506,7 +2510,14 @@ It employs its unique security protocol, leveraging the strength of SSL/TLS for * Flexible customisation to suit user needs to work with different operating systems and devices * Recognised by DPI analysis systems and therefore susceptible to blocking * Can operate over both TCP and UDP network protocols. - + OpenVPN однин из самых популярных и проверенных временем VPN-протоколов. +В нем используется уникальный протокол безопасности, опирающийся на протокол SSL/TLS для шифрования и обмена ключами. Кроме того, поддержка OpenVPN множества методов аутентификации делает его универсальным и адаптируемым к широкому спектру устройств и операционных систем. Благодаря открытому исходному коду OpenVPN подвергается тщательному анализу со стороны мирового сообщества, что постоянно повышает его безопасность. Благодаря оптимальному соотношению производительности, безопасности и совместимости OpenVPN остается лучшим выбором как для частных лиц, так и для компаний, заботящихся о конфиденциальности. + +* Доступность AmneziaVPN для всех платформ +* Нормальное энергопотребление на мобильных устройствах +* Гибкая настройка под нужды пользователя для работы с различными операционными системами и устройствами +* Распознается системами DPI-анализа и поэтому подвержен блокировке +* Может работать по сетевым протоколам TCP и UDP. @@ -2518,7 +2529,12 @@ It employs its unique security protocol, leveraging the strength of SSL/TLS for * Configurable encryption protocol * Detectable by some DPI systems * Works over TCP network protocol. - + Shadowsocks, создан на основе протокола SOCKS5, защищает соединение с помощью шифра AEAD. Несмотря на то, что протокол Shadowsocks разработан таким образом, чтобы быть незаметным и сложным для идентификации, он не идентичен стандартному HTTPS-соединению. Однако некоторые системы анализа трафика все же могут обнаружить соединение Shadowsocks. В связи с ограниченной поддержкой в Amnezia рекомендуется использовать протокол AmneziaWG, или OpenVPN over Cloak. + +* Доступен в AmneziaVPN только на ПК ноутбуках. +* Настраиваемый протокол шифрования +* Обнаруживается некоторыми DPI-системами +* Работает по сетевому протоколу TCP. @@ -2540,7 +2556,24 @@ If there is a extreme level of Internet censorship in your region, we advise you * Not recognised by DPI analysis systems * Works over TCP network protocol, 443 port. - + OpenVPN over Cloak - это комбинация протокола OpenVPN и плагина Cloak, разработанного специально для защиты от блокировок. + +OpenVPN обеспечивает безопасное VPN-соединение за счет шифрования всего интернет-трафика между клиентом и сервером. + +Cloak защищает OpenVPN от обнаружения и блокировок. + +Cloak может изменять метаданные пакетов. Он полностью маскирует VPN-трафик под обычный веб-трафик, а также защищает VPN от обнаружения с помощью Active Probing. Это делает ее очень устойчивой к обнаружению + +Сразу же после получения первого пакета данных Cloak проверяет подлинность входящего соединения. Если аутентификация не проходит, плагин маскирует сервер под поддельный сайт, и ваша VPN становится невидимой для аналитических систем. + +Если в вашем регионе существует экстремальный уровень цензуры в Интернете, мы советуем вам при первом подключении использовать только OpenVPN через Cloak + +* Доступность AmneziaVPN на всех платформах +* Высокое энергопотребление на мобильных устройствах +* Гибкие настройки +* Не распознается системами DPI-анализа +* Работает по сетевому протоколу TCP, 443 порт. + @@ -2553,7 +2586,15 @@ WireGuard is very susceptible to blocking due to its distinct packet signatures. * Minimum number of settings * Easily recognised by DPI analysis systems, susceptible to blocking * Works over UDP network protocol. - + WireGuard - относительно новый популярный VPN-протокол с упрощенной архитектурой. +Обеспечивает стабильное VPN-соединение, высокую производительность на всех устройствах. Использует жестко заданные настройки шифрования. WireGuard по сравнению с OpenVPN имеет меньшую задержку и лучшую пропускную способность при передаче данных. +WireGuard очень восприимчив к блокированию из-за особенностей сигнатур пакетов. В отличие от некоторых других VPN-протоколов, использующих методы обфускации, последовательные сигнатуры пакетов WireGuard легче выявляются и, соответственно, блокируются современными системами глубокой проверки пакетов (DPI) и другими средствами сетевого мониторинга. + +* Доступность AmneziaVPN для всех платформ +* Низкое энергопотребление +* Минимальное количество настроек +* Легко распознается системами DPI-анализа, подвержен блокировке +* Работает по сетевому протоколу UDP. @@ -2566,7 +2607,15 @@ This means that AmneziaWG keeps the fast performance of the original while addin * Minimum number of settings * Not recognised by DPI analysis systems, resistant to blocking * Works over UDP network protocol. - + AmneziaWG - усовершенствованная версия популярного VPN-протокола Wireguard. AmneziaWG опирается на фундамент, заложенный WireGuard, сохраняя упрощенную архитектуру и высокопроизводительные возможности работы на разных устройствах. +Хотя WireGuard известен своей эффективностью, у него были проблемы с обнаружением из-за характерных сигнатур пакетов. AmneziaWG решает эту проблему за счет использования более совершенных методов обфускации, благодаря чему его трафик сливается с обычным интернет-трафиком. +Таким образом, AmneziaWG сохраняет высокую производительность оригинала, добавляя при этом дополнительный уровень скрытности, что делает его отличным выбором для тех, кому нужно быстрое и незаметное VPN-соединение. + +* Доступность AmneziaVPN на всех платформах +* Низкое энергопотребление +* Минимальное количество настроек +* Не распознается системами DPI-анализа, устойчив к блокировке +* Работает по сетевому протоколу UDP. AmneziaWG container @@ -2642,16 +2691,6 @@ This means that AmneziaWG keeps the fast performance of the original while addin error 0x%1: %2 error 0x%1: %2 - - - WireGuard Configuration Highlighter - - - - - &Randomize colors - - SelectLanguageDrawer @@ -2877,7 +2916,7 @@ This means that AmneziaWG keeps the fast performance of the original while addin Medium or High - Спедний или Высокий + Средний или Высокий @@ -2925,7 +2964,7 @@ This means that AmneziaWG keeps the fast performance of the original while addin Private key passphrase - Кодовая фраза для закрытого ключа + Кодовая фраза для закрытого ключа diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 60e03307..b908bf56 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -2775,16 +2775,6 @@ While it offers a blend of security, stability, and speed, it's essential t error 0x%1: %2 错误 0x%1: %2 - - - WireGuard Configuration Highlighter - - - - - &Randomize colors - - SelectLanguageDrawer From 9eb23e38bd9b31cc50794312bd7cbd8793fdce3a Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Mon, 16 Oct 2023 22:57:12 +0500 Subject: [PATCH 13/47] disabled the ability to change the protocol/server when a vpn connection is active --- client/translations/amneziavpn_ru.ts | 13 ++++++-- client/translations/amneziavpn_zh_CN.ts | 13 ++++++-- .../qml/Components/HomeContainersListView.qml | 30 +++++++------------ client/ui/qml/Controls2/CardType.qml | 2 ++ client/ui/qml/Pages2/PageHome.qml | 6 ++++ 5 files changed, 41 insertions(+), 23 deletions(-) diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index 8d9e5e92..ad2ebfbe 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -119,13 +119,17 @@ HomeContainersListView + Unable change protocol while there is an active connection + + + + The selected protocol is not supported on the current platform Выбранный протокол не поддерживается на данном устройстве - Reconnect via VPN Procotol: - Переподключение через VPN протокол: + Переподключение через VPN протокол: @@ -267,6 +271,11 @@ Already installed containers were found on the server. All installed containers Servers Серверы + + + Unable change server while there is an active connection + + PageProtocolAwgSettings diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 60e03307..0def921b 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -130,13 +130,17 @@ HomeContainersListView + Unable change protocol while there is an active connection + Невозможно изменить протокол при наличии активного соединения + + + The selected protocol is not supported on the current platform 当前平台不支持所选协议 - Reconnect via VPN Procotol: - 重连VPN基于协议: + 重连VPN基于协议: @@ -301,6 +305,11 @@ Already installed containers were found on the server. All installed containers Servers 服务器 + + + Unable change server while there is an active connection + Невозможно изменить сервер при наличии активного соединения + PageProtocolAwgSettings diff --git a/client/ui/qml/Components/HomeContainersListView.qml b/client/ui/qml/Components/HomeContainersListView.qml index 2304427f..f05b90d6 100644 --- a/client/ui/qml/Components/HomeContainersListView.qml +++ b/client/ui/qml/Components/HomeContainersListView.qml @@ -50,34 +50,26 @@ ListView { imageSource: "qrc:/images/controls/download.svg" showImage: !isInstalled - checkable: isInstalled + checkable: isInstalled && !ConnectionController.isConnected && isSupported checked: isDefault - onPressed: function(mouse) { - if (!isSupported) { - PageController.showErrorMessage(qsTr("The selected protocol is not supported on the current platform")) - } - } - onClicked: { - if (checked) { - var needReconnected = false - if (!isDefault) { - needReconnected = true - } + if (ConnectionController.isConnected && isInstalled) { + PageController.showNotificationMessage(qsTr("Unable change protocol while there is an active connection")) + return + } + if (checked) { isDefault = true menuContent.currentIndex = index containersDropDown.menuVisible = false - - - if (needReconnected && (ConnectionController.isConnected || ConnectionController.isConnectionInProgress)) { - PageController.showNotificationMessage(qsTr("Reconnect via VPN Procotol: ") + name) - PageController.goToPageHome() - ConnectionController.openConnection() - } } else { + if (!isSupported && isInstalled) { + PageController.showErrorMessage(qsTr("The selected protocol is not supported on the current platform")) + return + } + ContainersModel.setCurrentlyProcessedContainerIndex(proxyContainersModel.mapToSource(index)) InstallController.setShouldCreateServer(false) PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings) diff --git a/client/ui/qml/Controls2/CardType.qml b/client/ui/qml/Controls2/CardType.qml index 8429acb8..32f89122 100644 --- a/client/ui/qml/Controls2/CardType.qml +++ b/client/ui/qml/Controls2/CardType.qml @@ -81,6 +81,7 @@ RadioButton { Text { text: root.headerText + wrapMode: Text.WordWrap color: "#D7D8DB" font.pixelSize: 25 font.weight: 700 @@ -110,6 +111,7 @@ RadioButton { Text { text: root.footerText + wrapMode: Text.WordWrap visible: root.footerText !== "" color: "#878B91" font.pixelSize: 13 diff --git a/client/ui/qml/Pages2/PageHome.qml b/client/ui/qml/Pages2/PageHome.qml index 519c17a5..d89d6be1 100644 --- a/client/ui/qml/Pages2/PageHome.qml +++ b/client/ui/qml/Pages2/PageHome.qml @@ -471,10 +471,16 @@ PageType { } checked: index === serversMenuContent.currentIndex + checkable: !ConnectionController.isConnected ButtonGroup.group: serversRadioButtonGroup onClicked: { + if (ConnectionController.isConnected) { + PageController.showNotificationMessage(qsTr("Unable change server while there is an active connection")) + return + } + serversMenuContent.currentIndex = index ServersModel.currentlyProcessedIndex = index From 5369e68267828ce243e32b1aca70a0de218e34f1 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Tue, 17 Oct 2023 14:30:59 +0800 Subject: [PATCH 14/47] updated Chinese translations for updating source strings --- client/translations/amneziavpn_zh_CN.ts | 105 ++++++++++++++++++------ 1 file changed, 80 insertions(+), 25 deletions(-) diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index b908bf56..e1f8a13a 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -74,17 +74,17 @@ Add new connection - + 添加新连接 Configure your server - + 配置您的服务器 Open config file, key or QR code - + 配置文件,授权码或二维码 Server IP, login and password @@ -860,7 +860,7 @@ Already installed containers were found on the server. All installed containers When configuring WordPress set the this onion address as domain. - + 配置 WordPress 时,将此洋葱地址设置为域。 When configuring WordPress set the domain as this onion address. @@ -1052,7 +1052,7 @@ And if you don't like the app, all the more support it - the donation will Launch the application every time the device is starts - + 每次设备启动时启动应用程序 @@ -1155,7 +1155,7 @@ And if you don't like the app, all the more support it - the donation will Backup file saved - + 备份文件已保存 @@ -1350,7 +1350,7 @@ And if you don't like the app, all the more support it - the donation will Logs file saved - + 日志文件已保存 @@ -1705,7 +1705,7 @@ It's okay as long as it's from someone you trust. Configure your server - + 配置服务器 @@ -1720,7 +1720,7 @@ It's okay as long as it's from someone you trust. Login to connect via SSH - ssh账号 + 用户 @@ -1736,7 +1736,8 @@ It's okay as long as it's from someone you trust. All data you enter will remain strictly confidential and will not be shared or disclosed to the Amnezia or any third parties - + 您输入的所有数据将严格保密 +不会向 Amnezia 或任何第三方分享或披露 @@ -1803,12 +1804,12 @@ and will not be shared or disclosed to the Amnezia or any third parties Amnezia has detected that your server is currently - + Amnezia 检测到您的服务器当前 busy installing other software. Amnezia installation - + 正安装其他软件。Amnezia安装 Amnesia has detected that your server is currently @@ -2017,7 +2018,7 @@ and will not be shared or disclosed to the Amnezia or any third parties Access to server management. The user with whom you share full access to the connection will be able to add and remove your protocols and services to the server, as well as change settings. - + 除访问VPN外,用户还能添加和删除协议、服务以及更改配置信息 Access to server management. The user with whom you share full access to the connection will be able to add and remove your protocols and services to the servers, as well as change settings. @@ -2578,7 +2579,7 @@ and will not be shared or disclosed to the Amnezia or any third parties AmneziaWG - Special protocol from Amnezia, based on WireGuard. It's fast like WireGuard, but very resistant to blockages. Recommended for regions with high levels of censorship. - + AmneziaWG - Amnezia 的特殊协议,基于 WireGuard。它的速度像 WireGuard 一样快,但非常抗堵塞。推荐用于审查较严的地区。 @@ -2610,7 +2611,14 @@ It employs its unique security protocol, leveraging the strength of SSL/TLS for * Flexible customisation to suit user needs to work with different operating systems and devices * Recognised by DPI analysis systems and therefore susceptible to blocking * Can operate over both TCP and UDP network protocols. - + OpenVPN 是最流行且经过时间考验的 VPN 协议之一。 +它采用其独特的安全协议,利用 SSL/TLS 的优势进行加密和密钥交换。此外,OpenVPN 支持多种身份验证方法,使其具有多功能性和适应性,可适应各种设备和操作系统。由于其开源性质,OpenVPN 受益于全球社区的广泛审查,这不断增强了其安全性。凭借性能、安全性和兼容性的强大平衡,OpenVPN 仍然是注重隐私的个人和企业的首选。 + +* 可在所有平台的 AmneziaVPN 中使用 +* 移动设备的正常功耗 +* 灵活定制,满足用户使用不同操作系统和设备的需求 +* 被DPI分析系统识别,因此容易被阻塞 +* 可以通过 TCP 和 UDP 网络协议运行 @@ -2622,7 +2630,14 @@ It employs its unique security protocol, leveraging the strength of SSL/TLS for * Configurable encryption protocol * Detectable by some DPI systems * Works over TCP network protocol. - + Shadowsocks 受到 SOCKS5 协议的启发,使用 AEAD 密码保护连接。尽管 Shadowsocks 设计得谨慎且难以识别,但它与标准 HTTPS 连接并不相同。但是,某些流量分析系统可能仍会检测到 Shadowsocks 连接。由于Amnezia支持有限,建议使用AmneziaWG协议。 + +* 仅在桌面平台上的 AmneziaVPN 中可用 +* 移动设备的正常功耗 + +* 可配置的加密协议 +* 可以被某些 DPI 系统检测到 +* 通过 TCP 网络协议工作。 @@ -2644,7 +2659,23 @@ If there is a extreme level of Internet censorship in your region, we advise you * Not recognised by DPI analysis systems * Works over TCP network protocol, 443 port. - + 这是 OpenVPN 协议和专门用于阻止保护的 Cloak 插件的组合。 + +OpenVPN 通过加密客户端和服务器之间的所有 Internet 流量来提供安全的 VPN 连接。 + +Cloak 可保护 OpenVPN 免遭检测和阻止。 + +Cloak 可以修改数据包元数据,以便将 VPN 流量完全屏蔽为正常 Web 流量,并且还可以保护 VPN 免受主动探测的检测。这使得它非常难以被发现 + +收到第一个数据包后,Cloak 立即对传入连接进行身份验证。如果身份验证失败,该插件会将服务器伪装成虚假网站,并且您的 VPN 对分析系统来说将变得不可见。 + +如果您所在地区的互联网审查非常严格,我们建议您在第一次连接时仅使用 OpenVPN over Cloak + +* 可在所有平台的 AmneziaVPN 中使用 +* 移动设备功耗高 +* 配置灵活 +* 不被 DPI 分析系统识别 +* 通过 TCP 网络协议、443 端口工作。 @@ -2657,7 +2688,15 @@ WireGuard is very susceptible to blocking due to its distinct packet signatures. * Minimum number of settings * Easily recognised by DPI analysis systems, susceptible to blocking * Works over UDP network protocol. - + 一种相对较新的流行 VPN 协议,具有简化的架构。 +在所有设备上提供稳定的 VPN 连接和高性能。使用硬编码的加密设置。 WireGuard 与 OpenVPN 相比具有更低的延迟和更好的数据传输吞吐量。 +由于其独特的数据包签名,WireGuard 非常容易受到阻塞。与其他一些采用混淆技术的 VPN 协议不同,WireGuard 数据包的一致签名模式可以更容易地被高级深度数据包检测 (DPI) 系统和其他网络监控工具识别并阻止。 + +* 可在所有平台的 AmneziaVPN 中使用 +* 低功耗 +* 配置简单 +* 容易被DPI分析系统识别,容易被阻塞 +* 通过 UDP 网络协议工作。 @@ -2670,7 +2709,15 @@ This means that AmneziaWG keeps the fast performance of the original while addin * Minimum number of settings * Not recognised by DPI analysis systems, resistant to blocking * Works over UDP network protocol. - + AmneziaWG 是流行 VPN 协议的现代迭代,它建立在 WireGuard 的基础上,保留了其简化的架构和跨设备的高性能功能。 +虽然 WireGuard 以其高效而闻名,但由于其独特的数据包签名,它存在容易被检测到的问题。 AmneziaWG 通过使用更好的混淆方法解决了这个问题,使其流量与常规互联网流量融合在一起。 +这意味着 AmneziaWG 保留了原始版本的快速性能,同时添加了额外的隐秘层,使其成为那些想要快速且谨慎的 VPN 连接的人的绝佳选择。 + +* 可在所有平台的 AmneziaVPN 中使用 +* 低功耗 +* 配置简单 +* 不被DPI分析系统识别,抗阻塞 +* 通过 UDP 网络协议工作。 @@ -2683,7 +2730,15 @@ While it offers a blend of security, stability, and speed, it's essential t * Minimal configuration * Recognised by DPI analysis systems * Works over UDP network protocol, ports 500 and 4500. - + IKEv2 与 IPSec 加密层配合使用,是一种现代且稳定的 VPN 协议。 +其显着特征之一是能够在网络和设备之间快速切换,使其特别适应动态网络环境。 +虽然 IKEv2 兼具安全性、稳定性和速度,但必须注意的是,IKEv2 很容易被检测到,并且容易受到阻止。 + +* 仅在 Windows 上的 AmneziaVPN 中可用 +* 低功耗,在移动设备上 +* 最低配置 +* 获得DPI分析系统认可 +* 通过 UDP 网络协议、端口 500 和 4500 工作。 OpenVPN container @@ -3004,27 +3059,27 @@ While it offers a blend of security, stability, and speed, it's essential t Medium or High - + 中或高 Extreme - + 极度 I just want to increase the level of my privacy. - + 只是想提高隐私保护级别。 I want to bypass censorship. This option recommended in most cases. - + 想要绕过审查制度。大多数情况下推荐使用此选项。 Most VPN protocols are blocked. Recommended if other options are not working. - + 大多数 VPN 协议都被阻止。如果其他选项不起作用,推荐此选项。 High From 03171e474331eec48be2717851a77359663c3139 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Tue, 17 Oct 2023 19:34:34 +0800 Subject: [PATCH 15/47] update background color and drag-effect, moved dulicated code --- .../qml/Components/HomeContainersListView.qml | 2 +- client/ui/qml/Controls2/Drawer2Type.qml | 27 ++++++++++--------- client/ui/qml/Controls2/DropDownType.qml | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/client/ui/qml/Components/HomeContainersListView.qml b/client/ui/qml/Components/HomeContainersListView.qml index 1436c747..c6c4125a 100644 --- a/client/ui/qml/Components/HomeContainersListView.qml +++ b/client/ui/qml/Components/HomeContainersListView.qml @@ -69,7 +69,7 @@ ListView { isDefault = true menuContent.currentIndex = index - containersDropDown.menu.state = "closed" + containersDropDown.menu.close() if (needReconnected && diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml index 3f3cf54b..fcd773a8 100644 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -10,7 +10,7 @@ Item { target: PageController function onForceCloseDrawer() { - root.state = "closed" + close() } } @@ -32,8 +32,6 @@ Item { state: "closed" - Drag.active: dragArea.drag.active - Rectangle { id: draw2Background @@ -41,7 +39,7 @@ Item { height: root.parent.height width: parent.width radius: 16 - color: "transparent" + color: "#90000000" border.color: "transparent" border.width: 1 visible: true @@ -54,6 +52,7 @@ Item { onClicked: { if (root.state === "opened") { + draw2Background.color = "transparent" root.state = "closed" return } @@ -61,14 +60,16 @@ Item { Rectangle { id: placeAreaHolder - anchors.top: parent.top height: parent.height - contentHeight anchors.right: parent.right anchors.left: parent.left visible: true color: "transparent" + + Drag.active: dragArea.drag.active } + Rectangle { id: contentArea @@ -98,27 +99,27 @@ Item { cursorShape: (root.state === "opened") ? Qt.PointingHandCursor : Qt.ArrowCursor hoverEnabled: true - drag.target: root + drag.target: placeAreaHolder drag.axis: Drag.YAxis drag.maximumY: root.height drag.minimumY: root.height - root.height /** If drag area is released at any point other than min or max y, transition to the other state */ onReleased: { - if (root.state === "closed" && root.y < dragArea.drag.maximumY) { + if (root.state === "closed" && placeAreaHolder.y < dragArea.drag.maximumY) { root.state = "opened" return } - if (root.state === "opened" && root.y > dragArea.drag.minimumY) { - root.state = "closed" + if (root.state === "opened" && placeAreaHolder.y > dragArea.drag.minimumY) { + close() return } } onClicked: { if (root.state === "opened") { - root.state = "closed" + close() return } } @@ -209,22 +210,24 @@ Item { if (root.visible && root.state !== "closed") { return } + draw2Background.color = "#90000000" root.y = 0 root.state = "opened" root.visible = true root.height = parent.height contentArea.height = contentHeight + placeAreaHolder.height = parent.height - contentHeight + placeAreaHolder.y = parent.height - root.height dragArea.drag.maximumY = parent.height dragArea.drag.minimumY = parent.height - root.height - animationVisible.running = true } function close() { - root.visible = false + draw2Background.color = "transparent" root.state = "closed" } diff --git a/client/ui/qml/Controls2/DropDownType.qml b/client/ui/qml/Controls2/DropDownType.qml index 0506bdc7..c666408a 100644 --- a/client/ui/qml/Controls2/DropDownType.qml +++ b/client/ui/qml/Controls2/DropDownType.qml @@ -187,7 +187,7 @@ Item { BackButtonType { backButtonImage: root.headerBackButtonImage backButtonFunction: function() { - menu.state = "closed" + menu.close() } } } From 61ddfe01a10f3149711e8405a2218264ea8ee534 Mon Sep 17 00:00:00 2001 From: pokamest Date: Tue, 17 Oct 2023 06:39:49 -0700 Subject: [PATCH 16/47] macos build script updated [no ci] --- deploy/build_macos.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/deploy/build_macos.sh b/deploy/build_macos.sh index 700198e7..13214d6d 100755 --- a/deploy/build_macos.sh +++ b/deploy/build_macos.sh @@ -96,16 +96,16 @@ if [ "${MAC_CERT_PW+x}" ]; then security find-identity -p codesigning echo "Signing App bundle..." - /usr/bin/codesign --deep --force --verbose --timestamp -o runtime --sign "Developer ID Application: Privacy Technologies OU (X7UJ388FXK)" $BUNDLE_DIR + /usr/bin/codesign --deep --force --verbose --timestamp -o runtime --sign "$MAC_SIGNER_ID" $BUNDLE_DIR /usr/bin/codesign --verify -vvvv $BUNDLE_DIR || true spctl -a -vvvv $BUNDLE_DIR || true if [ "${NOTARIZE_APP+x}" ]; then echo "Notarizing App bundle..." /usr/bin/ditto -c -k --keepParent $BUNDLE_DIR $PROJECT_DIR/Bundle_to_notarize.zip - xcrun altool --notarize-app -f $PROJECT_DIR/Bundle_to_notarize.zip -t osx --primary-bundle-id "$APP_DOMAIN" -u "$APPLE_DEV_EMAIL" -p $APPLE_DEV_PASSWORD + xcrun notarytool submit $PROJECT_DIR/Bundle_to_notarize.zip --apple-id $APPLE_DEV_EMAIL --team-id $MAC_TEAM_ID --password $APPLE_DEV_PASSWORD rm $PROJECT_DIR/Bundle_to_notarize.zip - sleep 600 + sleep 300 xcrun stapler staple $BUNDLE_DIR xcrun stapler validate $BUNDLE_DIR spctl -a -vvvv $BUNDLE_DIR || true @@ -130,15 +130,15 @@ $QIF_BIN_DIR/binarycreator --offline-only -v -c $BUILD_DIR/installer/config/maco if [ "${MAC_CERT_PW+x}" ]; then echo "Signing installer bundle..." security unlock-keychain -p $TEMP_PASS $KEYCHAIN - /usr/bin/codesign --deep --force --verbose --timestamp -o runtime --sign "Developer ID Application: Privacy Technologies OU (X7UJ388FXK)" $INSTALLER_BUNDLE_DIR + /usr/bin/codesign --deep --force --verbose --timestamp -o runtime --sign "$MAC_SIGNER_ID" $INSTALLER_BUNDLE_DIR /usr/bin/codesign --verify -vvvv $INSTALLER_BUNDLE_DIR || true if [ "${NOTARIZE_APP+x}" ]; then echo "Notarizing installer bundle..." /usr/bin/ditto -c -k --keepParent $INSTALLER_BUNDLE_DIR $PROJECT_DIR/Installer_bundle_to_notarize.zip - xcrun altool --notarize-app -f $PROJECT_DIR/Installer_bundle_to_notarize.zip -t osx --primary-bundle-id "$APP_DOMAIN" -u "$APPLE_DEV_EMAIL" -p $APPLE_DEV_PASSWORD + xcrun notarytool submit $PROJECT_DIR/Installer_bundle_to_notarize.zip --apple-id $APPLE_DEV_EMAIL --team-id $MAC_TEAM_ID --password $APPLE_DEV_PASSWORD rm $PROJECT_DIR/Installer_bundle_to_notarize.zip - sleep 600 + sleep 300 xcrun stapler staple $INSTALLER_BUNDLE_DIR xcrun stapler validate $INSTALLER_BUNDLE_DIR spctl -a -vvvv $INSTALLER_BUNDLE_DIR || true @@ -151,13 +151,13 @@ hdiutil create -volname AmneziaVPN -srcfolder $BUILD_DIR/installer/$APP_NAME.app if [ "${MAC_CERT_PW+x}" ]; then echo "Signing DMG installer..." security unlock-keychain -p $TEMP_PASS $KEYCHAIN - /usr/bin/codesign --deep --force --verbose --timestamp -o runtime --sign "Developer ID Application: Privacy Technologies OU (X7UJ388FXK)" $DMG_FILENAME + /usr/bin/codesign --deep --force --verbose --timestamp -o runtime --sign "$MAC_SIGNER_ID" $DMG_FILENAME /usr/bin/codesign --verify -vvvv $DMG_FILENAME || true if [ "${NOTARIZE_APP+x}" ]; then echo "Notarizing DMG installer..." - xcrun altool --notarize-app -f $DMG_FILENAME -t osx --primary-bundle-id $APP_DOMAIN -u $APPLE_DEV_EMAIL -p $APPLE_DEV_PASSWORD - sleep 600 + xcrun notarytool submit $DMG_FILENAME --apple-id $APPLE_DEV_EMAIL --team-id $MAC_TEAM_ID --password $APPLE_DEV_PASSWORD + sleep 300 xcrun stapler staple $DMG_FILENAME xcrun stapler validate $DMG_FILENAME fi From 94304b5777a6e74546f6aaa3f1d61126a019f940 Mon Sep 17 00:00:00 2001 From: pokamest Date: Tue, 17 Oct 2023 14:47:31 +0100 Subject: [PATCH 17/47] Version bump --- CMakeLists.txt | 2 +- client/ui/qml/Pages2/PageSettingsConnection.qml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 85d7d0ce..028aacd3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR) set(PROJECT AmneziaVPN) -project(${PROJECT} VERSION 4.0.8.2 +project(${PROJECT} VERSION 4.0.8.3 DESCRIPTION "AmneziaVPN" HOMEPAGE_URL "https://amnezia.org/" ) diff --git a/client/ui/qml/Pages2/PageSettingsConnection.qml b/client/ui/qml/Pages2/PageSettingsConnection.qml index 7f0262f9..565ae7db 100644 --- a/client/ui/qml/Pages2/PageSettingsConnection.qml +++ b/client/ui/qml/Pages2/PageSettingsConnection.qml @@ -94,7 +94,7 @@ PageType { DividerType {} LabelWithButtonType { - visible: !GC.isMobile() + visible: GC.isDesktop() Layout.fillWidth: true @@ -108,11 +108,11 @@ PageType { } DividerType { - visible: !GC.isMobile() + visible: GC.isDesktop() } LabelWithButtonType { - visible: !GC.isMobile() + visible: false Layout.fillWidth: true @@ -125,7 +125,7 @@ PageType { } DividerType { - visible: !GC.isMobile() + visible: false } } } From a83cd29f725136094bfb5d8855b9167b761bb125 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Tue, 17 Oct 2023 22:00:19 +0800 Subject: [PATCH 18/47] fixed the cursorShape, and some minor issues --- client/ui/qml/Controls2/Drawer2Type.qml | 47 ++++++++++++++----------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml index fcd773a8..988b4172 100644 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -28,15 +28,13 @@ Item { property int contentHeight: 0 property Item contentParent: contentArea - y: parent.height - root.height - state: "closed" Rectangle { id: draw2Background - anchors { left: root.left; right: root.right; top: root.top } - height: root.parent.height + anchors.fill: parent + height: parent.height width: parent.width radius: 16 color: "#90000000" @@ -45,15 +43,14 @@ Item { visible: true MouseArea { - id: fullArea + id: fullMouseArea anchors.fill: parent enabled: (root.state === "opened") hoverEnabled: true onClicked: { if (root.state === "opened") { - draw2Background.color = "transparent" - root.state = "closed" + close() return } } @@ -106,15 +103,17 @@ Item { /** If drag area is released at any point other than min or max y, transition to the other state */ onReleased: { - if (root.state === "closed" && placeAreaHolder.y < dragArea.drag.maximumY) { + if (root.state === "closed" && placeAreaHolder.y < root.height * 0.9) { root.state = "opened" return } - if (root.state === "opened" && placeAreaHolder.y > dragArea.drag.minimumY) { + if (root.state === "opened" && placeAreaHolder.y > (root.height - root.height * 0.9)) { close() return } + + placeAreaHolder.y = 0 } onClicked: { @@ -161,15 +160,15 @@ Item { State { name: "closed" PropertyChanges { - target: root + target: placeAreaHolder y: parent.height } }, State { - name: "opend" + name: "opened" PropertyChanges { - target: root + target: placeAreaHolder y: dragArea.drag.minimumY } } @@ -180,7 +179,7 @@ Item { from: "opened" to: "closed" PropertyAnimation { - target: root + target: placeAreaHolder properties: "y" duration: 200 } @@ -190,7 +189,7 @@ Item { from: "closed" to: "opened" PropertyAnimation { - target: root + target: placeAreaHolder properties: "y" duration: 200 } @@ -199,7 +198,7 @@ Item { NumberAnimation { id: animationVisible - target: root + target: placeAreaHolder property: "y" from: parent.height to: 0 @@ -212,21 +211,29 @@ Item { } draw2Background.color = "#90000000" + fullMouseArea.visible = true + dragArea.visible = true + root.y = 0 root.state = "opened" root.visible = true root.height = parent.height - contentArea.height = contentHeight - placeAreaHolder.height = parent.height - contentHeight - placeAreaHolder.y = parent.height - root.height - dragArea.drag.maximumY = parent.height - dragArea.drag.minimumY = parent.height - root.height + contentArea.height = contentHeight + + placeAreaHolder.height = root.height - contentHeight + placeAreaHolder.y = root.height - root.height + + dragArea.drag.maximumY = root.height + dragArea.drag.minimumY = 0 animationVisible.running = true } function close() { + fullMouseArea.visible = false + dragArea.visible = false + draw2Background.color = "transparent" root.state = "closed" } From 160d88f002ee612ec93e15d09e0b963ef5bcf646 Mon Sep 17 00:00:00 2001 From: lunardunno <126363523+lunardunno@users.noreply.github.com> Date: Tue, 17 Oct 2023 21:26:50 +0400 Subject: [PATCH 19/47] Restoring autostart and enable docker for CentOS 7 --- client/server_scripts/install_docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/server_scripts/install_docker.sh b/client/server_scripts/install_docker.sh index e780dac5..58f92540 100644 --- a/client/server_scripts/install_docker.sh +++ b/client/server_scripts/install_docker.sh @@ -8,7 +8,7 @@ if ! command -v sudo > /dev/null 2>&1; then $pm update -yq; $pm install -yq sudo if ! command -v fuser > /dev/null 2>&1; then sudo $pm install -yq psmisc; fi;\ if ! command -v lsof > /dev/null 2>&1; then sudo $pm install -yq lsof; fi;\ if ! command -v docker > /dev/null 2>&1; then sudo $pm update -yq; sudo $pm install -yq $docker_pkg;\ - if [ "$dist" = "fedora" ] || [ "$dist" = "debian" ]; then sudo systemctl enable docker && sudo systemctl start docker; fi;\ + if [ "$dist" = "fedora" ] || [ "$dist" = "centos" ] || [ "$dist" = "debian" ]; then sudo systemctl enable docker && sudo systemctl start docker; fi;\ fi;\ if [ "$dist" = "debian" ]; then \ docker_service=$(systemctl list-units --full --all | grep docker.service | grep -v inactive | grep -v dead | grep -v failed);\ From 2f0c1eeecc11165c1928a6b07e75859e6ec4e629 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Wed, 18 Oct 2023 00:36:40 +0500 Subject: [PATCH 20/47] fixed selection of default container after installing a new server --- client/amnezia_application.cpp | 2 ++ client/ui/controllers/installController.cpp | 2 ++ client/ui/models/servers_model.cpp | 2 +- client/ui/models/servers_model.h | 2 +- client/ui/qml/Components/ConnectButton.qml | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/amnezia_application.cpp b/client/amnezia_application.cpp index 4e6bce2b..bbd48c96 100644 --- a/client/amnezia_application.cpp +++ b/client/amnezia_application.cpp @@ -286,6 +286,8 @@ void AmneziaApplication::initModels() m_engine->rootContext()->setContextProperty("ServersModel", m_serversModel.get()); connect(m_serversModel.get(), &ServersModel::currentlyProcessedServerIndexChanged, m_containersModel.get(), &ContainersModel::setCurrentlyProcessedServerIndex); + connect(m_serversModel.get(), &ServersModel::defaultServerIndexChanged, m_containersModel.get(), + &ContainersModel::setCurrentlyProcessedServerIndex); m_languageModel.reset(new LanguageModel(m_settings, this)); m_engine->rootContext()->setContextProperty("LanguageModel", m_languageModel.get()); diff --git a/client/ui/controllers/installController.cpp b/client/ui/controllers/installController.cpp index bb10d39c..db2f9409 100644 --- a/client/ui/controllers/installController.cpp +++ b/client/ui/controllers/installController.cpp @@ -475,6 +475,8 @@ void InstallController::addEmptyServer() server.insert(config_key::port, m_currentlyInstalledServerCredentials.port); server.insert(config_key::description, m_settings->nextAvailableServerName()); + server.insert(config_key::defaultContainer, ContainerProps::containerToString(DockerContainer::None)); + m_serversModel->addServer(server); m_serversModel->setDefaultServerIndex(m_serversModel->getServersCount() - 1); diff --git a/client/ui/models/servers_model.cpp b/client/ui/models/servers_model.cpp index 7eea94e5..a2a28630 100644 --- a/client/ui/models/servers_model.cpp +++ b/client/ui/models/servers_model.cpp @@ -96,7 +96,7 @@ void ServersModel::setDefaultServerIndex(const int index) { m_settings->setDefaultServer(index); m_defaultServerIndex = m_settings->defaultServerIndex(); - emit defaultServerIndexChanged(); + emit defaultServerIndexChanged(m_defaultServerIndex); } const int ServersModel::getDefaultServerIndex() diff --git a/client/ui/models/servers_model.h b/client/ui/models/servers_model.h index d7b15844..ad1d5a83 100644 --- a/client/ui/models/servers_model.h +++ b/client/ui/models/servers_model.h @@ -64,7 +64,7 @@ protected: signals: void currentlyProcessedServerIndexChanged(const int index); - void defaultServerIndexChanged(); + void defaultServerIndexChanged(const int index); void defaultServerNameChanged(); private: diff --git a/client/ui/qml/Components/ConnectButton.qml b/client/ui/qml/Components/ConnectButton.qml index 76e83da5..c2ec186d 100644 --- a/client/ui/qml/Components/ConnectButton.qml +++ b/client/ui/qml/Components/ConnectButton.qml @@ -142,6 +142,7 @@ Button { PageController.setTriggeredBtConnectButton(true) ServersModel.currentlyProcessedIndex = ServersModel.getDefaultServerIndex() + InstallController.setShouldCreateServer(false) PageController.goToPage(PageEnum.PageSetupWizardEasy) return From 4b64bfaec029aca8355ed627aeaa8356ba243706 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Wed, 18 Oct 2023 00:37:15 +0500 Subject: [PATCH 21/47] fixed questionDrawer height --- client/translations/amneziavpn_ru.ts | 14 ++++++++++++-- client/translations/amneziavpn_zh_CN.ts | 14 ++++++++++++-- client/ui/qml/Components/QuestionDrawer.qml | 4 +++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index 1617413a..4d3ae6c9 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -4,7 +4,7 @@ AmneziaApplication - + Split tunneling for WireGuard is not implemented, the option was disabled Раздельное туннелирование для "Wireguard" не реализовано,опция отключена @@ -194,7 +194,7 @@ Already installed containers were found on the server. All installed containers Пожалуйста, войдите в систему от имени пользователя - + Server added successfully Сервер успешно добавлен @@ -2700,6 +2700,16 @@ This means that AmneziaWG keeps the fast performance of the original while addin error 0x%1: %2 error 0x%1: %2 + + + WireGuard Configuration Highlighter + + + + + &Randomize colors + + SelectLanguageDrawer diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 09198c9c..ae25e41c 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -4,7 +4,7 @@ AmneziaApplication - + Split tunneling for WireGuard is not implemented, the option was disabled 未启用选项,还未实现基于WireGuard协议的VPN分离 @@ -228,7 +228,7 @@ Already installed containers were found on the server. All installed containers 请以用户身份登录 - + Server added successfully 增加服务器成功 @@ -2839,6 +2839,16 @@ While it offers a blend of security, stability, and speed, it's essential t error 0x%1: %2 错误 0x%1: %2 + + + WireGuard Configuration Highlighter + + + + + &Randomize colors + + SelectLanguageDrawer diff --git a/client/ui/qml/Components/QuestionDrawer.qml b/client/ui/qml/Components/QuestionDrawer.qml index a79f9140..16cdcb39 100644 --- a/client/ui/qml/Components/QuestionDrawer.qml +++ b/client/ui/qml/Components/QuestionDrawer.qml @@ -17,9 +17,11 @@ DrawerType { property var noButtonFunction width: parent.width - height: parent.height * 0.5 + height: content.implicitHeight + 32 ColumnLayout { + id: content + anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right From a46e55d5c2b938f06ddd03e510e6f9470a538504 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Wed, 18 Oct 2023 01:11:41 +0500 Subject: [PATCH 22/47] added a dash for drawerType --- client/translations/amneziavpn_ru.ts | 6 +++--- client/translations/amneziavpn_zh_CN.ts | 6 +++--- client/ui/qml/Controls2/DrawerType.qml | 14 ++++++++++++++ client/ui/qml/Pages2/PageHome.qml | 14 ++++++++++++-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index 4d3ae6c9..db27afbc 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -262,17 +262,17 @@ Already installed containers were found on the server. All installed containers PageHome - + VPN protocol VPN протокол - + Servers Серверы - + Unable change server while there is an active connection diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index ae25e41c..59bef770 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -296,17 +296,17 @@ Already installed containers were found on the server. All installed containers PageHome - + VPN protocol VPN协议 - + Servers 服务器 - + Unable change server while there is an active connection Невозможно изменить сервер при наличии активного соединения diff --git a/client/ui/qml/Controls2/DrawerType.qml b/client/ui/qml/Controls2/DrawerType.qml index 72765d78..830f59f9 100644 --- a/client/ui/qml/Controls2/DrawerType.qml +++ b/client/ui/qml/Controls2/DrawerType.qml @@ -1,6 +1,8 @@ import QtQuick import QtQuick.Controls +import "../Config" + Drawer { id: drawer property bool needCloseButton: true @@ -39,6 +41,18 @@ Drawer { border.color: "#2C2D30" border.width: 1 + + Rectangle { + visible: GC.isMobile() + + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + anchors.topMargin: 10 + + width: 20 + height: 2 + color: "#2C2D30" + } } Overlay.modal: Rectangle { diff --git a/client/ui/qml/Pages2/PageHome.qml b/client/ui/qml/Pages2/PageHome.qml index d89d6be1..3a71adac 100644 --- a/client/ui/qml/Pages2/PageHome.qml +++ b/client/ui/qml/Pages2/PageHome.qml @@ -241,8 +241,18 @@ PageType { } ] + DividerType { + Layout.topMargin: 10 + Layout.fillWidth: false + Layout.preferredWidth: 20 + Layout.preferredHeight: 2 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + + visible: GC.isMobile() && (buttonContent.collapsedVisibility || buttonContent.expandedVisibility) + } + RowLayout { - Layout.topMargin: 24 + Layout.topMargin: 14 Layout.leftMargin: 24 Layout.rightMargin: 24 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter @@ -305,7 +315,7 @@ PageType { Header1TextType { Layout.fillWidth: true - Layout.topMargin: 24 + Layout.topMargin: 14 Layout.leftMargin: 16 Layout.rightMargin: 16 From f5f72f87a6246ee320aa027348e18edfae97cacc Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Wed, 18 Oct 2023 12:17:24 +0500 Subject: [PATCH 23/47] fixed switcher status display for page split site tunneling --- client/ui/models/sites_model.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/client/ui/models/sites_model.cpp b/client/ui/models/sites_model.cpp index 1e0f1692..5f4afe1a 100644 --- a/client/ui/models/sites_model.cpp +++ b/client/ui/models/sites_model.cpp @@ -8,6 +8,7 @@ SitesModel::SitesModel(std::shared_ptr settings, QObject *parent) m_isSplitTunnelingEnabled = false; m_currentRouteMode = Settings::RouteMode::VpnOnlyForwardSites; } else { + m_isSplitTunnelingEnabled = true; m_currentRouteMode = routeMode; } fillSites(); From c461e00c5c378e5ed6ade5291b2233947a94fe60 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Wed, 18 Oct 2023 16:17:57 +0800 Subject: [PATCH 24/47] keeping parent's cusorshape and Drawer2Type's close-animation --- client/ui/qml/Controls2/Drawer2Type.qml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml index 988b4172..b34390ac 100644 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -183,6 +183,12 @@ Item { properties: "y" duration: 200 } + + onRunningChanged: { + if (!running) { + visibledMouseArea(false) + } + } }, Transition { @@ -211,8 +217,7 @@ Item { } draw2Background.color = "#90000000" - fullMouseArea.visible = true - dragArea.visible = true + visibledMouseArea(true) root.y = 0 root.state = "opened" @@ -231,9 +236,6 @@ Item { } function close() { - fullMouseArea.visible = false - dragArea.visible = false - draw2Background.color = "transparent" root.state = "closed" } @@ -250,4 +252,9 @@ Item { close() } } + + function visibledMouseArea(visbile) { + fullMouseArea.visible = visbile + dragArea.visible = visbile + } } From e16c425f875d209f4f35fe7f94714b46593352e0 Mon Sep 17 00:00:00 2001 From: pokamest Date: Wed, 18 Oct 2023 12:04:39 +0100 Subject: [PATCH 25/47] PageHome.qml fix --- CMakeLists.txt | 2 +- client/translations/amneziavpn_ru.ts | 10 ---------- client/translations/amneziavpn_zh_CN.ts | 10 ---------- client/ui/qml/Pages2/PageHome.qml | 2 +- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 028aacd3..68de51fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR) set(PROJECT AmneziaVPN) -project(${PROJECT} VERSION 4.0.8.3 +project(${PROJECT} VERSION 4.0.8.4 DESCRIPTION "AmneziaVPN" HOMEPAGE_URL "https://amnezia.org/" ) diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index db27afbc..a26758b7 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -2700,16 +2700,6 @@ This means that AmneziaWG keeps the fast performance of the original while addin error 0x%1: %2 error 0x%1: %2 - - - WireGuard Configuration Highlighter - - - - - &Randomize colors - - SelectLanguageDrawer diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 59bef770..a10fb449 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -2839,16 +2839,6 @@ While it offers a blend of security, stability, and speed, it's essential t error 0x%1: %2 错误 0x%1: %2 - - - WireGuard Configuration Highlighter - - - - - &Randomize colors - - SelectLanguageDrawer diff --git a/client/ui/qml/Pages2/PageHome.qml b/client/ui/qml/Pages2/PageHome.qml index 3a71adac..cc49e4f0 100644 --- a/client/ui/qml/Pages2/PageHome.qml +++ b/client/ui/qml/Pages2/PageHome.qml @@ -248,7 +248,7 @@ PageType { Layout.preferredHeight: 2 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - visible: GC.isMobile() && (buttonContent.collapsedVisibility || buttonContent.expandedVisibility) + visible: (buttonContent.collapsedVisibility || buttonContent.expandedVisibility) } RowLayout { From e2ae341ba96b375e381b2a6346563e5a1dddd0a2 Mon Sep 17 00:00:00 2001 From: pokamest Date: Wed, 18 Oct 2023 14:01:06 +0100 Subject: [PATCH 26/47] AndroidManifest fix --- client/android/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/client/android/AndroidManifest.xml b/client/android/AndroidManifest.xml index 4ec807e9..1115b74d 100644 --- a/client/android/AndroidManifest.xml +++ b/client/android/AndroidManifest.xml @@ -45,6 +45,7 @@ android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleInstance" + android:windowSoftInputMode="adjustResize" android:exported="true"> From 79e1761c1f476e2608ad2c93ff024f829509dce5 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Thu, 19 Oct 2023 01:14:09 +0500 Subject: [PATCH 27/47] added generation of random values for awg parameters --- client/core/servercontroller.cpp | 37 +++++++-------------- client/translations/amneziavpn_ru.ts | 34 ++++++++++++------- client/translations/amneziavpn_zh_CN.ts | 34 ++++++++++++------- client/ui/controllers/installController.cpp | 31 +++++++++++++++++ 4 files changed, 87 insertions(+), 49 deletions(-) diff --git a/client/core/servercontroller.cpp b/client/core/servercontroller.cpp index 60691759..443cd5a3 100644 --- a/client/core/servercontroller.cpp +++ b/client/core/servercontroller.cpp @@ -337,7 +337,7 @@ bool ServerController::isReinstallContainerRequired(DockerContainer container, c != newProtoConfig.value(config_key::port).toString(protocols::shadowsocks::defaultPort)) return true; } - + if (container == DockerContainer::Awg) { return true; } @@ -490,8 +490,7 @@ ServerController::Vars ServerController::genVarsForScript(const ServerCredential const QJsonObject &cloakConfig = config.value(ProtocolProps::protoToString(Proto::Cloak)).toObject(); const QJsonObject &ssConfig = config.value(ProtocolProps::protoToString(Proto::ShadowSocks)).toObject(); const QJsonObject &wireguarConfig = config.value(ProtocolProps::protoToString(Proto::WireGuard)).toObject(); - const QJsonObject &amneziaWireguarConfig = - config.value(ProtocolProps::protoToString(Proto::Awg)).toObject(); + const QJsonObject &amneziaWireguarConfig = config.value(ProtocolProps::protoToString(Proto::Awg)).toObject(); const QJsonObject &sftpConfig = config.value(ProtocolProps::protoToString(Proto::Sftp)).toObject(); Vars vars; @@ -591,33 +590,21 @@ ServerController::Vars ServerController::genVarsForScript(const ServerCredential // Amnezia wireguard vars vars.append({ { "$AWG_SERVER_PORT", amneziaWireguarConfig.value(config_key::port).toString(protocols::awg::defaultPort) } }); - vars.append({ { "$JUNK_PACKET_COUNT", - amneziaWireguarConfig.value(config_key::junkPacketCount) - .toString(protocols::awg::defaultJunkPacketCount) } }); - vars.append({ { "$JUNK_PACKET_MIN_SIZE", - amneziaWireguarConfig.value(config_key::junkPacketMinSize) - .toString(protocols::awg::defaultJunkPacketMinSize) } }); - vars.append({ { "$JUNK_PACKET_MAX_SIZE", - amneziaWireguarConfig.value(config_key::junkPacketMaxSize) - .toString(protocols::awg::defaultJunkPacketMaxSize) } }); - vars.append({ { "$INIT_PACKET_JUNK_SIZE", - amneziaWireguarConfig.value(config_key::initPacketJunkSize) - .toString(protocols::awg::defaultInitPacketJunkSize) } }); + + vars.append({ { "$JUNK_PACKET_COUNT", amneziaWireguarConfig.value(config_key::junkPacketCount).toString() } }); + vars.append({ { "$JUNK_PACKET_MIN_SIZE", amneziaWireguarConfig.value(config_key::junkPacketMinSize).toString() } }); + vars.append({ { "$JUNK_PACKET_MAX_SIZE", amneziaWireguarConfig.value(config_key::junkPacketMaxSize).toString() } }); + vars.append({ { "$INIT_PACKET_JUNK_SIZE", amneziaWireguarConfig.value(config_key::initPacketJunkSize).toString() } }); vars.append({ { "$RESPONSE_PACKET_JUNK_SIZE", - amneziaWireguarConfig.value(config_key::responsePacketJunkSize) - .toString(protocols::awg::defaultResponsePacketJunkSize) } }); + amneziaWireguarConfig.value(config_key::responsePacketJunkSize).toString() } }); vars.append({ { "$INIT_PACKET_MAGIC_HEADER", - amneziaWireguarConfig.value(config_key::initPacketMagicHeader) - .toString(protocols::awg::defaultInitPacketMagicHeader) } }); + amneziaWireguarConfig.value(config_key::initPacketMagicHeader).toString() } }); vars.append({ { "$RESPONSE_PACKET_MAGIC_HEADER", - amneziaWireguarConfig.value(config_key::responsePacketMagicHeader) - .toString(protocols::awg::defaultResponsePacketMagicHeader) } }); + amneziaWireguarConfig.value(config_key::responsePacketMagicHeader).toString() } }); vars.append({ { "$UNDERLOAD_PACKET_MAGIC_HEADER", - amneziaWireguarConfig.value(config_key::underloadPacketMagicHeader) - .toString(protocols::awg::defaultUnderloadPacketMagicHeader) } }); + amneziaWireguarConfig.value(config_key::underloadPacketMagicHeader).toString() } }); vars.append({ { "$TRANSPORT_PACKET_MAGIC_HEADER", - amneziaWireguarConfig.value(config_key::transportPacketMagicHeader) - .toString(protocols::awg::defaultTransportPacketMagicHeader) } }); + amneziaWireguarConfig.value(config_key::transportPacketMagicHeader).toString() } }); QString serverIp = Utils::getIPAddress(credentials.hostName); if (!serverIp.isEmpty()) { diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index a26758b7..733c374d 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -143,58 +143,58 @@ InstallController - - + + %1 installed successfully. %1 успешно установлен. - - + + %1 is already installed on the server. %1 уже установлен на сервер. - + Added containers that were already installed on the server В приложение добавлены обнаруженные на сервере протоклы и сервисы - + Already installed containers were found on the server. All installed containers have been added to the application На сервере обнаружены установленные протоколы и сервисы, все они добавлены в приложение - + Settings updated successfully Настройки успешно обновлены - + Server '%1' was removed Сервер '%1' был удален - + All containers from server '%1' have been removed Все протоклы и сервисы были удалены с сервера '%1' - + %1 has been removed from the server '%2' %1 был удален с сервера '%2' - + Please login as the user Пожалуйста, войдите в систему от имени пользователя - + Server added successfully Сервер успешно добавлен @@ -2700,6 +2700,16 @@ This means that AmneziaWG keeps the fast performance of the original while addin error 0x%1: %2 error 0x%1: %2 + + + WireGuard Configuration Highlighter + + + + + &Randomize colors + + SelectLanguageDrawer diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index a10fb449..64faa6f4 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -162,47 +162,47 @@ 已安装在服务器上 - - + + %1 installed successfully. %1 安装成功。 - - + + %1 is already installed on the server. 服务器上已经安装 %1。 - + Added containers that were already installed on the server 添加已安装在服务器上的容器 - + Already installed containers were found on the server. All installed containers have been added to the application 在服务上发现已经安装协议并添加至应用 - + Settings updated successfully 配置更新成功 - + Server '%1' was removed 已移除服务器 '%1' - + All containers from server '%1' have been removed 服务器 '%1' 的所有容器已移除 - + %1 has been removed from the server '%2' %1 已从服务器 '%2' 上移除 @@ -223,12 +223,12 @@ Already installed containers were found on the server. All installed containers 协议已从 - + Please login as the user 请以用户身份登录 - + Server added successfully 增加服务器成功 @@ -2839,6 +2839,16 @@ While it offers a blend of security, stability, and speed, it's essential t error 0x%1: %2 错误 0x%1: %2 + + + WireGuard Configuration Highlighter + + + + + &Randomize colors + + SelectLanguageDrawer diff --git a/client/ui/controllers/installController.cpp b/client/ui/controllers/installController.cpp index db2f9409..8efe368b 100644 --- a/client/ui/controllers/installController.cpp +++ b/client/ui/controllers/installController.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "core/errorstrings.h" #include "core/servercontroller.h" @@ -73,6 +74,36 @@ void InstallController::install(DockerContainer container, int port, TransportPr containerConfig.insert(config_key::transport_proto, ProtocolProps::transportProtoToString(transportProto, protocol)); + if (container == DockerContainer::Awg) { + QString defaultJunkPacketCount = QString::number(QRandomGenerator::global()->bounded(3, 10)); + QString defaultJunkPacketMinSize = QString::number(50); + QString defaultJunkPacketMaxSize = QString::number(1000); + QString defaultInitPacketJunkSize = QString::number(QRandomGenerator::global()->bounded(15, 150)); + QString defaultResponsePacketJunkSize = QString::number(QRandomGenerator::global()->bounded(15, 150)); + + QSet headersValue; + while (headersValue.size() != 4) { + headersValue.insert(QString::number(QRandomGenerator::global()->bounded(1, std::numeric_limits::max()))); + } + + auto headersValueList = headersValue.values(); + + QString defaultInitPacketMagicHeader = headersValueList.at(0); + QString defaultResponsePacketMagicHeader = headersValueList.at(1); + QString defaultUnderloadPacketMagicHeader = headersValueList.at(2); + QString defaultTransportPacketMagicHeader = headersValueList.at(3); + + containerConfig[config_key::junkPacketCount] = defaultJunkPacketCount; + containerConfig[config_key::junkPacketMinSize] = defaultJunkPacketMinSize; + containerConfig[config_key::junkPacketMaxSize] = defaultJunkPacketMaxSize; + containerConfig[config_key::initPacketJunkSize] = defaultInitPacketJunkSize; + containerConfig[config_key::responsePacketJunkSize] = defaultResponsePacketJunkSize; + containerConfig[config_key::initPacketMagicHeader] = defaultInitPacketMagicHeader; + containerConfig[config_key::responsePacketMagicHeader] = defaultResponsePacketMagicHeader; + containerConfig[config_key::underloadPacketMagicHeader] = defaultUnderloadPacketMagicHeader; + containerConfig[config_key::transportPacketMagicHeader] = defaultTransportPacketMagicHeader; + } + if (container == DockerContainer::Sftp) { containerConfig.insert(config_key::userName, protocols::sftp::defaultUserName); containerConfig.insert(config_key::password, Utils::getRandomString(10)); From 338499247dd64ac81c5eb8ac55192da3aad01fc0 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Thu, 19 Oct 2023 01:16:36 +0500 Subject: [PATCH 28/47] changed the display order of containers --- client/containers/containers_defs.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/containers/containers_defs.h b/client/containers/containers_defs.h index b9cb760d..92ca4f18 100644 --- a/client/containers/containers_defs.h +++ b/client/containers/containers_defs.h @@ -16,11 +16,11 @@ namespace amnezia Q_NAMESPACE enum DockerContainer { None = 0, - OpenVpn, - ShadowSocks, - Cloak, - WireGuard, Awg, + WireGuard, + OpenVpn, + Cloak, + ShadowSocks, Ipsec, // non-vpn From 366e27a321050119df3e1c8ca912a5bd113c7497 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Thu, 19 Oct 2023 09:27:39 +0800 Subject: [PATCH 29/47] re-adatped pagehome --- client/resources.qrc | 1 - .../ui/qml/Components/HomeRootMenuButton.qml | 140 --------- client/ui/qml/Controls2/Drawer2Type.qml | 279 +++++++++++++----- client/ui/qml/Pages2/PageHome.qml | 121 ++++++-- client/ui/qml/Pages2/PageStart.qml | 2 +- 5 files changed, 298 insertions(+), 245 deletions(-) delete mode 100644 client/ui/qml/Components/HomeRootMenuButton.qml diff --git a/client/resources.qrc b/client/resources.qrc index ac6e5a6d..d7f8ff7a 100644 --- a/client/resources.qrc +++ b/client/resources.qrc @@ -217,6 +217,5 @@ ui/qml/Controls2/TopCloseButtonType.qml images/controls/x-circle.svg ui/qml/Controls2/Drawer2Type.qml - ui/qml/Components/HomeRootMenuButton.qml diff --git a/client/ui/qml/Components/HomeRootMenuButton.qml b/client/ui/qml/Components/HomeRootMenuButton.qml deleted file mode 100644 index b2ca98dc..00000000 --- a/client/ui/qml/Components/HomeRootMenuButton.qml +++ /dev/null @@ -1,140 +0,0 @@ -import QtQuick -import QtQuick.Controls -import QtQuick.Layouts - -import "../Controls2/TextTypes" -import "../Controls2" - -Item { - id: root - - property string text - property int textMaximumLineCount: 2 - property int textElide: Qt.ElideRight - - property string descriptionText - - property var clickedFunction - - property string rightImageSource - - property string textColor: "#d7d8db" - property string descriptionColor: "#878B91" - property real textOpacity: 1.0 - - property string rightImageColor: "#d7d8db" - - property bool descriptionOnTop: false - - property string defaultServerHostName - property string defaultContainerName - - implicitWidth: content.implicitWidth + content.anchors.topMargin + content.anchors.bottomMargin - implicitHeight: content.implicitHeight + content.anchors.leftMargin + content.anchors.rightMargin - - ColumnLayout { - id: content - - anchors.right: parent.right - anchors.left: parent.left - anchors.bottom: parent.bottom - - RowLayout { - Layout.topMargin: 24 - Layout.leftMargin: 24 - Layout.rightMargin: 24 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - Header1TextType { - Layout.maximumWidth: root.width - 48 - 18 - 12 // todo - - maximumLineCount: 2 - elide: Qt.ElideRight - - text: root.text - Layout.alignment: Qt.AlignLeft - } - - - ImageButtonType { - id: rightImage - - hoverEnabled: false - image: rightImageSource - imageColor: rightImageColor - visible: rightImageSource ? true : false - -// implicitSize: 18 -// backGroudRadius: 5 - horizontalPadding: 0 - padding: 0 - spacing: 0 - - - Rectangle { - id: rightImageBackground - anchors.fill: parent - radius: 16 - color: "transparent" - - Behavior on color { - PropertyAnimation { duration: 200 } - } - } - } - } - - LabelTextType { - Layout.bottomMargin: 44 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - text: { - var description = "" - if (ServersModel.isDefaultServerHasWriteAccess()) { - if (SettingsController.isAmneziaDnsEnabled() - && ContainersModel.isAmneziaDnsContainerInstalled(ServersModel.getDefaultServerIndex())) { - description += "Amnezia DNS | " - } - } else { - if (ServersModel.isDefaultServerConfigContainsAmneziaDns()) { - description += "Amnezia DNS | " - } - } - - description += root.defaultContainerName + " | " + root.defaultServerHostName - return description - } - } - } - - - MouseArea { - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - hoverEnabled: true - - onEntered: { - rightImageBackground.color = rightImage.hoveredColor - - root.textOpacity = 0.8 - } - - onExited: { - rightImageBackground.color = rightImage.defaultColor - - root.textOpacity = 1 - } - - onPressedChanged: { - rightImageBackground.color = pressed ? rightImage.pressedColor : entered ? rightImage.hoveredColor : rightImage.defaultColor - - root.textOpacity = 0.7 - } - - onClicked: { - if (clickedFunction && typeof clickedFunction === "function") { - clickedFunction() - } - } - } -} diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml index b34390ac..fc486744 100644 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -10,11 +10,18 @@ Item { target: PageController function onForceCloseDrawer() { - close() + if (root.opened()) { + close() + return + } + + if (root.expanded()) { + collapse() + } } } - signal closed + signal drawerClosed visible: false @@ -28,6 +35,13 @@ Item { property int contentHeight: 0 property Item contentParent: contentArea + property bool dragActive: dragArea.drag.active + + /** Initial height of button content */ + property int collapsedHeight: 0 + + property bool fullMouseAreaVisible: true + state: "closed" Rectangle { @@ -37,7 +51,7 @@ Item { height: parent.height width: parent.width radius: 16 - color: "#90000000" + color: "transparent" //"#90000000" border.color: "transparent" border.width: 1 visible: true @@ -45,90 +59,119 @@ Item { MouseArea { id: fullMouseArea anchors.fill: parent - enabled: (root.state === "opened") + enabled: (root.opened() || root.expanded()) hoverEnabled: true + visible: fullMouseAreaVisible onClicked: { - if (root.state === "opened") { + if (root.opened()) { close() return } + + if (root.expanded()) { + collapse() + } } + } + + Rectangle { + id: placeAreaHolder + height: (!root.opened()) ? 0 : parent.height - contentHeight + anchors.right: parent.right + anchors.left: parent.left + visible: true + color: "transparent" + + Drag.active: dragArea.drag.active + } + + + Rectangle { + id: contentArea + + anchors.top: placeAreaHolder.bottom + height: contentHeight + radius: 16 + color: root.defaultColor + border.width: 1 + border.color: root.borderColor + width: parent.width + visible: true Rectangle { - id: placeAreaHolder - height: parent.height - contentHeight + width: parent.radius + height: parent.radius + anchors.bottom: parent.bottom anchors.right: parent.right anchors.left: parent.left - visible: true - color: "transparent" - - Drag.active: dragArea.drag.active + color: parent.color } + MouseArea { + id: dragArea - Rectangle { - id: contentArea + anchors.fill: parent - anchors.top: placeAreaHolder.bottom - height: contentHeight - radius: 16 - color: root.defaultColor - border.width: 1 - border.color: root.borderColor - width: parent.width - visible: true + cursorShape: root.collapsed() ? Qt.PointingHandCursor : Qt.ArrowCursor // ? + hoverEnabled: true - Rectangle { - width: parent.radius - height: parent.radius - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.left: parent.left - color: parent.color - } + drag.target: placeAreaHolder + drag.axis: Drag.YAxis + drag.maximumY: (root.collapsed() || root.expanded()) ? (root.height - collapsedHeight) : root.height + drag.minimumY: (root.collapsed() || root.expanded()) ? (root.height - root.height * 0.9) : (root.height - root.height) - MouseArea { - id: dragArea - - anchors.fill: parent - - cursorShape: (root.state === "opened") ? Qt.PointingHandCursor : Qt.ArrowCursor - hoverEnabled: true - - drag.target: placeAreaHolder - drag.axis: Drag.YAxis - drag.maximumY: root.height - drag.minimumY: root.height - root.height - - /** If drag area is released at any point other than min or max y, transition to the other state */ - onReleased: { - if (root.state === "closed" && placeAreaHolder.y < root.height * 0.9) { - root.state = "opened" - return - } - - if (root.state === "opened" && placeAreaHolder.y > (root.height - root.height * 0.9)) { - close() - return - } - - placeAreaHolder.y = 0 + /** If drag area is released at any point other than min or max y, transition to the other state */ + onReleased: { + if (root.closed() && placeAreaHolder.y < root.height * 0.9) { + root.state = "opened" + return } - onClicked: { - if (root.state === "opened") { - close() - return - } + if (root.opened() && placeAreaHolder.y > (root.height - root.height * 0.9)) { + close() + return + } + + + if (root.collapsed() && placeAreaHolder.y < (root.height - collapsedHeight)) { + root.state = "expanded" + return + } + + if (root.expanded() && placeAreaHolder.y > (root.height - root.height * 0.9)) { + root.state = "collapsed" + return + } + + + if (root.opened()) { + placeAreaHolder.y = 0 + } + } + + onClicked: { + if (root.opened()) { + close() + return + } + + if (root.expanded()) { + collapse() + return + } + + if (root.collapsed()) { + root.state = "expanded" } } } } + } onStateChanged: { - if (root.state === "closed") { + if (root.closed() || root.collapsed()) { var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor() if (initialPageNavigationBarColor !== 0xFF1C1D21) { PageController.updateNavigationBarColor(initialPageNavigationBarColor) @@ -138,11 +181,12 @@ Item { PageController.drawerClose() } - closed() + drawerClosed() return } - if (root.state === "opened") { + + if (root.opened() || root.expanded()) { if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) { PageController.updateNavigationBarColor(0xFF1C1D21) } @@ -161,7 +205,7 @@ Item { name: "closed" PropertyChanges { target: placeAreaHolder - y: parent.height + y: root.height } }, @@ -171,6 +215,22 @@ Item { target: placeAreaHolder y: dragArea.drag.minimumY } + }, + + State { + name: "collapsed" + PropertyChanges { + target: placeAreaHolder + y: root.height - collapsedHeight + } + }, + + State { + name: "expanded" + PropertyChanges { + target: placeAreaHolder + y: root.height - root.height * 0.9 + } } ] @@ -199,6 +259,40 @@ Item { properties: "y" duration: 200 } + }, + + Transition { + from: "expanded" + to: "collapsed" + PropertyAnimation { + target: placeAreaHolder + properties: "y" + duration: 200 + } + + onRunningChanged: { + if (!running) { + draw2Background.color = "transparent" + fullMouseArea.visible = false + } + } + }, + + Transition { + from: "collapsed" + to: "expanded" + PropertyAnimation { + target: placeAreaHolder + properties: "y" + duration: 200 + } + + onRunningChanged: { + if (!running) { + draw2Background.color = "#90000000" + visibledMouseArea(true) + } + } } ] @@ -212,9 +306,11 @@ Item { } function open() { - if (root.visible && root.state !== "closed") { + //if (root.visible && !root.closed()) { + if (root.opened()) { return } + draw2Background.color = "#90000000" visibledMouseArea(true) @@ -240,21 +336,52 @@ Item { root.state = "closed" } - onVisibleChanged: { - // e.g cancel, ...... - if (!visible) { - if (root.state === "opened") { - if (needCloseButton) { - PageController.drawerClose() - } - } - - close() - } + function collapse() { + draw2Background.color = "transparent" + root.state = "collapsed" } + function visibledMouseArea(visbile) { fullMouseArea.visible = visbile dragArea.visible = visbile } + + function opened() { + return root.state === "opened" ? true : false + } + + function expanded() { + return root.state === "expanded" ? true : false + } + + function closed() { + return root.state === "closed" ? true : false + } + + function collapsed() { + return root.state === "collapsed" ? true : false + } + + + onVisibleChanged: { + // e.g cancel, ...... + if (!visible) { + if (root.opened()) { + if (needCloseButton) { + PageController.drawerClose() + } + + close() + } + + if (root.expanded()) { + if (needCloseButton) { + PageController.drawerClose() + } + + collapse() + } + } + } } diff --git a/client/ui/qml/Pages2/PageHome.qml b/client/ui/qml/Pages2/PageHome.qml index dafa3bdc..a3a3ed9d 100644 --- a/client/ui/qml/Pages2/PageHome.qml +++ b/client/ui/qml/Pages2/PageHome.qml @@ -30,13 +30,13 @@ PageType { target: PageController function onRestorePageHomeState(isContainerInstalled) { - menu.close() + buttonContent.collapse() if (isContainerInstalled) { containersDropDown.menuVisible = true } } function onForceCloseDrawer() { - menu.close() + buttonContent.collapse() } } @@ -69,7 +69,7 @@ PageType { } } - // collapsedServerMenuDescription.text = description + root.defaultContainerName + " | " + root.defaultServerHostName + collapsedServerMenuDescription.text = description + root.defaultContainerName + " | " + root.defaultServerHostName expandedServersMenuDescription.text = description + root.defaultServerHostName } @@ -79,7 +79,7 @@ PageType { Item { anchors.fill: parent - anchors.bottomMargin: defaultServerInfo.implicitHeight + anchors.bottomMargin: buttonContent.collapsedHeight ConnectButton { anchors.centerIn: parent @@ -88,7 +88,7 @@ PageType { Rectangle { id: buttonBackground - anchors.fill: defaultServerInfo + anchors { left: buttonContent.left; right: buttonContent.right; top: buttonContent.top } radius: 16 color: root.defaultColor @@ -105,41 +105,105 @@ PageType { } } - HomeRootMenuButton { - id: defaultServerInfo - anchors.right: parent.right - anchors.left: parent.left - anchors.bottom: parent.bottom - - text: root.defaultServerName - rightImageSource: "qrc:/images/controls/chevron-down.svg" - - defaultContainerName: root.defaultContainerName - defaultServerHostName: root.defaultServerHostName - - clickedFunction: function() { - menu.open() - } - } - Drawer2Type { - id: menu - parent: root + id: buttonContent + visible: true + + fullMouseAreaVisible: false + + /** True when expanded objects should be visible */ + property bool expandedVisibility: buttonContent.expanded() || (buttonContent.collapsed() && buttonContent.dragActive) + /** True when collapsed objects should be visible */ + property bool collapsedVisibility: buttonContent.collapsed() && !buttonContent.dragActive width: parent.width height: parent.height contentHeight: parent.height * 0.9 + ColumnLayout { + id: content + + parent: buttonContent.contentParent + + visible: buttonContent.collapsedVisibility + + anchors.right: parent.right + anchors.left: parent.left + anchors.top: parent.top + + onImplicitHeightChanged: { + if (buttonContent.collapsed() && buttonContent.collapsedHeight === 0) { + buttonContent.collapsedHeight = implicitHeight + } + } + + RowLayout { + Layout.topMargin: 24 + Layout.leftMargin: 24 + Layout.rightMargin: 24 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + + Header1TextType { + id: collapsedButtonHeader + Layout.maximumWidth: root.width - 48 - 18 - 12 // todo + + maximumLineCount: 2 + elide: Qt.ElideRight + + text: root.defaultServerName + + Layout.alignment: Qt.AlignLeft + } + + + ImageButtonType { + id: collapsedButtonChevron + + hoverEnabled: false + image: "qrc:/images/controls/chevron-down.svg" + imageColor: "#d7d8db" + + horizontalPadding: 0 + padding: 0 + spacing: 0 + + Rectangle { + id: rightImageBackground + anchors.fill: parent + radius: 16 + color: "transparent" + + Behavior on color { + PropertyAnimation { duration: 200 } + } + } + } + } + + LabelTextType { + id: collapsedServerMenuDescription + Layout.bottomMargin: 44 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + visible: buttonContent.collapsedVisibility + } + } + + Component.onCompleted: { + buttonContent.collapse() + } + ColumnLayout { id: serversMenuHeader - parent: menu.contentParent + parent: buttonContent.contentParent anchors.top: parent.top anchors.right: parent.right anchors.left: parent.left + visible: buttonContent.expandedVisibility + Header1TextType { Layout.fillWidth: true Layout.topMargin: 24 @@ -222,6 +286,7 @@ PageType { Layout.topMargin: 48 Layout.leftMargin: 16 Layout.rightMargin: 16 + visible: buttonContent.expandedVisibility headerText: qsTr("Servers") } @@ -230,7 +295,7 @@ PageType { Flickable { id: serversContainer - parent: menu.contentParent + parent: buttonContent.contentParent anchors.top: serversMenuHeader.bottom anchors.right: parent.right @@ -239,6 +304,8 @@ PageType { anchors.topMargin: 16 contentHeight: col.implicitHeight + visible: buttonContent.expandedVisibility + clip: true ScrollBar.vertical: ScrollBar { @@ -342,7 +409,7 @@ PageType { onClicked: function() { ServersModel.currentlyProcessedIndex = index PageController.goToPage(PageEnum.PageSettingsServerInfo) - menu.close() + buttonContent.collapse() } } } diff --git a/client/ui/qml/Pages2/PageStart.qml b/client/ui/qml/Pages2/PageStart.qml index 8afad392..4ccd40d8 100644 --- a/client/ui/qml/Pages2/PageStart.qml +++ b/client/ui/qml/Pages2/PageStart.qml @@ -247,7 +247,7 @@ PageType { z: 1 - onClosed: { + onDrawerClosed: { tabBar.setCurrentIndex(tabBar.previousIndex) } } From 6ec773079cef7fd8b39711801296f1120bdc0d06 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Thu, 19 Oct 2023 11:22:52 +0800 Subject: [PATCH 30/47] added hovering effect of button --- .../qml/Components/ShareConnectionDrawer.qml | 2 +- client/ui/qml/Controls2/Drawer2Type.qml | 32 +++++++++++++------ client/ui/qml/Pages2/PageHome.qml | 25 ++++++++++++++- 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/client/ui/qml/Components/ShareConnectionDrawer.qml b/client/ui/qml/Components/ShareConnectionDrawer.qml index ae0df0e2..03e7b500 100644 --- a/client/ui/qml/Components/ShareConnectionDrawer.qml +++ b/client/ui/qml/Components/ShareConnectionDrawer.qml @@ -31,7 +31,7 @@ Drawer2Type { height: parent.height contentHeight: parent.height * 0.9 - onClosed: { + onDrawerClosed: { configExtension = ".vpn" configCaption = qsTr("Save AmneziaVPN config") configFileName = "amnezia_config" diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml index fc486744..f10fac21 100644 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -22,6 +22,11 @@ Item { } signal drawerClosed + signal collapsedEntered + signal collapsedExited + signal collapsedEnter + signal collapsedPressChanged + visible: false @@ -41,6 +46,7 @@ Item { property int collapsedHeight: 0 property bool fullMouseAreaVisible: true + property MouseArea drawerDragArea: dragArea state: "closed" @@ -165,6 +171,18 @@ Item { root.state = "expanded" } } + + onExited: { + collapsedExited() + } + + onEntered: { + collapsedEnter() + } + + onPressedChanged: { + collapsedPressChanged() + } } } @@ -306,7 +324,6 @@ Item { } function open() { - //if (root.visible && !root.closed()) { if (root.opened()) { return } @@ -341,6 +358,11 @@ Item { root.state = "collapsed" } + function expand() { + draw2Background.color = "#90000000" + root.state = "expanded" + } + function visibledMouseArea(visbile) { fullMouseArea.visible = visbile @@ -374,14 +396,6 @@ Item { close() } - - if (root.expanded()) { - if (needCloseButton) { - PageController.drawerClose() - } - - collapse() - } } } } diff --git a/client/ui/qml/Pages2/PageHome.qml b/client/ui/qml/Pages2/PageHome.qml index a3a3ed9d..13148a80 100644 --- a/client/ui/qml/Pages2/PageHome.qml +++ b/client/ui/qml/Pages2/PageHome.qml @@ -122,7 +122,7 @@ PageType { ColumnLayout { - id: content + id: collapsedButtonContent parent: buttonContent.contentParent @@ -178,6 +178,12 @@ PageType { PropertyAnimation { duration: 200 } } } + + onClicked: { + if (buttonContent.collapsed()) { + buttonContent.expand() + } + } } } @@ -424,5 +430,22 @@ PageType { } } } + + onCollapsedEnter: { + collapsedButtonChevron.backgroundColor = collapsedButtonChevron.hoveredColor + collapsedButtonHeader.opacity = 0.8 + } + + onCollapsedExited: { + collapsedButtonChevron.backgroundColor = collapsedButtonChevron.defaultColor + collapsedButtonHeader.opacity = 1 + } + + onCollapsedPressChanged: { + collapsedButtonChevron.backgroundColor = buttonContent.drawerDragArea.pressed ? + collapsedButtonChevron.pressedColor : buttonContent.drawerDragArea.entered ? + collapsedButtonChevron.hoveredColor : collapsedButtonChevron.defaultColor + collapsedButtonHeader.opacity = 0.7 + } } } From f7bed04ab217baad98a72854c57578592718a812 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Thu, 19 Oct 2023 19:32:15 +0800 Subject: [PATCH 31/47] removed invalid function code --- client/ui/qml/Controls2/Drawer2Type.qml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml index f10fac21..fd6406ee 100644 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -34,6 +34,7 @@ Item { property string defaultColor: "#1C1D21" property string borderColor: "#2C2D30" + property string semitransparentColor: "#90000000" property bool needCollapsed: false @@ -57,7 +58,7 @@ Item { height: parent.height width: parent.width radius: 16 - color: "transparent" //"#90000000" + color: "transparent" border.color: "transparent" border.width: 1 visible: true @@ -264,7 +265,7 @@ Item { onRunningChanged: { if (!running) { - visibledMouseArea(false) + fullMouseArea.visible = false } } }, @@ -307,8 +308,8 @@ Item { onRunningChanged: { if (!running) { - draw2Background.color = "#90000000" - visibledMouseArea(true) + draw2Background.color = semitransparentColor + fullMouseArea.visible = true } } } @@ -328,9 +329,8 @@ Item { return } - draw2Background.color = "#90000000" - - visibledMouseArea(true) + draw2Background.color = semitransparentColor + fullMouseArea.visible = true root.y = 0 root.state = "opened" @@ -359,16 +359,10 @@ Item { } function expand() { - draw2Background.color = "#90000000" + draw2Background.color = semitransparentColor root.state = "expanded" } - - function visibledMouseArea(visbile) { - fullMouseArea.visible = visbile - dragArea.visible = visbile - } - function opened() { return root.state === "opened" ? true : false } From a6949bd3aefeb3e90852d85be5a5028d0aff4b50 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Thu, 19 Oct 2023 19:45:22 +0800 Subject: [PATCH 32/47] resized questiondrawer of page serverdata --- client/ui/qml/Pages2/PageSettingsServerData.qml | 6 ++++-- client/ui/qml/Pages2/PageSettingsServerInfo.qml | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/ui/qml/Pages2/PageSettingsServerData.qml b/client/ui/qml/Pages2/PageSettingsServerData.qml index 2e401c67..09066ccb 100644 --- a/client/ui/qml/Pages2/PageSettingsServerData.qml +++ b/client/ui/qml/Pages2/PageSettingsServerData.qml @@ -14,6 +14,8 @@ import "../Components" PageType { id: root + property Item questionDrawerParent + Connections { target: InstallController @@ -193,9 +195,9 @@ PageType { QuestionDrawer { id: questionDrawer - drawerHeight: 0.8 + drawerHeight: 0.5 - parent: root + parent: questionDrawerParent } } } diff --git a/client/ui/qml/Pages2/PageSettingsServerInfo.qml b/client/ui/qml/Pages2/PageSettingsServerInfo.qml index f6d569dd..e14c6ab5 100644 --- a/client/ui/qml/Pages2/PageSettingsServerInfo.qml +++ b/client/ui/qml/Pages2/PageSettingsServerInfo.qml @@ -169,6 +169,7 @@ PageType { } PageSettingsServerData { stackView: root.stackView + questionDrawerParent: root } } } From 6c78b4ec8f8bad64ee2f936096dd421c47192af6 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Thu, 19 Oct 2023 23:01:03 +0800 Subject: [PATCH 33/47] enabled drag-pagehome-drawer in tabBar --- client/ui/qml/Pages2/PageStart.qml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/ui/qml/Pages2/PageStart.qml b/client/ui/qml/Pages2/PageStart.qml index 4ccd40d8..12c83e06 100644 --- a/client/ui/qml/Pages2/PageStart.qml +++ b/client/ui/qml/Pages2/PageStart.qml @@ -176,6 +176,12 @@ PageType { strokeColor: "#2C2D30" fillColor: "#1C1D21" } + + MouseArea { + id: noPropagateMouseEvent + anchors.fill: parent + enabled: true + } } TabImageButtonType { From 2da1025f2695c8a8ba2b1f0d82bdcacd0437b473 Mon Sep 17 00:00:00 2001 From: pokamest Date: Fri, 20 Oct 2023 02:25:40 +0100 Subject: [PATCH 34/47] Random port on install --- client/protocols/protocols_defs.cpp | 25 +++++++++--- client/protocols/protocols_defs.h | 2 + client/ui/controllers/installController.cpp | 40 ++++++++++--------- .../PageSetupWizardProtocolSettings.qml | 2 +- 4 files changed, 44 insertions(+), 25 deletions(-) diff --git a/client/protocols/protocols_defs.cpp b/client/protocols/protocols_defs.cpp index b3823a11..a451014c 100644 --- a/client/protocols/protocols_defs.cpp +++ b/client/protocols/protocols_defs.cpp @@ -1,5 +1,7 @@ #include "protocols_defs.h" +#include + using namespace amnezia; QDebug operator<<(QDebug debug, const amnezia::ProtocolEnumNS::Proto &p) @@ -98,15 +100,28 @@ amnezia::ServiceType ProtocolProps::protocolService(Proto p) } } +int ProtocolProps::getPortForInstall(Proto p) +{ + switch (p) { + case Awg: + case WireGuard: + case ShadowSocks: + case OpenVpn: + return QRandomGenerator::global()->bounded(30000, 50000); + default: + return defaultPort(p); + } +} + int ProtocolProps::defaultPort(Proto p) { switch (p) { case Proto::Any: return -1; - case Proto::OpenVpn: return 1194; - case Proto::Cloak: return 443; - case Proto::ShadowSocks: return 6789; - case Proto::WireGuard: return 51820; - case Proto::Awg: return 55424; + case Proto::OpenVpn: return QString(protocols::openvpn::defaultPort).toInt(); + case Proto::Cloak: return QString(protocols::cloak::defaultPort).toInt(); + case Proto::ShadowSocks: return QString(protocols::shadowsocks::defaultPort).toInt(); + case Proto::WireGuard: return QString(protocols::wireguard::defaultPort).toInt(); + case Proto::Awg: return QString(protocols::awg::defaultPort).toInt(); case Proto::Ikev2: return -1; case Proto::L2tp: return -1; diff --git a/client/protocols/protocols_defs.h b/client/protocols/protocols_defs.h index ed2ed313..ab9cac1b 100644 --- a/client/protocols/protocols_defs.h +++ b/client/protocols/protocols_defs.h @@ -228,6 +228,8 @@ namespace amnezia Q_INVOKABLE static ServiceType protocolService(Proto p); + Q_INVOKABLE static int getPortForInstall(Proto p); + Q_INVOKABLE static int defaultPort(Proto p); Q_INVOKABLE static bool defaultPortChangeable(Proto p); diff --git a/client/ui/controllers/installController.cpp b/client/ui/controllers/installController.cpp index 8efe368b..8853f108 100644 --- a/client/ui/controllers/installController.cpp +++ b/client/ui/controllers/installController.cpp @@ -75,33 +75,35 @@ void InstallController::install(DockerContainer container, int port, TransportPr ProtocolProps::transportProtoToString(transportProto, protocol)); if (container == DockerContainer::Awg) { - QString defaultJunkPacketCount = QString::number(QRandomGenerator::global()->bounded(3, 10)); - QString defaultJunkPacketMinSize = QString::number(50); - QString defaultJunkPacketMaxSize = QString::number(1000); - QString defaultInitPacketJunkSize = QString::number(QRandomGenerator::global()->bounded(15, 150)); - QString defaultResponsePacketJunkSize = QString::number(QRandomGenerator::global()->bounded(15, 150)); + QString junkPacketCount = QString::number(QRandomGenerator::global()->bounded(3, 10)); + QString junkPacketMinSize = QString::number(50); + QString junkPacketMaxSize = QString::number(1000); + QString initPacketJunkSize = QString::number(QRandomGenerator::global()->bounded(15, 150)); + QString responsePacketJunkSize = QString::number(QRandomGenerator::global()->bounded(15, 150)); QSet headersValue; while (headersValue.size() != 4) { - headersValue.insert(QString::number(QRandomGenerator::global()->bounded(1, std::numeric_limits::max()))); + + auto max = (std::numeric_limits::max)(); + headersValue.insert(QString::number(QRandomGenerator::global()->bounded(1, max))); } auto headersValueList = headersValue.values(); - QString defaultInitPacketMagicHeader = headersValueList.at(0); - QString defaultResponsePacketMagicHeader = headersValueList.at(1); - QString defaultUnderloadPacketMagicHeader = headersValueList.at(2); - QString defaultTransportPacketMagicHeader = headersValueList.at(3); + QString initPacketMagicHeader = headersValueList.at(0); + QString responsePacketMagicHeader = headersValueList.at(1); + QString underloadPacketMagicHeader = headersValueList.at(2); + QString transportPacketMagicHeader = headersValueList.at(3); - containerConfig[config_key::junkPacketCount] = defaultJunkPacketCount; - containerConfig[config_key::junkPacketMinSize] = defaultJunkPacketMinSize; - containerConfig[config_key::junkPacketMaxSize] = defaultJunkPacketMaxSize; - containerConfig[config_key::initPacketJunkSize] = defaultInitPacketJunkSize; - containerConfig[config_key::responsePacketJunkSize] = defaultResponsePacketJunkSize; - containerConfig[config_key::initPacketMagicHeader] = defaultInitPacketMagicHeader; - containerConfig[config_key::responsePacketMagicHeader] = defaultResponsePacketMagicHeader; - containerConfig[config_key::underloadPacketMagicHeader] = defaultUnderloadPacketMagicHeader; - containerConfig[config_key::transportPacketMagicHeader] = defaultTransportPacketMagicHeader; + containerConfig[config_key::junkPacketCount] = junkPacketCount; + containerConfig[config_key::junkPacketMinSize] = junkPacketMinSize; + containerConfig[config_key::junkPacketMaxSize] = junkPacketMaxSize; + containerConfig[config_key::initPacketJunkSize] = initPacketJunkSize; + containerConfig[config_key::responsePacketJunkSize] = responsePacketJunkSize; + containerConfig[config_key::initPacketMagicHeader] = initPacketMagicHeader; + containerConfig[config_key::responsePacketMagicHeader] = responsePacketMagicHeader; + containerConfig[config_key::underloadPacketMagicHeader] = underloadPacketMagicHeader; + containerConfig[config_key::transportPacketMagicHeader] = transportPacketMagicHeader; } if (container == DockerContainer::Sftp) { diff --git a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml index 2b97f044..7698c755 100644 --- a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml +++ b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml @@ -224,7 +224,7 @@ PageType { if (ProtocolProps.defaultPort(defaultContainerProto) < 0) { port.visible = false } else { - port.textFieldText = ProtocolProps.defaultPort(defaultContainerProto) + port.textFieldText = ProtocolProps.getPortForInstall(defaultContainerProto) } transportProtoSelector.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto) From 0a15f44193fb7be45dd57e3a19babfb295175a95 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Fri, 20 Oct 2023 10:38:12 +0800 Subject: [PATCH 35/47] removed states 'opened', 'closed' --- client/ui/qml/Controls2/Drawer2Type.qml | 131 +++++------------------- 1 file changed, 25 insertions(+), 106 deletions(-) diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml index fd6406ee..fa393982 100644 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ b/client/ui/qml/Controls2/Drawer2Type.qml @@ -10,11 +10,6 @@ Item { target: PageController function onForceCloseDrawer() { - if (root.opened()) { - close() - return - } - if (root.expanded()) { collapse() } @@ -43,13 +38,12 @@ Item { property bool dragActive: dragArea.drag.active - /** Initial height of button content */ property int collapsedHeight: 0 property bool fullMouseAreaVisible: true property MouseArea drawerDragArea: dragArea - state: "closed" + state: "collapsed" Rectangle { id: draw2Background @@ -66,16 +60,11 @@ Item { MouseArea { id: fullMouseArea anchors.fill: parent - enabled: (root.opened() || root.expanded()) + enabled: root.expanded() hoverEnabled: true visible: fullMouseAreaVisible onClicked: { - if (root.opened()) { - close() - return - } - if (root.expanded()) { collapse() } @@ -84,7 +73,10 @@ Item { Rectangle { id: placeAreaHolder - height: (!root.opened()) ? 0 : parent.height - contentHeight + + // for apdating home drawer, normal drawer will reset it + height: 0 + anchors.right: parent.right anchors.left: parent.left visible: true @@ -120,49 +112,27 @@ Item { anchors.fill: parent - cursorShape: root.collapsed() ? Qt.PointingHandCursor : Qt.ArrowCursor // ? + cursorShape: root.collapsed() ? Qt.PointingHandCursor : Qt.ArrowCursor hoverEnabled: true drag.target: placeAreaHolder drag.axis: Drag.YAxis - drag.maximumY: (root.collapsed() || root.expanded()) ? (root.height - collapsedHeight) : root.height - drag.minimumY: (root.collapsed() || root.expanded()) ? (root.height - root.height * 0.9) : (root.height - root.height) + drag.maximumY: root.height - root.collapsedHeight + drag.minimumY: root.collapsedHeight > 0 ? root.height - root.height * 0.9 : 0 /** If drag area is released at any point other than min or max y, transition to the other state */ onReleased: { - if (root.closed() && placeAreaHolder.y < root.height * 0.9) { - root.state = "opened" - return - } - - if (root.opened() && placeAreaHolder.y > (root.height - root.height * 0.9)) { - close() - return - } - - - if (root.collapsed() && placeAreaHolder.y < (root.height - collapsedHeight)) { + if (root.collapsed() && placeAreaHolder.y < drag.maximumY) { root.state = "expanded" return } - - if (root.expanded() && placeAreaHolder.y > (root.height - root.height * 0.9)) { + if (root.expanded() && placeAreaHolder.y > drag.minimumY) { root.state = "collapsed" return } - - - if (root.opened()) { - placeAreaHolder.y = 0 - } } onClicked: { - if (root.opened()) { - close() - return - } - if (root.expanded()) { collapse() return @@ -186,11 +156,10 @@ Item { } } } - } onStateChanged: { - if (root.closed() || root.collapsed()) { + if (root.collapsed()) { var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor() if (initialPageNavigationBarColor !== 0xFF1C1D21) { PageController.updateNavigationBarColor(initialPageNavigationBarColor) @@ -205,7 +174,7 @@ Item { return } - if (root.opened() || root.expanded()) { + if (root.expanded()) { if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) { PageController.updateNavigationBarColor(0xFF1C1D21) } @@ -220,27 +189,11 @@ Item { /** Two states of buttonContent, great place to add any future animations for the drawer */ states: [ - State { - name: "closed" - PropertyChanges { - target: placeAreaHolder - y: root.height - } - }, - - State { - name: "opened" - PropertyChanges { - target: placeAreaHolder - y: dragArea.drag.minimumY - } - }, - State { name: "collapsed" PropertyChanges { target: placeAreaHolder - y: root.height - collapsedHeight + y: dragArea.drag.maximumY } }, @@ -248,38 +201,12 @@ Item { name: "expanded" PropertyChanges { target: placeAreaHolder - y: root.height - root.height * 0.9 + y: dragArea.drag.minimumY } } ] transitions: [ - Transition { - from: "opened" - to: "closed" - PropertyAnimation { - target: placeAreaHolder - properties: "y" - duration: 200 - } - - onRunningChanged: { - if (!running) { - fullMouseArea.visible = false - } - } - }, - - Transition { - from: "closed" - to: "opened" - PropertyAnimation { - target: placeAreaHolder - properties: "y" - duration: 200 - } - }, - Transition { from: "expanded" to: "collapsed" @@ -324,33 +251,32 @@ Item { duration: 200 } + // for normal drawer function open() { - if (root.opened()) { + if (root.expanded()) { return } draw2Background.color = semitransparentColor fullMouseArea.visible = true + collapsedHeight = 0 + root.y = 0 - root.state = "opened" + root.state = "expanded" root.visible = true root.height = parent.height contentArea.height = contentHeight - placeAreaHolder.height = root.height - contentHeight - placeAreaHolder.y = root.height - root.height - - dragArea.drag.maximumY = root.height - dragArea.drag.minimumY = 0 + placeAreaHolder.y = 0 + placeAreaHolder.height = root.height - contentHeight animationVisible.running = true } function close() { - draw2Background.color = "transparent" - root.state = "closed" + collapse() } function collapse() { @@ -358,23 +284,16 @@ Item { root.state = "collapsed" } + // for page home function expand() { draw2Background.color = semitransparentColor root.state = "expanded" } - function opened() { - return root.state === "opened" ? true : false - } - function expanded() { return root.state === "expanded" ? true : false } - function closed() { - return root.state === "closed" ? true : false - } - function collapsed() { return root.state === "collapsed" ? true : false } @@ -383,7 +302,7 @@ Item { onVisibleChanged: { // e.g cancel, ...... if (!visible) { - if (root.opened()) { + if (root.expanded()) { if (needCloseButton) { PageController.drawerClose() } From 58ad7dc16135a8cbe3fcb1ef55a1406dbdd191dc Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Fri, 20 Oct 2023 14:10:04 +0500 Subject: [PATCH 36/47] removed the "remove protocol" buttons from where they shouldn't be --- client/ui/qml/Controls2/SwitcherType.qml | 11 ++++------- client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml | 5 +++++ client/ui/qml/Pages2/PageProtocolRaw.qml | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/client/ui/qml/Controls2/SwitcherType.qml b/client/ui/qml/Controls2/SwitcherType.qml index ee7372f5..1dbd0e84 100644 --- a/client/ui/qml/Controls2/SwitcherType.qml +++ b/client/ui/qml/Controls2/SwitcherType.qml @@ -30,17 +30,13 @@ Switch { property string hoveredIndicatorBackgroundColor: Qt.rgba(1, 1, 1, 0.08) property string defaultIndicatorBackgroundColor: "transparent" - implicitWidth: content.implicitWidth + switcher.implicitWidth - implicitHeight: content.implicitHeight - hoverEnabled: enabled ? true : false indicator: Rectangle { id: switcher - anchors.left: content.right + anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin: 4 implicitWidth: 52 implicitHeight: 32 @@ -90,11 +86,11 @@ Switch { contentItem: ColumnLayout { id: content - anchors.fill: parent - anchors.rightMargin: switcher.implicitWidth + anchors.verticalCenter: parent.verticalCenter ListItemTitleType { Layout.fillWidth: true + rightPadding: indicator.width text: root.text color: root.enabled ? root.textColor : root.textDisabledColor @@ -104,6 +100,7 @@ Switch { id: description Layout.fillWidth: true + rightPadding: indicator.width color: root.enabled ? root.descriptionTextColor : root.descriptionTextDisabledColor diff --git a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml index c8469dcb..cd2dd51d 100644 --- a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml @@ -5,6 +5,7 @@ import QtQuick.Layouts import SortFilterProxyModel 0.2 import PageEnum 1.0 +import ContainerEnum 1.0 import "./" import "../Controls2" @@ -252,6 +253,8 @@ PageType { ColumnLayout { id: checkboxLayout + + anchors.fill: parent CheckBoxType { Layout.fillWidth: true @@ -351,6 +354,8 @@ PageType { Layout.leftMargin: -8 implicitHeight: 32 + visible: ContainersModel.getCurrentlyProcessedContainerIndex() === ContainerEnum.OpenVpn + defaultColor: "transparent" hoveredColor: Qt.rgba(1, 1, 1, 0.08) pressedColor: Qt.rgba(1, 1, 1, 0.12) diff --git a/client/ui/qml/Pages2/PageProtocolRaw.qml b/client/ui/qml/Pages2/PageProtocolRaw.qml index f0959143..f3621d96 100644 --- a/client/ui/qml/Pages2/PageProtocolRaw.qml +++ b/client/ui/qml/Pages2/PageProtocolRaw.qml @@ -169,6 +169,8 @@ PageType { width: parent.width + visible: ServersModel.isCurrentlyProcessedServerHasWriteAccess() + text: qsTr("Remove ") + ContainersModel.getCurrentlyProcessedContainerName() textColor: "#EB5757" From da1cdfd6faef78dfbc566c79961b00de0cebbbd2 Mon Sep 17 00:00:00 2001 From: ronoaer Date: Fri, 20 Oct 2023 18:01:57 +0800 Subject: [PATCH 37/47] translated new source strings to chinese --- client/translations/amneziavpn_zh_CN.ts | 40 ++++++++++--------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 64faa6f4..76a4feac 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -131,7 +131,7 @@ Unable change protocol while there is an active connection - Невозможно изменить протокол при наличии активного соединения + 已建立连接时无法更改服务器配置 @@ -162,47 +162,47 @@ 已安装在服务器上 - - + + %1 installed successfully. %1 安装成功。 - - + + %1 is already installed on the server. 服务器上已经安装 %1。 - + Added containers that were already installed on the server 添加已安装在服务器上的容器 - + Already installed containers were found on the server. All installed containers have been added to the application 在服务上发现已经安装协议并添加至应用 - + Settings updated successfully 配置更新成功 - + Server '%1' was removed 已移除服务器 '%1' - + All containers from server '%1' have been removed 服务器 '%1' 的所有容器已移除 - + %1 has been removed from the server '%2' %1 已从服务器 '%2' 上移除 @@ -223,12 +223,12 @@ Already installed containers were found on the server. All installed containers 协议已从 - + Please login as the user 请以用户身份登录 - + Server added successfully 增加服务器成功 @@ -308,7 +308,7 @@ Already installed containers were found on the server. All installed containers Unable change server while there is an active connection - Невозможно изменить сервер при наличии активного соединения + 已建立连接时无法更改服务器配置 @@ -2335,7 +2335,7 @@ and will not be shared or disclosed to the Amnezia or any third parties QObject - + Sftp service Sftp 服务 @@ -2839,16 +2839,6 @@ While it offers a blend of security, stability, and speed, it's essential t error 0x%1: %2 错误 0x%1: %2 - - - WireGuard Configuration Highlighter - - - - - &Randomize colors - - SelectLanguageDrawer From 3d60ac751eefa101bbeb8ae5fcf3bb1cd57a969f Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Fri, 20 Oct 2023 20:52:14 +0500 Subject: [PATCH 38/47] removed the default protocol/server change if connected to VPN --- client/translations/amneziavpn_ru.ts | 130 +++++++++--------- client/translations/amneziavpn_zh_CN.ts | 130 +++++++++--------- client/ui/controllers/importController.cpp | 2 - client/ui/controllers/installController.cpp | 5 - client/ui/models/containers_model.cpp | 9 +- client/ui/models/containers_model.h | 1 + .../qml/Pages2/PageSetupWizardInstalling.qml | 8 ++ .../qml/Pages2/PageSetupWizardViewConfig.qml | 4 + 8 files changed, 151 insertions(+), 138 deletions(-) diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index 733c374d..8c72f093 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -135,7 +135,7 @@ ImportController - + Scanned %1 of %2. Отсканировано %1 из%2. @@ -144,13 +144,13 @@ InstallController - + %1 installed successfully. %1 успешно установлен. - + %1 is already installed on the server. %1 уже установлен на сервер. @@ -162,39 +162,39 @@ Added containers that were already installed on the server В приложение добавлены обнаруженные на сервере протоклы и сервисы - + Already installed containers were found on the server. All installed containers have been added to the application На сервере обнаружены установленные протоколы и сервисы, все они добавлены в приложение - + Settings updated successfully Настройки успешно обновлены - + Server '%1' was removed Сервер '%1' был удален - + All containers from server '%1' have been removed Все протоклы и сервисы были удалены с сервера '%1' - + %1 has been removed from the server '%2' %1 был удален с сервера '%2' - + Please login as the user Пожалуйста, войдите в систему от имени пользователя - + Server added successfully Сервер успешно добавлен @@ -397,195 +397,195 @@ Already installed containers were found on the server. All installed containers PageProtocolOpenVpnSettings - + OpenVPN settings Настройки OpenVPN - + VPN Addresses Subnet VPN Адреса Подсеть - + Network protocol Сетевой протокол - + Port Порт - + Auto-negotiate encryption Шифрование с автоматическим согласованием - + Hash Хэш - + SHA512 SHA512 - + SHA384 SHA384 - + SHA256 SHA256 - + SHA3-512 SHA3-512 - + SHA3-384 SHA3-384 - + SHA3-256 SHA3-256 - + whirlpool whirlpool - + BLAKE2b512 BLAKE2b512 - + BLAKE2s256 BLAKE2s256 - + SHA1 SHA1 - + Cipher Шифрование - + AES-256-GCM AES-256-GCM - + AES-192-GCM AES-192-GCM - + AES-128-GCM AES-128-GCM - + AES-256-CBC AES-256-CBC - + AES-192-CBC AES-192-CBC - + AES-128-CBC AES-128-CBC - + ChaCha20-Poly1305 ChaCha20-Poly1305 - + ARIA-256-CBC ARIA-256-CBC - + CAMELLIA-256-CBC CAMELLIA-256-CBC - + none none - + TLS auth TLS авторизация - + Block DNS requests outside of VPN Блокировать DNS запросы за пределами VPN - + Additional client configuration commands Дополнительные команды конфигурации клиента - - + + Commands: Commands: - + Additional server configuration commands Дополнительные команды конфигурации сервера - + Remove OpenVPN Удалить OpenVPN - + Remove OpenVpn from server? Удалить OpenVpn с сервера? - + All users who you shared a connection with will no longer be able to connect to it. Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. - + Continue Продолжить - + Cancel Отменить - + Save and Restart Amnezia Сохранить и перезагрузить @@ -608,27 +608,27 @@ Already installed containers were found on the server. All installed containers Параметры подключения %1 - + Remove Удалить - + Remove %1 from server? Удалить %1 с сервера? - + All users who you shared a connection with will no longer be able to connect to it. Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. - + Continue Продолжить - + Cancel Отменить @@ -1694,7 +1694,7 @@ and will not be shared or disclosed to the Amnezia or any third parties PageSetupWizardInstalling - + The server has already been added to the application Сервер уже был добавлен в приложение @@ -1707,28 +1707,28 @@ and will not be shared or disclosed to the Amnezia or any third parties занят установкой других протоколов или сервисов. Установка Amnesia - + Amnezia has detected that your server is currently Amnezia обнаружила, что ваш сервер в настоящее время - + busy installing other software. Amnezia installation занят установкой другого программного обеспечения. Установка Amnezia - + will pause until the server finishes installing other software будет приостановлена до тех пор, пока сервер не завершит установку - + Installing Установка - + Usually it takes no more than 5 minutes Обычно это занимает не более 5 минут @@ -1846,27 +1846,27 @@ and will not be shared or disclosed to the Amnezia or any third parties PageSetupWizardViewConfig - + New connection Новое соединение - + Do not use connection code from public sources. It could be created to intercept your data. Не используйте код подключения из публичных источников. Его могли создать, чтобы перехватывать ваши данные. - + Collapse content Свернуть - + Show content Показать содержимое ключа - + Connect Подключиться diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 64faa6f4..10064ce2 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -146,7 +146,7 @@ ImportController - + Scanned %1 of %2. 扫描 %1 of %2. @@ -163,13 +163,13 @@ - + %1 installed successfully. %1 安装成功。 - + %1 is already installed on the server. 服务器上已经安装 %1。 @@ -180,29 +180,29 @@ Added containers that were already installed on the server 添加已安装在服务器上的容器 - + Already installed containers were found on the server. All installed containers have been added to the application 在服务上发现已经安装协议并添加至应用 - + Settings updated successfully 配置更新成功 - + Server '%1' was removed 已移除服务器 '%1' - + All containers from server '%1' have been removed 服务器 '%1' 的所有容器已移除 - + %1 has been removed from the server '%2' %1 已从服务器 '%2' 上移除 @@ -223,12 +223,12 @@ Already installed containers were found on the server. All installed containers 协议已从 - + Please login as the user 请以用户身份登录 - + Server added successfully 增加服务器成功 @@ -431,180 +431,180 @@ Already installed containers were found on the server. All installed containers PageProtocolOpenVpnSettings - + OpenVPN settings OpenVPN 配置 - + VPN Addresses Subnet VPN子网掩码 - + Network protocol 网络协议 - + Port 端口 - + Auto-negotiate encryption 自定义加密方式 - + Hash - + SHA512 - + SHA384 - + SHA256 - + SHA3-512 - + SHA3-384 - + SHA3-256 - + whirlpool - + BLAKE2b512 - + BLAKE2s256 - + SHA1 - + Cipher - + AES-256-GCM - + AES-192-GCM - + AES-128-GCM - + AES-256-CBC - + AES-192-CBC - + AES-128-CBC - + ChaCha20-Poly1305 - + ARIA-256-CBC - + CAMELLIA-256-CBC - + none - + TLS auth TLS认证 - + Block DNS requests outside of VPN 阻止VPN外的DNS请求 - + Additional client configuration commands 附加客户端配置命令 - - + + Commands: 命令: - + Additional server configuration commands 附加服务器端配置命令 - + Remove OpenVPN 移除OpenVPN - + Remove OpenVpn from server? 从服务器移除OpenVPN吗? - + All users who you shared a connection with will no longer be able to connect to it. 使用此共享连接的所有用户,将无法再连接它。 @@ -613,17 +613,17 @@ Already installed containers were found on the server. All installed containers 与您共享连接的所有用户将无法再连接到此链接 - + Continue 继续 - + Cancel 取消 - + Save and Restart Amnezia 保存并重启Amnezia @@ -650,17 +650,17 @@ Already installed containers were found on the server. All installed containers %1 连接选项 - + Remove 移除 - + Remove %1 from server? 从服务器移除 %1 ? - + All users who you shared a connection with will no longer be able to connect to it. 使用此共享连接的所有用户,将无法再连接它。 @@ -673,12 +673,12 @@ Already installed containers were found on the server. All installed containers 与您共享连接的所有用户将无法再连接到此链接 - + Continue 继续 - + Cancel 取消 @@ -1801,22 +1801,22 @@ and will not be shared or disclosed to the Amnezia or any third parties PageSetupWizardInstalling - + Usually it takes no more than 5 minutes 通常不超过5分钟 - + The server has already been added to the application 服务器已添加到应用软件中 - + Amnezia has detected that your server is currently Amnezia 检测到您的服务器当前 - + busy installing other software. Amnezia installation 正安装其他软件。Amnezia安装 @@ -1829,12 +1829,12 @@ and will not be shared or disclosed to the Amnezia or any third parties 正安装其他软件。Amnezia安装 - + will pause until the server finishes installing other software 将暂停,直到其他软件安装完成。 - + Installing 安装中 @@ -1952,27 +1952,27 @@ and will not be shared or disclosed to the Amnezia or any third parties PageSetupWizardViewConfig - + New connection 新连接 - + Do not use connection code from public sources. It could be created to intercept your data. 请勿使用公共来源的连接码。它可以被创建来拦截您的数据。 - + Collapse content 折叠内容 - + Show content 显示内容 - + Connect 连接 diff --git a/client/ui/controllers/importController.cpp b/client/ui/controllers/importController.cpp index 08b662ec..bd924087 100644 --- a/client/ui/controllers/importController.cpp +++ b/client/ui/controllers/importController.cpp @@ -144,8 +144,6 @@ void ImportController::importConfig() if (credentials.isValid() || m_config.contains(config_key::containers)) { m_serversModel->addServer(m_config); - m_serversModel->setDefaultServerIndex(m_serversModel->getServersCount() - 1); - emit importFinished(); } else { qDebug() << "Failed to import profile"; diff --git a/client/ui/controllers/installController.cpp b/client/ui/controllers/installController.cpp index 8efe368b..2aa4e81b 100644 --- a/client/ui/controllers/installController.cpp +++ b/client/ui/controllers/installController.cpp @@ -163,7 +163,6 @@ void InstallController::installServer(DockerContainer container, QJsonObject &co server.insert(config_key::defaultContainer, ContainerProps::containerToString(container)); m_serversModel->addServer(server); - m_serversModel->setDefaultServerIndex(m_serversModel->getServersCount() - 1); emit installServerFinished(finishMessage); return; @@ -214,9 +213,6 @@ void InstallController::installContainer(DockerContainer container, QJsonObject "All installed containers have been added to the application"); } - if (ContainerProps::containerService(container) == ServiceType::Vpn) { - m_containersModel->setData(m_containersModel->index(container), true, ContainersModel::Roles::IsDefaultRole); - } emit installContainerFinished(finishMessage, ContainerProps::containerService(container) == ServiceType::Other); return; } @@ -509,7 +505,6 @@ void InstallController::addEmptyServer() server.insert(config_key::defaultContainer, ContainerProps::containerToString(DockerContainer::None)); m_serversModel->addServer(server); - m_serversModel->setDefaultServerIndex(m_serversModel->getServersCount() - 1); emit installServerFinished(tr("Server added successfully")); } diff --git a/client/ui/models/containers_model.cpp b/client/ui/models/containers_model.cpp index 0c99041e..780809c5 100644 --- a/client/ui/models/containers_model.cpp +++ b/client/ui/models/containers_model.cpp @@ -41,7 +41,7 @@ bool ContainersModel::setData(const QModelIndex &index, const QVariant &value, i // return container; case IsInstalledRole: // return m_settings->containers(m_currentlyProcessedServerIndex).contains(container); - case IsDefaultRole: { + case IsDefaultRole: { //todo remove m_settings->setDefaultContainer(m_currentlyProcessedServerIndex, container); m_defaultContainerIndex = container; emit defaultContainerChanged(); @@ -117,6 +117,13 @@ QString ContainersModel::getDefaultContainerName() return ContainerProps::containerHumanNames().value(m_defaultContainerIndex); } +void ContainersModel::setDefaultContainer(DockerContainer container) +{ + m_settings->setDefaultContainer(m_currentlyProcessedServerIndex, container); + m_defaultContainerIndex = container; + emit defaultContainerChanged(); +} + int ContainersModel::getCurrentlyProcessedContainerIndex() { return m_currentlyProcessedContainerIndex; diff --git a/client/ui/models/containers_model.h b/client/ui/models/containers_model.h index cc549bb3..4ba85749 100644 --- a/client/ui/models/containers_model.h +++ b/client/ui/models/containers_model.h @@ -46,6 +46,7 @@ public: public slots: DockerContainer getDefaultContainer(); QString getDefaultContainerName(); + void setDefaultContainer(DockerContainer container); void setCurrentlyProcessedServerIndex(const int index); diff --git a/client/ui/qml/Pages2/PageSetupWizardInstalling.qml b/client/ui/qml/Pages2/PageSetupWizardInstalling.qml index bd1fd7e6..50aad294 100644 --- a/client/ui/qml/Pages2/PageSetupWizardInstalling.qml +++ b/client/ui/qml/Pages2/PageSetupWizardInstalling.qml @@ -24,6 +24,10 @@ PageType { target: InstallController function onInstallContainerFinished(finishedMessage, isServiceInstall) { + if (!ConnectionController.isConnected && !isServiceInstall) { + ContainersModel.setDefaultContainer(ContainersModel.getCurrentlyProcessedContainerIndex) + } + PageController.goToStartPage() if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageHome)) { PageController.restorePageHomeState(true) @@ -41,6 +45,10 @@ PageType { } function onInstallServerFinished(finishedMessage) { + if (!ConnectionController.isConnected) { + ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1); + } + PageController.goToStartPage() if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageSetupWizardStart)) { PageController.replaceStartPage() diff --git a/client/ui/qml/Pages2/PageSetupWizardViewConfig.qml b/client/ui/qml/Pages2/PageSetupWizardViewConfig.qml index 83132bd9..ac35651f 100644 --- a/client/ui/qml/Pages2/PageSetupWizardViewConfig.qml +++ b/client/ui/qml/Pages2/PageSetupWizardViewConfig.qml @@ -24,6 +24,10 @@ PageType { } function onImportFinished() { + if (ConnectionController.isConnected) { + ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1); + } + PageController.goToStartPage() if (stackView.currentItem.objectName === PageController.getPagePath(PageEnum.PageSetupWizardStart)) { PageController.replaceStartPage() From 09305724fa35b3524d527b170284a2d1d367e527 Mon Sep 17 00:00:00 2001 From: Mykola Baibuz Date: Fri, 20 Oct 2023 16:44:30 -0400 Subject: [PATCH 39/47] Fix MTU len for Win WG/AWG --- CMakeLists.txt | 2 +- client/3rd-prebuilt | 2 +- client/android/build.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 68de51fb..12fc8dce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR) set(PROJECT AmneziaVPN) -project(${PROJECT} VERSION 4.0.8.4 +project(${PROJECT} VERSION 4.0.8.5 DESCRIPTION "AmneziaVPN" HOMEPAGE_URL "https://amnezia.org/" ) diff --git a/client/3rd-prebuilt b/client/3rd-prebuilt index 15b0ff39..ac32d335 160000 --- a/client/3rd-prebuilt +++ b/client/3rd-prebuilt @@ -1 +1 @@ -Subproject commit 15b0ff395d9d372339c5ea8ea35cb2715b975ea9 +Subproject commit ac32d33555bd62f0b0af314b1e5119d6d78a1a4e diff --git a/client/android/build.gradle b/client/android/build.gradle index 49e378a0..a6b3f651 100644 --- a/client/android/build.gradle +++ b/client/android/build.gradle @@ -138,7 +138,7 @@ android { resConfig "en" minSdkVersion = 24 targetSdkVersion = 34 - versionCode 36 // Change to a higher number + versionCode 37 // Change to a higher number versionName "4.0.8" // Change to a higher number javaCompileOptions.annotationProcessorOptions.arguments = [ From d98fdbdc5cd4a6b5cc2b15f33a910b300b8bc167 Mon Sep 17 00:00:00 2001 From: pokamest Date: Sat, 21 Oct 2023 14:17:45 +0100 Subject: [PATCH 40/47] Revert "added new drawer2type for replacing drawertype" --- client/resources.qrc | 1 - .../ConnectionTypeSelectionDrawer.qml | 7 +- .../qml/Components/HomeContainersListView.qml | 2 +- client/ui/qml/Components/QuestionDrawer.qml | 10 +- .../qml/Components/SelectLanguageDrawer.qml | 8 +- .../qml/Components/ShareConnectionDrawer.qml | 27 +- client/ui/qml/Controls2/Drawer2Type.qml | 314 ---------------- client/ui/qml/Controls2/DropDownType.qml | 21 +- client/ui/qml/Pages2/PageHome.qml | 340 +++++++++++------- .../qml/Pages2/PageProtocolCloakSettings.qml | 2 - .../Pages2/PageProtocolOpenVpnSettings.qml | 11 +- client/ui/qml/Pages2/PageProtocolRaw.qml | 15 +- .../PageProtocolShadowSocksSettings.qml | 2 - .../ui/qml/Pages2/PageServiceDnsSettings.qml | 7 +- .../ui/qml/Pages2/PageServiceSftpSettings.qml | 7 +- .../Pages2/PageServiceTorWebsiteSettings.qml | 7 +- .../ui/qml/Pages2/PageSettingsApplication.qml | 8 +- client/ui/qml/Pages2/PageSettingsBackup.qml | 7 +- client/ui/qml/Pages2/PageSettingsDns.qml | 7 +- client/ui/qml/Pages2/PageSettingsLogging.qml | 7 +- .../ui/qml/Pages2/PageSettingsServerData.qml | 24 +- .../ui/qml/Pages2/PageSettingsServerInfo.qml | 12 +- .../qml/Pages2/PageSettingsServerProtocol.qml | 7 +- .../qml/Pages2/PageSettingsSplitTunneling.qml | 29 +- .../PageSetupWizardProtocolSettings.qml | 11 +- client/ui/qml/Pages2/PageSetupWizardStart.qml | 3 +- client/ui/qml/Pages2/PageShare.qml | 7 - client/ui/qml/Pages2/PageStart.qml | 12 +- 28 files changed, 276 insertions(+), 639 deletions(-) delete mode 100644 client/ui/qml/Controls2/Drawer2Type.qml diff --git a/client/resources.qrc b/client/resources.qrc index 91578418..4c63383c 100644 --- a/client/resources.qrc +++ b/client/resources.qrc @@ -216,7 +216,6 @@ ui/qml/Pages2/PageServiceDnsSettings.qml ui/qml/Controls2/TopCloseButtonType.qml images/controls/x-circle.svg - ui/qml/Controls2/Drawer2Type.qml ui/qml/Pages2/PageProtocolAwgSettings.qml server_scripts/awg/template.conf server_scripts/awg/start.sh diff --git a/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml b/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml index 71ec889f..1f7b2f29 100644 --- a/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml +++ b/client/ui/qml/Components/ConnectionTypeSelectionDrawer.qml @@ -8,16 +8,13 @@ import "../Controls2" import "../Controls2/TextTypes" import "../Config" -Drawer2Type { +DrawerType { id: root width: parent.width - height: parent.height - contentHeight: parent.height * 0.4375 + height: parent.height * 0.4375 ColumnLayout { - parent: root.contentParent - anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Components/HomeContainersListView.qml b/client/ui/qml/Components/HomeContainersListView.qml index d410f252..f05b90d6 100644 --- a/client/ui/qml/Components/HomeContainersListView.qml +++ b/client/ui/qml/Components/HomeContainersListView.qml @@ -63,7 +63,7 @@ ListView { isDefault = true menuContent.currentIndex = index - containersDropDown.menu.close() + containersDropDown.menuVisible = false } else { if (!isSupported && isInstalled) { PageController.showErrorMessage(qsTr("The selected protocol is not supported on the current platform")) diff --git a/client/ui/qml/Components/QuestionDrawer.qml b/client/ui/qml/Components/QuestionDrawer.qml index 72067f97..16cdcb39 100644 --- a/client/ui/qml/Components/QuestionDrawer.qml +++ b/client/ui/qml/Components/QuestionDrawer.qml @@ -5,7 +5,7 @@ import QtQuick.Layouts import "../Controls2" import "../Controls2/TextTypes" -Drawer2Type { +DrawerType { id: root property string headerText @@ -15,14 +15,12 @@ Drawer2Type { property var yesButtonFunction property var noButtonFunction - property real drawerHeight: 0.5 width: parent.width - height: parent.height - contentHeight: parent.height * drawerHeight + height: content.implicitHeight + 32 ColumnLayout { - parent: root.contentParent + id: content anchors.top: parent.top anchors.left: parent.left @@ -31,8 +29,6 @@ Drawer2Type { anchors.rightMargin: 16 anchors.leftMargin: 16 - // visible: false - spacing: 8 Header2TextType { diff --git a/client/ui/qml/Components/SelectLanguageDrawer.qml b/client/ui/qml/Components/SelectLanguageDrawer.qml index e6fdc2b5..d318aab8 100644 --- a/client/ui/qml/Components/SelectLanguageDrawer.qml +++ b/client/ui/qml/Components/SelectLanguageDrawer.qml @@ -5,18 +5,15 @@ import QtQuick.Layouts import "../Controls2" import "../Controls2/TextTypes" -Drawer2Type { +DrawerType { id: root width: parent.width - height: parent.height - contentHeight: parent.height * 0.9 + height: parent.height * 0.9 ColumnLayout { id: backButton - parent: root.contentParent - anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -31,7 +28,6 @@ Drawer2Type { } FlickableType { - parent: root.contentParent anchors.top: backButton.bottom anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Components/ShareConnectionDrawer.qml b/client/ui/qml/Components/ShareConnectionDrawer.qml index 03e7b500..1158dadc 100644 --- a/client/ui/qml/Components/ShareConnectionDrawer.qml +++ b/client/ui/qml/Components/ShareConnectionDrawer.qml @@ -16,7 +16,7 @@ import "../Controls2/TextTypes" import "../Config" import "../Components" -Drawer2Type { +DrawerType { id: root property alias headerText: header.headerText @@ -28,10 +28,9 @@ Drawer2Type { property string configFileName: "amnezia_config.vpn" width: parent.width - height: parent.height - contentHeight: parent.height * 0.9 + height: parent.height * 0.9 - onDrawerClosed: { + onClosed: { configExtension = ".vpn" configCaption = qsTr("Save AmneziaVPN config") configFileName = "amnezia_config" @@ -42,9 +41,6 @@ Drawer2Type { Header2Type { id: header - - parent: root.contentParent - anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -54,8 +50,6 @@ Drawer2Type { } FlickableType { - parent: root.contentParent - anchors.top: header.bottom anchors.bottom: parent.bottom contentHeight: content.height + 32 @@ -132,37 +126,30 @@ Drawer2Type { text: qsTr("Show connection settings") onClicked: { - configContentDrawer.open() + configContentDrawer.visible = true } } - Drawer2Type { + DrawerType { id: configContentDrawer - parent: root width: parent.width - height: parent.height - - contentHeight: parent.height * 0.9 + height: parent.height * 0.9 BackButtonType { id: backButton - parent: configContentDrawer.contentParent - anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right anchors.topMargin: 16 backButtonFunction: function() { - configContentDrawer.close() + configContentDrawer.visible = false } } FlickableType { - parent: configContentDrawer.contentParent - anchors.top: backButton.bottom anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Controls2/Drawer2Type.qml b/client/ui/qml/Controls2/Drawer2Type.qml deleted file mode 100644 index fa393982..00000000 --- a/client/ui/qml/Controls2/Drawer2Type.qml +++ /dev/null @@ -1,314 +0,0 @@ -import QtQuick -import QtQuick.Layouts -import QtQuick.Controls -import QtQuick.Shapes - -Item { - id: root - - Connections { - target: PageController - - function onForceCloseDrawer() { - if (root.expanded()) { - collapse() - } - } - } - - signal drawerClosed - signal collapsedEntered - signal collapsedExited - signal collapsedEnter - signal collapsedPressChanged - - - visible: false - - property bool needCloseButton: true - - property string defaultColor: "#1C1D21" - property string borderColor: "#2C2D30" - property string semitransparentColor: "#90000000" - - property bool needCollapsed: false - - property int contentHeight: 0 - property Item contentParent: contentArea - - property bool dragActive: dragArea.drag.active - - property int collapsedHeight: 0 - - property bool fullMouseAreaVisible: true - property MouseArea drawerDragArea: dragArea - - state: "collapsed" - - Rectangle { - id: draw2Background - - anchors.fill: parent - height: parent.height - width: parent.width - radius: 16 - color: "transparent" - border.color: "transparent" - border.width: 1 - visible: true - - MouseArea { - id: fullMouseArea - anchors.fill: parent - enabled: root.expanded() - hoverEnabled: true - visible: fullMouseAreaVisible - - onClicked: { - if (root.expanded()) { - collapse() - } - } - } - - Rectangle { - id: placeAreaHolder - - // for apdating home drawer, normal drawer will reset it - height: 0 - - anchors.right: parent.right - anchors.left: parent.left - visible: true - color: "transparent" - - Drag.active: dragArea.drag.active - } - - - Rectangle { - id: contentArea - - anchors.top: placeAreaHolder.bottom - height: contentHeight - radius: 16 - color: root.defaultColor - border.width: 1 - border.color: root.borderColor - width: parent.width - visible: true - - Rectangle { - width: parent.radius - height: parent.radius - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.left: parent.left - color: parent.color - } - - MouseArea { - id: dragArea - - anchors.fill: parent - - cursorShape: root.collapsed() ? Qt.PointingHandCursor : Qt.ArrowCursor - hoverEnabled: true - - drag.target: placeAreaHolder - drag.axis: Drag.YAxis - drag.maximumY: root.height - root.collapsedHeight - drag.minimumY: root.collapsedHeight > 0 ? root.height - root.height * 0.9 : 0 - - /** If drag area is released at any point other than min or max y, transition to the other state */ - onReleased: { - if (root.collapsed() && placeAreaHolder.y < drag.maximumY) { - root.state = "expanded" - return - } - if (root.expanded() && placeAreaHolder.y > drag.minimumY) { - root.state = "collapsed" - return - } - } - - onClicked: { - if (root.expanded()) { - collapse() - return - } - - if (root.collapsed()) { - root.state = "expanded" - } - } - - onExited: { - collapsedExited() - } - - onEntered: { - collapsedEnter() - } - - onPressedChanged: { - collapsedPressChanged() - } - } - } - } - - onStateChanged: { - if (root.collapsed()) { - var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor() - if (initialPageNavigationBarColor !== 0xFF1C1D21) { - PageController.updateNavigationBarColor(initialPageNavigationBarColor) - } - - if (needCloseButton) { - PageController.drawerClose() - } - - drawerClosed() - - return - } - - if (root.expanded()) { - if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) { - PageController.updateNavigationBarColor(0xFF1C1D21) - } - - if (needCloseButton) { - PageController.drawerOpen() - } - - return - } - } - - /** Two states of buttonContent, great place to add any future animations for the drawer */ - states: [ - State { - name: "collapsed" - PropertyChanges { - target: placeAreaHolder - y: dragArea.drag.maximumY - } - }, - - State { - name: "expanded" - PropertyChanges { - target: placeAreaHolder - y: dragArea.drag.minimumY - } - } - ] - - transitions: [ - Transition { - from: "expanded" - to: "collapsed" - PropertyAnimation { - target: placeAreaHolder - properties: "y" - duration: 200 - } - - onRunningChanged: { - if (!running) { - draw2Background.color = "transparent" - fullMouseArea.visible = false - } - } - }, - - Transition { - from: "collapsed" - to: "expanded" - PropertyAnimation { - target: placeAreaHolder - properties: "y" - duration: 200 - } - - onRunningChanged: { - if (!running) { - draw2Background.color = semitransparentColor - fullMouseArea.visible = true - } - } - } - ] - - NumberAnimation { - id: animationVisible - target: placeAreaHolder - property: "y" - from: parent.height - to: 0 - duration: 200 - } - - // for normal drawer - function open() { - if (root.expanded()) { - return - } - - draw2Background.color = semitransparentColor - fullMouseArea.visible = true - - collapsedHeight = 0 - - root.y = 0 - root.state = "expanded" - root.visible = true - root.height = parent.height - - contentArea.height = contentHeight - - placeAreaHolder.y = 0 - placeAreaHolder.height = root.height - contentHeight - - animationVisible.running = true - } - - function close() { - collapse() - } - - function collapse() { - draw2Background.color = "transparent" - root.state = "collapsed" - } - - // for page home - function expand() { - draw2Background.color = semitransparentColor - root.state = "expanded" - } - - function expanded() { - return root.state === "expanded" ? true : false - } - - function collapsed() { - return root.state === "collapsed" ? true : false - } - - - onVisibleChanged: { - // e.g cancel, ...... - if (!visible) { - if (root.expanded()) { - if (needCloseButton) { - PageController.drawerClose() - } - - close() - } - } - } -} diff --git a/client/ui/qml/Controls2/DropDownType.qml b/client/ui/qml/Controls2/DropDownType.qml index c666408a..b91f0b7a 100644 --- a/client/ui/qml/Controls2/DropDownType.qml +++ b/client/ui/qml/Controls2/DropDownType.qml @@ -40,10 +40,6 @@ Item { property alias menuVisible: menu.visible - property Item drawerParent: root - - property Drawer2Type menu: menu - implicitWidth: rootButtonContent.implicitWidth implicitHeight: rootButtonContent.implicitHeight @@ -159,26 +155,21 @@ Item { onClicked: { if (rootButtonClickedFunction && typeof rootButtonClickedFunction === "function") { rootButtonClickedFunction() + } else { + menu.visible = true } - - menu.open() } } - Drawer2Type { + DrawerType { id: menu - parent: drawerParent - width: parent.width - height: parent.height - contentHeight: parent.height * drawerHeight + height: parent.height * drawerHeight ColumnLayout { id: header - parent: menu.contentParent - anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -187,14 +178,12 @@ Item { BackButtonType { backButtonImage: root.headerBackButtonImage backButtonFunction: function() { - menu.close() + root.menuVisible = false } } } FlickableType { - parent: menu.contentParent - anchors.top: header.bottom anchors.topMargin: 16 contentHeight: col.implicitHeight diff --git a/client/ui/qml/Pages2/PageHome.qml b/client/ui/qml/Pages2/PageHome.qml index 414d604b..cc49e4f0 100644 --- a/client/ui/qml/Pages2/PageHome.qml +++ b/client/ui/qml/Pages2/PageHome.qml @@ -30,13 +30,13 @@ PageType { target: PageController function onRestorePageHomeState(isContainerInstalled) { - buttonContent.collapse() + buttonContent.state = "expanded" if (isContainerInstalled) { containersDropDown.menuVisible = true } } function onForceCloseDrawer() { - buttonContent.collapse() + buttonContent.state = "collapsed" } } @@ -73,8 +73,14 @@ PageType { expandedServersMenuDescription.text = description + root.defaultServerHostName } - Component.onCompleted: { - updateDescriptions() + Component.onCompleted: updateDescriptions() + + MouseArea { + anchors.fill: parent + enabled: buttonContent.state === "expanded" + onClicked: { + buttonContent.state = "collapsed" + } } Item { @@ -86,10 +92,56 @@ PageType { } } + MouseArea { + id: dragArea + + anchors.fill: buttonBackground + cursorShape: buttonContent.state === "collapsed" ? Qt.PointingHandCursor : Qt.ArrowCursor + hoverEnabled: true + + drag.target: buttonContent + drag.axis: Drag.YAxis + drag.maximumY: root.height - buttonContent.collapsedHeight + drag.minimumY: root.height - root.height * 0.9 + + /** If drag area is released at any point other than min or max y, transition to the other state */ + onReleased: { + if (buttonContent.state === "collapsed" && buttonContent.y < dragArea.drag.maximumY) { + buttonContent.state = "expanded" + return + } + if (buttonContent.state === "expanded" && buttonContent.y > dragArea.drag.minimumY) { + buttonContent.state = "collapsed" + return + } + } + + onEntered: { + collapsedButtonChevron.backgroundColor = collapsedButtonChevron.hoveredColor + collapsedButtonHeader.opacity = 0.8 + } + onExited: { + collapsedButtonChevron.backgroundColor = collapsedButtonChevron.defaultColor + collapsedButtonHeader.opacity = 1 + } + onPressedChanged: { + collapsedButtonChevron.backgroundColor = pressed ? collapsedButtonChevron.pressedColor : entered ? collapsedButtonChevron.hoveredColor : collapsedButtonChevron.defaultColor + collapsedButtonHeader.opacity = 0.7 + } + + + onClicked: { + if (buttonContent.state === "collapsed") { + buttonContent.state = "expanded" + } + } + } + Rectangle { id: buttonBackground - anchors { left: buttonContent.left; right: buttonContent.right; top: buttonContent.top } + anchors { left: buttonContent.left; right: buttonContent.right; top: buttonContent.top } + height: root.height radius: 16 color: root.defaultColor border.color: root.borderColor @@ -105,126 +157,161 @@ PageType { } } - Drawer2Type { + ColumnLayout { id: buttonContent - visible: true - - fullMouseAreaVisible: false + /** Initial height of button content */ + property int collapsedHeight: 0 /** True when expanded objects should be visible */ - property bool expandedVisibility: buttonContent.expanded() || (buttonContent.collapsed() && buttonContent.dragActive) + property bool expandedVisibility: buttonContent.state === "expanded" || (buttonContent.state === "collapsed" && dragArea.drag.active === true) /** True when collapsed objects should be visible */ - property bool collapsedVisibility: buttonContent.collapsed() && !buttonContent.dragActive + property bool collapsedVisibility: buttonContent.state === "collapsed" && dragArea.drag.active === false - width: parent.width - height: parent.height - contentHeight: parent.height * 0.9 + Drag.active: dragArea.drag.active + anchors.right: root.right + anchors.left: root.left + y: root.height - buttonContent.height + Component.onCompleted: { + buttonContent.state = "collapsed" + } - ColumnLayout { - id: collapsedButtonContent - - parent: buttonContent.contentParent - - visible: buttonContent.collapsedVisibility - - anchors.right: parent.right - anchors.left: parent.left - anchors.top: parent.top - - onImplicitHeightChanged: { - if (buttonContent.collapsed() && buttonContent.collapsedHeight === 0) { - buttonContent.collapsedHeight = implicitHeight - } - } - - DividerType { - Layout.topMargin: 10 - Layout.fillWidth: false - Layout.preferredWidth: 20 - Layout.preferredHeight: 2 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - } - - RowLayout { - Layout.topMargin: 14 - Layout.leftMargin: 24 - Layout.rightMargin: 24 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - Header1TextType { - id: collapsedButtonHeader - Layout.maximumWidth: root.width - 48 - 18 - 12 // todo - - maximumLineCount: 2 - elide: Qt.ElideRight - - text: root.defaultServerName - - Layout.alignment: Qt.AlignLeft - } - - - ImageButtonType { - id: collapsedButtonChevron - - hoverEnabled: false - image: "qrc:/images/controls/chevron-down.svg" - imageColor: "#d7d8db" - - horizontalPadding: 0 - padding: 0 - spacing: 0 - - Rectangle { - id: rightImageBackground - anchors.fill: parent - radius: 16 - color: "transparent" - - Behavior on color { - PropertyAnimation { duration: 200 } - } - } - - onClicked: { - if (buttonContent.collapsed()) { - buttonContent.expand() - } - } - } - } - - LabelTextType { - id: collapsedServerMenuDescription - Layout.bottomMargin: 44 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - visible: buttonContent.collapsedVisibility + /** Set once based on first implicit height change once all children are layed out */ + onImplicitHeightChanged: { + if (buttonContent.state === "collapsed" && collapsedHeight == 0) { + collapsedHeight = implicitHeight } } - Component.onCompleted: { - buttonContent.collapse() + onStateChanged: { + if (buttonContent.state === "collapsed") { + var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor() + if (initialPageNavigationBarColor !== 0xFF1C1D21) { + PageController.updateNavigationBarColor(initialPageNavigationBarColor) + } + PageController.drawerClose() + return + } + if (buttonContent.state === "expanded") { + if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) { + PageController.updateNavigationBarColor(0xFF1C1D21) + } + PageController.drawerOpen() + return + } + } + + /** Two states of buttonContent, great place to add any future animations for the drawer */ + states: [ + State { + name: "collapsed" + PropertyChanges { + target: buttonContent + y: root.height - collapsedHeight + } + }, + State { + name: "expanded" + PropertyChanges { + target: buttonContent + y: dragArea.drag.minimumY + + } + } + ] + + transitions: [ + Transition { + from: "collapsed" + to: "expanded" + PropertyAnimation { + target: buttonContent + properties: "y" + duration: 200 + } + }, + Transition { + from: "expanded" + to: "collapsed" + PropertyAnimation { + target: buttonContent + properties: "y" + duration: 200 + } + } + ] + + DividerType { + Layout.topMargin: 10 + Layout.fillWidth: false + Layout.preferredWidth: 20 + Layout.preferredHeight: 2 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + + visible: (buttonContent.collapsedVisibility || buttonContent.expandedVisibility) + } + + RowLayout { + Layout.topMargin: 14 + Layout.leftMargin: 24 + Layout.rightMargin: 24 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + visible: buttonContent.collapsedVisibility + + spacing: 0 + + Header1TextType { + id: collapsedButtonHeader + Layout.maximumWidth: buttonContent.width - 48 - 18 - 12 // todo + + maximumLineCount: 2 + elide: Qt.ElideRight + + text: root.defaultServerName + horizontalAlignment: Qt.AlignHCenter + + Behavior on opacity { + PropertyAnimation { duration: 200 } + } + } + + ImageButtonType { + id: collapsedButtonChevron + + Layout.leftMargin: 8 + + hoverEnabled: false + image: "qrc:/images/controls/chevron-down.svg" + imageColor: "#d7d8db" + + icon.width: 18 + icon.height: 18 + backgroundRadius: 16 + horizontalPadding: 4 + topPadding: 4 + bottomPadding: 3 + + onClicked: { + if (buttonContent.state === "collapsed") { + buttonContent.state = "expanded" + } + } + } + } + + LabelTextType { + id: collapsedServerMenuDescription + Layout.bottomMargin: 44 + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + visible: buttonContent.collapsedVisibility } ColumnLayout { id: serversMenuHeader - parent: buttonContent.contentParent - - anchors.top: parent.top - anchors.right: parent.right - anchors.left: parent.left - + Layout.alignment: Qt.AlignTop | Qt.AlignHCenter + Layout.fillWidth: true visible: buttonContent.expandedVisibility - - DividerType { - Layout.topMargin: 10 - Layout.fillWidth: false - Layout.preferredWidth: 20 - Layout.preferredHeight: 2 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - } Header1TextType { Layout.fillWidth: true @@ -253,8 +340,6 @@ PageType { DropDownType { id: containersDropDown - drawerParent: root - rootButtonImageColor: "#0E0E11" rootButtonBackgroundColor: "#D7D8DB" rootButtonBackgroundHoveredColor: Qt.rgba(215, 216, 219, 0.8) @@ -316,18 +401,12 @@ PageType { Flickable { id: serversContainer - - parent: buttonContent.contentParent - - anchors.top: serversMenuHeader.bottom - anchors.right: parent.right - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.topMargin: 16 + Layout.alignment: Qt.AlignTop | Qt.AlignHCenter + Layout.fillWidth: true + Layout.topMargin: 16 contentHeight: col.implicitHeight - + implicitHeight: root.height - (root.height * 0.1) - serversMenuHeader.implicitHeight - 52 //todo 52 is tabbar height visible: buttonContent.expandedVisibility - clip: true ScrollBar.vertical: ScrollBar { @@ -437,7 +516,7 @@ PageType { onClicked: function() { ServersModel.currentlyProcessedIndex = index PageController.goToPage(PageEnum.PageSettingsServerInfo) - buttonContent.collapse() + buttonContent.state = "collapsed" } } } @@ -452,22 +531,5 @@ PageType { } } } - - onCollapsedEnter: { - collapsedButtonChevron.backgroundColor = collapsedButtonChevron.hoveredColor - collapsedButtonHeader.opacity = 0.8 - } - - onCollapsedExited: { - collapsedButtonChevron.backgroundColor = collapsedButtonChevron.defaultColor - collapsedButtonHeader.opacity = 1 - } - - onCollapsedPressChanged: { - collapsedButtonChevron.backgroundColor = buttonContent.drawerDragArea.pressed ? - collapsedButtonChevron.pressedColor : buttonContent.drawerDragArea.entered ? - collapsedButtonChevron.hoveredColor : collapsedButtonChevron.defaultColor - collapsedButtonHeader.opacity = 0.7 - } } } diff --git a/client/ui/qml/Pages2/PageProtocolCloakSettings.qml b/client/ui/qml/Pages2/PageProtocolCloakSettings.qml index b0f36971..78e666a7 100644 --- a/client/ui/qml/Pages2/PageProtocolCloakSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolCloakSettings.qml @@ -117,8 +117,6 @@ PageType { Layout.fillWidth: true Layout.topMargin: 16 - drawerParent: root - descriptionText: qsTr("Cipher") headerText: qsTr("Cipher") diff --git a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml index 8ce5e554..cd2dd51d 100644 --- a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml @@ -157,8 +157,6 @@ PageType { Layout.fillWidth: true Layout.topMargin: 20 - drawerParent: root - enabled: !autoNegotiateEncryprionSwitcher.checked descriptionText: qsTr("Hash") @@ -205,8 +203,6 @@ PageType { Layout.fillWidth: true Layout.topMargin: 16 - drawerParent: root - enabled: !autoNegotiateEncryprionSwitcher.checked descriptionText: qsTr("Cipher") @@ -374,14 +370,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } } @@ -406,7 +402,6 @@ PageType { QuestionDrawer { id: questionDrawer - parent: root } } } diff --git a/client/ui/qml/Pages2/PageProtocolRaw.qml b/client/ui/qml/Pages2/PageProtocolRaw.qml index accfd0bd..f3621d96 100644 --- a/client/ui/qml/Pages2/PageProtocolRaw.qml +++ b/client/ui/qml/Pages2/PageProtocolRaw.qml @@ -90,19 +90,15 @@ PageType { DividerType {} - Drawer2Type { + DrawerType { id: configContentDrawer - parent: root width: parent.width - height: parent.height - contentHeight: parent.height * 0.9 + height: parent.height * 0.9 BackButtonType { id: backButton - parent: configContentDrawer.contentParent - anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -185,14 +181,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } MouseArea { @@ -207,7 +203,6 @@ PageType { QuestionDrawer { id: questionDrawer - parent: root } } } diff --git a/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml b/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml index 75853d1f..2453281f 100644 --- a/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolShadowSocksSettings.qml @@ -95,8 +95,6 @@ PageType { Layout.fillWidth: true Layout.topMargin: 20 - drawerParent: root - descriptionText: qsTr("Cipher") headerText: qsTr("Cipher") diff --git a/client/ui/qml/Pages2/PageServiceDnsSettings.qml b/client/ui/qml/Pages2/PageServiceDnsSettings.qml index 9ad3b289..10fe6f56 100644 --- a/client/ui/qml/Pages2/PageServiceDnsSettings.qml +++ b/client/ui/qml/Pages2/PageServiceDnsSettings.qml @@ -68,14 +68,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } MouseArea { @@ -89,7 +89,6 @@ PageType { QuestionDrawer { id: questionDrawer - parent: root } } } diff --git a/client/ui/qml/Pages2/PageServiceSftpSettings.qml b/client/ui/qml/Pages2/PageServiceSftpSettings.qml index 1a591268..b12302dd 100644 --- a/client/ui/qml/Pages2/PageServiceSftpSettings.qml +++ b/client/ui/qml/Pages2/PageServiceSftpSettings.qml @@ -253,14 +253,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } } } @@ -270,7 +270,6 @@ PageType { QuestionDrawer { id: questionDrawer - parent: root } } } diff --git a/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml b/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml index 9771c4db..3bfa5bb0 100644 --- a/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml +++ b/client/ui/qml/Pages2/PageServiceTorWebsiteSettings.qml @@ -131,21 +131,20 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } } } QuestionDrawer { id: questionDrawer - parent: root } } } diff --git a/client/ui/qml/Pages2/PageSettingsApplication.qml b/client/ui/qml/Pages2/PageSettingsApplication.qml index 31f59438..05e468f0 100644 --- a/client/ui/qml/Pages2/PageSettingsApplication.qml +++ b/client/ui/qml/Pages2/PageSettingsApplication.qml @@ -119,7 +119,6 @@ PageType { SelectLanguageDrawer { id: selectLanguageDrawer - parent: root } @@ -152,14 +151,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false SettingsController.clearSettings() PageController.replaceStartPage() } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } } @@ -167,7 +166,6 @@ PageType { QuestionDrawer { id: questionDrawer - parent: root } } } diff --git a/client/ui/qml/Pages2/PageSettingsBackup.qml b/client/ui/qml/Pages2/PageSettingsBackup.qml index eabf1f48..81be0465 100644 --- a/client/ui/qml/Pages2/PageSettingsBackup.qml +++ b/client/ui/qml/Pages2/PageSettingsBackup.qml @@ -139,19 +139,18 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false PageController.showBusyIndicator(true) SettingsController.restoreAppConfig(filePath) PageController.showBusyIndicator(false) } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } QuestionDrawer { id: questionDrawer - parent: root } } diff --git a/client/ui/qml/Pages2/PageSettingsDns.qml b/client/ui/qml/Pages2/PageSettingsDns.qml index 8afb9bcc..5670464f 100644 --- a/client/ui/qml/Pages2/PageSettingsDns.qml +++ b/client/ui/qml/Pages2/PageSettingsDns.qml @@ -92,7 +92,7 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false SettingsController.primaryDns = "1.1.1.1" primaryDns.textFieldText = SettingsController.primaryDns SettingsController.secondaryDns = "1.0.0.1" @@ -100,9 +100,9 @@ PageType { PageController.showNotificationMessage(qsTr("Settings have been reset")) } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } } @@ -124,7 +124,6 @@ PageType { } QuestionDrawer { id: questionDrawer - parent: root } } } diff --git a/client/ui/qml/Pages2/PageSettingsLogging.qml b/client/ui/qml/Pages2/PageSettingsLogging.qml index d282d0f0..840c41d4 100644 --- a/client/ui/qml/Pages2/PageSettingsLogging.qml +++ b/client/ui/qml/Pages2/PageSettingsLogging.qml @@ -147,16 +147,16 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false PageController.showBusyIndicator(true) SettingsController.clearLogs() PageController.showBusyIndicator(false) PageController.showNotificationMessage(qsTr("Logs have been cleaned up")) } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } } @@ -172,7 +172,6 @@ PageType { QuestionDrawer { id: questionDrawer - parent: root } } } diff --git a/client/ui/qml/Pages2/PageSettingsServerData.qml b/client/ui/qml/Pages2/PageSettingsServerData.qml index 09066ccb..3eb07ce9 100644 --- a/client/ui/qml/Pages2/PageSettingsServerData.qml +++ b/client/ui/qml/Pages2/PageSettingsServerData.qml @@ -14,8 +14,6 @@ import "../Components" PageType { id: root - property Item questionDrawerParent - Connections { target: InstallController @@ -96,15 +94,15 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false PageController.showBusyIndicator(true) SettingsController.clearCachedProfiles() PageController.showBusyIndicator(false) } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } } @@ -143,7 +141,7 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false PageController.showBusyIndicator(true) if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) { ConnectionController.closeConnection() @@ -152,9 +150,9 @@ PageType { PageController.showBusyIndicator(false) } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } } @@ -174,7 +172,7 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false PageController.goToPage(PageEnum.PageDeinstalling) if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) { ConnectionController.closeConnection() @@ -182,9 +180,9 @@ PageType { InstallController.removeAllContainers() } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } } @@ -194,10 +192,6 @@ PageType { QuestionDrawer { id: questionDrawer - - drawerHeight: 0.5 - - parent: questionDrawerParent } } } diff --git a/client/ui/qml/Pages2/PageSettingsServerInfo.qml b/client/ui/qml/Pages2/PageSettingsServerInfo.qml index e14c6ab5..e2e7868c 100644 --- a/client/ui/qml/Pages2/PageSettingsServerInfo.qml +++ b/client/ui/qml/Pages2/PageSettingsServerInfo.qml @@ -71,17 +71,15 @@ PageType { } actionButtonFunction: function() { - serverNameEditDrawer.open() + serverNameEditDrawer.visible = true } } - Drawer2Type { + DrawerType { id: serverNameEditDrawer - parent: root width: root.width - height: root.height // * 0.35 - contentHeight: root.height * 0.35 + height: root.height * 0.35 onVisibleChanged: { if (serverNameEditDrawer.visible) { @@ -90,8 +88,6 @@ PageType { } ColumnLayout { - parent: serverNameEditDrawer.contentParent - anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -99,7 +95,6 @@ PageType { anchors.leftMargin: 16 anchors.rightMargin: 16 - TextFieldWithHeaderType { id: serverName @@ -169,7 +164,6 @@ PageType { } PageSettingsServerData { stackView: root.stackView - questionDrawerParent: root } } } diff --git a/client/ui/qml/Pages2/PageSettingsServerProtocol.qml b/client/ui/qml/Pages2/PageSettingsServerProtocol.qml index a518167c..30758da4 100644 --- a/client/ui/qml/Pages2/PageSettingsServerProtocol.qml +++ b/client/ui/qml/Pages2/PageSettingsServerProtocol.qml @@ -119,14 +119,14 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false PageController.goToPage(PageEnum.PageDeinstalling) InstallController.removeCurrentlyProcessedContainer() } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } MouseArea { @@ -141,7 +141,6 @@ PageType { QuestionDrawer { id: questionDrawer - parent: root } } } diff --git a/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml b/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml index 7811e2bb..cc4973f1 100644 --- a/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml +++ b/client/ui/qml/Pages2/PageSettingsSplitTunneling.qml @@ -116,8 +116,6 @@ PageType { DropDownType { id: selector - drawerParent: root - Layout.fillWidth: true Layout.topMargin: 32 Layout.leftMargin: 16 @@ -210,13 +208,13 @@ PageType { questionDrawer.noButtonText = qsTr("Cancel") questionDrawer.yesButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false SitesController.removeSite(index) } questionDrawer.noButtonFunction = function() { - questionDrawer.close() + questionDrawer.visible = false } - questionDrawer.open() + questionDrawer.visible = true } } @@ -224,7 +222,6 @@ PageType { QuestionDrawer { id: questionDrawer - parent: root } } } @@ -279,18 +276,13 @@ PageType { } } - Drawer2Type { + DrawerType { id: moreActionsDrawer width: parent.width - height: parent.height - contentHeight: parent.height * 0.4375 - - parent: root + height: parent.height * 0.4375 FlickableType { - parent: moreActionsDrawer.contentParent - anchors.fill: parent contentHeight: moreActionsDrawerContent.height ColumnLayout { @@ -349,20 +341,15 @@ PageType { } } - Drawer2Type { + DrawerType { id: importSitesDrawer width: parent.width - height: parent.height - contentHeight: parent.height * 0.4375 - - parent: root + height: parent.height * 0.4375 BackButtonType { id: importSitesDrawerBackButton - parent: importSitesDrawer.contentParent - anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -374,8 +361,6 @@ PageType { } FlickableType { - parent: importSitesDrawer.contentParent - anchors.top: importSitesDrawerBackButton.bottom anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml index 86d3c1fd..7698c755 100644 --- a/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml +++ b/client/ui/qml/Pages2/PageSetupWizardProtocolSettings.qml @@ -97,20 +97,15 @@ PageType { } } - Drawer2Type { + DrawerType { id: showDetailsDrawer width: parent.width - height: parent.height - contentHeight: parent.height * 0.9 - - parent: root + height: parent.height * 0.9 BackButtonType { id: showDetailsBackButton - parent: showDetailsDrawer.contentParent - anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -122,8 +117,6 @@ PageType { } FlickableType { - parent: showDetailsDrawer.contentParent - anchors.top: showDetailsBackButton.bottom anchors.left: parent.left anchors.right: parent.right diff --git a/client/ui/qml/Pages2/PageSetupWizardStart.qml b/client/ui/qml/Pages2/PageSetupWizardStart.qml index 059aedab..ba78c985 100644 --- a/client/ui/qml/Pages2/PageSetupWizardStart.qml +++ b/client/ui/qml/Pages2/PageSetupWizardStart.qml @@ -115,7 +115,7 @@ PageType { text: qsTr("I have the data to connect") onClicked: { - connectionTypeSelection.open() + connectionTypeSelection.visible = true } } @@ -140,7 +140,6 @@ PageType { ConnectionTypeSelectionDrawer { id: connectionTypeSelection - parent: root } } diff --git a/client/ui/qml/Pages2/PageShare.qml b/client/ui/qml/Pages2/PageShare.qml index 5e97cb42..25aad3de 100644 --- a/client/ui/qml/Pages2/PageShare.qml +++ b/client/ui/qml/Pages2/PageShare.qml @@ -179,8 +179,6 @@ PageType { DropDownType { id: serverSelector - drawerParent: root - signal severSelectorIndexChanged property int currentIndex: 0 @@ -243,8 +241,6 @@ PageType { DropDownType { id: protocolSelector - drawerParent: root - visible: accessTypeSelector.currentIndex === 0 Layout.fillWidth: true @@ -334,8 +330,6 @@ PageType { DropDownType { id: exportTypeSelector - drawerParent: root - property int currentIndex: 0 Layout.fillWidth: true @@ -377,7 +371,6 @@ PageType { ShareConnectionDrawer { id: shareConnectionDrawer - parent: root } BasicButtonType { diff --git a/client/ui/qml/Pages2/PageStart.qml b/client/ui/qml/Pages2/PageStart.qml index 65c351bf..ab02ace4 100644 --- a/client/ui/qml/Pages2/PageStart.qml +++ b/client/ui/qml/Pages2/PageStart.qml @@ -135,8 +135,6 @@ PageType { var pagePath = PageController.getPagePath(PageEnum.PageHome) ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex tabBarStackView.push(pagePath, { "objectName" : pagePath }) - - connectionTypeSelection.parent = tabBarStackView } // onWidthChanged: { @@ -176,12 +174,6 @@ PageType { strokeColor: "#2C2D30" fillColor: "#1C1D21" } - - MouseArea { - id: noPropagateMouseEvent - anchors.fill: parent - enabled: true - } } TabImageButtonType { @@ -252,9 +244,7 @@ PageType { ConnectionTypeSelectionDrawer { id: connectionTypeSelection - z: 1 - - onDrawerClosed: { + onAboutToHide: { tabBar.setCurrentIndex(tabBar.previousIndex) } } From 99214e22e30c630aafa3a3e59c4b5444ac7c7abb Mon Sep 17 00:00:00 2001 From: pokamest Date: Sat, 21 Oct 2023 16:05:09 +0100 Subject: [PATCH 41/47] Fix docs url --- client/ui/qml/Pages2/PageSetupWizardStart.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ui/qml/Pages2/PageSetupWizardStart.qml b/client/ui/qml/Pages2/PageSetupWizardStart.qml index ba78c985..994ec200 100644 --- a/client/ui/qml/Pages2/PageSetupWizardStart.qml +++ b/client/ui/qml/Pages2/PageSetupWizardStart.qml @@ -134,7 +134,7 @@ PageType { text: qsTr("I have nothing") - onClicked: Qt.openUrlExternally("https://ru-docs.amnezia.org/guides/hosting-instructions") + onClicked: Qt.openUrlExternally("https://amnezia.org/instructions/0_starter-guide") } } From e16a1100d8bc2f762d14e24de9800e20eeeac53b Mon Sep 17 00:00:00 2001 From: pokamest Date: Sat, 21 Oct 2023 16:20:57 +0100 Subject: [PATCH 42/47] Update amneziavpn_ru.ts --- client/translations/amneziavpn_ru.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index 281e4edb..eb19ad82 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -2571,9 +2571,9 @@ OpenVPN обеспечивает безопасное VPN-соединение Cloak защищает OpenVPN от обнаружения и блокировок. -Cloak может изменять метаданные пакетов. Он полностью маскирует VPN-трафик под обычный веб-трафик, а также защищает VPN от обнаружения с помощью Active Probing. Это делает ее очень устойчивой к обнаружению +Cloak может изменять метаданные пакетов. Он полностью маскирует VPN-трафик под обычный веб-трафик, а также защищает VPN от обнаружения с помощью Active Probing. Это делает его очень устойчивым к обнаружению -Сразу же после получения первого пакета данных Cloak проверяет подлинность входящего соединения. Если аутентификация не проходит, плагин маскирует сервер под поддельный сайт, и ваша VPN становится невидимой для аналитических систем. +Сразу же после получения первого пакета данных Cloak проверяет подлинность входящего соединения. Если аутентификация не проходит, плагин маскирует сервер под поддельный сайт, и ваш VPN становится невидимым для аналитических систем. Если в вашем регионе существует экстремальный уровень цензуры в Интернете, мы советуем вам при первом подключении использовать только OpenVPN через Cloak From 7a54dc15da5070e744d9d9be0cc9bc72d4790e52 Mon Sep 17 00:00:00 2001 From: pokamest Date: Sat, 21 Oct 2023 16:33:21 +0100 Subject: [PATCH 43/47] Update amneziavpn_ru.ts --- client/translations/amneziavpn_ru.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index eb19ad82..83cab7ae 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -404,7 +404,7 @@ Already installed containers were found on the server. All installed containers VPN Addresses Subnet - VPN Адреса Подсеть + Подсеть для VPN @@ -1132,7 +1132,7 @@ Already installed containers were found on the server. All installed containers Connection - Подключение + Соединение @@ -1278,7 +1278,7 @@ Already installed containers were found on the server. All installed containers Save logs to file - Сохранять логи в файл + Сохранить логи в файл From 0bb4dd94423bc8bc2a58e980fb0af31340e76c72 Mon Sep 17 00:00:00 2001 From: pokamest Date: Sat, 21 Oct 2023 18:32:30 +0100 Subject: [PATCH 44/47] Text and translations fixes --- client/translations/amneziavpn_ru.ts | 62 ++++++++++++------- client/translations/amneziavpn_zh_CN.ts | 58 +++++++++++------ .../ui/qml/Pages2/PageProtocolAwgSettings.qml | 2 +- .../Pages2/PageProtocolOpenVpnSettings.qml | 2 +- client/ui/qml/Pages2/PageProtocolRaw.qml | 2 +- .../qml/Pages2/PageSettingsServerProtocol.qml | 2 +- client/ui/qml/Pages2/PageShare.qml | 6 +- 7 files changed, 85 insertions(+), 49 deletions(-) diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index 83cab7ae..f4ef9c0f 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -120,7 +120,7 @@ Unable change protocol while there is an active connection - + Невозможно изменить протокол при активном соединении @@ -274,7 +274,7 @@ Already installed containers were found on the server. All installed containers Unable change server while there is an active connection - + Невозможно изменить сервер при активном соединении @@ -346,9 +346,13 @@ Already installed containers were found on the server. All installed containers - All users who you shared a connection with will no longer be able to connect to it. + All users with whom you shared a connection will no longer be able to connect to it. Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. + + All users who you shared a connection with will no longer be able to connect to it. + Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. + Continue @@ -571,9 +575,13 @@ Already installed containers were found on the server. All installed containers - All users who you shared a connection with will no longer be able to connect to it. + All users with whom you shared a connection will no longer be able to connect to it. Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. + + All users who you shared a connection with will no longer be able to connect to it. + Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. + Continue @@ -619,8 +627,12 @@ Already installed containers were found on the server. All installed containers + All users with whom you shared a connection will no longer be able to connect to it. + Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. + + All users who you shared a connection with will no longer be able to connect to it. - Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. + Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. @@ -1440,8 +1452,12 @@ Already installed containers were found on the server. All installed containers + All users with whom you shared a connection will no longer be able to connect to it. + Все пользователи, с которыми вы поделились этим VPN-протоколом, больше не смогут к нему подключаться. + + All users who you shared a connection with will no longer be able to connect to it. - Все пользователи, которым вы поделились VPN, больше не смогут к нему подключаться. + Все пользователи, которым вы поделились VPN, больше не смогут к нему подключаться. @@ -1884,9 +1900,8 @@ and will not be shared or disclosed to the Amnezia or any third parties WireGuard нативный формат - VPN Access - VPN-Доступ + VPN-Доступ @@ -1894,14 +1909,12 @@ and will not be shared or disclosed to the Amnezia or any third parties Соединение - VPN access without the ability to manage the server - Доступ к VPN, без возможности управления сервером + Доступ к VPN, без возможности управления сервером - Access to server management. The user with whom you share full access to the connection will be able to add and remove your protocols and services to the server, as well as change settings. - Доступ к управлению сервером. Пользователь, с которым вы делитесь полным доступом к соединению, сможет добавлять и удалять ваши протоколы и службы на сервере, а также изменять настройки. + Доступ к управлению сервером. Пользователь, с которым вы делитесь полным доступом к соединению, сможет добавлять и удалять ваши протоколы и службы на сервере, а также изменять настройки. @@ -1944,11 +1957,26 @@ and will not be shared or disclosed to the Amnezia or any third parties For the AmneziaVPN app Для AmneziaVPN + + + Share VPN Access + Поделиться VPN + Full access Полный доступ + + + Share VPN access without the ability to manage the server + Поделиться доступом к VPN, без возможности управления сервером + + + + Share access to server management. The user with whom you share full access to the server will be able to add and remove any protocols and services to the server, as well as change settings. + Поделиться доступом к управлению сервером. Пользователь, с которым вы делитесь полным доступом к серверу, сможет добавлять и удалять любые протоколы и службы на сервере, а также изменять настройки. + @@ -2700,16 +2728,6 @@ This means that AmneziaWG keeps the fast performance of the original while addin error 0x%1: %2 error 0x%1: %2 - - - WireGuard Configuration Highlighter - - - - - &Randomize colors - - SelectLanguageDrawer diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 8e31af68..c711b3fc 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -131,7 +131,7 @@ Unable change protocol while there is an active connection - 已建立连接时无法更改服务器配置 + 已建立连接时无法更改服务器配置 @@ -380,8 +380,12 @@ Already installed containers were found on the server. All installed containers + All users with whom you shared a connection will no longer be able to connect to it. + 与您共享连接的所有用户将无法再连接到该连接。 + + All users who you shared a connection with will no longer be able to connect to it. - 使用此共享连接的所有用户,将无法再连接它。 + 使用此共享连接的所有用户,将无法再连接它。 @@ -605,8 +609,12 @@ Already installed containers were found on the server. All installed containers + All users with whom you shared a connection will no longer be able to connect to it. + 与您共享连接的所有用户将无法再连接到该连接。 + + All users who you shared a connection with will no longer be able to connect to it. - 使用此共享连接的所有用户,将无法再连接它。 + 使用此共享连接的所有用户,将无法再连接它。 All users with whom you shared a connection will no longer be able to connect to it @@ -661,8 +669,12 @@ Already installed containers were found on the server. All installed containers + All users with whom you shared a connection will no longer be able to connect to it. + 与您共享连接的所有用户将无法再连接到该连接。 + + All users who you shared a connection with will no longer be able to connect to it. - 使用此共享连接的所有用户,将无法再连接它。 + 使用此共享连接的所有用户,将无法再连接它。 from server? @@ -1521,8 +1533,12 @@ And if you don't like the app, all the more support it - the donation will + All users with whom you shared a connection will no longer be able to connect to it. + 与您共享连接的所有用户将无法再连接到该连接。 + + All users who you shared a connection with will no longer be able to connect to it. - 使用此共享连接的所有用户,将无法再连接它。 + 使用此共享连接的所有用户,将无法再连接它。 from server? @@ -2006,8 +2022,22 @@ and will not be shared or disclosed to the Amnezia or any third parties + Share VPN Access + 共享 VPN 访问 + + + + Share VPN access without the ability to manage the server + 共享 VPN 访问,无需管理服务器 + + + + Share access to server management. The user with whom you share full access to the server will be able to add and remove any protocols and services to the server, as well as change settings. + 共享服务器管理访问权限。与您共享服务器全部访问权限的用户将可以添加和删除服务器上的任何协议和服务,以及更改设置。 + + VPN Access - 访问VPN + 访问VPN @@ -2020,14 +2050,12 @@ and will not be shared or disclosed to the Amnezia or any third parties 完全访问 - VPN access without the ability to manage the server - 访问VPN,但没有权限管理服务。 + 访问VPN,但没有权限管理服务。 - Access to server management. The user with whom you share full access to the connection will be able to add and remove your protocols and services to the server, as well as change settings. - 除访问VPN外,用户还能添加和删除协议、服务以及更改配置信息 + 除访问VPN外,用户还能添加和删除协议、服务以及更改配置信息 Access to server management. The user with whom you share full access to the connection will be able to add and remove your protocols and services to the servers, as well as change settings. @@ -2839,16 +2867,6 @@ While it offers a blend of security, stability, and speed, it's essential t error 0x%1: %2 错误 0x%1: %2 - - - WireGuard Configuration Highlighter - - - - - &Randomize colors - - SelectLanguageDrawer diff --git a/client/ui/qml/Pages2/PageProtocolAwgSettings.qml b/client/ui/qml/Pages2/PageProtocolAwgSettings.qml index 079c85a1..237a8b46 100644 --- a/client/ui/qml/Pages2/PageProtocolAwgSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolAwgSettings.qml @@ -276,7 +276,7 @@ PageType { onClicked: { questionDrawer.headerText = qsTr("Remove AmneziaWG from server?") - questionDrawer.descriptionText = qsTr("All users who you shared a connection with will no longer be able to connect to it.") + questionDrawer.descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.") questionDrawer.yesButtonText = qsTr("Continue") questionDrawer.noButtonText = qsTr("Cancel") diff --git a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml index cd2dd51d..55cdcf04 100644 --- a/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolOpenVpnSettings.qml @@ -365,7 +365,7 @@ PageType { onClicked: { questionDrawer.headerText = qsTr("Remove OpenVpn from server?") - questionDrawer.descriptionText = qsTr("All users who you shared a connection with will no longer be able to connect to it.") + questionDrawer.descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.") questionDrawer.yesButtonText = qsTr("Continue") questionDrawer.noButtonText = qsTr("Cancel") diff --git a/client/ui/qml/Pages2/PageProtocolRaw.qml b/client/ui/qml/Pages2/PageProtocolRaw.qml index f3621d96..967b605b 100644 --- a/client/ui/qml/Pages2/PageProtocolRaw.qml +++ b/client/ui/qml/Pages2/PageProtocolRaw.qml @@ -176,7 +176,7 @@ PageType { clickedFunction: function() { questionDrawer.headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getCurrentlyProcessedContainerName()) - questionDrawer.descriptionText = qsTr("All users who you shared a connection with will no longer be able to connect to it.") + questionDrawer.descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.") questionDrawer.yesButtonText = qsTr("Continue") questionDrawer.noButtonText = qsTr("Cancel") diff --git a/client/ui/qml/Pages2/PageSettingsServerProtocol.qml b/client/ui/qml/Pages2/PageSettingsServerProtocol.qml index 30758da4..a961cf56 100644 --- a/client/ui/qml/Pages2/PageSettingsServerProtocol.qml +++ b/client/ui/qml/Pages2/PageSettingsServerProtocol.qml @@ -114,7 +114,7 @@ PageType { clickedFunction: function() { questionDrawer.headerText = qsTr("Remove %1 from server?").arg(ContainersModel.getCurrentlyProcessedContainerName()) - questionDrawer.descriptionText = qsTr("All users who you shared a connection with will no longer be able to connect to it.") + questionDrawer.descriptionText = qsTr("All users with whom you shared a connection will no longer be able to connect to it.") questionDrawer.yesButtonText = qsTr("Continue") questionDrawer.noButtonText = qsTr("Cancel") diff --git a/client/ui/qml/Pages2/PageShare.qml b/client/ui/qml/Pages2/PageShare.qml index 25aad3de..ced7a5ff 100644 --- a/client/ui/qml/Pages2/PageShare.qml +++ b/client/ui/qml/Pages2/PageShare.qml @@ -118,7 +118,7 @@ PageType { Layout.fillWidth: true Layout.topMargin: 24 - headerText: qsTr("VPN Access") + headerText: qsTr("Share VPN Access") } Rectangle { @@ -171,8 +171,8 @@ PageType { Layout.topMargin: 24 Layout.bottomMargin: 24 - text: accessTypeSelector.currentIndex === 0 ? qsTr("VPN access without the ability to manage the server") : - qsTr("Access to server management. The user with whom you share full access to the connection will be able to add and remove your protocols and services to the server, as well as change settings.") + text: accessTypeSelector.currentIndex === 0 ? qsTr("Share VPN access without the ability to manage the server") : + qsTr("Share access to server management. The user with whom you share full access to the server will be able to add and remove any protocols and services to the server, as well as change settings.") color: "#878B91" } From 994aa327455c462a1c985b625a1f8d5f60fb7f92 Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Sun, 22 Oct 2023 17:31:13 +0500 Subject: [PATCH 45/47] added getting awg parameters when adding an already installed awg container --- client/configurators/awg_configurator.cpp | 4 +-- client/core/servercontroller.cpp | 28 +++++++++++++++++++ client/translations/amneziavpn_ru.ts | 10 +++++++ client/translations/amneziavpn_zh_CN.ts | 10 +++++++ client/ui/models/containers_model.cpp | 3 +- client/ui/models/containers_model.h | 2 +- .../qml/Pages2/PageSetupWizardInstalling.qml | 2 +- 7 files changed, 54 insertions(+), 5 deletions(-) diff --git a/client/configurators/awg_configurator.cpp b/client/configurators/awg_configurator.cpp index 8962067a..2bf03359 100644 --- a/client/configurators/awg_configurator.cpp +++ b/client/configurators/awg_configurator.cpp @@ -16,8 +16,6 @@ QString AwgConfigurator::genAwgConfig(const ServerCredentials &credentials, { QString config = WireguardConfigurator::genWireguardConfig(credentials, container, containerConfig, errorCode); - QJsonObject jsonConfig = QJsonDocument::fromJson(config.toUtf8()).object(); - ServerController serverController(m_settings); QString serverConfig = serverController.getTextFileFromContainer(container, credentials, protocols::awg::serverConfigPath, errorCode); @@ -45,6 +43,8 @@ QString AwgConfigurator::genAwgConfig(const ServerCredentials &credentials, config.replace("$UNDERLOAD_PACKET_MAGIC_HEADER", serverConfigMap.value(config_key::underloadPacketMagicHeader)); config.replace("$TRANSPORT_PACKET_MAGIC_HEADER", serverConfigMap.value(config_key::transportPacketMagicHeader)); + QJsonObject jsonConfig = QJsonDocument::fromJson(config.toUtf8()).object(); + jsonConfig[config_key::junkPacketCount] = serverConfigMap.value(config_key::junkPacketCount); jsonConfig[config_key::junkPacketMinSize] = serverConfigMap.value(config_key::junkPacketMinSize); jsonConfig[config_key::junkPacketMaxSize] = serverConfigMap.value(config_key::junkPacketMaxSize); diff --git a/client/core/servercontroller.cpp b/client/core/servercontroller.cpp index 443cd5a3..da76e1ff 100644 --- a/client/core/servercontroller.cpp +++ b/client/core/servercontroller.cpp @@ -834,6 +834,34 @@ ErrorCode ServerController::getAlreadyInstalledContainers(const ServerCredential containerConfig.insert(config_key::port, port); containerConfig.insert(config_key::transport_proto, transportProto); + if (protocol == Proto::Awg) { + QString serverConfig = getTextFileFromContainer(container, credentials, protocols::awg::serverConfigPath, &errorCode); + + QMap serverConfigMap; + auto serverConfigLines = serverConfig.split("\n"); + for (auto &line : serverConfigLines) { + auto trimmedLine = line.trimmed(); + if (trimmedLine.startsWith("[") && trimmedLine.endsWith("]")) { + continue; + } else { + QStringList parts = trimmedLine.split(" = "); + if (parts.count() == 2) { + serverConfigMap.insert(parts[0].trimmed(), parts[1].trimmed()); + } + } + } + + containerConfig[config_key::junkPacketCount] = serverConfigMap.value(config_key::junkPacketCount); + containerConfig[config_key::junkPacketMinSize] = serverConfigMap.value(config_key::junkPacketMinSize); + containerConfig[config_key::junkPacketMaxSize] = serverConfigMap.value(config_key::junkPacketMaxSize); + containerConfig[config_key::initPacketJunkSize] = serverConfigMap.value(config_key::initPacketJunkSize); + containerConfig[config_key::responsePacketJunkSize] = serverConfigMap.value(config_key::responsePacketJunkSize); + containerConfig[config_key::initPacketMagicHeader] = serverConfigMap.value(config_key::initPacketMagicHeader); + containerConfig[config_key::responsePacketMagicHeader] = serverConfigMap.value(config_key::responsePacketMagicHeader); + containerConfig[config_key::underloadPacketMagicHeader] = serverConfigMap.value(config_key::underloadPacketMagicHeader); + containerConfig[config_key::transportPacketMagicHeader] = serverConfigMap.value(config_key::transportPacketMagicHeader); + } + config.insert(config_key::container, ContainerProps::containerToString(container)); } config.insert(ProtocolProps::protoToString(protocol), containerConfig); diff --git a/client/translations/amneziavpn_ru.ts b/client/translations/amneziavpn_ru.ts index f4ef9c0f..316cd076 100644 --- a/client/translations/amneziavpn_ru.ts +++ b/client/translations/amneziavpn_ru.ts @@ -2728,6 +2728,16 @@ This means that AmneziaWG keeps the fast performance of the original while addin error 0x%1: %2 error 0x%1: %2 + + + WireGuard Configuration Highlighter + + + + + &Randomize colors + + SelectLanguageDrawer diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index c711b3fc..592717ab 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -2867,6 +2867,16 @@ While it offers a blend of security, stability, and speed, it's essential t error 0x%1: %2 错误 0x%1: %2 + + + WireGuard Configuration Highlighter + + + + + &Randomize colors + + SelectLanguageDrawer diff --git a/client/ui/models/containers_model.cpp b/client/ui/models/containers_model.cpp index 780809c5..6a4c0e63 100644 --- a/client/ui/models/containers_model.cpp +++ b/client/ui/models/containers_model.cpp @@ -117,8 +117,9 @@ QString ContainersModel::getDefaultContainerName() return ContainerProps::containerHumanNames().value(m_defaultContainerIndex); } -void ContainersModel::setDefaultContainer(DockerContainer container) +void ContainersModel::setDefaultContainer(int index) { + auto container = static_cast(index); m_settings->setDefaultContainer(m_currentlyProcessedServerIndex, container); m_defaultContainerIndex = container; emit defaultContainerChanged(); diff --git a/client/ui/models/containers_model.h b/client/ui/models/containers_model.h index 4ba85749..997b21e3 100644 --- a/client/ui/models/containers_model.h +++ b/client/ui/models/containers_model.h @@ -46,7 +46,7 @@ public: public slots: DockerContainer getDefaultContainer(); QString getDefaultContainerName(); - void setDefaultContainer(DockerContainer container); + void setDefaultContainer(int index); void setCurrentlyProcessedServerIndex(const int index); diff --git a/client/ui/qml/Pages2/PageSetupWizardInstalling.qml b/client/ui/qml/Pages2/PageSetupWizardInstalling.qml index 50aad294..a223f646 100644 --- a/client/ui/qml/Pages2/PageSetupWizardInstalling.qml +++ b/client/ui/qml/Pages2/PageSetupWizardInstalling.qml @@ -25,7 +25,7 @@ PageType { function onInstallContainerFinished(finishedMessage, isServiceInstall) { if (!ConnectionController.isConnected && !isServiceInstall) { - ContainersModel.setDefaultContainer(ContainersModel.getCurrentlyProcessedContainerIndex) + ContainersModel.setDefaultContainer(ContainersModel.getCurrentlyProcessedContainerIndex()) } PageController.goToStartPage() From 7cfb38307e5533dbaddce6578e926a75430bc6ac Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Sun, 22 Oct 2023 18:04:34 +0500 Subject: [PATCH 46/47] removed re-processing of server config for awg --- client/configurators/awg_configurator.cpp | 42 ++++++++--------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/client/configurators/awg_configurator.cpp b/client/configurators/awg_configurator.cpp index 2bf03359..c3e42258 100644 --- a/client/configurators/awg_configurator.cpp +++ b/client/configurators/awg_configurator.cpp @@ -16,44 +16,32 @@ QString AwgConfigurator::genAwgConfig(const ServerCredentials &credentials, { QString config = WireguardConfigurator::genWireguardConfig(credentials, container, containerConfig, errorCode); - ServerController serverController(m_settings); - QString serverConfig = serverController.getTextFileFromContainer(container, credentials, protocols::awg::serverConfigPath, errorCode); + QJsonObject jsonConfig = QJsonDocument::fromJson(config.toUtf8()).object(); + QString awgConfig = jsonConfig.value(config_key::config).toString(); - QMap serverConfigMap; - auto serverConfigLines = serverConfig.split("\n"); - for (auto &line : serverConfigLines) { + QMap configMap; + auto configLines = awgConfig.split("\n"); + for (auto &line : configLines) { auto trimmedLine = line.trimmed(); if (trimmedLine.startsWith("[") && trimmedLine.endsWith("]")) { continue; } else { QStringList parts = trimmedLine.split(" = "); if (parts.count() == 2) { - serverConfigMap.insert(parts[0].trimmed(), parts[1].trimmed()); + configMap.insert(parts[0].trimmed(), parts[1].trimmed()); } } } - config.replace("$JUNK_PACKET_COUNT", serverConfigMap.value(config_key::junkPacketCount)); - config.replace("$JUNK_PACKET_MIN_SIZE", serverConfigMap.value(config_key::junkPacketMinSize)); - config.replace("$JUNK_PACKET_MAX_SIZE", serverConfigMap.value(config_key::junkPacketMaxSize)); - config.replace("$INIT_PACKET_JUNK_SIZE", serverConfigMap.value(config_key::initPacketJunkSize)); - config.replace("$RESPONSE_PACKET_JUNK_SIZE", serverConfigMap.value(config_key::responsePacketJunkSize)); - config.replace("$INIT_PACKET_MAGIC_HEADER", serverConfigMap.value(config_key::initPacketMagicHeader)); - config.replace("$RESPONSE_PACKET_MAGIC_HEADER", serverConfigMap.value(config_key::responsePacketMagicHeader)); - config.replace("$UNDERLOAD_PACKET_MAGIC_HEADER", serverConfigMap.value(config_key::underloadPacketMagicHeader)); - config.replace("$TRANSPORT_PACKET_MAGIC_HEADER", serverConfigMap.value(config_key::transportPacketMagicHeader)); - - QJsonObject jsonConfig = QJsonDocument::fromJson(config.toUtf8()).object(); - - jsonConfig[config_key::junkPacketCount] = serverConfigMap.value(config_key::junkPacketCount); - jsonConfig[config_key::junkPacketMinSize] = serverConfigMap.value(config_key::junkPacketMinSize); - jsonConfig[config_key::junkPacketMaxSize] = serverConfigMap.value(config_key::junkPacketMaxSize); - jsonConfig[config_key::initPacketJunkSize] = serverConfigMap.value(config_key::initPacketJunkSize); - jsonConfig[config_key::responsePacketJunkSize] = serverConfigMap.value(config_key::responsePacketJunkSize); - jsonConfig[config_key::initPacketMagicHeader] = serverConfigMap.value(config_key::initPacketMagicHeader); - jsonConfig[config_key::responsePacketMagicHeader] = serverConfigMap.value(config_key::responsePacketMagicHeader); - jsonConfig[config_key::underloadPacketMagicHeader] = serverConfigMap.value(config_key::underloadPacketMagicHeader); - jsonConfig[config_key::transportPacketMagicHeader] = serverConfigMap.value(config_key::transportPacketMagicHeader); + jsonConfig[config_key::junkPacketCount] = configMap.value(config_key::junkPacketCount); + jsonConfig[config_key::junkPacketMinSize] = configMap.value(config_key::junkPacketMinSize); + jsonConfig[config_key::junkPacketMaxSize] = configMap.value(config_key::junkPacketMaxSize); + jsonConfig[config_key::initPacketJunkSize] = configMap.value(config_key::initPacketJunkSize); + jsonConfig[config_key::responsePacketJunkSize] = configMap.value(config_key::responsePacketJunkSize); + jsonConfig[config_key::initPacketMagicHeader] = configMap.value(config_key::initPacketMagicHeader); + jsonConfig[config_key::responsePacketMagicHeader] = configMap.value(config_key::responsePacketMagicHeader); + jsonConfig[config_key::underloadPacketMagicHeader] = configMap.value(config_key::underloadPacketMagicHeader); + jsonConfig[config_key::transportPacketMagicHeader] = configMap.value(config_key::transportPacketMagicHeader); return QJsonDocument(jsonConfig).toJson(); } From 97090888d5b2f10c900464db1120a29bee034967 Mon Sep 17 00:00:00 2001 From: pokamest Date: Sun, 22 Oct 2023 08:11:37 -0700 Subject: [PATCH 47/47] Bump version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 12fc8dce..2e7be435 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR) set(PROJECT AmneziaVPN) -project(${PROJECT} VERSION 4.0.8.5 +project(${PROJECT} VERSION 4.0.8.6 DESCRIPTION "AmneziaVPN" HOMEPAGE_URL "https://amnezia.org/" )