Added the advanced settings page
- added a button to scan the server for installed containers - added a check on the presence of installed containers before configuring the server, if the containers are already installed, then we will add them to the GUI - added new control element - PopupWarning.qml
This commit is contained in:
parent
b5778a9cb5
commit
ddc3fe7807
23 changed files with 487 additions and 156 deletions
63
client/ui/pages_logic/AdvancedServerSettingsLogic.cpp
Normal file
63
client/ui/pages_logic/AdvancedServerSettingsLogic.cpp
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
#include "AdvancedServerSettingsLogic.h"
|
||||
|
||||
#include "VpnLogic.h"
|
||||
#include "ui/uilogic.h"
|
||||
#include "core/errorstrings.h"
|
||||
#include "core/servercontroller.h"
|
||||
|
||||
AdvancedServerSettingsLogic::AdvancedServerSettingsLogic(UiLogic *uiLogic, QObject *parent): PageLogicBase(uiLogic, parent),
|
||||
m_labelWaitInfoVisible{true},
|
||||
m_pushButtonClearVisible{true},
|
||||
m_pushButtonClearText{tr("Clear server from Amnezia software")}
|
||||
{
|
||||
}
|
||||
|
||||
void AdvancedServerSettingsLogic::onUpdatePage()
|
||||
{
|
||||
set_labelWaitInfoVisible(false);
|
||||
set_labelWaitInfoText("");
|
||||
set_pushButtonClearVisible(m_settings->haveAuthData(uiLogic()->m_selectedServerIndex));
|
||||
const QJsonObject &server = m_settings->server(uiLogic()->m_selectedServerIndex);
|
||||
const QString &port = server.value(config_key::port).toString();
|
||||
|
||||
const QString &userName = server.value(config_key::userName).toString();
|
||||
const QString &hostName = server.value(config_key::hostName).toString();
|
||||
QString name = QString("%1%2%3%4%5").arg(userName,
|
||||
userName.isEmpty() ? "" : "@",
|
||||
hostName,
|
||||
port.isEmpty() ? "" : ":",
|
||||
port);
|
||||
|
||||
set_labelServerText(name);
|
||||
|
||||
DockerContainer selectedContainer = m_settings->defaultContainer(uiLogic()->m_selectedServerIndex);
|
||||
QString selectedContainerName = ContainerProps::containerHumanNames().value(selectedContainer);
|
||||
set_labelCurrentVpnProtocolText(tr("Service: ") + selectedContainerName);
|
||||
}
|
||||
|
||||
void AdvancedServerSettingsLogic::onPushButtonClearServer()
|
||||
{
|
||||
set_pageEnabled(false);
|
||||
set_pushButtonClearText(tr("Uninstalling Amnezia software..."));
|
||||
|
||||
if (m_settings->defaultServerIndex() == uiLogic()->m_selectedServerIndex) {
|
||||
uiLogic()->pageLogic<VpnLogic>()->onDisconnect();
|
||||
}
|
||||
|
||||
ErrorCode e = m_serverController->removeAllContainers(m_settings->serverCredentials(uiLogic()->m_selectedServerIndex));
|
||||
m_serverController->disconnectFromHost(m_settings->serverCredentials(uiLogic()->m_selectedServerIndex));
|
||||
if (e) {
|
||||
uiLogic()->set_dialogConnectErrorText(tr("Error occurred while configuring server.") + "\n" +
|
||||
errorString(e) + "\n" + tr("See logs for details."));
|
||||
emit uiLogic()->showConnectErrorDialog();
|
||||
} else {
|
||||
set_labelWaitInfoVisible(true);
|
||||
set_labelWaitInfoText(tr("Amnezia server successfully uninstalled"));
|
||||
}
|
||||
|
||||
m_settings->setContainers(uiLogic()->m_selectedServerIndex, {});
|
||||
m_settings->setDefaultContainer(uiLogic()->m_selectedServerIndex, DockerContainer::None);
|
||||
|
||||
set_pageEnabled(true);
|
||||
set_pushButtonClearText(tr("Clear server from Amnezia software"));
|
||||
}
|
||||
30
client/ui/pages_logic/AdvancedServerSettingsLogic.h
Normal file
30
client/ui/pages_logic/AdvancedServerSettingsLogic.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef ADVANCEDSERVERSETTINGSLOGIC_H
|
||||
#define ADVANCEDSERVERSETTINGSLOGIC_H
|
||||
|
||||
#include "PageLogicBase.h"
|
||||
|
||||
class UiLogic;
|
||||
|
||||
class AdvancedServerSettingsLogic : public PageLogicBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
AUTO_PROPERTY(bool, labelWaitInfoVisible)
|
||||
AUTO_PROPERTY(QString, labelWaitInfoText)
|
||||
|
||||
AUTO_PROPERTY(QString, pushButtonClearText)
|
||||
AUTO_PROPERTY(bool, pushButtonClearVisible)
|
||||
|
||||
AUTO_PROPERTY(QString, labelServerText)
|
||||
AUTO_PROPERTY(QString, labelCurrentVpnProtocolText)
|
||||
|
||||
public:
|
||||
explicit AdvancedServerSettingsLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~AdvancedServerSettingsLogic() = default;
|
||||
|
||||
Q_INVOKABLE void onUpdatePage() override;
|
||||
|
||||
Q_INVOKABLE void onPushButtonClearServer();
|
||||
};
|
||||
|
||||
#endif // ADVANCEDSERVERSETTINGSLOGIC_H
|
||||
|
|
@ -12,29 +12,29 @@ GeneralSettingsLogic::GeneralSettingsLogic(UiLogic *logic, QObject *parent):
|
|||
|
||||
void GeneralSettingsLogic::onUpdatePage()
|
||||
{
|
||||
uiLogic()->selectedServerIndex = m_settings->defaultServerIndex();
|
||||
set_existsAnyServer(uiLogic()->selectedServerIndex >= 0);
|
||||
uiLogic()->selectedDockerContainer = m_settings->defaultContainer(m_settings->defaultServerIndex());
|
||||
uiLogic()->m_selectedServerIndex = m_settings->defaultServerIndex();
|
||||
set_existsAnyServer(uiLogic()->m_selectedServerIndex >= 0);
|
||||
uiLogic()->m_selectedDockerContainer = m_settings->defaultContainer(m_settings->defaultServerIndex());
|
||||
|
||||
set_pushButtonGeneralSettingsShareConnectionEnable(m_settings->haveAuthData(m_settings->defaultServerIndex()));
|
||||
}
|
||||
|
||||
void GeneralSettingsLogic::onPushButtonGeneralSettingsServerSettingsClicked()
|
||||
{
|
||||
uiLogic()->selectedServerIndex = m_settings->defaultServerIndex();
|
||||
uiLogic()->selectedDockerContainer = m_settings->defaultContainer(m_settings->defaultServerIndex());
|
||||
uiLogic()->m_selectedServerIndex = m_settings->defaultServerIndex();
|
||||
uiLogic()->m_selectedDockerContainer = m_settings->defaultContainer(m_settings->defaultServerIndex());
|
||||
|
||||
emit uiLogic()->goToPage(Page::ServerSettings);
|
||||
}
|
||||
|
||||
void GeneralSettingsLogic::onPushButtonGeneralSettingsShareConnectionClicked()
|
||||
{
|
||||
uiLogic()->selectedServerIndex = m_settings->defaultServerIndex();
|
||||
uiLogic()->selectedDockerContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex);
|
||||
uiLogic()->m_selectedServerIndex = m_settings->defaultServerIndex();
|
||||
uiLogic()->m_selectedDockerContainer = m_settings->defaultContainer(uiLogic()->m_selectedServerIndex);
|
||||
|
||||
qobject_cast<ProtocolsModel *>(uiLogic()->protocolsModel())->setSelectedServerIndex(uiLogic()->selectedServerIndex);
|
||||
qobject_cast<ProtocolsModel *>(uiLogic()->protocolsModel())->setSelectedDockerContainer(uiLogic()->selectedDockerContainer);
|
||||
qobject_cast<ProtocolsModel *>(uiLogic()->protocolsModel())->setSelectedServerIndex(uiLogic()->m_selectedServerIndex);
|
||||
qobject_cast<ProtocolsModel *>(uiLogic()->protocolsModel())->setSelectedDockerContainer(uiLogic()->m_selectedDockerContainer);
|
||||
|
||||
uiLogic()->pageLogic<ShareConnectionLogic>()->updateSharingPage(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer);
|
||||
uiLogic()->pageLogic<ShareConnectionLogic>()->updateSharingPage(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer);
|
||||
emit uiLogic()->goToPage(Page::ShareConnection);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,34 +24,34 @@ ServerContainersLogic::ServerContainersLogic(UiLogic *logic, QObject *parent):
|
|||
void ServerContainersLogic::onUpdatePage()
|
||||
{
|
||||
ContainersModel *c_model = qobject_cast<ContainersModel *>(uiLogic()->containersModel());
|
||||
c_model->setSelectedServerIndex(uiLogic()->selectedServerIndex);
|
||||
c_model->setSelectedServerIndex(uiLogic()->m_selectedServerIndex);
|
||||
|
||||
ProtocolsModel *p_model = qobject_cast<ProtocolsModel *>(uiLogic()->protocolsModel());
|
||||
p_model->setSelectedServerIndex(uiLogic()->selectedServerIndex);
|
||||
p_model->setSelectedServerIndex(uiLogic()->m_selectedServerIndex);
|
||||
|
||||
set_isManagedServer(m_settings->haveAuthData(uiLogic()->selectedServerIndex));
|
||||
set_isManagedServer(m_settings->haveAuthData(uiLogic()->m_selectedServerIndex));
|
||||
emit updatePage();
|
||||
}
|
||||
|
||||
void ServerContainersLogic::onPushButtonProtoSettingsClicked(DockerContainer c, Proto p)
|
||||
{
|
||||
qDebug()<< "ServerContainersLogic::onPushButtonProtoSettingsClicked" << c << p;
|
||||
uiLogic()->selectedDockerContainer = c;
|
||||
uiLogic()->protocolLogic(p)->updateProtocolPage(m_settings->protocolConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, p),
|
||||
uiLogic()->selectedDockerContainer,
|
||||
m_settings->haveAuthData(uiLogic()->selectedServerIndex));
|
||||
uiLogic()->m_selectedDockerContainer = c;
|
||||
uiLogic()->protocolLogic(p)->updateProtocolPage(m_settings->protocolConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer, p),
|
||||
uiLogic()->m_selectedDockerContainer,
|
||||
m_settings->haveAuthData(uiLogic()->m_selectedServerIndex));
|
||||
|
||||
emit uiLogic()->goToProtocolPage(p);
|
||||
}
|
||||
|
||||
void ServerContainersLogic::onPushButtonDefaultClicked(DockerContainer c)
|
||||
{
|
||||
if (m_settings->defaultContainer(uiLogic()->selectedServerIndex) == c) return;
|
||||
if (m_settings->defaultContainer(uiLogic()->m_selectedServerIndex) == c) return;
|
||||
|
||||
m_settings->setDefaultContainer(uiLogic()->selectedServerIndex, c);
|
||||
m_settings->setDefaultContainer(uiLogic()->m_selectedServerIndex, c);
|
||||
uiLogic()->onUpdateAllPages();
|
||||
|
||||
if (uiLogic()->selectedServerIndex != m_settings->defaultServerIndex()) return;
|
||||
if (uiLogic()->m_selectedServerIndex != m_settings->defaultServerIndex()) return;
|
||||
if (!uiLogic()->m_vpnConnection) return;
|
||||
if (!uiLogic()->m_vpnConnection->isConnected()) return;
|
||||
|
||||
|
|
@ -61,21 +61,21 @@ void ServerContainersLogic::onPushButtonDefaultClicked(DockerContainer c)
|
|||
|
||||
void ServerContainersLogic::onPushButtonShareClicked(DockerContainer c)
|
||||
{
|
||||
uiLogic()->pageLogic<ShareConnectionLogic>()->updateSharingPage(uiLogic()->selectedServerIndex, c);
|
||||
uiLogic()->pageLogic<ShareConnectionLogic>()->updateSharingPage(uiLogic()->m_selectedServerIndex, c);
|
||||
emit uiLogic()->goToPage(Page::ShareConnection);
|
||||
}
|
||||
|
||||
void ServerContainersLogic::onPushButtonRemoveClicked(DockerContainer container)
|
||||
{
|
||||
//buttonSetEnabledFunc(false);
|
||||
ErrorCode e = m_serverController->removeContainer(m_settings->serverCredentials(uiLogic()->selectedServerIndex), container);
|
||||
m_settings->removeContainerConfig(uiLogic()->selectedServerIndex, container);
|
||||
ErrorCode e = m_serverController->removeContainer(m_settings->serverCredentials(uiLogic()->m_selectedServerIndex), container);
|
||||
m_settings->removeContainerConfig(uiLogic()->m_selectedServerIndex, container);
|
||||
//buttonSetEnabledFunc(true);
|
||||
|
||||
if (m_settings->defaultContainer(uiLogic()->selectedServerIndex) == container) {
|
||||
const auto &c = m_settings->containers(uiLogic()->selectedServerIndex);
|
||||
if (c.isEmpty()) m_settings->setDefaultContainer(uiLogic()->selectedServerIndex, DockerContainer::None);
|
||||
else m_settings->setDefaultContainer(uiLogic()->selectedServerIndex, c.keys().first());
|
||||
if (m_settings->defaultContainer(uiLogic()->m_selectedServerIndex) == container) {
|
||||
const auto &c = m_settings->containers(uiLogic()->m_selectedServerIndex);
|
||||
if (c.isEmpty()) m_settings->setDefaultContainer(uiLogic()->m_selectedServerIndex, DockerContainer::None);
|
||||
else m_settings->setDefaultContainer(uiLogic()->m_selectedServerIndex, c.keys().first());
|
||||
}
|
||||
uiLogic()->onUpdateAllPages();
|
||||
}
|
||||
|
|
@ -87,14 +87,21 @@ void ServerContainersLogic::onPushButtonContinueClicked(DockerContainer c, int p
|
|||
emit uiLogic()->goToPage(Page::ServerConfiguringProgress);
|
||||
qApp->processEvents();
|
||||
|
||||
ErrorCode error = uiLogic()->pageLogic<ServerConfiguringProgressLogic>()->doInstallAction([this, c, &config](){
|
||||
return m_serverController->setupContainer(m_settings->serverCredentials(uiLogic()->selectedServerIndex), c, config);
|
||||
});
|
||||
uiLogic()->getInstalledContainers(false); //todo its work like should be?
|
||||
|
||||
if (error == ErrorCode::NoError || error == ErrorCode::ServerContainerAlreadyInstalledError) {
|
||||
m_settings->setContainerConfig(uiLogic()->selectedServerIndex, c, config);
|
||||
if (ContainerProps::containerService(c) == ServiceType::Vpn) {
|
||||
m_settings->setDefaultContainer(uiLogic()->selectedServerIndex, c);
|
||||
ServerCredentials credentials = m_settings->serverCredentials(uiLogic()->m_selectedServerIndex);
|
||||
|
||||
if (!uiLogic()->isContainerAlreadyAddedToGui(c, credentials)) {
|
||||
auto installAction = [this, c, &config](){
|
||||
return m_serverController->setupContainer(m_settings->serverCredentials(uiLogic()->m_selectedServerIndex), c, config);
|
||||
};
|
||||
ErrorCode error = uiLogic()->pageLogic<ServerConfiguringProgressLogic>()->doInstallAction(installAction);
|
||||
|
||||
if (error == ErrorCode::NoError) {
|
||||
m_settings->setContainerConfig(uiLogic()->m_selectedServerIndex, c, config);
|
||||
if (ContainerProps::containerService(c) == ServiceType::Vpn) {
|
||||
m_settings->setDefaultContainer(uiLogic()->m_selectedServerIndex, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ void ServerListLogic::onServerListPushbuttonDefaultClicked(int index)
|
|||
|
||||
void ServerListLogic::onServerListPushbuttonSettingsClicked(int index)
|
||||
{
|
||||
uiLogic()->selectedServerIndex = index;
|
||||
uiLogic()->m_selectedServerIndex = index;
|
||||
uiLogic()->goToPage(Page::ServerSettings);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ void ServerSettingsLogic::onUpdatePage()
|
|||
{
|
||||
set_labelWaitInfoVisible(false);
|
||||
set_labelWaitInfoText("");
|
||||
set_pushButtonClearVisible(m_settings->haveAuthData(uiLogic()->selectedServerIndex));
|
||||
set_pushButtonClearClientCacheVisible(m_settings->haveAuthData(uiLogic()->selectedServerIndex));
|
||||
set_pushButtonShareFullVisible(m_settings->haveAuthData(uiLogic()->selectedServerIndex));
|
||||
const QJsonObject &server = m_settings->server(uiLogic()->selectedServerIndex);
|
||||
set_pushButtonClearVisible(m_settings->haveAuthData(uiLogic()->m_selectedServerIndex));
|
||||
set_pushButtonClearClientCacheVisible(m_settings->haveAuthData(uiLogic()->m_selectedServerIndex));
|
||||
set_pushButtonShareFullVisible(m_settings->haveAuthData(uiLogic()->m_selectedServerIndex));
|
||||
const QJsonObject &server = m_settings->server(uiLogic()->m_selectedServerIndex);
|
||||
const QString &port = server.value(config_key::port).toString();
|
||||
|
||||
const QString &userName = server.value(config_key::userName).toString();
|
||||
|
|
@ -45,7 +45,7 @@ void ServerSettingsLogic::onUpdatePage()
|
|||
set_labelServerText(name);
|
||||
set_lineEditDescriptionText(server.value(config_key::description).toString());
|
||||
|
||||
DockerContainer selectedContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex);
|
||||
DockerContainer selectedContainer = m_settings->defaultContainer(uiLogic()->m_selectedServerIndex);
|
||||
QString selectedContainerName = ContainerProps::containerHumanNames().value(selectedContainer);
|
||||
set_labelCurrentVpnProtocolText(tr("Service: ") + selectedContainerName);
|
||||
}
|
||||
|
|
@ -55,12 +55,12 @@ void ServerSettingsLogic::onPushButtonClearServer()
|
|||
set_pageEnabled(false);
|
||||
set_pushButtonClearText(tr("Uninstalling Amnezia software..."));
|
||||
|
||||
if (m_settings->defaultServerIndex() == uiLogic()->selectedServerIndex) {
|
||||
if (m_settings->defaultServerIndex() == uiLogic()->m_selectedServerIndex) {
|
||||
uiLogic()->pageLogic<VpnLogic>()->onDisconnect();
|
||||
}
|
||||
|
||||
ErrorCode e = m_serverController->removeAllContainers(m_settings->serverCredentials(uiLogic()->selectedServerIndex));
|
||||
m_serverController->disconnectFromHost(m_settings->serverCredentials(uiLogic()->selectedServerIndex));
|
||||
ErrorCode e = m_serverController->removeAllContainers(m_settings->serverCredentials(uiLogic()->m_selectedServerIndex));
|
||||
m_serverController->disconnectFromHost(m_settings->serverCredentials(uiLogic()->m_selectedServerIndex));
|
||||
if (e) {
|
||||
uiLogic()->set_dialogConnectErrorText(
|
||||
tr("Error occurred while configuring server.") + "\n" +
|
||||
|
|
@ -73,8 +73,8 @@ void ServerSettingsLogic::onPushButtonClearServer()
|
|||
set_labelWaitInfoText(tr("Amnezia server successfully uninstalled"));
|
||||
}
|
||||
|
||||
m_settings->setContainers(uiLogic()->selectedServerIndex, {});
|
||||
m_settings->setDefaultContainer(uiLogic()->selectedServerIndex, DockerContainer::None);
|
||||
m_settings->setContainers(uiLogic()->m_selectedServerIndex, {});
|
||||
m_settings->setDefaultContainer(uiLogic()->m_selectedServerIndex, DockerContainer::None);
|
||||
|
||||
set_pageEnabled(true);
|
||||
set_pushButtonClearText(tr("Clear server from Amnezia software"));
|
||||
|
|
@ -82,15 +82,15 @@ void ServerSettingsLogic::onPushButtonClearServer()
|
|||
|
||||
void ServerSettingsLogic::onPushButtonForgetServer()
|
||||
{
|
||||
if (m_settings->defaultServerIndex() == uiLogic()->selectedServerIndex && uiLogic()->m_vpnConnection->isConnected()) {
|
||||
if (m_settings->defaultServerIndex() == uiLogic()->m_selectedServerIndex && uiLogic()->m_vpnConnection->isConnected()) {
|
||||
uiLogic()->pageLogic<VpnLogic>()->onDisconnect();
|
||||
}
|
||||
m_settings->removeServer(uiLogic()->selectedServerIndex);
|
||||
m_settings->removeServer(uiLogic()->m_selectedServerIndex);
|
||||
|
||||
if (m_settings->defaultServerIndex() == uiLogic()->selectedServerIndex) {
|
||||
if (m_settings->defaultServerIndex() == uiLogic()->m_selectedServerIndex) {
|
||||
m_settings->setDefaultServer(0);
|
||||
}
|
||||
else if (m_settings->defaultServerIndex() > uiLogic()->selectedServerIndex) {
|
||||
else if (m_settings->defaultServerIndex() > uiLogic()->m_selectedServerIndex) {
|
||||
m_settings->setDefaultServer(m_settings->defaultServerIndex() - 1);
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ void ServerSettingsLogic::onPushButtonForgetServer()
|
|||
}
|
||||
|
||||
|
||||
uiLogic()->selectedServerIndex = -1;
|
||||
uiLogic()->m_selectedServerIndex = -1;
|
||||
uiLogic()->onUpdateAllPages();
|
||||
|
||||
if (m_settings->serversCount() == 0) {
|
||||
|
|
@ -114,9 +114,9 @@ void ServerSettingsLogic::onPushButtonClearClientCacheClicked()
|
|||
{
|
||||
set_pushButtonClearClientCacheText(tr("Cache cleared"));
|
||||
|
||||
const auto &containers = m_settings->containers(uiLogic()->selectedServerIndex);
|
||||
for (DockerContainer container: containers.keys()) {
|
||||
m_settings->clearLastConnectionConfig(uiLogic()->selectedServerIndex, container);
|
||||
const auto &containers = m_settings->containers(uiLogic()->m_selectedServerIndex);
|
||||
for (DockerContainer container : containers.keys()) {
|
||||
m_settings->clearLastConnectionConfig(uiLogic()->m_selectedServerIndex, container);
|
||||
}
|
||||
|
||||
QTimer::singleShot(3000, this, [this]() {
|
||||
|
|
@ -127,9 +127,9 @@ void ServerSettingsLogic::onPushButtonClearClientCacheClicked()
|
|||
void ServerSettingsLogic::onLineEditDescriptionEditingFinished()
|
||||
{
|
||||
const QString &newText = lineEditDescriptionText();
|
||||
QJsonObject server = m_settings->server(uiLogic()->selectedServerIndex);
|
||||
QJsonObject server = m_settings->server(uiLogic()->m_selectedServerIndex);
|
||||
server.insert(config_key::description, newText);
|
||||
m_settings->editServer(uiLogic()->selectedServerIndex, server);
|
||||
m_settings->editServer(uiLogic()->m_selectedServerIndex, server);
|
||||
uiLogic()->onUpdateAllPages();
|
||||
}
|
||||
|
||||
|
|
@ -168,7 +168,7 @@ void ServerSettingsLogic::onPushButtonShareFullClicked()
|
|||
}
|
||||
}
|
||||
#else
|
||||
uiLogic()->pageLogic<ShareConnectionLogic>()->updateSharingPage(uiLogic()->selectedServerIndex, DockerContainer::None);
|
||||
uiLogic()->pageLogic<ShareConnectionLogic>()->updateSharingPage(uiLogic()->m_selectedServerIndex, DockerContainer::None);
|
||||
emit uiLogic()->goToShareProtocolPage(Proto::Any);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ void ShareConnectionLogic::onPushButtonShareAmneziaGenerateClicked()
|
|||
set_shareAmneziaQrCodeTextSeriesLength(0);
|
||||
|
||||
QJsonObject serverConfig;
|
||||
int serverIndex = uiLogic()->selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->selectedDockerContainer;
|
||||
int serverIndex = uiLogic()->m_selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->m_selectedDockerContainer;
|
||||
|
||||
// Full access
|
||||
if (shareFullAccess()) {
|
||||
|
|
@ -127,8 +127,8 @@ void ShareConnectionLogic::onPushButtonShareAmneziaGenerateClicked()
|
|||
|
||||
void ShareConnectionLogic::onPushButtonShareOpenVpnGenerateClicked()
|
||||
{
|
||||
int serverIndex = uiLogic()->selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->selectedDockerContainer;
|
||||
int serverIndex = uiLogic()->m_selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->m_selectedDockerContainer;
|
||||
ServerCredentials credentials = m_settings->serverCredentials(serverIndex);
|
||||
|
||||
const QJsonObject &containerConfig = m_settings->containerConfig(serverIndex, container);
|
||||
|
|
@ -142,8 +142,8 @@ void ShareConnectionLogic::onPushButtonShareOpenVpnGenerateClicked()
|
|||
|
||||
void ShareConnectionLogic::onPushButtonShareShadowSocksGenerateClicked()
|
||||
{
|
||||
int serverIndex = uiLogic()->selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->selectedDockerContainer;
|
||||
int serverIndex = uiLogic()->m_selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->m_selectedDockerContainer;
|
||||
ServerCredentials credentials = m_settings->serverCredentials(serverIndex);
|
||||
|
||||
QJsonObject protoConfig = m_settings->protocolConfig(serverIndex, container, Proto::ShadowSocks);
|
||||
|
|
@ -186,8 +186,8 @@ void ShareConnectionLogic::onPushButtonShareShadowSocksGenerateClicked()
|
|||
|
||||
void ShareConnectionLogic::onPushButtonShareCloakGenerateClicked()
|
||||
{
|
||||
int serverIndex = uiLogic()->selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->selectedDockerContainer;
|
||||
int serverIndex = uiLogic()->m_selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->m_selectedDockerContainer;
|
||||
ServerCredentials credentials = m_settings->serverCredentials(serverIndex);
|
||||
|
||||
QJsonObject protoConfig = m_settings->protocolConfig(serverIndex, container, Proto::Cloak);
|
||||
|
|
@ -209,8 +209,8 @@ void ShareConnectionLogic::onPushButtonShareCloakGenerateClicked()
|
|||
|
||||
void ShareConnectionLogic::onPushButtonShareWireGuardGenerateClicked()
|
||||
{
|
||||
int serverIndex = uiLogic()->selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->selectedDockerContainer;
|
||||
int serverIndex = uiLogic()->m_selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->m_selectedDockerContainer;
|
||||
ServerCredentials credentials = m_settings->serverCredentials(serverIndex);
|
||||
|
||||
const QJsonObject &containerConfig = m_settings->containerConfig(serverIndex, container);
|
||||
|
|
@ -236,8 +236,8 @@ void ShareConnectionLogic::onPushButtonShareWireGuardGenerateClicked()
|
|||
|
||||
void ShareConnectionLogic::onPushButtonShareIkev2GenerateClicked()
|
||||
{
|
||||
int serverIndex = uiLogic()->selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->selectedDockerContainer;
|
||||
int serverIndex = uiLogic()->m_selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->m_selectedDockerContainer;
|
||||
ServerCredentials credentials = m_settings->serverCredentials(serverIndex);
|
||||
|
||||
Ikev2Configurator::ConnectionData connData = m_configurator->ikev2Configurator->prepareIkev2Config(credentials, container);
|
||||
|
|
@ -259,8 +259,8 @@ void ShareConnectionLogic::onPushButtonShareIkev2GenerateClicked()
|
|||
|
||||
void ShareConnectionLogic::updateSharingPage(int serverIndex, DockerContainer container)
|
||||
{
|
||||
uiLogic()->selectedDockerContainer = container;
|
||||
uiLogic()->selectedServerIndex = serverIndex;
|
||||
uiLogic()->m_selectedDockerContainer = container;
|
||||
uiLogic()->m_selectedServerIndex = serverIndex;
|
||||
set_shareFullAccess(container == DockerContainer::None);
|
||||
|
||||
m_shareAmneziaQrCodeTextSeries.clear();
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ void StartPageLogic::onPushButtonConnect()
|
|||
set_pushButtonConnectEnabled(true);
|
||||
set_pushButtonConnectText(tr("Connect"));
|
||||
|
||||
uiLogic()->installCredentials = serverCredentials;
|
||||
uiLogic()->m_installCredentials = serverCredentials;
|
||||
if (ok) emit uiLogic()->goToPage(Page::NewServer);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ void ViewConfigLogic::importConfig()
|
|||
|
||||
|
||||
if (!configJson().contains(config_key::containers) || configJson().value(config_key::containers).toArray().isEmpty()) {
|
||||
uiLogic()->selectedServerIndex = m_settings->defaultServerIndex();
|
||||
uiLogic()->selectedDockerContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex);
|
||||
uiLogic()->m_selectedServerIndex = m_settings->defaultServerIndex();
|
||||
uiLogic()->m_selectedDockerContainer = m_settings->defaultContainer(uiLogic()->m_selectedServerIndex);
|
||||
uiLogic()->onUpdateAllPages();
|
||||
emit uiLogic()->goToPage(Page::Vpn);
|
||||
emit uiLogic()->setStartPage(Page::Vpn);
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ QJsonObject CloakLogic::getProtocolConfigFromPage(QJsonObject oldConfig)
|
|||
|
||||
void CloakLogic::onPushButtonSaveClicked()
|
||||
{
|
||||
QJsonObject protocolConfig = m_settings->protocolConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, Proto::Cloak);
|
||||
QJsonObject protocolConfig = m_settings->protocolConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer, Proto::Cloak);
|
||||
protocolConfig = getProtocolConfigFromPage(protocolConfig);
|
||||
|
||||
QJsonObject containerConfig = m_settings->containerConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer);
|
||||
QJsonObject containerConfig = m_settings->containerConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer);
|
||||
QJsonObject newContainerConfig = containerConfig;
|
||||
newContainerConfig.insert(ProtocolProps::protoToString(Proto::Cloak), protocolConfig);
|
||||
|
||||
|
|
@ -113,8 +113,8 @@ void CloakLogic::onPushButtonSaveClicked()
|
|||
progressBarFunc.setTextVisibleFunc(true);
|
||||
progressBarFunc.setTextFunc(QString("Configuring..."));
|
||||
ErrorCode e = uiLogic()->pageLogic<ServerConfiguringProgressLogic>()->doInstallAction([this, containerConfig, &newContainerConfig](){
|
||||
return m_serverController->updateContainer(m_settings->serverCredentials(uiLogic()->selectedServerIndex),
|
||||
uiLogic()->selectedDockerContainer,
|
||||
return m_serverController->updateContainer(m_settings->serverCredentials(uiLogic()->m_selectedServerIndex),
|
||||
uiLogic()->m_selectedDockerContainer,
|
||||
containerConfig,
|
||||
newContainerConfig);
|
||||
},
|
||||
|
|
@ -123,11 +123,11 @@ void CloakLogic::onPushButtonSaveClicked()
|
|||
busyInfoFuncy, cancelButtonFunc);
|
||||
|
||||
if (!e) {
|
||||
m_settings->setContainerConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, newContainerConfig);
|
||||
m_settings->clearLastConnectionConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer);
|
||||
m_settings->setContainerConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer, newContainerConfig);
|
||||
m_settings->clearLastConnectionConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer);
|
||||
}
|
||||
|
||||
qDebug() << "Protocol saved with code:" << e << "for" << uiLogic()->selectedServerIndex << uiLogic()->selectedDockerContainer;
|
||||
qDebug() << "Protocol saved with code:" << e << "for" << uiLogic()->m_selectedServerIndex << uiLogic()->m_selectedDockerContainer;
|
||||
}
|
||||
|
||||
void CloakLogic::onPushButtonCancelClicked()
|
||||
|
|
|
|||
|
|
@ -105,10 +105,10 @@ void OpenVpnLogic::updateProtocolPage(const QJsonObject &openvpnConfig, DockerCo
|
|||
|
||||
void OpenVpnLogic::onPushButtonSaveClicked()
|
||||
{
|
||||
QJsonObject protocolConfig = m_settings->protocolConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, Proto::OpenVpn);
|
||||
QJsonObject protocolConfig = m_settings->protocolConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer, Proto::OpenVpn);
|
||||
protocolConfig = getProtocolConfigFromPage(protocolConfig);
|
||||
|
||||
QJsonObject containerConfig = m_settings->containerConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer);
|
||||
QJsonObject containerConfig = m_settings->containerConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer);
|
||||
QJsonObject newContainerConfig = containerConfig;
|
||||
newContainerConfig.insert(ProtocolProps::protoToString(Proto::OpenVpn), protocolConfig);
|
||||
|
||||
|
|
@ -163,8 +163,8 @@ void OpenVpnLogic::onPushButtonSaveClicked()
|
|||
progressBarFunc.setTextVisibleFunc(true);
|
||||
progressBarFunc.setTextFunc(QString("Configuring..."));
|
||||
ErrorCode e = uiLogic()->pageLogic<ServerConfiguringProgressLogic>()->doInstallAction([this, containerConfig, &newContainerConfig](){
|
||||
return m_serverController->updateContainer(m_settings->serverCredentials(uiLogic()->selectedServerIndex),
|
||||
uiLogic()->selectedDockerContainer,
|
||||
return m_serverController->updateContainer(m_settings->serverCredentials(uiLogic()->m_selectedServerIndex),
|
||||
uiLogic()->m_selectedDockerContainer,
|
||||
containerConfig,
|
||||
newContainerConfig);
|
||||
},
|
||||
|
|
@ -173,10 +173,10 @@ void OpenVpnLogic::onPushButtonSaveClicked()
|
|||
busyInfoFuncy, cancelButtonFunc);
|
||||
|
||||
if (!e) {
|
||||
m_settings->setContainerConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, newContainerConfig);
|
||||
m_settings->clearLastConnectionConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer);
|
||||
m_settings->setContainerConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer, newContainerConfig);
|
||||
m_settings->clearLastConnectionConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer);
|
||||
}
|
||||
qDebug() << "Protocol saved with code:" << e << "for" << uiLogic()->selectedServerIndex << uiLogic()->selectedDockerContainer;
|
||||
qDebug() << "Protocol saved with code:" << e << "for" << uiLogic()->m_selectedServerIndex << uiLogic()->m_selectedDockerContainer;
|
||||
}
|
||||
|
||||
QJsonObject OpenVpnLogic::getProtocolConfigFromPage(QJsonObject oldConfig)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ void OtherProtocolsLogic::onPushButtonSftpMountDriveClicked()
|
|||
{
|
||||
QString mountPath;
|
||||
QString cmd;
|
||||
QString host = m_settings->serverCredentials(uiLogic()->selectedServerIndex).hostName;
|
||||
QString host = m_settings->serverCredentials(uiLogic()->m_selectedServerIndex).hostName;
|
||||
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ QJsonObject ShadowSocksLogic::getProtocolConfigFromPage(QJsonObject oldConfig)
|
|||
|
||||
void ShadowSocksLogic::onPushButtonSaveClicked()
|
||||
{
|
||||
QJsonObject protocolConfig = m_settings->protocolConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, Proto::ShadowSocks);
|
||||
QJsonObject protocolConfig = m_settings->protocolConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer, Proto::ShadowSocks);
|
||||
|
||||
QJsonObject containerConfig = m_settings->containerConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer);
|
||||
QJsonObject containerConfig = m_settings->containerConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer);
|
||||
QJsonObject newContainerConfig = containerConfig;
|
||||
newContainerConfig.insert(ProtocolProps::protoToString(Proto::ShadowSocks), protocolConfig);
|
||||
ServerConfiguringProgressLogic::PageFunc pageFunc;
|
||||
|
|
@ -105,8 +105,8 @@ void ShadowSocksLogic::onPushButtonSaveClicked()
|
|||
progressBarFunc.setTextVisibleFunc(true);
|
||||
progressBarFunc.setTextFunc(QString("Configuring..."));
|
||||
ErrorCode e = uiLogic()->pageLogic<ServerConfiguringProgressLogic>()->doInstallAction([this, containerConfig, &newContainerConfig](){
|
||||
return m_serverController->updateContainer(m_settings->serverCredentials(uiLogic()->selectedServerIndex),
|
||||
uiLogic()->selectedDockerContainer,
|
||||
return m_serverController->updateContainer(m_settings->serverCredentials(uiLogic()->m_selectedServerIndex),
|
||||
uiLogic()->m_selectedDockerContainer,
|
||||
containerConfig,
|
||||
newContainerConfig);
|
||||
},
|
||||
|
|
@ -115,10 +115,10 @@ void ShadowSocksLogic::onPushButtonSaveClicked()
|
|||
busyInfoFuncy, cancelButtonFunc);
|
||||
|
||||
if (!e) {
|
||||
m_settings->setContainerConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, newContainerConfig);
|
||||
m_settings->clearLastConnectionConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer);
|
||||
m_settings->setContainerConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer, newContainerConfig);
|
||||
m_settings->clearLastConnectionConfig(uiLogic()->m_selectedServerIndex, uiLogic()->m_selectedDockerContainer);
|
||||
}
|
||||
qDebug() << "Protocol saved with code:" << e << "for" << uiLogic()->selectedServerIndex << uiLogic()->selectedDockerContainer;
|
||||
qDebug() << "Protocol saved with code:" << e << "for" << uiLogic()->m_selectedServerIndex << uiLogic()->m_selectedDockerContainer;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::onPushButtonCancelClicked()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue