refactor: refactor the application to the mvvm architecture (#2009)

* refactor: move business logic from servers model

* refactor: move containersModel initialization

* refactor: added protocol ui controller and removed settings class from protocols model

* refactor: moved cli management to separate controller

* refactor: moved app split to separate controller

* refactor: moved site split to separate controller

* refactor: moved allowed dns to separate controller

* refactor: moved language logic to separate ui controller

* refactor: removed Settings from devices model

* refactor: moved configs and services api logit to separate core controller

* refactor: added a layer with a repository between the storage and controllers

* refactor: use child parent system instead of smart pointers for controllers and models initialization

* refactor: moved install functions from server controller to install controller

* refactor: install controller refactoring

* chore: renamed exportController to exportUiController

* refactor: separate export controller

* refactor: removed VpnConfigurationsController

* chore: renamed ServerController to SshSession

* refactor: replaced ServerController to SshSession

* chore: moved qml controllers to separate folder

* chore: include fixes

* chore: moved utils from core root to core/utils

* chore: include fixes

* chore: rename core/utils files to camelCase foramt

* chore: include fixes

* chore: moved some utils to api and selfhosted folders

* chore: include fixes

* chore: remove unused file

* chore: moved serialization folder to core/utils

* chore: include fixes

* chore: moved some files from client root to core/utils

* chore: include fixes

* chore: moved ui utils to ui/utils folder

* chore: include fixes

* chore: move utils from root to ui/utils

* chore: include fixes

* chore: moved configurators to core/configurators

* chore: include fixes

* refactor: moved iap logic from ui controller to core

* refactor: moved remaining core logic from ApiConfigsController to SubscriptionController

* chore: rename apiNewsController to apiNewsUiController

* refactor: moved core logic from news ui controller to core

* chore: renamed apiConfigsController to subscriptionUiController

* chore: include fixes

* refactor: merge ApiSettingsController with SubscriptionUiController

* chore: moved ui selfhosted controllers to separate folder

* chore: include fixes

* chore: rename connectionController to connectiomUiController

* refactor: moved core logic from connectionUiController

* chore: rename settingsController to settingsUiController

* refactor: move core logic from settingsUiController

* refactor: moved core controller signal/slot connections to separate class

* fix: newsController fixes after refactoring

* chore: rename model to camelCase

* chore: include fixes

* chore: remove unused code

* chore: move selfhosted core to separate folder

* chore: include fixes

* chore: rename importController to importUiController

* refactor: move core logic from importUiController

* chore: minor fixes

* chore: remove prem v1 migration

* refactor: remove openvpn over cloak and openvpn over shadowsocks

* refactor: removed protocolsForContainer function

* refactor: add core models

* refactor: replace json with c++ structs for server config

* refactor: move getDnsPair to ServerConfigUtils

* feat: add admin selfhosted config export test

* feat: add multi import test

* refactor: use coreController for tests

* feat: add few simple tests

* chore: qrepos in all core controllers

* feat: add test for settings

* refactor: remove repo dependency from configurators

* chore: moved protocols to core folder

* chore: include fixes

* refactor: moved containersDefs, defs, apiDefs, protocolsDefs to different places

* chore: include fixes

* chore: build fixes

* chore: build fixes

* refactor: remove q repo and interface repo

* feat: add test for ui servers model and controller

* chore: renamed to camelCase

* chore: include fixes

* refactor: moved core logic from sites ui controller

* fix: fixed api config processing

* fix: fixed processed server index processing

* refactor: protocol models now use c++ structs instead of json configs

* refactor: servers model now use c++ struct instead of json config

* fix: fixed default server index processing

* fix: fix logs init

* fix: fix secure settings load keys

* chore: build fixes

* fix: fixed clear settings

* fix: fixed restore backup

* fix: sshSession usage

* fix: fixed export functions signatures

* fix: return missing part from buildContainerWorker

* fix: fixed server description on page home

* refactor: add container config helpers functions

* refactor: c++ structs instead of json

* chore: add dns protocol config struct

* refactor: move config utils functions to config structs

* feat: add test for selfhosted server setup

* refactor: separate resources.qrc

* fix: fixed server rename

* chore: return nameOverriddenByUser

* fix: build fixes

* fix: fixed models init

* refactor: cleanup models usage

* fix: fixed models init

* chore: cleanup connections and functions signatures

* chore: cleanup updateModel calls

* feat: added cache to servers repo

* chore: cleanup unused functions

* chore: ssxray processing

* chore: remove transportProtoWithDefault and portWithDefault functions

* chore: removed proto types any and l2tp

* refactor: moved some constants

* fix: fixed native configs export

* refactor: remove json from processConfigWith functions

* fix: fixed processed server index usage

* fix: qml warning fixes

* chore: merge fixes

* chore: update tests

* fix: fixed xray config processing

* fix: fixed split tunneling processing

* chore: rename sites controllers and model

* chore: rename fixes

* chore: minor fixes

* chore: remove ability to load backup from "file with connection settings" button

* fix: fixed api device revoke

* fix: remove full model update when renaming a user

* fix: fixed premium/free server rename

* fix: fixed selfhosted new server install

* fix: fixed updateContainer function

* fix: fixed revoke for external premium configs

* feat: add native configs qr processing

* chore: codestyle fixes

* fix: fixed admin config create

* chore: again remove ability to load backup from "file with connection settings" button

* chore: minor fixes

* fix: fixed variables initialization

* fix: fixed qml imports

* fix: minor fixes

* fix: fix vpnConnection function calls

* feat: add buckup error handling

* fix: fixed admin config revok

* fix: fixed selfhosted awg installation

* fix: ad visability

* feat: add empty check for primary dns

* chore: minor fixes
This commit is contained in:
vkamn
2026-04-30 14:53:03 +08:00
committed by GitHub
parent 2edd7de413
commit 847bb6923b
469 changed files with 25992 additions and 17154 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ PageType {
BaseHeaderType {
Layout.fillWidth: true
Layout.topMargin: 20 + SettingsController.safeAreaTopMargin
Layout.topMargin: 20 + PageController.safeAreaTopMargin
Layout.leftMargin: 16
Layout.rightMargin: 16
+1 -1
View File
@@ -20,7 +20,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
}
ListViewType {
+19 -16
View File
@@ -6,7 +6,6 @@ import Qt5Compat.GraphicalEffects
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import ContainersModelFilters 1.0
import Style 1.0
@@ -20,6 +19,8 @@ import "../Components"
PageType {
id: root
property var containersDropDownRef: null
Connections {
target: Qt.application
@@ -42,8 +43,8 @@ PageType {
function onRestorePageHomeState(isContainerInstalled) {
drawer.openTriggered()
if (isContainerInstalled) {
containersDropDown.rootButtonClickedFunction()
if (isContainerInstalled && root.containersDropDownRef) {
root.containersDropDownRef.rootButtonClickedFunction()
}
}
}
@@ -59,7 +60,7 @@ PageType {
objectName: "homeColumnLayout"
anchors.fill: parent
anchors.topMargin: 12 + SettingsController.safeAreaTopMargin
anchors.topMargin: 12 + PageController.safeAreaTopMargin
anchors.bottomMargin: 16
BasicButtonType {
@@ -147,8 +148,8 @@ PageType {
buttonTextLabel.font.pixelSize: 14
buttonTextLabel.font.weight: 500
property bool isSplitTunnelingEnabled: SitesModel.isTunnelingEnabled || AppSplitTunnelingModel.isTunnelingEnabled ||
ServersModel.isDefaultServerDefaultContainerHasSplitTunneling
property bool isSplitTunnelingEnabled: IpSplitTunnelingController.isSplitTunnelingEnabled || AppSplitTunnelingController.isSplitTunnelingEnabled ||
ServersUiController.isDefaultServerDefaultContainerHasSplitTunneling
text: isSplitTunnelingEnabled ? qsTr("Split tunneling enabled") : qsTr("Split tunneling disabled")
@@ -268,7 +269,7 @@ PageType {
maximumLineCount: 2
elide: Qt.ElideRight
text: ServersModel.defaultServerName
text: ServersUiController.defaultServerName
horizontalAlignment: Qt.AlignHCenter
Behavior on opacity {
@@ -310,11 +311,11 @@ PageType {
objectName: "rowLayoutLabel"
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.topMargin: 8
Layout.bottomMargin: drawer.isCollapsedStateActive ? 44 : ServersModel.isDefaultServerFromApi ? 61 : 16
Layout.bottomMargin: drawer.isCollapsedStateActive ? 44 : ServersUiController.isDefaultServerFromApi ? 61 : 16
spacing: 0
BasicButtonType {
enabled: (ServersModel.defaultServerImagePathCollapsed !== "") && drawer.isCollapsedStateActive
enabled: (ServersUiController.defaultServerImagePathCollapsed !== "") && drawer.isCollapsedStateActive
hoverEnabled: enabled
implicitHeight: 36
@@ -332,8 +333,8 @@ PageType {
buttonTextLabel.font.pixelSize: 13
buttonTextLabel.font.weight: 400
text: drawer.isCollapsedStateActive ? ServersModel.defaultServerDescriptionCollapsed : ServersModel.defaultServerDescriptionExpanded
leftImageSource: ServersModel.defaultServerImagePathCollapsed
text: drawer.isCollapsedStateActive ? ServersUiController.defaultServerDescriptionCollapsed : ServersUiController.defaultServerDescriptionExpanded
leftImageSource: ServersUiController.defaultServerImagePathCollapsed
leftImageColor: ""
changeLeftImageSize: false
@@ -343,14 +344,14 @@ PageType {
Keys.onReturnPressed: this.clicked()
onClicked: {
ServersModel.processedIndex = ServersModel.defaultIndex
ServersUiController.processedIndex = ServersUiController.defaultIndex
if (ServersModel.getProcessedServerData("isServerFromGatewayApi")) {
if (ServersModel.getProcessedServerData("isCountrySelectionAvailable")) {
PageController.goToPage(PageEnum.PageSettingsApiAvailableCountries)
} else {
PageController.showBusyIndicator(true)
let result = ApiSettingsController.getAccountInfo(false)
let result = SubscriptionUiController.getAccountInfo(ServersUiController.getProcessedServerIndex(), false)
PageController.showBusyIndicator(false)
if (!result) {
return
@@ -378,12 +379,14 @@ PageType {
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
spacing: 8
visible: !ServersModel.isDefaultServerFromApi
visible: !ServersUiController.isDefaultServerFromApi
DropDownType {
id: containersDropDown
objectName: "containersDropDown"
Component.onCompleted: root.containersDropDownRef = containersDropDown
rootButtonImageColor: AmneziaStyle.color.midnightBlack
rootButtonBackgroundColor: AmneziaStyle.color.paleGray
rootButtonBackgroundHoveredColor: AmneziaStyle.color.mistyGray
@@ -395,7 +398,7 @@ PageType {
enabled: drawer.isOpened
text: ServersModel.defaultServerDefaultContainerName
text: ServersUiController.defaultServerDefaultContainerName
textColor: AmneziaStyle.color.midnightBlack
headerText: qsTr("VPN protocol")
headerBackButtonImage: "qrc:/images/controls/arrow-left.svg"
@@ -415,7 +418,7 @@ PageType {
Connections {
objectName: "rowLayoutConnections"
target: ServersModel
target: ServersUiController
function onDefaultServerIndexChanged() {
updateContainersModelFilters()
@@ -5,6 +5,7 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import "./"
import "../Controls2"
@@ -22,7 +23,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
@@ -434,13 +435,13 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ServersUiController.processedContainerIndex) {
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
return
}
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(AwgConfigModel.getConfig())
InstallController.updateContainer(ServersUiController.processedIndex, ServersUiController.processedContainerIndex, ProtocolEnum.Awg)
}
var noButtonFunction = function() {}
@@ -7,6 +7,7 @@ import QtCore
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import Style 1.0
import "./"
@@ -25,7 +26,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
@@ -55,7 +56,7 @@ PageType {
width: listView.width
property alias vpnAddressSubnetTextField: vpnAddressSubnetTextField
property bool isEnabled: ServersModel.isProcessedServerHasWriteAccess()
property bool isEnabled: ServersUiController.isProcessedServerHasWriteAccess()
spacing: 0
@@ -554,13 +555,13 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ServersUiController.processedContainerIndex) {
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
return
}
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(AwgConfigModel.getConfig())
InstallController.updateContainer(ServersUiController.processedIndex, ServersUiController.processedContainerIndex, ProtocolEnum.Awg)
}
var noButtonFunction = function() {}
@@ -1,218 +0,0 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
import "../Components"
PageType {
id: root
BackButtonType {
id: backButton
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
listView.positionViewAtBeginning()
}
}
}
ListViewType {
id: listView
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
property int selectedIndex: 0
enabled: ServersModel.isProcessedServerHasWriteAccess()
header: ColumnLayout {
width: listView.width
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Cloak settings")
}
}
model: CloakConfigModel
delegate: ColumnLayout {
width: listView.width
property alias trafficFromField: trafficFromField
spacing: 0
TextFieldWithHeaderType {
id: trafficFromField
Layout.fillWidth: true
Layout.topMargin: 32
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Disguised as traffic from")
textField.text: site
textField.onEditingFinished: {
if (textField.text !== site) {
var tmpText = textField.text
tmpText = tmpText.toLocaleLowerCase()
var indexHttps = tmpText.indexOf("https://")
if (indexHttps === 0) {
tmpText = textField.text.substring(8)
} else {
site = textField.text
}
}
}
checkEmptyText: true
}
TextFieldWithHeaderType {
id: portTextField
Layout.fillWidth: true
Layout.topMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Port")
textField.text: port
textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 }
textField.onEditingFinished: {
if (textField.text !== port) {
port = textField.text
}
}
checkEmptyText: true
}
DropDownType {
id: cipherDropDown
Layout.fillWidth: true
Layout.topMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
descriptionText: qsTr("Cipher")
headerText: qsTr("Cipher")
drawerParent: root
listView: ListViewWithRadioButtonType {
id: cipherListView
rootWidth: root.width
model: ListModel {
ListElement { name : "chacha20-ietf-poly1305" }
ListElement { name : "xchacha20-ietf-poly1305" }
ListElement { name : "aes-256-gcm" }
ListElement { name : "aes-192-gcm" }
ListElement { name : "aes-128-gcm" }
}
function updateSelectedIndex() {
cipherDropDown.text = cipher
for (var i = 0; i < cipherListView.model.count; i++) {
if (cipherListView.model.get(i).name === cipher) {
selectedIndex = i
break
}
}
}
clickedFunction: function() {
cipherDropDown.text = selectedText
cipher = cipherDropDown.text
cipherDropDown.closeTriggered()
}
Component.onCompleted: {
updateSelectedIndex()
}
}
Connections {
target: listView.model
function onDataChanged() {
cipherListView.updateSelectedIndex()
}
}
}
BasicButtonType {
id: saveButton
Layout.fillWidth: true
Layout.topMargin: 24
Layout.bottomMargin: 24
Layout.leftMargin: 16
Layout.rightMargin: 16
enabled: trafficFromField.errorText === "" &&
portTextField.errorText === ""
text: qsTr("Save")
clickedFunc: function() {
forceActiveFocus()
var headerText = qsTr("Save settings?")
var descriptionText = qsTr("All users with whom you shared a connection with will no longer be able to connect to it.")
var yesButtonText = qsTr("Continue")
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
return
}
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
InstallController.updateContainer(CloakConfigModel.getConfig())
}
var noButtonFunction = function() {
if (!GC.isMobile()) {
saveButton.forceActiveFocus()
}
}
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
}
Keys.onEnterPressed: saveButton.clicked()
Keys.onReturnPressed: saveButton.clicked()
}
}
}
}
@@ -5,7 +5,7 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ContainerEnum 1.0
import ProtocolEnum 1.0
import Style 1.0
import "./"
@@ -23,7 +23,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
@@ -40,7 +40,7 @@ PageType {
anchors.right: parent.right
anchors.left: parent.left
enabled: ServersModel.isProcessedServerHasWriteAccess()
enabled: ServersUiController.isProcessedServerHasWriteAccess()
header: ColumnLayout {
width: listView.width
@@ -428,13 +428,13 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ServersUiController.processedContainerIndex) {
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
return
}
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(OpenVpnConfigModel.getConfig())
InstallController.updateContainer(ServersUiController.processedIndex, ServersUiController.processedContainerIndex, ProtocolEnum.OpenVpn)
}
var noButtonFunction = function() {
if (!GC.isMobile()) {
+3 -5
View File
@@ -5,8 +5,6 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerEnum 1.0
import ContainerProps 1.0
import Style 1.0
@@ -25,7 +23,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -173,7 +171,7 @@ PageType {
width: parent.width
visible: ServersModel.isProcessedServerHasWriteAccess()
visible: ServersUiController.isProcessedServerHasWriteAccess()
text: qsTr("Remove ") + ContainersModel.getProcessedContainerName()
textColor: AmneziaStyle.color.vibrantRed
@@ -186,7 +184,7 @@ PageType {
var yesButtonFunction = function() {
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeProcessedContainer()
InstallController.removeContainer(ServersUiController.processedIndex, ServersUiController.processedContainerIndex)
}
var noButtonFunction = function() {}
@@ -1,184 +0,0 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Config"
import "../Components"
PageType {
id: root
BackButtonType {
id: backButton
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
listView.positionViewAtBeginning()
}
}
}
ListViewType {
id: listView
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
enabled: ServersModel.isProcessedServerHasWriteAccess()
model: ShadowSocksConfigModel
delegate: ColumnLayout {
width: listView.width
spacing: 0
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Shadowsocks settings")
}
TextFieldWithHeaderType {
id: portTextField
Layout.fillWidth: true
Layout.topMargin: 40
Layout.leftMargin: 16
Layout.rightMargin: 16
enabled: listView.enabled
headerText: qsTr("Port")
textField.text: port
textField.maximumLength: 5
textField.validator: IntValidator { bottom: 1; top: 65535 }
textField.onEditingFinished: {
if (textField.text !== port) {
port = textField.text
}
}
checkEmptyText: true
}
DropDownType {
id: cipherDropDown
Layout.fillWidth: true
Layout.topMargin: 20
Layout.leftMargin: 16
Layout.rightMargin: 16
enabled: listView.enabled
descriptionText: qsTr("Cipher")
headerText: qsTr("Cipher")
drawerParent: root
listView: ListViewWithRadioButtonType {
id: cipherListView
rootWidth: root.width
model: ListModel {
ListElement { name : "chacha20-ietf-poly1305" }
ListElement { name : "xchacha20-ietf-poly1305" }
ListElement { name : "aes-256-gcm" }
ListElement { name : "aes-192-gcm" }
ListElement { name : "aes-128-gcm" }
}
function updateSelectedIndex() {
cipherDropDown.text = cipher
for (var i = 0; i < cipherListView.model.count; i++) {
if (cipherListView.model.get(i).name === cipher) {
selectedIndex = i
break
}
}
}
clickedFunction: function() {
cipherDropDown.text = selectedText
cipher = cipherDropDown.text
cipherDropDown.closeTriggered()
}
Component.onCompleted: {
updateSelectedIndex()
}
}
Connections {
target: listView.model
function onDataChanged() {
cipherListView.updateSelectedIndex()
}
}
}
BasicButtonType {
id: saveButton
Layout.fillWidth: true
Layout.topMargin: 24
Layout.bottomMargin: 24
Layout.leftMargin: 16
Layout.rightMargin: 16
enabled: portTextField.errorText === ""
text: qsTr("Save")
clickedFunc: function() {
forceActiveFocus()
var headerText = qsTr("Save settings?")
var descriptionText = qsTr("All users with whom you shared a connection with will no longer be able to connect to it.")
var yesButtonText = qsTr("Continue")
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
return
}
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(ShadowSocksConfigModel.getConfig())
}
var noButtonFunction = function() {
if (!GC.isMobile()) {
saveButton.forceActiveFocus()
}
}
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
}
Keys.onEnterPressed: saveButton.clicked()
Keys.onReturnPressed: saveButton.clicked()
}
}
}
}
@@ -5,6 +5,7 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import "./"
import "../Controls2"
@@ -22,7 +23,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -122,13 +123,13 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ServersUiController.processedContainerIndex) {
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
return
}
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(WireGuardConfigModel.getConfig())
InstallController.updateContainer(ServersUiController.processedIndex, ServersUiController.processedContainerIndex, ProtocolEnum.WireGuard)
}
var noButtonFunction = function() {}
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
@@ -5,6 +5,7 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import Style 1.0
import "./"
@@ -22,7 +23,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -39,14 +40,14 @@ PageType {
anchors.right: parent.right
anchors.left: parent.left
enabled: ServersModel.isProcessedServerHasWriteAccess()
enabled: ServersUiController.isProcessedServerHasWriteAccess()
model: WireGuardConfigModel
delegate: ColumnLayout {
width: listView.width
property bool isEnabled: ServersModel.isProcessedServerHasWriteAccess()
property bool isEnabled: ServersUiController.isProcessedServerHasWriteAccess()
spacing: 0
@@ -122,13 +123,13 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ServersUiController.processedContainerIndex) {
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
return
}
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(WireGuardConfigModel.getConfig())
InstallController.updateContainer(ServersUiController.processedIndex, ServersUiController.processedContainerIndex, ProtocolEnum.WireGuard)
}
var noButtonFunction = function() {
if (!GC.isMobile()) {
@@ -5,7 +5,7 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ContainerEnum 1.0
import ProtocolEnum 1.0
import Style 1.0
import "./"
@@ -23,7 +23,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -40,7 +40,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
enabled: ServersModel.isProcessedServerHasWriteAccess()
enabled: ServersUiController.isProcessedServerHasWriteAccess()
model: XrayConfigModel
delegate: ColumnLayout {
@@ -133,13 +133,13 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ServersUiController.processedContainerIndex) {
PageController.showNotificationMessage(qsTr("Unable change settings while there is an active connection"))
return
}
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.updateContainer(XrayConfigModel.getConfig())
InstallController.updateContainer(ServersUiController.processedIndex, ServersUiController.processedContainerIndex, ProtocolEnum.Xray)
}
var noButtonFunction = function() {
if (!GC.isMobile()) {
@@ -22,7 +22,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -60,6 +60,7 @@ PageType {
width: listView.width
LabelWithButtonType {
id: removeButton
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
@@ -73,12 +74,12 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected
if (ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected
&& SettingsController.isAmneziaDnsEnabled()) {
PageController.showNotificationMessage(qsTr("Cannot remove AmneziaDNS from running server"))
} else {
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeProcessedContainer()
InstallController.removeContainer(ServersUiController.processedIndex, ServersUiController.processedContainerIndex)
}
}
var noButtonFunction = function() {}
@@ -30,7 +30,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -47,7 +47,7 @@ PageType {
anchors.right: parent.right
anchors.left: parent.left
enabled: ServersModel.isProcessedServerHasWriteAccess()
enabled: ServersUiController.isProcessedServerHasWriteAccess()
model: SftpConfigModel
@@ -173,7 +173,7 @@ PageType {
clickedFunc: function() {
PageController.showBusyIndicator(true)
InstallController.mountSftpDrive(port, password, username)
InstallController.mountSftpDrive(ServersUiController.processedIndex, port, password, username)
PageController.showBusyIndicator(false)
}
}
@@ -5,6 +5,7 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import Style 1.0
@@ -31,7 +32,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -284,7 +285,7 @@ PageType {
}
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
InstallController.updateContainer(Socks5ProxyConfigModel.getConfig())
InstallController.updateContainer(ServersUiController.processedIndex, ServersUiController.processedContainerIndex, ProtocolEnum.Socks5Proxy)
tempPort = portTextField.textField.text
tempUsername = usernameTextField.textField.text
tempPassword = passwordTextField.textField.text
@@ -31,7 +31,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -60,7 +60,7 @@ PageType {
}
}
model: 1 // fake model to force the ListView to be created without a model
model: TorConfigModel
delegate: ColumnLayout { // TODO(CyAn84): add DelegateChooser after migrate to 6.9
width: listView.width
@@ -73,11 +73,7 @@ PageType {
Layout.bottomMargin: 24
text: qsTr("Website address")
descriptionText: {
var containerIndex = ContainersModel.getProcessedContainerIndex()
var config = ContainersModel.getContainerConfig(containerIndex)
return config[ContainerProps.containerTypeToString(containerIndex)]["site"]
}
descriptionText: site || ""
descriptionOnTop: true
textColor: AmneziaStyle.color.goldenApricot
+3 -3
View File
@@ -40,7 +40,7 @@ PageType {
BaseHeaderType {
id: header
Layout.fillWidth: true
Layout.topMargin: 24 + SettingsController.safeAreaTopMargin
Layout.topMargin: 24 + PageController.safeAreaTopMargin
Layout.bottomMargin: 16
Layout.rightMargin: 16
Layout.leftMargin: 16
@@ -149,9 +149,9 @@ PageType {
property string title: qsTr("News & Notifications")
readonly property string leftImagePath: NewsModel.hasUnread && SettingsController.isNewsNotificationsEnabled() ? "qrc:/images/controls/news-unread.svg" : "qrc:/images/controls/news.svg"
property bool isVisible: ServersModel.hasServersFromGatewayApi
property bool isVisible: ServersUiController.hasServersFromGatewayApi
readonly property var clickedHandler: function() {
if (!ServersModel.hasServersFromGatewayApi) {
if (!ServersUiController.hasServersFromGatewayApi) {
return;
}
PageController.showBusyIndicator(true)
+3 -3
View File
@@ -20,7 +20,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
@@ -170,7 +170,7 @@ PageType {
text: qsTr("Privacy Policy")
clickedFunc: function() {
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl("policy"))
Qt.openUrlExternally(LanguageUiController.getCurrentSiteUrl("policy"))
}
}
}
@@ -223,7 +223,7 @@ PageType {
readonly property string description: qsTr("Visit official website")
readonly property string imageSource: "qrc:/images/controls/amnezia.svg"
readonly property var handler: function() {
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl())
Qt.openUrlExternally(LanguageUiController.getCurrentSiteUrl())
}
}
}
@@ -90,7 +90,7 @@ PageType {
id: backButton
objectName: "backButton"
Layout.topMargin: 20 + SettingsController.safeAreaTopMargin
Layout.topMargin: 20 + PageController.safeAreaTopMargin
}
HeaderTypeWithButton {
@@ -108,7 +108,7 @@ PageType {
actionButtonFunction: function() {
PageController.showBusyIndicator(true)
let result = ApiSettingsController.getAccountInfo(false)
let result = SubscriptionUiController.getAccountInfo(ServersUiController.getProcessedServerIndex(), false)
PageController.showBusyIndicator(false)
if (!result) {
return
@@ -148,7 +148,7 @@ PageType {
text: qsTr("Renew subscription")
clickedFunc: function() {
ApiSettingsController.getRenewalLink()
SubscriptionUiController.getRenewalLink(ServersUiController.getProcessedServerIndex())
}
}
@@ -200,7 +200,7 @@ PageType {
PageController.showBusyIndicator(true)
var prevIndex = ApiCountryModel.currentIndex
ApiCountryModel.currentIndex = index
if (!ApiConfigsController.updateServiceFromGateway(ServersModel.defaultIndex, countryCode, countryName)) {
if (!SubscriptionUiController.updateServiceFromGateway(ServersUiController.getProcessedServerIndex(), countryCode, countryName)) {
ApiCountryModel.currentIndex = prevIndex
}
PageController.showBusyIndicator(false)
@@ -23,7 +23,7 @@ PageType {
id: listView
anchors.fill: parent
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
anchors.bottomMargin: 24
model: ApiDevicesModel
@@ -71,7 +71,7 @@ PageType {
rightImageSource: "qrc:/images/controls/trash.svg"
clickedFunction: function() {
if (isCurrentDevice && ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
if (isCurrentDevice && ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot unlink device during active connection"))
return
}
@@ -82,7 +82,8 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
Qt.callLater(deactivateExternalDevice, supportTag, countryCode)
var serverIndex = ServersUiController.getProcessedServerIndex()
Qt.callLater(deactivateExternalDevice, serverIndex, supportTag, countryCode)
}
var noButtonFunction = function() {
}
@@ -95,10 +96,10 @@ PageType {
}
}
function deactivateExternalDevice(supportTag, countryCode) {
function deactivateExternalDevice(serverIndex, supportTag, countryCode) {
PageController.showBusyIndicator(true)
if (ApiConfigsController.deactivateExternalDevice(supportTag, countryCode)) {
ApiSettingsController.getAccountInfo(true)
if (SubscriptionUiController.deactivateExternalDevice(serverIndex, supportTag, countryCode)) {
SubscriptionUiController.getAccountInfo(serverIndex, true)
}
PageController.showBusyIndicator(false)
}
@@ -79,7 +79,7 @@ PageType {
id: listView
anchors.fill: parent
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
anchors.bottomMargin: 24
model: instructionsModel
@@ -114,7 +114,7 @@ PageType {
rightImageSource: "qrc:/images/controls/external-link.svg"
clickedFunction: function() {
Qt.openUrlExternally(LanguageModel.getCurrentDocsUrl(link))
Qt.openUrlExternally(LanguageUiController.getCurrentDocsUrl(link))
}
}
@@ -28,7 +28,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
@@ -191,9 +191,9 @@ PageType {
}
if (fileName !== "") {
PageController.showBusyIndicator(true)
let result = ApiConfigsController.exportNativeConfig(countryCode, fileName)
let result = SubscriptionUiController.exportNativeConfig(ServersUiController.getProcessedServerIndex(), countryCode, fileName)
if (result) {
ApiSettingsController.getAccountInfo(true)
SubscriptionUiController.getAccountInfo(ServersUiController.getProcessedServerIndex(), true)
}
PageController.showBusyIndicator(false)
@@ -205,9 +205,9 @@ PageType {
function revokeConfig(countryCode) {
PageController.showBusyIndicator(true)
let result = ApiConfigsController.revokeNativeConfig(countryCode)
let result = SubscriptionUiController.revokeNativeConfig(ServersUiController.getProcessedServerIndex(), countryCode)
if (result) {
ApiSettingsController.getAccountInfo(true)
SubscriptionUiController.getAccountInfo(ServersUiController.getProcessedServerIndex(), true)
}
PageController.showBusyIndicator(false)
@@ -117,7 +117,7 @@ PageType {
id: backButton
objectName: "backButton"
Layout.topMargin: 20 + SettingsController.safeAreaTopMargin
Layout.topMargin: 20 + PageController.safeAreaTopMargin
}
HeaderTypeWithButton {
@@ -186,7 +186,7 @@ PageType {
textColor: AmneziaStyle.color.midnightBlack
clickedFunc: function() {
ApiSettingsController.getRenewalLink()
SubscriptionUiController.getRenewalLink(ServersUiController.getProcessedServerIndex())
}
}
}
@@ -246,7 +246,7 @@ PageType {
text: qsTr("Renew subscription")
clickedFunc: function() {
ApiSettingsController.getRenewalLink()
SubscriptionUiController.getRenewalLink(ServersUiController.getProcessedServerIndex())
}
}
@@ -258,7 +258,7 @@ PageType {
SwitcherType {
id: switcher
readonly property bool isVlessProtocol: ApiConfigsController.isVlessProtocol()
readonly property bool isVlessProtocol: SubscriptionUiController.isVlessProtocol(ServersUiController.getProcessedServerIndex())
readonly property bool isProtocolSwitchBlocked: ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected
Layout.fillWidth: true
@@ -272,12 +272,12 @@ PageType {
text: qsTr("Use VLESS protocol")
checked: switcher.isVlessProtocol
onToggled: function() {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
if (ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot change protocol during active connection"))
} else {
PageController.showBusyIndicator(true)
ApiConfigsController.setCurrentProtocol(switcher.isVlessProtocol ? "awg" : "vless")
ApiConfigsController.updateServiceFromGateway(ServersModel.processedIndex, "", "", true)
SubscriptionUiController.setCurrentProtocol(ServersUiController.getProcessedServerIndex(), switcher.isVlessProtocol ? "awg" : "vless")
SubscriptionUiController.updateServiceFromGateway(ServersUiController.processedIndex, "", "", true)
PageController.showBusyIndicator(false)
}
}
@@ -325,7 +325,7 @@ PageType {
PageController.goToPage(PageEnum.PageSettingsApiSubscriptionKey)
PageController.showBusyIndicator(true)
ApiConfigsController.prepareVpnKeyExport()
SubscriptionUiController.prepareVpnKeyExport(ServersUiController.getProcessedServerIndex())
PageController.showBusyIndicator(false)
}
@@ -346,7 +346,7 @@ PageType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
ApiSettingsController.updateApiCountryModel()
SubscriptionUiController.updateApiCountryModel()
PageController.goToPage(PageEnum.PageSettingsApiNativeConfigs)
}
}
@@ -366,7 +366,7 @@ PageType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
ApiSettingsController.updateApiDevicesModel()
SubscriptionUiController.updateApiDevicesModel()
PageController.goToPage(PageEnum.PageSettingsApiDevices)
}
}
@@ -427,11 +427,11 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
if (ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot reload API config during active connection"))
} else {
PageController.showBusyIndicator(true)
ApiConfigsController.updateServiceFromGateway(ServersModel.processedIndex, "", "", true)
SubscriptionUiController.updateServiceFromGateway(ServersUiController.processedIndex, "", "", true)
PageController.showBusyIndicator(false)
}
}
@@ -465,12 +465,12 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
if (ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot unlink device during active connection"))
} else {
PageController.showBusyIndicator(true)
if (ApiConfigsController.deactivateDevice(false)) {
ApiSettingsController.getAccountInfo(true)
if (SubscriptionUiController.deactivateDevice(ServersUiController.getProcessedServerIndex(), false)) {
SubscriptionUiController.getAccountInfo(ServersUiController.getProcessedServerIndex(), true)
}
PageController.showBusyIndicator(false)
}
@@ -502,11 +502,11 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
if (ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot remove server during active connection"))
} else {
PageController.showBusyIndicator(true)
InstallController.removeProcessedServer()
InstallController.removeServer(ServersUiController.getProcessedServerIndex())
PageController.showBusyIndicator(false)
}
}
@@ -48,7 +48,7 @@ PageType {
Component.onCompleted: {
PageController.showBusyIndicator(true)
ApiConfigsController.prepareVpnKeyExport()
SubscriptionUiController.prepareVpnKeyExport(ServersUiController.getProcessedServerIndex())
PageController.showBusyIndicator(false)
}
@@ -61,7 +61,7 @@ PageType {
width: root.width
BackButtonType {
Layout.topMargin: 20 + SettingsController.safeAreaTopMargin
Layout.topMargin: 20 + PageController.safeAreaTopMargin
}
Label {
@@ -86,7 +86,7 @@ PageType {
leftImageSource: "qrc:/images/controls/copy.svg"
clickedFunc: function() {
ApiConfigsController.copyVpnKeyToClipboard()
SubscriptionUiController.copyVpnKeyToClipboard()
PageController.showNotificationMessage(qsTr("Copied"))
}
}
@@ -119,7 +119,7 @@ PageType {
if (fileName !== "") {
PageController.showBusyIndicator(true)
ApiConfigsController.exportVpnKey(fileName)
SubscriptionUiController.exportVpnKey(ServersUiController.getProcessedServerIndex(), fileName)
PageController.showBusyIndicator(false)
}
}
@@ -141,7 +141,7 @@ PageType {
clickedFunc: function() {
PageController.showBusyIndicator(true)
ApiConfigsController.prepareVpnKeyExport()
SubscriptionUiController.prepareVpnKeyExport(ServersUiController.getProcessedServerIndex())
PageController.showBusyIndicator(false)
vpnKeyDrawer.openTriggered()
}
@@ -155,7 +155,7 @@ PageType {
Layout.leftMargin: 16
Layout.rightMargin: 16
visible: ApiConfigsController.qrCodesCount > 0
visible: SubscriptionUiController.qrCodesCount > 0
color: "white"
radius: 12
@@ -165,7 +165,7 @@ PageType {
fillMode: Image.PreserveAspectFit
sourceSize.width: parent.width
sourceSize.height: parent.height
source: ApiConfigsController.qrCodesCount > 0 && ApiConfigsController.qrCodes[0] ? ApiConfigsController.qrCodes[0] : ""
source: SubscriptionUiController.qrCodesCount > 0 && SubscriptionUiController.qrCodes[0] ? SubscriptionUiController.qrCodes[0] : ""
}
}
@@ -175,7 +175,7 @@ PageType {
Layout.bottomMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
visible: ApiConfigsController.qrCodesCount > 0
visible: SubscriptionUiController.qrCodesCount > 0
horizontalAlignment: Text.AlignHCenter
text: qsTr("To read the QR code in the Amnezia app, tap + in the main menu → 'QR code'")
}
@@ -219,7 +219,7 @@ PageType {
font.pixelSize: 16
font.weight: Font.Medium
font.family: "PT Root UI VF"
text: ApiConfigsController.vpnKey
text: SubscriptionUiController.vpnKey
wrapMode: Text.Wrap
background: Rectangle { color: AmneziaStyle.color.transparent }
}
@@ -59,7 +59,7 @@ PageType {
id: listView
anchors.fill: parent
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
anchors.bottomMargin: 24
model: supportModel
@@ -8,7 +8,6 @@ import QtCore
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import Style 1.0
@@ -59,7 +58,7 @@ PageType {
}
function getRouteModesModelIndex() {
var currentRouteMode = AppSplitTunnelingModel.routeMode
var currentRouteMode = AppSplitTunnelingController.routeMode
if ((routeMode.onlyForwardApps === currentRouteMode) || (routeMode.allApps === currentRouteMode)) {
return 0
} else if (routeMode.allExceptApps === currentRouteMode) {
@@ -74,7 +73,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
BackButtonType {
id: backButton
@@ -90,11 +89,11 @@ PageType {
enabled: root.pageEnabled
showSwitcher: true
switcher {
checked: AppSplitTunnelingModel.isTunnelingEnabled
checked: AppSplitTunnelingController.isSplitTunnelingEnabled
enabled: root.pageEnabled
}
switcherFunction: function(checked) {
AppSplitTunnelingModel.toggleSplitTunneling(checked)
AppSplitTunnelingController.toggleSplitTunneling(checked)
selector.text = root.routeModesModel[getRouteModesModelIndex()].name
}
}
@@ -124,13 +123,13 @@ PageType {
clickedFunction: function() {
selector.text = selectedText
selector.closeTriggered()
if (AppSplitTunnelingModel.routeMode !== root.routeModesModel[selectedIndex].type) {
AppSplitTunnelingModel.routeMode = root.routeModesModel[selectedIndex].type
if (AppSplitTunnelingController.routeMode !== root.routeModesModel[selectedIndex].type) {
AppSplitTunnelingController.routeMode = root.routeModesModel[selectedIndex].type
}
}
Component.onCompleted: {
if (root.routeModesModel[selectedIndex].type === AppSplitTunnelingModel.routeMode) {
if (root.routeModesModel[selectedIndex].type === AppSplitTunnelingController.routeMode) {
selector.text = selectedText
} else {
selector.text = root.routeModesModel[0].name
@@ -138,7 +137,7 @@ PageType {
}
Connections {
target: AppSplitTunnelingModel
target: AppSplitTunnelingController
function onRouteModeChanged() {
selectedIndex = getRouteModesModelIndex()
}
@@ -166,7 +165,7 @@ PageType {
anchors.top: header.bottom
anchors.bottom: parent.bottom
anchors.bottomMargin: addAppButton.implicitHeight + 48 + SettingsController.safeAreaBottomMargin + (searchField.textField.activeFocus ? 0 : SettingsController.imeHeight)
anchors.bottomMargin: addAppButton.implicitHeight + 48 + PageController.safeAreaBottomMargin + (searchField.textField.activeFocus ? 0 : PageController.imeHeight)
anchors.left: parent.left
anchors.right: parent.right
clip: true
@@ -221,7 +220,7 @@ PageType {
anchors.right: parent.right
anchors.bottom: parent.bottom
height: addAppButton.implicitHeight + 48 + SettingsController.safeAreaBottomMargin
height: addAppButton.implicitHeight + 48 + PageController.safeAreaBottomMargin
color: AmneziaStyle.color.midnightBlack
@@ -236,7 +235,7 @@ PageType {
anchors.topMargin: 24
anchors.rightMargin: 16
anchors.leftMargin: 16
anchors.bottomMargin: 24 + SettingsController.safeAreaBottomMargin
anchors.bottomMargin: 24 + PageController.safeAreaBottomMargin
TextFieldWithHeaderType {
id: searchField
@@ -20,7 +20,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
@@ -172,7 +172,7 @@ PageType {
SwitcherType {
id: switcherNewsNotificationEnabled
visible: ServersModel.hasServersFromGatewayApi
visible: ServersUiController.hasServersFromGatewayApi
Layout.fillWidth: true
Layout.margins: 16
@@ -203,7 +203,7 @@ PageType {
Layout.fillWidth: true
text: qsTr("Language")
descriptionText: LanguageModel.currentLanguageName
descriptionText: LanguageUiController.currentLanguageName
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
@@ -245,7 +245,7 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
if (ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot reset settings during active connection"))
} else
{
+1 -5
View File
@@ -20,10 +20,6 @@ PageType {
Connections {
target: SettingsController
function onChangeSettingsErrorOccurred(errorMessage) {
PageController.showErrorMessage(errorMessage)
}
function onRestoreBackupFinished() {
PageController.showNotificationMessage(qsTr("Settings restored from backup file"))
PageController.goToPageHome()
@@ -40,7 +36,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
@@ -20,7 +20,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
+170 -163
View File
@@ -1,163 +1,170 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import PageEnum 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Config"
import "../Controls2/TextTypes"
import "../Components"
PageType {
id: root
BackButtonType {
id: backButton
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
listView.positionViewAtBeginning()
}
}
}
ListViewType {
id: listView
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
property var isServerFromApi: ServersModel.isServerFromApi(ServersModel.defaultIndex)
enabled: !isServerFromApi
Component.onCompleted: {
if (isServerFromApi) {
PageController.showNotificationMessage(qsTr("Default server does not support custom DNS"))
}
}
header: ColumnLayout {
width: listView.width
spacing: 16
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("DNS servers")
}
ParagraphTextType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
text: qsTr("If AmneziaDNS is not used or installed")
}
}
model: 1 // fake model to force the ListView to be created without a model
delegate: ColumnLayout {
width: listView.width
spacing: 16
TextFieldWithHeaderType {
id: primaryDns
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Primary DNS")
textField.text: SettingsController.primaryDns
textField.validator: RegularExpressionValidator {
regularExpression: InstallController.ipAddressRegExp()
}
}
TextFieldWithHeaderType {
id: secondaryDns
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Secondary DNS")
textField.text: SettingsController.secondaryDns
textField.validator: RegularExpressionValidator {
regularExpression: InstallController.ipAddressRegExp()
}
}
BasicButtonType {
id: restoreDefaultButton
Layout.fillWidth: true
Layout.topMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
defaultColor: AmneziaStyle.color.transparent
hoveredColor: AmneziaStyle.color.translucentWhite
pressedColor: AmneziaStyle.color.sheerWhite
disabledColor: AmneziaStyle.color.mutedGray
textColor: AmneziaStyle.color.paleGray
borderWidth: 1
text: qsTr("Restore default")
clickedFunc: function() {
var headerText = qsTr("Restore default DNS settings?")
var yesButtonText = qsTr("Continue")
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
SettingsController.primaryDns = "1.1.1.1"
primaryDns.textField.text = SettingsController.primaryDns
SettingsController.secondaryDns = "1.0.0.1"
secondaryDns.textField.text = SettingsController.secondaryDns
PageController.showNotificationMessage(qsTr("Settings have been reset"))
}
var noButtonFunction = function() {
}
showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
}
}
BasicButtonType {
id: saveButton
Layout.fillWidth: true
Layout.margins: 16
text: qsTr("Save")
clickedFunc: function() {
if (primaryDns.textField.text !== SettingsController.primaryDns) {
SettingsController.primaryDns = primaryDns.textField.text
}
if (secondaryDns.textField.text !== SettingsController.secondaryDns) {
SettingsController.secondaryDns = secondaryDns.textField.text
}
PageController.showNotificationMessage(qsTr("Settings saved"))
}
}
}
}
}
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import PageEnum 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Config"
import "../Controls2/TextTypes"
import "../Components"
PageType {
id: root
BackButtonType {
id: backButton
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
listView.positionViewAtBeginning()
}
}
}
ListViewType {
id: listView
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
property var isServerFromApi: ServersModel.isServerFromApi(ServersUiController.defaultIndex)
enabled: !isServerFromApi
Component.onCompleted: {
if (isServerFromApi) {
PageController.showNotificationMessage(qsTr("Default server does not support custom DNS"))
}
}
header: ColumnLayout {
width: listView.width
spacing: 16
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("DNS servers")
}
ParagraphTextType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
text: qsTr("If AmneziaDNS is not used or installed")
}
}
model: 1 // fake model to force the ListView to be created without a model
delegate: ColumnLayout {
width: listView.width
spacing: 16
TextFieldWithHeaderType {
id: primaryDns
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Primary DNS")
textField.text: SettingsController.primaryDns
textField.validator: RegularExpressionValidator {
regularExpression: InstallController.ipAddressRegExp()
}
}
TextFieldWithHeaderType {
id: secondaryDns
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
headerText: qsTr("Secondary DNS")
textField.text: SettingsController.secondaryDns
textField.validator: RegularExpressionValidator {
regularExpression: InstallController.ipAddressRegExp()
}
}
BasicButtonType {
id: restoreDefaultButton
Layout.fillWidth: true
Layout.topMargin: 16
Layout.leftMargin: 16
Layout.rightMargin: 16
defaultColor: AmneziaStyle.color.transparent
hoveredColor: AmneziaStyle.color.translucentWhite
pressedColor: AmneziaStyle.color.sheerWhite
disabledColor: AmneziaStyle.color.mutedGray
textColor: AmneziaStyle.color.paleGray
borderWidth: 1
text: qsTr("Restore default")
clickedFunc: function() {
var headerText = qsTr("Restore default DNS settings?")
var yesButtonText = qsTr("Continue")
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
SettingsController.primaryDns = "1.1.1.1"
primaryDns.textField.text = SettingsController.primaryDns
SettingsController.secondaryDns = "1.0.0.1"
secondaryDns.textField.text = SettingsController.secondaryDns
PageController.showNotificationMessage(qsTr("Settings have been reset"))
}
var noButtonFunction = function() {
}
showQuestionDrawer(headerText, "", yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
}
}
BasicButtonType {
id: saveButton
Layout.fillWidth: true
Layout.margins: 16
text: qsTr("Save")
clickedFunc: function() {
if (primaryDns.textField.text === "") {
primaryDns.errorText = qsTr("Primary DNS cannot be empty")
return
}
primaryDns.errorText = ""
secondaryDns.errorText = ""
if (primaryDns.textField.text !== SettingsController.primaryDns) {
SettingsController.primaryDns = primaryDns.textField.text
}
if (secondaryDns.textField.text !== SettingsController.secondaryDns) {
SettingsController.secondaryDns = secondaryDns.textField.text
}
PageController.showNotificationMessage(qsTr("Settings saved"))
}
}
}
}
}
@@ -17,7 +17,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
}
FlickableType {
@@ -8,7 +8,6 @@ import QtCore
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import Style 1.0
@@ -30,7 +29,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
BackButtonType {
id: backButton
+1 -1
View File
@@ -22,7 +22,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -34,7 +34,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
}
FlickableType {
@@ -19,7 +19,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
BackButtonType {
id: backButton
+14 -15
View File
@@ -5,7 +5,6 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import Style 1.0
import "../Controls2"
@@ -18,7 +17,7 @@ PageType {
signal lastItemTabClickedSignal()
property bool isServerWithWriteAccess: ServersModel.isProcessedServerHasWriteAccess()
property bool isServerWithWriteAccess: ServersUiController.isProcessedServerHasWriteAccess()
Connections {
target: InstallController
@@ -34,7 +33,7 @@ PageType {
PageController.showErrorMessage(message)
}
function onRebootProcessedServerFinished(finishedMessage) {
function onRebootServerFinished(finishedMessage) {
PageController.showNotificationMessage(finishedMessage)
}
@@ -43,7 +42,7 @@ PageType {
PageController.showNotificationMessage(finishedMessage)
}
function onRemoveProcessedContainerFinished(finishedMessage) {
function onRemoveContainerFinished(finishedMessage) {
PageController.closePage() // close deInstalling page
PageController.closePage() // close page with remove button
PageController.showNotificationMessage(finishedMessage)
@@ -58,10 +57,10 @@ PageType {
}
Connections {
target: ServersModel
target: ServersUiController
function onProcessedServerIndexChanged() {
root.isServerWithWriteAccess = ServersModel.isProcessedServerHasWriteAccess()
root.isServerWithWriteAccess = ServersUiController.isProcessedServerHasWriteAccess()
}
}
@@ -112,7 +111,7 @@ PageType {
readonly property var tColor: AmneziaStyle.color.paleGray
readonly property var clickedHandler: function() {
PageController.showBusyIndicator(true)
InstallController.scanServerForInstalledContainers()
InstallController.scanServerForInstalledContainers(ServersUiController.processedIndex)
PageController.showBusyIndicator(false)
}
}
@@ -131,11 +130,11 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
if (ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot reboot server during active connection"))
} else {
PageController.showBusyIndicator(true)
InstallController.rebootProcessedServer()
InstallController.rebootServer(ServersUiController.processedIndex)
PageController.showBusyIndicator(false)
}
}
@@ -161,11 +160,11 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
if (ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot remove server during active connection"))
} else {
PageController.showBusyIndicator(true)
InstallController.removeProcessedServer()
InstallController.removeServer(ServersUiController.processedIndex)
PageController.showBusyIndicator(false)
}
}
@@ -191,11 +190,11 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
if (ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot clear server from Amnezia software during active connection"))
} else {
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeAllContainers()
InstallController.removeAllContainers(ServersUiController.processedIndex)
}
}
var noButtonFunction = function() {
@@ -220,11 +219,11 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
if (ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot reset API config during active connection"))
} else {
PageController.showBusyIndicator(true)
InstallController.removeApiConfig(ServersModel.processedIndex)
SubscriptionUiController.removeApiConfig(ServersUiController.processedIndex)
PageController.showBusyIndicator(false)
}
}
@@ -5,9 +5,7 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import ProtocolProps 1.0
import Style 1.0
import "./"
@@ -62,7 +60,7 @@ PageType {
objectName: "mainLayout"
anchors.fill: parent
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
spacing: 4
@@ -5,8 +5,6 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerEnum 1.0
import ContainerProps 1.0
import Style 1.0
@@ -19,7 +17,7 @@ import "../Components"
PageType {
id: root
property bool isClearCacheVisible: ServersModel.isProcessedServerHasWriteAccess() && !ContainersModel.isServiceContainer(ContainersModel.getProcessedContainerIndex())
property bool isClearCacheVisible: ServersUiController.isProcessedServerHasWriteAccess() && !ContainersModel.isServiceContainer(ServersUiController.processedContainerIndex)
BackButtonType {
id: backButton
@@ -27,7 +25,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -64,8 +62,8 @@ PageType {
width: listView.width
property bool isClientSettingsVisible: (protocolIndex === ProtocolEnum.WireGuard) || (protocolIndex === ProtocolEnum.Awg)
property bool isServerSettingsVisible: ServersModel.isProcessedServerHasWriteAccess()
property bool isClientSettingsVisible: isWireGuard || isAwg
property bool isServerSettingsVisible: ServersUiController.isProcessedServerHasWriteAccess()
LabelWithButtonType {
id: clientSettings
@@ -78,10 +76,7 @@ PageType {
clickedFunction: function() {
if (isClientProtocolExists) {
switch (protocolIndex) {
case ProtocolEnum.WireGuard: WireGuardConfigModel.updateModel(ProtocolsModel.getConfig()); break;
case ProtocolEnum.Awg: AwgConfigModel.updateModel(ProtocolsModel.getConfig()); break;
}
InstallController.openClientSettings(ServersUiController.processedIndex, ServersUiController.processedContainerIndex, protocolIndex)
PageController.goToPage(clientProtocolPage);
} else {
PageController.showNotificationMessage(qsTr("Click the \"connect\" button to create a connection configuration"))
@@ -109,17 +104,7 @@ PageType {
visible: delegateContent.isServerSettingsVisible
clickedFunction: function() {
switch (protocolIndex) {
case ProtocolEnum.OpenVpn: OpenVpnConfigModel.updateModel(ProtocolsModel.getConfig()); break;
case ProtocolEnum.ShadowSocks: ShadowSocksConfigModel.updateModel(ProtocolsModel.getConfig()); break;
case ProtocolEnum.Cloak: CloakConfigModel.updateModel(ProtocolsModel.getConfig()); break;
case ProtocolEnum.WireGuard: WireGuardConfigModel.updateModel(ProtocolsModel.getConfig()); break;
case ProtocolEnum.Awg: AwgConfigModel.updateModel(ProtocolsModel.getConfig()); break;
case ProtocolEnum.Xray: XrayConfigModel.updateModel(ProtocolsModel.getConfig()); break;
case ProtocolEnum.Sftp: SftpConfigModel.updateModel(ProtocolsModel.getConfig()); break;
case ProtocolEnum.Ipsec: Ikev2ConfigModel.updateModel(ProtocolsModel.getConfig()); break;
case ProtocolEnum.Socks5Proxy: Socks5ProxyConfigModel.updateModel(ProtocolsModel.getConfig()); break;
}
InstallController.openServerSettings(ServersUiController.processedIndex, ServersUiController.processedContainerIndex, protocolIndex)
PageController.goToPage(serverProtocolPage);
}
@@ -155,14 +140,14 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
if (ConnectionController.isConnected && ServersModel.getDefaultServerData("defaultContainer") === ServersUiController.processedContainerIndex) {
var message = qsTr("Unable to clear %1 profile while there is an active connection").arg(ContainersModel.getProcessedContainerName())
PageController.showNotificationMessage(message)
return
}
PageController.showBusyIndicator(true)
InstallController.clearCachedProfile()
InstallController.clearCachedProfile(ServersUiController.processedIndex, ServersUiController.processedContainerIndex)
PageController.showBusyIndicator(false)
}
@@ -188,7 +173,7 @@ PageType {
Layout.fillWidth: true
visible: ServersModel.isProcessedServerHasWriteAccess()
visible: ServersUiController.isProcessedServerHasWriteAccess()
text: qsTr("Remove ")
textColor: AmneziaStyle.color.vibrantRed
@@ -200,13 +185,13 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected
&& ServersModel.getDefaultServerData("defaultContainer") === ContainersModel.getProcessedContainerIndex()) {
if (ServersUiController.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected
&& ServersModel.getDefaultServerData("defaultContainer") === ServersUiController.processedContainerIndex) {
PageController.showNotificationMessage(qsTr("Cannot remove active container"))
} else
{
PageController.goToPage(PageEnum.PageDeinstalling)
InstallController.removeProcessedContainer()
InstallController.removeContainer(ServersUiController.processedIndex, ServersUiController.processedContainerIndex)
}
}
var noButtonFunction = function() {
@@ -224,7 +209,7 @@ PageType {
}
DividerType {
visible: ServersModel.isProcessedServerHasWriteAccess()
visible: ServersUiController.isProcessedServerHasWriteAccess()
}
}
}
@@ -5,7 +5,6 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import ContainersModelFilters 1.0
import Style 1.0
@@ -31,7 +30,7 @@ PageType {
anchors.fill: parent
Connections {
target: ServersModel
target: ServersUiController
function onProcessedServerIndexChanged() {
settingsContainersListView.updateContainersModelFilters()
@@ -39,7 +38,7 @@ PageType {
}
function updateContainersModelFilters() {
if (ServersModel.isProcessedServerHasWriteAccess()) {
if (ServersUiController.isProcessedServerHasWriteAccess()) {
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessProtocolsListFilters()
} else {
proxyContainersModel.filters = ContainersModelFilters.getReadAccessProtocolsListFilters()
@@ -5,7 +5,6 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import ContainersModelFilters 1.0
import Style 1.0
@@ -27,7 +26,7 @@ PageType {
anchors.fill: parent
Connections {
target: ServersModel
target: ServersUiController
function onProcessedServerIndexChanged() {
settingsContainersListView.updateContainersModelFilters()
@@ -35,7 +34,7 @@ PageType {
}
function updateContainersModelFilters() {
if (ServersModel.isProcessedServerHasWriteAccess()) {
if (ServersUiController.isProcessedServerHasWriteAccess()) {
proxyContainersModel.filters = ContainersModelFilters.getWriteAccessServicesListFilters()
} else {
proxyContainersModel.filters = ContainersModelFilters.getReadAccessServicesListFilters()
@@ -5,7 +5,6 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import Style 1.0
@@ -25,7 +24,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
BackButtonType {
id: backButton
@@ -73,7 +72,7 @@ PageType {
descriptionText: {
var servicesNameString = ""
var servicesName = ServersModel.getAllInstalledServicesName(index)
var servicesName = ServersUiController.getAllInstalledServicesName(index)
for (var i = 0; i < servicesName.length; i++) {
servicesNameString += servicesName[i] + " · "
}
@@ -87,11 +86,11 @@ PageType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function() {
ServersModel.processedIndex = index
ServersUiController.processedIndex = index
if (ServersModel.getProcessedServerData("isServerFromGatewayApi")) {
PageController.showBusyIndicator(true)
let result = ApiSettingsController.getAccountInfo(false)
let result = SubscriptionUiController.getAccountInfo(ServersUiController.getProcessedServerIndex(), false)
PageController.showBusyIndicator(false)
if (!result) {
return
@@ -8,7 +8,6 @@ import QtCore
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import ContainerProps 1.0
import Style 1.0
@@ -29,7 +28,7 @@ PageType {
if (ConnectionController.isConnected) {
PageController.showNotificationMessage(qsTr("Cannot change split tunneling settings during active connection"))
root.pageEnabled = false
} else if (ServersModel.isDefaultServerDefaultContainerHasSplitTunneling) {
} else if (ServersUiController.isDefaultServerDefaultContainerHasSplitTunneling) {
PageController.showNotificationMessage(qsTr("Default server does not support split tunneling function"))
root.pageEnabled = false
} else {
@@ -38,7 +37,7 @@ PageType {
}
Connections {
target: SitesController
target: IpSplitTunnelingController
function onFinished(message) {
PageController.showNotificationMessage(message)
@@ -73,7 +72,7 @@ PageType {
}
function getRouteModesModelIndex() {
var currentRouteMode = SitesModel.routeMode
var currentRouteMode = IpSplitTunnelingController.routeMode
if ((routeMode.onlyForwardSites === currentRouteMode) || (routeMode.allSites === currentRouteMode)) {
return 0
} else if (routeMode.allExceptSites === currentRouteMode) {
@@ -88,7 +87,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
BackButtonType {
id: backButton
@@ -104,11 +103,11 @@ PageType {
enabled: root.pageEnabled
showSwitcher: true
switcher {
checked: SitesModel.isTunnelingEnabled
checked: IpSplitTunnelingController.isSplitTunnelingEnabled
enabled: root.pageEnabled
}
switcherFunction: function(checked) {
SitesModel.toggleSplitTunneling(checked)
IpSplitTunnelingController.toggleSplitTunneling(checked)
selector.text = root.routeModesModel[getRouteModesModelIndex()].name
}
}
@@ -138,13 +137,13 @@ PageType {
clickedFunction: function() {
selector.text = selectedText
selector.closeTriggered()
if (SitesModel.routeMode !== root.routeModesModel[selectedIndex].type) {
SitesModel.routeMode = root.routeModesModel[selectedIndex].type
if (IpSplitTunnelingController.routeMode !== root.routeModesModel[selectedIndex].type) {
IpSplitTunnelingController.routeMode = root.routeModesModel[selectedIndex].type
}
}
Component.onCompleted: {
if (root.routeModesModel[selectedIndex].type === SitesModel.routeMode) {
if (root.routeModesModel[selectedIndex].type === IpSplitTunnelingController.routeMode) {
selector.text = selectedText
} else {
selector.text = root.routeModesModel[0].name
@@ -152,7 +151,7 @@ PageType {
}
Connections {
target: SitesModel
target: IpSplitTunnelingController
function onRouteModeChanged() {
selectedIndex = getRouteModesModelIndex()
}
@@ -169,7 +168,7 @@ PageType {
anchors.top: header.bottom
anchors.topMargin: 16
anchors.bottom: parent.bottom
anchors.bottomMargin: addSiteButton.implicitHeight + 48 + (searchField.textField.activeFocus ? 0 : SettingsController.imeHeight)
anchors.bottomMargin: addSiteButton.implicitHeight + 48 + (searchField.textField.activeFocus ? 0 : PageController.imeHeight)
width: parent.width
@@ -177,8 +176,8 @@ PageType {
clip: true
model: SortFilterProxyModel {
id: proxySitesModel
sourceModel: SitesModel
id: proxyIpSplitTunnelingModel
sourceModel: IpSplitTunnelingModel
filters: [
AnyOf {
RegExpFilter {
@@ -213,7 +212,7 @@ PageType {
var noButtonText = qsTr("Cancel")
var yesButtonFunction = function() {
SitesController.removeSite(proxySitesModel.mapToSource(index))
IpSplitTunnelingController.removeSite(proxyIpSplitTunnelingModel.mapToSource(index))
if (!GC.isMobile()) {
site.rightButton.forceActiveFocus()
}
@@ -265,7 +264,7 @@ PageType {
clickedFunc: function() {
PageController.showBusyIndicator(true)
SitesController.addSite(textField.text)
IpSplitTunnelingController.addSite(textField.text)
textField.text = ""
PageController.showBusyIndicator(false)
}
@@ -341,7 +340,7 @@ PageType {
}
if (fileName !== "") {
PageController.showBusyIndicator(true)
SitesController.exportSites(fileName)
IpSplitTunnelingController.exportSites(fileName)
moreActionsDrawer.closeTriggered()
PageController.showBusyIndicator(false)
}
@@ -364,7 +363,7 @@ PageType {
var yesButtonFunction = function() {
PageController.showBusyIndicator(true)
SitesController.removeSites()
IpSplitTunnelingController.removeSites()
PageController.showBusyIndicator(false)
}
var noButtonFunction = function() {
@@ -482,7 +481,7 @@ PageType {
function importSites(fileName, replaceExistingSites) {
PageController.showBusyIndicator(true)
SitesController.importSites(fileName, replaceExistingSites)
IpSplitTunnelingController.importSites(fileName, replaceExistingSites)
PageController.showBusyIndicator(false)
importSitesDrawer.closeTriggered()
moreActionsDrawer.closeTriggered()
@@ -29,7 +29,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (activeFocus) {
@@ -46,7 +46,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
contentHeight: scrollColumn.implicitHeight + 24
contentHeight: scrollColumn.childrenRect.height + 24
ColumnLayout {
id: scrollColumn
@@ -106,7 +106,7 @@ PageType {
visible: (Qt.platform.os === "ios" || IsMacOsNeBuild)
termsUrl: "https://www.apple.com/legal/internet-services/itunes/dev/stdeula/"
privacyUrl: LanguageModel.getCurrentSiteUrl("policy")
privacyUrl: LanguageUiController.getCurrentSiteUrl("policy")
}
}
}
@@ -120,13 +120,13 @@ PageType {
anchors.bottom: parent.bottom
anchors.leftMargin: 16
anchors.rightMargin: 16
anchors.bottomMargin: 16 + SettingsController.safeAreaBottomMargin
anchors.bottomMargin: 16 + PageController.safeAreaBottomMargin
text: qsTr("Continue")
clickedFunc: function() {
PageController.showBusyIndicator(true)
var result = ApiConfigsController.importService()
var result = SubscriptionUiController.importFreeFromGateway()
PageController.showBusyIndicator(false)
if (!result) {
@@ -35,7 +35,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (activeFocus) {
@@ -52,7 +52,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
contentHeight: scrollColumn.implicitHeight + 24
contentHeight: scrollColumn.childrenRect.height + 24
ColumnLayout {
id: scrollColumn
@@ -134,7 +134,7 @@ PageType {
TermsAndPrivacyText {
termsUrl: "https://www.apple.com/legal/internet-services/itunes/dev/stdeula/"
privacyUrl: LanguageModel.getCurrentSiteUrl("policy")
privacyUrl: LanguageUiController.getCurrentSiteUrl("policy")
}
}
@@ -161,7 +161,7 @@ PageType {
anchors.bottom: parent.bottom
anchors.leftMargin: 16
anchors.rightMargin: 16
anchors.bottomMargin: 16 + SettingsController.safeAreaBottomMargin
anchors.bottomMargin: 16 + PageController.safeAreaBottomMargin
text: {
var plan = root.currentPlan
@@ -183,7 +183,7 @@ PageType {
if (Qt.platform.os === "ios" || IsMacOsNeBuild) {
PageController.showBusyIndicator(true)
var storeId = plan.storeProductId !== undefined ? String(plan.storeProductId) : ""
ApiConfigsController.importPremiumFromAppStore(storeId)
SubscriptionUiController.importPremiumFromAppStore(storeId)
PageController.showBusyIndicator(false)
return
}
@@ -22,7 +22,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
@@ -16,7 +16,7 @@ PageType {
property string trialEmailErrorMessage: ""
Connections {
target: ApiConfigsController
target: SubscriptionUiController
function onTrialEmailError(message) {
root.trialEmailErrorMessage = message
@@ -30,7 +30,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (activeFocus) {
@@ -113,7 +113,7 @@ PageType {
anchors.bottom: parent.bottom
anchors.leftMargin: 16
anchors.rightMargin: 16
anchors.bottomMargin: 16 + SettingsController.safeAreaBottomMargin
anchors.bottomMargin: 16 + PageController.safeAreaBottomMargin
text: qsTr("Continue")
@@ -127,7 +127,7 @@ PageType {
return
}
PageController.showBusyIndicator(true)
var ok = ApiConfigsController.importTrialFromGateway(raw)
var ok = SubscriptionUiController.importTrialFromGateway(raw)
PageController.showBusyIndicator(false)
if (ok) {
PageController.closePage()
@@ -41,7 +41,7 @@ PageType {
property bool isVisible: SettingsController.getInstallationUuid() !== "" || PageController.isStartPageVisible()
Layout.fillWidth: true
Layout.topMargin: 24 + SettingsController.safeAreaTopMargin
Layout.topMargin: 24 + PageController.safeAreaTopMargin
Layout.rightMargin: 16
Layout.leftMargin: 16
@@ -258,7 +258,7 @@ PageType {
rightImageSource: "qrc:/images/controls/external-link.svg"
clickedFunc: function() {
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl())
Qt.openUrlExternally(LanguageUiController.getCurrentSiteUrl())
}
}
}
@@ -284,7 +284,7 @@ PageType {
property bool isVisible: true
property var handler: function() {
PageController.showBusyIndicator(true)
var result = ApiConfigsController.fillAvailableServices()
var result = SubscriptionUiController.fillAvailableServices()
PageController.showBusyIndicator(false)
if (result) {
PageController.goToPage(PageEnum.PageSetupWizardApiServicesList)
@@ -333,8 +333,7 @@ PageType {
property string imageSource: "qrc:/images/controls/folder-search-2.svg"
property bool isVisible: true
property var handler: function() {
var nameFilter = !ServersModel.getServersCount() ? "Config or backup files (*.vpn *.ovpn *.conf *.json *.backup)" :
"Config files (*.vpn *.ovpn *.conf *.json)"
var nameFilter = "Config files (*.vpn *.ovpn *.conf *.json)"
var fileName = SystemController.getFileName(qsTr("Open config file"), nameFilter)
if (fileName !== "") {
if (ImportController.extractConfigFromFile(fileName)) {
@@ -370,7 +369,7 @@ PageType {
property bool isVisible: Qt.platform.os === "ios" || IsMacOsNeBuild
property var handler: function() {
PageController.showBusyIndicator(true)
ApiConfigsController.restoreServiceFromAppStore()
SubscriptionUiController.restoreServiceFromAppStore()
PageController.showBusyIndicator(false)
}
}
@@ -384,7 +383,7 @@ PageType {
property string imageSource: "qrc:/images/controls/help-circle.svg"
property bool isVisible: PageController.isStartPageVisible() && Qt.platform.os !== "ios" && !IsMacOsNeBuild
property var handler: function() {
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl())
Qt.openUrlExternally(LanguageUiController.getCurrentSiteUrl())
}
}
}
@@ -19,7 +19,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -116,12 +116,12 @@ PageType {
return
}
InstallController.setShouldCreateServer(true)
var _hostname = listView.itemAtIndex(vars.hostnameIndex).children[0].textField.text
var _username = listView.itemAtIndex(vars.usernameIndex).children[0].textField.text
var _secretData = listView.itemAtIndex(vars.secretDataIndex).children[0].textField.text
InstallController.setProcessedServerCredentials(_hostname, _username, _secretData)
ServersUiController.processedIndex = -1
PageController.showBusyIndicator(true)
var isConnectionOpened = InstallController.checkSshConnection()
@@ -159,7 +159,7 @@ PageType {
leftImageSource: "qrc:/images/controls/help-circle.svg"
onClicked: {
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl("starter-guide"))
Qt.openUrlExternally(LanguageUiController.getCurrentSiteUrl("starter-guide"))
}
Keys.onEnterPressed: this.clicked()
+6 -5
View File
@@ -40,7 +40,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
@@ -111,8 +111,8 @@ PageType {
var defaultContainerProto = ContainerProps.defaultProtocol(dockerContainer)
listView.dockerContainer = dockerContainer
listView.containerDefaultPort = ProtocolProps.getPortForInstall(defaultContainerProto)
listView.containerDefaultTransportProto = ProtocolProps.defaultTransportProto(defaultContainerProto)
listView.containerDefaultPort = InstallController.getPortForInstall(defaultContainerProto)
listView.containerDefaultTransportProto = InstallController.defaultTransportProto(defaultContainerProto)
}
Keys.onReturnPressed: this.clicked()
@@ -160,11 +160,12 @@ PageType {
clickedFunc: function() {
if (root.isEasySetup) {
ContainersModel.setProcessedContainerIndex(listView.dockerContainer)
ServersUiController.processedContainerIndex = listView.dockerContainer
PageController.goToPage(PageEnum.PageSetupWizardInstalling)
InstallController.install(listView.dockerContainer,
listView.containerDefaultPort,
listView.containerDefaultTransportProto)
listView.containerDefaultTransportProto,
ServersUiController.processedIndex)
} else {
PageController.goToPage(PageEnum.PageSetupWizardProtocols)
}
@@ -26,9 +26,9 @@ PageType {
target: InstallController
function onInstallContainerFinished(finishedMessage, isServiceInstall) {
var containerIndex = ContainersModel.getProcessedContainerIndex()
var containerIndex = ServersUiController.processedContainerIndex
if (!ConnectionController.isConnected && !ContainersModel.isServiceContainer(containerIndex)) {
ServersModel.setDefaultContainer(ServersModel.processedIndex, containerIndex)
ServersUiController.setDefaultContainer(ServersUiController.processedIndex, containerIndex)
}
PageController.closePage() // close installing page
@@ -47,8 +47,8 @@ PageType {
function onInstallServerFinished(finishedMessage) {
if (!ConnectionController.isConnected) {
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1);
ServersModel.processedIndex = ServersModel.defaultIndex
ServersUiController.setDefaultServerIndex(ServersModel.getServersCount() - 1);
ServersUiController.processedIndex = ServersUiController.defaultIndex
}
PageController.goToPageHome()
@@ -57,7 +57,7 @@ PageType {
function onServerAlreadyExists(serverIndex) {
PageController.goToStartPage()
ServersModel.processedIndex = serverIndex
ServersUiController.processedIndex = serverIndex
PageController.goToPage(PageEnum.PageSettingsServerInfo, false)
PageController.showErrorMessage(qsTr("The server has already been added to the application"))
@@ -103,7 +103,7 @@ PageType {
BaseHeaderType {
Layout.fillWidth: true
Layout.topMargin: 20 + SettingsController.safeAreaTopMargin
Layout.topMargin: 20 + PageController.safeAreaTopMargin
Layout.leftMargin: 16
Layout.rightMargin: 16
@@ -147,7 +147,7 @@ PageType {
Layout.fillWidth: true
Layout.topMargin: 24
Layout.bottomMargin: 24 + SettingsController.safeAreaBottomMargin
Layout.bottomMargin: 24 + PageController.safeAreaBottomMargin
Layout.leftMargin: 16
Layout.rightMargin: 16
@@ -35,7 +35,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -243,22 +243,22 @@ PageType {
}
PageController.goToPage(PageEnum.PageSetupWizardInstalling);
InstallController.install(dockerContainer, port.textField.text, transportProtoSelector.currentIndex)
InstallController.install(dockerContainer, port.textField.text, transportProtoSelector.currentIndex, ServersUiController.processedIndex)
}
}
Component.onCompleted: {
var defaultContainerProto = ContainerProps.defaultProtocol(dockerContainer)
if (ProtocolProps.defaultPort(defaultContainerProto) < 0) {
if (InstallController.defaultPort(defaultContainerProto) < 0) {
port.visible = false
} else {
port.textField.text = ProtocolProps.getPortForInstall(defaultContainerProto)
port.textField.text = InstallController.getPortForInstall(defaultContainerProto)
}
transportProtoSelector.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto)
transportProtoSelector.currentIndex = InstallController.defaultTransportProto(defaultContainerProto)
port.enabled = ProtocolProps.defaultPortChangeable(defaultContainerProto)
var protocolSelectorVisible = ProtocolProps.defaultTransportProtoChangeable(defaultContainerProto)
port.enabled = InstallController.defaultPortChangeable(defaultContainerProto)
var protocolSelectorVisible = InstallController.defaultTransportProtoChangeable(defaultContainerProto)
transportProtoSelector.visible = protocolSelectorVisible
transportProtoHeader.visible = protocolSelectorVisible
}
@@ -5,7 +5,6 @@ import QtQuick.Layouts
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ProtocolEnum 1.0
import Style 1.0
import "./"
@@ -20,8 +19,8 @@ PageType {
sourceModel: ContainersModel
filters: [
ValueFilter {
roleName: "serviceType"
value: ProtocolEnum.Vpn
roleName: "isVpnContainer"
value: true
},
ValueFilter {
roleName: "isSupported"
@@ -45,7 +44,7 @@ PageType {
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
@@ -93,7 +92,7 @@ PageType {
rightImageSource: "qrc:/images/controls/chevron-right.svg"
clickedFunction: function () {
ContainersModel.setProcessedContainerIndex(proxyContainersModel.mapToSource(index));
ServersUiController.processedContainerIndex = proxyContainersModel.mapToSource(index)
PageController.goToPage(PageEnum.PageSetupWizardProtocolSettings);
}
}
@@ -20,7 +20,7 @@ PageType {
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
}
ParagraphTextType {
@@ -26,7 +26,7 @@ PageType {
source: "qrc:/images/amneziaBigLogo.png"
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.topMargin: 32 + SettingsController.safeAreaTopMargin
Layout.topMargin: 32 + PageController.safeAreaTopMargin
Layout.preferredWidth: 360
Layout.preferredHeight: 287
}
@@ -34,7 +34,7 @@ PageType {
BasicButtonType {
id: startButton
Layout.fillWidth: true
Layout.bottomMargin: 48 + SettingsController.safeAreaBottomMargin
Layout.bottomMargin: 48 + PageController.safeAreaBottomMargin
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.alignment: Qt.AlignBottom
@@ -19,7 +19,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
@@ -22,7 +22,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onActiveFocusChanged: {
if(backButton.enabled && backButton.activeFocus) {
@@ -53,11 +53,6 @@ PageType {
function onImportFinished() {
PageController.showBusyIndicator(false)
if (!ConnectionController.isConnected) {
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1);
ServersModel.processedIndex = ServersModel.defaultIndex
}
PageController.goToPageHome()
}
}
@@ -128,7 +123,7 @@ PageType {
id: cloakingCheckBox
objectName: "cloakingCheckBox"
visible: ImportController.isNativeWireGuardConfig()
visible: ImportController.isNativeWireGuardConfig
Layout.fillWidth: true
Layout.leftMargin: 16
@@ -149,7 +144,7 @@ PageType {
Layout.leftMargin: 16
Layout.rightMargin: 16
textString: ImportController.getMaliciousWarningText()
textString: ImportController.maliciousWarningText
textFormat: Qt.RichText
visible: textString !== ""
+32 -62
View File
@@ -24,15 +24,13 @@ PageType {
OpenVpn,
WireGuard,
Awg,
ShadowSocks,
Cloak,
Xray
}
Connections {
target: ExportController
function onRevokeConfigCompleted() {
function onRevokeConfigFinished() {
PageController.showBusyIndicator(false)
PageController.showNotificationMessage(qsTr("Config revoked"))
}
@@ -44,51 +42,40 @@ PageType {
var configExtension
var configFileName
var serverIndex = ServersUiController.processedIndex
var containerIndex = ServersUiController.processedContainerIndex
switch (type) {
case PageShare.ConfigType.AmneziaConnection: {
ExportController.generateConnectionConfig(clientNameTextField.textField.text);
ExportController.generateConnectionConfig(serverIndex, containerIndex, clientNameTextField.textField.text);
configCaption = qsTr("Save AmneziaVPN config")
configExtension = ".vpn"
configFileName = "amnezia_config"
break;
}
case PageShare.ConfigType.OpenVpn: {
ExportController.generateOpenVpnConfig(clientNameTextField.textField.text)
ExportController.generateOpenVpnConfig(serverIndex, clientNameTextField.textField.text)
configCaption = qsTr("Save OpenVPN config")
configExtension = ".ovpn"
configFileName = "amnezia_for_openvpn"
break
}
case PageShare.ConfigType.WireGuard: {
ExportController.generateWireGuardConfig(clientNameTextField.textField.text)
ExportController.generateWireGuardConfig(serverIndex, clientNameTextField.textField.text)
configCaption = qsTr("Save WireGuard config")
configExtension = ".conf"
configFileName = "amnezia_for_wireguard"
break
}
case PageShare.ConfigType.Awg: {
ExportController.generateAwgConfig(clientNameTextField.textField.text)
ExportController.generateAwgConfig(serverIndex, containerIndex, clientNameTextField.textField.text)
configCaption = qsTr("Save AmneziaWG config")
configExtension = ".conf"
configFileName = "amnezia_for_awg"
break
}
case PageShare.ConfigType.ShadowSocks: {
ExportController.generateShadowSocksConfig()
configCaption = qsTr("Save Shadowsocks config")
configExtension = ".json"
configFileName = "amnezia_for_shadowsocks"
break
}
case PageShare.ConfigType.Cloak: {
ExportController.generateCloakConfig()
configCaption = qsTr("Save Cloak config")
configExtension = ".json"
configFileName = "amnezia_for_cloak"
break
}
case PageShare.ConfigType.Xray: {
ExportController.generateXrayConfig(clientNameTextField.textField.text)
ExportController.generateXrayConfig(serverIndex, clientNameTextField.textField.text)
configCaption = qsTr("Save XRay config")
configExtension = ".json"
configFileName = "amnezia_for_xray"
@@ -135,16 +122,6 @@ PageType {
readonly property string name: qsTr("AmneziaWG native format")
readonly property int type: PageShare.ConfigType.Awg
}
QtObject {
id: shadowSocksConnectionFormat
readonly property string name: qsTr("Shadowsocks native format")
readonly property int type: PageShare.ConfigType.ShadowSocks
}
QtObject {
id: cloakConnectionFormat
readonly property string name: qsTr("Cloak native format")
readonly property int type: PageShare.ConfigType.Cloak
}
QtObject {
id: xrayConnectionFormat
readonly property string name: qsTr("XRay native format")
@@ -173,7 +150,7 @@ PageType {
HeaderTypeWithButton {
id: header
Layout.fillWidth: true
Layout.topMargin: 24 + SettingsController.safeAreaTopMargin
Layout.topMargin: 24 + PageController.safeAreaTopMargin
headerText: qsTr("Share VPN Access")
@@ -272,8 +249,8 @@ PageType {
onClicked: {
accessTypeSelector.currentIndex = 1
PageController.showBusyIndicator(true)
ExportController.updateClientManagementModel(ContainersModel.getProcessedContainerIndex(),
ServersModel.getProcessedServerCredentials())
ExportController.updateClientManagementModel(ServersUiController.processedIndex,
ServersUiController.processedContainerIndex)
PageController.showBusyIndicator(false)
}
@@ -356,7 +333,7 @@ PageType {
Component.onCompleted: {
if (ServersModel.isDefaultServerHasWriteAccess() && ServersModel.getDefaultServerData("hasInstalledContainers")) {
serverSelectorListView.selectedIndex = proxyServersModel.mapFromSource(ServersModel.defaultIndex)
serverSelectorListView.selectedIndex = proxyServersModel.mapFromSource(ServersUiController.defaultIndex)
} else {
serverSelectorListView.selectedIndex = 0
}
@@ -367,15 +344,15 @@ PageType {
function handler() {
serverSelector.text = selectedText
ServersModel.processedIndex = proxyServersModel.mapToSource(selectedIndex)
ServersUiController.processedIndex = proxyServersModel.mapToSource(selectedIndex)
}
}
}
DropDownType {
id: protocolSelector
id: containerSelector
signal protocolSelectorTextChanged
signal containerSelectorTextChanged
Layout.fillWidth: true
Layout.topMargin: 16
@@ -387,7 +364,7 @@ PageType {
headerText: qsTr("Protocol")
listView: ListViewWithRadioButtonType {
id: protocolSelectorListView
id: containerSelectorListView
rootWidth: root.width
imageSource: "qrc:/images/controls/check.svg"
@@ -410,7 +387,7 @@ PageType {
clickedFunction: function() {
handler()
protocolSelector.closeTriggered()
containerSelector.closeTriggered()
}
Connections {
@@ -418,9 +395,9 @@ PageType {
function onServerSelectorIndexChanged() {
var defaultContainer = proxyContainersModel.mapFromSource(ServersModel.getProcessedServerData("defaultContainer"))
protocolSelectorListView.selectedIndex = defaultContainer
protocolSelectorListView.positionViewAtIndex(selectedIndex, ListView.Beginning)
protocolSelectorListView.triggerCurrentItem()
containerSelectorListView.selectedIndex = defaultContainer
containerSelectorListView.positionViewAtIndex(selectedIndex, ListView.Beginning)
containerSelectorListView.triggerCurrentItem()
}
}
@@ -432,20 +409,20 @@ PageType {
root.shareButtonEnabled = true
}
protocolSelector.text = selectedText
containerSelector.text = selectedText
ContainersModel.setProcessedContainerIndex(proxyContainersModel.mapToSource(selectedIndex))
ServersUiController.processedContainerIndex = proxyContainersModel.mapToSource(selectedIndex)
fillConnectionTypeModel()
if (accessTypeSelector.currentIndex === 1) {
PageController.showBusyIndicator(true)
ExportController.updateClientManagementModel(ContainersModel.getProcessedContainerIndex(),
ServersModel.getProcessedServerCredentials())
ExportController.updateClientManagementModel(ServersUiController.processedIndex,
ServersUiController.processedContainerIndex)
PageController.showBusyIndicator(false)
}
protocolSelector.protocolSelectorTextChanged()
containerSelector.containerSelectorTextChanged()
}
function fillConnectionTypeModel() {
@@ -461,13 +438,6 @@ PageType {
root.connectionTypesModel.push(awgConnectionFormat)
} else if (index === ContainerProps.containerFromString("amnezia-awg2")) {
root.connectionTypesModel.push(awgConnectionFormat)
} else if (index === ContainerProps.containerFromString("amnezia-shadowsocks")) {
root.connectionTypesModel.push(openVpnConnectionFormat)
root.connectionTypesModel.push(shadowSocksConnectionFormat)
} else if (index === ContainerProps.containerFromString("amnezia-openvpn-cloak")) {
root.connectionTypesModel.push(openVpnConnectionFormat)
root.connectionTypesModel.push(shadowSocksConnectionFormat)
root.connectionTypesModel.push(cloakConnectionFormat)
} else if (index === ContainerProps.containerFromString("amnezia-xray")) {
root.connectionTypesModel.push(xrayConnectionFormat)
}
@@ -522,9 +492,9 @@ PageType {
currentIndex: 0
Connections {
target: protocolSelector
target: containerSelector
function onProtocolSelectorTextChanged() {
function onContainerSelectorTextChanged() {
if (exportTypeSelector.currentIndex >= root.connectionTypesModel.length) {
exportTypeSelectorListView.selectedIndex = 0
exportTypeSelector.currentIndex = 0
@@ -823,8 +793,8 @@ PageType {
PageController.showBusyIndicator(true)
ExportController.renameClient(proxyClientManagementModel.mapToSource(index),
clientNameEditor.textField.text,
ContainersModel.getProcessedContainerIndex(),
ServersModel.getProcessedServerCredentials())
ServersUiController.processedIndex,
ServersUiController.processedContainerIndex)
PageController.showBusyIndicator(false)
Qt.callLater(function(){ clientsListView.freezeFilter = false })
clientNameEditDrawer.closeTriggered()
@@ -859,8 +829,8 @@ PageType {
clientInfoDrawer.closeTriggered()
PageController.showBusyIndicator(true)
ExportController.revokeConfig(proxyClientManagementModel.mapToSource(index),
ContainersModel.getProcessedContainerIndex(),
ServersModel.getProcessedServerCredentials())
ServersUiController.processedIndex,
ServersUiController.processedContainerIndex)
}
var noButtonFunction = function() {
}
+8 -8
View File
@@ -47,7 +47,7 @@ PageType {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
}
Text {
@@ -55,7 +55,7 @@ PageType {
anchors.top: backButton.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
anchors.topMargin: 20 + PageController.safeAreaTopMargin
anchors.leftMargin: 16
anchors.rightMargin: 16
@@ -175,7 +175,7 @@ PageType {
id: configContentDrawer
parent: pageShareConnection.parent
anchors.fill: parent
expandedHeight: parent ? parent.height * 0.9 : 0
expandedHeight: (parent ? parent.height : pageShareConnection.height) * 0.9
expandedStateContent: Item {
id: configContentContainer
implicitHeight: configContentDrawer.expandedHeight
@@ -197,7 +197,7 @@ PageType {
configText.copy()
configText.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied"))
header.forceActiveFocus()
shareHeader.forceActiveFocus()
}
}
@@ -265,7 +265,7 @@ PageType {
delegate: ColumnLayout {
width: listView.width
property bool isQrCodeVisible: pageShareConnection.isSelfHostedConfig ? ExportController.qrCodesCount > 0 : ApiConfigsController.qrCodesCount > 0
property bool isQrCodeVisible: pageShareConnection.isSelfHostedConfig ? ExportController.qrCodesCount > 0 : SubscriptionUiController.qrCodesCount > 0
Rectangle {
id: qrCodeContainer
@@ -284,7 +284,7 @@ PageType {
fillMode: Image.PreserveAspectFit
sourceSize.width: parent.width
sourceSize.height: parent.height
source: pageShareConnection.isSelfHostedConfig ? (isQrCodeVisible ? ExportController.qrCodes[0] : "") : (isQrCodeVisible ? ApiConfigsController.qrCodes[0] : "")
source: pageShareConnection.isSelfHostedConfig ? (isQrCodeVisible ? ExportController.qrCodes[0] : "") : (isQrCodeVisible ? SubscriptionUiController.qrCodes[0] : "")
property bool isFocusable: true
Keys.onTabPressed: FocusController.nextKeyTabItem()
Keys.onBacktabPressed: FocusController.previousKeyTabItem()
@@ -301,9 +301,9 @@ PageType {
onTriggered: {
if (isQrCodeVisible) {
index++
let qrCodesCount = pageShareConnection.isSelfHostedConfig ? ExportController.qrCodesCount : ApiConfigsController.qrCodesCount
let qrCodesCount = pageShareConnection.isSelfHostedConfig ? ExportController.qrCodesCount : SubscriptionUiController.qrCodesCount
if (index >= qrCodesCount) index = 0
parent.source = pageShareConnection.isSelfHostedConfig ? ExportController.qrCodes[index] : ApiConfigsController.qrCodes[index]
parent.source = pageShareConnection.isSelfHostedConfig ? ExportController.qrCodes[index] : SubscriptionUiController.qrCodes[index]
}
}
}
+168 -168
View File
@@ -1,168 +1,168 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ContainerProps 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Components"
import "../Config"
PageType {
id: root
BackButtonType {
id: backButton
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + SettingsController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
listView.positionViewAtBeginning()
}
}
}
ListViewType {
id: listView
property string headerText: ""
property string configContentHeaderText: ""
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
header: ColumnLayout {
width: listView.width
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.topMargin: 24
headerText: qsTr("Full access to the server and VPN")
}
ParagraphTextType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.topMargin: 24
Layout.bottomMargin: 24
text: qsTr("We recommend that you use full access to the server only for your own additional devices.\n") +
qsTr("If you share full access with other people, they can remove and add protocols and services to the server, which will cause the VPN to work incorrectly for all users. ")
color: AmneziaStyle.color.mutedGray
}
DropDownType {
id: serverSelector
objectName: "serverSelector"
signal serverSelectorIndexChanged
property int currentIndex: 0
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.topMargin: 16
drawerHeight: 0.4375
drawerParent: root
descriptionText: qsTr("Server")
headerText: qsTr("Server")
listView: ListViewWithRadioButtonType {
id: serverSelectorListView
rootWidth: root.width
imageSource: "qrc:/images/controls/check.svg"
model: SortFilterProxyModel {
id: proxyServersModel
sourceModel: ServersModel
filters: [
ValueFilter {
roleName: "hasWriteAccess"
value: true
}
]
}
clickedFunction: function() {
handler()
if (serverSelector.currentIndex !== serverSelectorListView.selectedIndex) {
serverSelector.currentIndex = serverSelectorListView.selectedIndex
serverSelector.serverSelectorIndexChanged()
}
listView.headerText = qsTr("Accessing ") + serverSelector.text
listView.configContentHeaderText = qsTr("File with accessing settings to ") + serverSelector.text
serverSelector.closeTriggered()
}
Component.onCompleted: {
serverSelectorListView.currentIndex = ServersModel.isDefaultServerHasWriteAccess() ?
proxyServersModel.mapFromSource(ServersModel.defaultIndex) : 0
serverSelectorListView.triggerCurrentItem()
}
function handler() {
serverSelector.text = selectedText
ServersModel.processedIndex = proxyServersModel.mapToSource(selectedIndex)
}
}
}
}
model: 1 // fake model to force the ListView to be created without a model
spacing: 0
delegate: ColumnLayout {
width: listView.width
BasicButtonType {
id: shareButton
Layout.fillWidth: true
Layout.topMargin: 32
Layout.leftMargin: 16
Layout.rightMargin: 16
text: qsTr("Share")
leftImageSource: "qrc:/images/controls/share-2.svg"
clickedFunc: function() {
PageController.showBusyIndicator(true)
if (Qt.platform.os === "android" && !SystemController.isAuthenticated()) {
PageController.showBusyIndicator(false)
ExportController.exportErrorOccurred(qsTr("Access error!"))
return
} else {
ExportController.generateFullAccessConfig()
}
PageController.showBusyIndicator(false)
PageController.goToShareConnectionPage(listView.headerText, listView.configContentHeaderText, "", ".vpn", "amnezia_config")
}
}
}
}
}
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import SortFilterProxyModel 0.2
import PageEnum 1.0
import ContainerProps 1.0
import Style 1.0
import "./"
import "../Controls2"
import "../Controls2/TextTypes"
import "../Components"
import "../Config"
PageType {
id: root
BackButtonType {
id: backButton
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 20 + PageController.safeAreaTopMargin
onFocusChanged: {
if (this.activeFocus) {
listView.positionViewAtBeginning()
}
}
}
ListViewType {
id: listView
property string headerText: ""
property string configContentHeaderText: ""
anchors.top: backButton.bottom
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
header: ColumnLayout {
width: listView.width
BaseHeaderType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.topMargin: 24
headerText: qsTr("Full access to the server and VPN")
}
ParagraphTextType {
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.topMargin: 24
Layout.bottomMargin: 24
text: qsTr("We recommend that you use full access to the server only for your own additional devices.\n") +
qsTr("If you share full access with other people, they can remove and add protocols and services to the server, which will cause the VPN to work incorrectly for all users. ")
color: AmneziaStyle.color.mutedGray
}
DropDownType {
id: serverSelector
objectName: "serverSelector"
signal severSelectorIndexChanged
property int currentIndex: 0
Layout.fillWidth: true
Layout.leftMargin: 16
Layout.rightMargin: 16
Layout.topMargin: 16
drawerHeight: 0.4375
drawerParent: root
descriptionText: qsTr("Server")
headerText: qsTr("Server")
listView: ListViewWithRadioButtonType {
id: serverSelectorListView
rootWidth: root.width
imageSource: "qrc:/images/controls/check.svg"
model: SortFilterProxyModel {
id: proxyServersModel
sourceModel: ServersModel
filters: [
ValueFilter {
roleName: "hasWriteAccess"
value: true
}
]
}
clickedFunction: function() {
handler()
if (serverSelector.currentIndex !== serverSelectorListView.selectedIndex) {
serverSelector.currentIndex = serverSelectorListView.selectedIndex
serverSelector.severSelectorIndexChanged()
}
listView.headerText = qsTr("Accessing ") + serverSelector.text
listView.configContentHeaderText = qsTr("File with accessing settings to ") + serverSelector.text
serverSelector.closeTriggered()
}
Component.onCompleted: {
serverSelectorListView.currentIndex = ServersModel.isDefaultServerHasWriteAccess() ?
proxyServersModel.mapFromSource(ServersUiController.defaultIndex) : 0
serverSelectorListView.triggerCurrentItem()
}
function handler() {
serverSelector.text = selectedText
ServersUiController.processedIndex = proxyServersModel.mapToSource(selectedIndex)
}
}
}
}
model: 1 // fake model to force the ListView to be created without a model
spacing: 0
delegate: ColumnLayout {
width: listView.width
BasicButtonType {
id: shareButton
Layout.fillWidth: true
Layout.topMargin: 32
Layout.leftMargin: 16
Layout.rightMargin: 16
text: qsTr("Share")
leftImageSource: "qrc:/images/controls/share-2.svg"
clickedFunc: function() {
PageController.showBusyIndicator(true)
if (Qt.platform.os === "android" && !SystemController.isAuthenticated()) {
PageController.showBusyIndicator(false)
ExportController.exportErrorOccurred(qsTr("Access error!"))
return
} else {
ExportController.generateFullAccessConfig(ServersUiController.processedIndex)
}
PageController.showBusyIndicator(false)
PageController.goToShareConnectionPage(listView.headerText, listView.configContentHeaderText, "", ".vpn", "amnezia_config")
}
}
}
}
}
+17 -18
View File
@@ -141,11 +141,7 @@ PageType {
PageController.showNotificationMessage(message)
}
function onApiConfigRemoved(message) {
PageController.showNotificationMessage(message)
}
function onRemoveProcessedServerFinished(finishedMessage) {
function onRemoveServerFinished(finishedMessage) {
if (!ServersModel.getServersCount()) {
PageController.goToPageHome()
} else {
@@ -158,8 +154,7 @@ PageType {
function onNoInstalledContainers() {
PageController.setTriggeredByConnectButton(true)
ServersModel.processedIndex = ServersModel.getDefaultServerIndex()
InstallController.setShouldCreateServer(false)
ServersUiController.processedIndex = ServersUiController.defaultIndex
PageController.goToPage(PageEnum.PageSetupWizardEasy)
}
}
@@ -215,7 +210,7 @@ PageType {
}
Connections {
target: ApiSettingsController
target: SubscriptionUiController
function onErrorOccurred(error) {
PageController.showErrorMessage(error)
@@ -223,16 +218,20 @@ PageType {
}
Connections {
target: ApiConfigsController
target: SubscriptionUiController
function onApiConfigRemoved(message) {
PageController.showNotificationMessage(message)
}
function onInstallServerFromApiFinished(message, preferredDefaultIndex) {
if (!ConnectionController.isConnected) {
if (preferredDefaultIndex !== undefined && preferredDefaultIndex >= 0) {
ServersModel.setDefaultServerIndex(preferredDefaultIndex)
ServersUiController.setDefaultServerIndex(preferredDefaultIndex)
} else {
ServersModel.setDefaultServerIndex(ServersModel.getServersCount() - 1)
ServersUiController.setDefaultServerIndex(ServersModel.getServersCount() - 1);
}
ServersModel.processedIndex = ServersModel.defaultIndex
ServersUiController.processedIndex = ServersUiController.defaultIndex
}
PageController.goToPageHome()
@@ -275,7 +274,7 @@ PageType {
} else {
tabBar.visible = true
pagePath = PageController.getPagePath(PageEnum.PageHome)
ServersModel.processedIndex = ServersModel.defaultIndex
ServersUiController.processedIndex = ServersUiController.defaultIndex
}
tabBarStackView.push(pagePath, { "objectName" : pagePath })
@@ -309,10 +308,10 @@ PageType {
anchors.bottom: parent.bottom
// Also adjust TabBar position when keyboard appears (Android 14+ workaround)
anchors.bottomMargin: SettingsController.imeHeight
anchors.bottomMargin: PageController.imeHeight
topPadding: 8
bottomPadding: 8 + SettingsController.safeAreaBottomMargin
bottomPadding: 8 + PageController.safeAreaBottomMargin
leftPadding: 96
rightPadding: 96
@@ -349,7 +348,7 @@ PageType {
image: "qrc:/images/controls/home.svg"
clickedFunc: function () {
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
ServersModel.processedIndex = ServersModel.defaultIndex
ServersUiController.processedIndex = ServersUiController.defaultIndex
tabBar.currentIndex = 0
}
}
@@ -386,12 +385,12 @@ PageType {
objectName: "settingsTabButton"
isSelected: tabBar.currentIndex === 2
image: (ServersModel.hasServersFromGatewayApi && NewsModel.hasUnread && SettingsController.isNewsNotificationsEnabled()) ? "qrc:/images/controls/settings-news.svg" : "qrc:/images/controls/settings.svg"
image: (ServersUiController.hasServersFromGatewayApi && NewsModel.hasUnread && SettingsController.isNewsNotificationsEnabled()) ? "qrc:/images/controls/settings-news.svg" : "qrc:/images/controls/settings.svg"
Binding {
target: settingsTabButton
property: "defaultColor"
value: "transparent"
when: (ServersModel.hasServersFromGatewayApi && NewsModel.hasUnread)
when: (ServersUiController.hasServersFromGatewayApi && NewsModel.hasUnread)
}
clickedFunc: function () {
tabBarStackView.goToTabBarPage(PageEnum.PageSettings)