refact 2
This commit is contained in:
parent
135b96a280
commit
84ca7e8879
11 changed files with 446 additions and 425 deletions
|
@ -75,7 +75,7 @@
|
||||||
<file>ui/qml/Pages/PageProtoCloak.qml</file>
|
<file>ui/qml/Pages/PageProtoCloak.qml</file>
|
||||||
<file>ui/qml/Pages/PageProtoOpenVPN.qml</file>
|
<file>ui/qml/Pages/PageProtoOpenVPN.qml</file>
|
||||||
<file>ui/qml/Pages/PageProtoShadowSock.qml</file>
|
<file>ui/qml/Pages/PageProtoShadowSock.qml</file>
|
||||||
<file>ui/qml/Pages/PageServer.qml</file>
|
<file>ui/qml/Pages/PageServerList.qml</file>
|
||||||
<file>ui/qml/Pages/PageServerProtocols.qml</file>
|
<file>ui/qml/Pages/PageServerProtocols.qml</file>
|
||||||
<file>ui/qml/Pages/PageServerSetting.qml</file>
|
<file>ui/qml/Pages/PageServerSetting.qml</file>
|
||||||
<file>ui/qml/Pages/PageSetupWizard.qml</file>
|
<file>ui/qml/Pages/PageSetupWizard.qml</file>
|
||||||
|
|
|
@ -38,9 +38,7 @@
|
||||||
#include "vpnconnection.h"
|
#include "vpnconnection.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#if defined Q_OS_MAC || defined Q_OS_LINUX
|
#include "../uilogic.h"
|
||||||
#include "ui/macos_util.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace amnezia;
|
using namespace amnezia;
|
||||||
using namespace PageEnumNS;
|
using namespace PageEnumNS;
|
||||||
|
@ -48,7 +46,44 @@ using namespace PageEnumNS;
|
||||||
|
|
||||||
ServerListLogic::ServerListLogic(UiLogic *uiLogic, QObject *parent):
|
ServerListLogic::ServerListLogic(UiLogic *uiLogic, QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_uiLogic(uiLogic)
|
m_uiLogic(uiLogic),
|
||||||
|
m_serverListModel{new ServersModel(this)}
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QObject* ServerListLogic::getServerListModel() const
|
||||||
|
{
|
||||||
|
return m_serverListModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerListLogic::onServerListPushbuttonDefaultClicked(int index)
|
||||||
|
{
|
||||||
|
m_settings.setDefaultServer(index);
|
||||||
|
updateServersListPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerListLogic::onServerListPushbuttonSettingsClicked(int index)
|
||||||
|
{
|
||||||
|
m_uiLogic->selectedServerIndex = index;
|
||||||
|
m_uiLogic->goToPage(Page::ServerSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerListLogic::updateServersListPage()
|
||||||
|
{
|
||||||
|
const QJsonArray &servers = m_settings.serversArray();
|
||||||
|
int defaultServer = m_settings.defaultServerIndex();
|
||||||
|
std::vector<ServerModelContent> serverListContent;
|
||||||
|
for(int i = 0; i < servers.size(); i++) {
|
||||||
|
ServerModelContent c;
|
||||||
|
auto server = servers.at(i).toObject();
|
||||||
|
c.desc = server.value(config_key::description).toString();
|
||||||
|
c.address = server.value(config_key::hostName).toString();
|
||||||
|
if (c.desc.isEmpty()) {
|
||||||
|
c.desc = c.address;
|
||||||
|
}
|
||||||
|
c.isDefault = (i == defaultServer);
|
||||||
|
serverListContent.push_back(c);
|
||||||
|
}
|
||||||
|
m_serverListModel->setContent(serverListContent);
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "../pages.h"
|
#include "../pages.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "../serversmodel.h"
|
||||||
|
|
||||||
class UiLogic;
|
class UiLogic;
|
||||||
|
|
||||||
|
@ -10,10 +11,20 @@ class ServerListLogic : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
Q_INVOKABLE void updateServersListPage();
|
||||||
|
|
||||||
|
Q_PROPERTY(QObject* serverListModel READ getServerListModel CONSTANT)
|
||||||
|
|
||||||
|
Q_INVOKABLE void onServerListPushbuttonDefaultClicked(int index);
|
||||||
|
Q_INVOKABLE void onServerListPushbuttonSettingsClicked(int index);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ServerListLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
explicit ServerListLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||||
~ServerListLogic() = default;
|
~ServerListLogic() = default;
|
||||||
|
|
||||||
|
QObject* getServerListModel() const;
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
@ -29,6 +40,7 @@ private:
|
||||||
Settings m_settings;
|
Settings m_settings;
|
||||||
UiLogic *m_uiLogic;
|
UiLogic *m_uiLogic;
|
||||||
|
|
||||||
|
ServersModel* m_serverListModel;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // SERVER_LIST_LOGIC_H
|
#endif // SERVER_LIST_LOGIC_H
|
||||||
|
|
|
@ -1,46 +1,34 @@
|
||||||
#include <QApplication>
|
//#include <QApplication>
|
||||||
#include <QClipboard>
|
//#include <QClipboard>
|
||||||
#include <QDebug>
|
//#include <QDebug>
|
||||||
#include <QDesktopServices>
|
//#include <QDesktopServices>
|
||||||
#include <QFileDialog>
|
//#include <QFileDialog>
|
||||||
#include <QHBoxLayout>
|
//#include <QHBoxLayout>
|
||||||
#include <QHostInfo>
|
//#include <QHostInfo>
|
||||||
#include <QItemSelectionModel>
|
//#include <QItemSelectionModel>
|
||||||
#include <QJsonDocument>
|
//#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
//#include <QJsonObject>
|
||||||
#include <QKeyEvent>
|
//#include <QKeyEvent>
|
||||||
#include <QMenu>
|
//#include <QMenu>
|
||||||
#include <QMessageBox>
|
//#include <QMessageBox>
|
||||||
#include <QMetaEnum>
|
//#include <QMetaEnum>
|
||||||
#include <QSysInfo>
|
//#include <QSysInfo>
|
||||||
#include <QThread>
|
//#include <QThread>
|
||||||
#include <QTimer>
|
//#include <QTimer>
|
||||||
#include <QRegularExpression>
|
//#include <QRegularExpression>
|
||||||
#include <QSaveFile>
|
//#include <QSaveFile>
|
||||||
|
|
||||||
//#include "configurators/cloak_configurator.h"
|
|
||||||
//#include "configurators/vpn_configurator.h"
|
|
||||||
//#include "configurators/openvpn_configurator.h"
|
|
||||||
//#include "configurators/shadowsocks_configurator.h"
|
|
||||||
//#include "configurators/ssh_configurator.h"
|
|
||||||
|
|
||||||
//#include "core/servercontroller.h"
|
|
||||||
//#include "core/server_defs.h"
|
|
||||||
//#include "core/errorstrings.h"
|
|
||||||
|
|
||||||
//#include "protocols/protocols_defs.h"
|
|
||||||
//#include "protocols/shadowsocksvpnprotocol.h"
|
|
||||||
|
|
||||||
#include "debug.h"
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "ServerSettingsLogic.h"
|
#include "ServerSettingsLogic.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "vpnconnection.h"
|
#include "vpnconnection.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#if defined Q_OS_MAC || defined Q_OS_LINUX
|
#include "../uilogic.h"
|
||||||
#include "ui/macos_util.h"
|
|
||||||
#endif
|
#include "core/errorstrings.h"
|
||||||
|
#include <core/servercontroller.h>
|
||||||
|
|
||||||
using namespace amnezia;
|
using namespace amnezia;
|
||||||
using namespace PageEnumNS;
|
using namespace PageEnumNS;
|
||||||
|
@ -48,7 +36,269 @@ using namespace PageEnumNS;
|
||||||
|
|
||||||
ServerSettingsLogic::ServerSettingsLogic(UiLogic *uiLogic, QObject *parent):
|
ServerSettingsLogic::ServerSettingsLogic(UiLogic *uiLogic, QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_uiLogic(uiLogic)
|
m_uiLogic(uiLogic),
|
||||||
|
m_pageServerSettingsEnabled{true},
|
||||||
|
m_labelServerSettingsWaitInfoVisible{true},
|
||||||
|
m_pushButtonServerSettingsClearVisible{true},
|
||||||
|
m_pushButtonServerSettingsClearClientCacheVisible{true},
|
||||||
|
m_pushButtonServerSettingsShareFullVisible{true},
|
||||||
|
m_pushButtonServerSettingsClearText{tr("Clear server from Amnezia software")},
|
||||||
|
m_pushButtonServerSettingsClearClientCacheText{tr("Clear client cached profile")}
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::updateServerSettingsPage()
|
||||||
|
{
|
||||||
|
setLabelServerSettingsWaitInfoVisible(false);
|
||||||
|
setLabelServerSettingsWaitInfoText("");
|
||||||
|
setPushButtonServerSettingsClearVisible(m_settings.haveAuthData(m_uiLogic->selectedServerIndex));
|
||||||
|
setPushButtonServerSettingsClearClientCacheVisible(m_settings.haveAuthData(m_uiLogic->selectedServerIndex));
|
||||||
|
setPushButtonServerSettingsShareFullVisible(m_settings.haveAuthData(m_uiLogic->selectedServerIndex));
|
||||||
|
QJsonObject server = m_settings.server(m_uiLogic->selectedServerIndex);
|
||||||
|
QString port = server.value(config_key::port).toString();
|
||||||
|
setLabelServerSettingsServerText(QString("%1@%2%3%4")
|
||||||
|
.arg(server.value(config_key::userName).toString())
|
||||||
|
.arg(server.value(config_key::hostName).toString())
|
||||||
|
.arg(port.isEmpty() ? "" : ":")
|
||||||
|
.arg(port));
|
||||||
|
setLineEditServerSettingsDescriptionText(server.value(config_key::description).toString());
|
||||||
|
QString selectedContainerName = m_settings.defaultContainerName(m_uiLogic->selectedServerIndex);
|
||||||
|
setLabelServerSettingsCurrentVpnProtocolText(tr("Protocol: ") + selectedContainerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ServerSettingsLogic::getPageServerSettingsEnabled() const
|
||||||
|
{
|
||||||
|
return m_pageServerSettingsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::setPageServerSettingsEnabled(bool pageServerSettingsEnabled)
|
||||||
|
{
|
||||||
|
if (m_pageServerSettingsEnabled != pageServerSettingsEnabled) {
|
||||||
|
m_pageServerSettingsEnabled = pageServerSettingsEnabled;
|
||||||
|
emit pageServerSettingsEnabledChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ServerSettingsLogic::onPushButtonServerSettingsClearServer()
|
||||||
|
{
|
||||||
|
setPageServerSettingsEnabled(false);
|
||||||
|
setPushButtonServerSettingsClearText(tr("Uninstalling Amnezia software..."));
|
||||||
|
|
||||||
|
if (m_settings.defaultServerIndex() == m_uiLogic->selectedServerIndex) {
|
||||||
|
m_uiLogic->onDisconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorCode e = ServerController::removeAllContainers(m_settings.serverCredentials(m_uiLogic->selectedServerIndex));
|
||||||
|
ServerController::disconnectFromHost(m_settings.serverCredentials(m_uiLogic->selectedServerIndex));
|
||||||
|
if (e) {
|
||||||
|
m_uiLogic->setDialogConnectErrorText(
|
||||||
|
tr("Error occurred while configuring server.") + "\n" +
|
||||||
|
errorString(e) + "\n" +
|
||||||
|
tr("See logs for details."));
|
||||||
|
emit m_uiLogic->showConnectErrorDialog();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setLabelServerSettingsWaitInfoVisible(true);
|
||||||
|
setLabelServerSettingsWaitInfoText(tr("Amnezia server successfully uninstalled"));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_settings.setContainers(m_uiLogic->selectedServerIndex, {});
|
||||||
|
m_settings.setDefaultContainer(m_uiLogic->selectedServerIndex, DockerContainer::None);
|
||||||
|
|
||||||
|
setPageServerSettingsEnabled(true);
|
||||||
|
setPushButtonServerSettingsClearText(tr("Clear server from Amnezia software"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::onPushButtonServerSettingsForgetServer()
|
||||||
|
{
|
||||||
|
if (m_settings.defaultServerIndex() == m_uiLogic->selectedServerIndex && m_uiLogic->m_vpnConnection->isConnected()) {
|
||||||
|
m_uiLogic->onDisconnect();
|
||||||
|
}
|
||||||
|
m_settings.removeServer(m_uiLogic->selectedServerIndex);
|
||||||
|
|
||||||
|
if (m_settings.defaultServerIndex() == m_uiLogic->selectedServerIndex) {
|
||||||
|
m_settings.setDefaultServer(0);
|
||||||
|
}
|
||||||
|
else if (m_settings.defaultServerIndex() > m_uiLogic->selectedServerIndex) {
|
||||||
|
m_settings.setDefaultServer(m_settings.defaultServerIndex() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_settings.serversCount() == 0) {
|
||||||
|
m_settings.setDefaultServer(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
m_uiLogic->selectedServerIndex = -1;
|
||||||
|
|
||||||
|
// TODO_REFACT updateServersListPage();
|
||||||
|
|
||||||
|
if (m_settings.serversCount() == 0) {
|
||||||
|
m_uiLogic->setStartPage(Page::Start);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_uiLogic->closePage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool ServerSettingsLogic::getLabelServerSettingsWaitInfoVisible() const
|
||||||
|
{
|
||||||
|
return m_labelServerSettingsWaitInfoVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::setLabelServerSettingsWaitInfoVisible(bool labelServerSettingsWaitInfoVisible)
|
||||||
|
{
|
||||||
|
if (m_labelServerSettingsWaitInfoVisible != labelServerSettingsWaitInfoVisible) {
|
||||||
|
m_labelServerSettingsWaitInfoVisible = labelServerSettingsWaitInfoVisible;
|
||||||
|
emit labelServerSettingsWaitInfoVisibleChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ServerSettingsLogic::getLabelServerSettingsWaitInfoText() const
|
||||||
|
{
|
||||||
|
return m_labelServerSettingsWaitInfoText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::setLabelServerSettingsWaitInfoText(const QString &labelServerSettingsWaitInfoText)
|
||||||
|
{
|
||||||
|
if (m_labelServerSettingsWaitInfoText != labelServerSettingsWaitInfoText) {
|
||||||
|
m_labelServerSettingsWaitInfoText = labelServerSettingsWaitInfoText;
|
||||||
|
emit labelServerSettingsWaitInfoTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ServerSettingsLogic::getPushButtonServerSettingsClearVisible() const
|
||||||
|
{
|
||||||
|
return m_pushButtonServerSettingsClearVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::setPushButtonServerSettingsClearVisible(bool pushButtonServerSettingsClearVisible)
|
||||||
|
{
|
||||||
|
if (m_pushButtonServerSettingsClearVisible != pushButtonServerSettingsClearVisible) {
|
||||||
|
m_pushButtonServerSettingsClearVisible = pushButtonServerSettingsClearVisible;
|
||||||
|
emit pushButtonServerSettingsClearVisibleChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ServerSettingsLogic::getPushButtonServerSettingsClearClientCacheVisible() const
|
||||||
|
{
|
||||||
|
return m_pushButtonServerSettingsClearClientCacheVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::setPushButtonServerSettingsClearClientCacheVisible(bool pushButtonServerSettingsClearClientCacheVisible)
|
||||||
|
{
|
||||||
|
if (m_pushButtonServerSettingsClearClientCacheVisible != pushButtonServerSettingsClearClientCacheVisible) {
|
||||||
|
m_pushButtonServerSettingsClearClientCacheVisible = pushButtonServerSettingsClearClientCacheVisible;
|
||||||
|
emit pushButtonServerSettingsClearClientCacheVisibleChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ServerSettingsLogic::getPushButtonServerSettingsShareFullVisible() const
|
||||||
|
{
|
||||||
|
return m_pushButtonServerSettingsShareFullVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::setPushButtonServerSettingsShareFullVisible(bool pushButtonServerSettingsShareFullVisible)
|
||||||
|
{
|
||||||
|
if (m_pushButtonServerSettingsShareFullVisible != pushButtonServerSettingsShareFullVisible) {
|
||||||
|
m_pushButtonServerSettingsShareFullVisible = pushButtonServerSettingsShareFullVisible;
|
||||||
|
emit pushButtonServerSettingsShareFullVisibleChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ServerSettingsLogic::getLabelServerSettingsServerText() const
|
||||||
|
{
|
||||||
|
return m_labelServerSettingsServerText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::setLabelServerSettingsServerText(const QString &labelServerSettingsServerText)
|
||||||
|
{
|
||||||
|
if (m_labelServerSettingsServerText != labelServerSettingsServerText) {
|
||||||
|
m_labelServerSettingsServerText = labelServerSettingsServerText;
|
||||||
|
emit labelServerSettingsServerTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ServerSettingsLogic::getLineEditServerSettingsDescriptionText() const
|
||||||
|
{
|
||||||
|
return m_lineEditServerSettingsDescriptionText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::setLineEditServerSettingsDescriptionText(const QString &lineEditServerSettingsDescriptionText)
|
||||||
|
{
|
||||||
|
if (m_lineEditServerSettingsDescriptionText != lineEditServerSettingsDescriptionText) {
|
||||||
|
m_lineEditServerSettingsDescriptionText = lineEditServerSettingsDescriptionText;
|
||||||
|
emit lineEditServerSettingsDescriptionTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ServerSettingsLogic::getLabelServerSettingsCurrentVpnProtocolText() const
|
||||||
|
{
|
||||||
|
return m_labelServerSettingsCurrentVpnProtocolText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::setLabelServerSettingsCurrentVpnProtocolText(const QString &labelServerSettingsCurrentVpnProtocolText)
|
||||||
|
{
|
||||||
|
if (m_labelServerSettingsCurrentVpnProtocolText != labelServerSettingsCurrentVpnProtocolText) {
|
||||||
|
m_labelServerSettingsCurrentVpnProtocolText = labelServerSettingsCurrentVpnProtocolText;
|
||||||
|
emit labelServerSettingsCurrentVpnProtocolTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ServerSettingsLogic::getPushButtonServerSettingsClearText() const
|
||||||
|
{
|
||||||
|
return m_pushButtonServerSettingsClearText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::setPushButtonServerSettingsClearText(const QString &pushButtonServerSettingsClearText)
|
||||||
|
{
|
||||||
|
if (m_pushButtonServerSettingsClearText != pushButtonServerSettingsClearText) {
|
||||||
|
m_pushButtonServerSettingsClearText = pushButtonServerSettingsClearText;
|
||||||
|
emit pushButtonServerSettingsClearTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::onPushButtonServerSettingsClearClientCacheClicked()
|
||||||
|
{
|
||||||
|
setPushButtonServerSettingsClearClientCacheText(tr("Cache cleared"));
|
||||||
|
|
||||||
|
const auto &containers = m_settings.containers(m_uiLogic->selectedServerIndex);
|
||||||
|
for (DockerContainer container: containers.keys()) {
|
||||||
|
m_settings.clearLastConnectionConfig(m_uiLogic->selectedServerIndex, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTimer::singleShot(3000, this, [this]() {
|
||||||
|
setPushButtonServerSettingsClearClientCacheText(tr("Clear client cached profile"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::onLineEditServerSettingsDescriptionEditingFinished()
|
||||||
|
{
|
||||||
|
const QString &newText = getLineEditServerSettingsDescriptionText();
|
||||||
|
QJsonObject server = m_settings.server(m_uiLogic->selectedServerIndex);
|
||||||
|
server.insert(config_key::description, newText);
|
||||||
|
m_settings.editServer(m_uiLogic->selectedServerIndex, server);
|
||||||
|
// TODO_REFACT updateServersListPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ServerSettingsLogic::getPushButtonServerSettingsClearClientCacheText() const
|
||||||
|
{
|
||||||
|
return m_pushButtonServerSettingsClearClientCacheText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::setPushButtonServerSettingsClearClientCacheText(const QString &pushButtonServerSettingsClearClientCacheText)
|
||||||
|
{
|
||||||
|
if (m_pushButtonServerSettingsClearClientCacheText != pushButtonServerSettingsClearClientCacheText) {
|
||||||
|
m_pushButtonServerSettingsClearClientCacheText = pushButtonServerSettingsClearClientCacheText;
|
||||||
|
emit pushButtonServerSettingsClearClientCacheTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerSettingsLogic::onPushButtonServerSettingsShareFullClicked()
|
||||||
|
{
|
||||||
|
m_uiLogic->updateSharingPage(m_uiLogic->selectedServerIndex, m_settings.serverCredentials(m_uiLogic->selectedServerIndex), DockerContainer::None);
|
||||||
|
m_uiLogic->goToPage(Page::ShareConnection);
|
||||||
|
}
|
||||||
|
|
|
@ -10,13 +10,69 @@ class ServerSettingsLogic : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Q_INVOKABLE void updateServerSettingsPage();
|
||||||
|
|
||||||
|
Q_PROPERTY(bool pageServerSettingsEnabled READ getPageServerSettingsEnabled WRITE setPageServerSettingsEnabled NOTIFY pageServerSettingsEnabledChanged)
|
||||||
|
|
||||||
|
Q_PROPERTY(bool labelServerSettingsWaitInfoVisible READ getLabelServerSettingsWaitInfoVisible WRITE setLabelServerSettingsWaitInfoVisible NOTIFY labelServerSettingsWaitInfoVisibleChanged)
|
||||||
|
Q_PROPERTY(QString labelServerSettingsWaitInfoText READ getLabelServerSettingsWaitInfoText WRITE setLabelServerSettingsWaitInfoText NOTIFY labelServerSettingsWaitInfoTextChanged)
|
||||||
|
Q_PROPERTY(QString pushButtonServerSettingsClearText READ getPushButtonServerSettingsClearText WRITE setPushButtonServerSettingsClearText NOTIFY pushButtonServerSettingsClearTextChanged)
|
||||||
|
Q_PROPERTY(QString pushButtonServerSettingsClearClientCacheText READ getPushButtonServerSettingsClearClientCacheText WRITE setPushButtonServerSettingsClearClientCacheText NOTIFY pushButtonServerSettingsClearClientCacheTextChanged)
|
||||||
|
|
||||||
|
Q_PROPERTY(bool pushButtonServerSettingsClearVisible READ getPushButtonServerSettingsClearVisible WRITE setPushButtonServerSettingsClearVisible NOTIFY pushButtonServerSettingsClearVisibleChanged)
|
||||||
|
Q_PROPERTY(bool pushButtonServerSettingsClearClientCacheVisible READ getPushButtonServerSettingsClearClientCacheVisible WRITE setPushButtonServerSettingsClearClientCacheVisible NOTIFY pushButtonServerSettingsClearClientCacheVisibleChanged)
|
||||||
|
Q_PROPERTY(bool pushButtonServerSettingsShareFullVisible READ getPushButtonServerSettingsShareFullVisible WRITE setPushButtonServerSettingsShareFullVisible NOTIFY pushButtonServerSettingsShareFullVisibleChanged)
|
||||||
|
Q_PROPERTY(QString labelServerSettingsServerText READ getLabelServerSettingsServerText WRITE setLabelServerSettingsServerText NOTIFY labelServerSettingsServerTextChanged)
|
||||||
|
Q_PROPERTY(QString lineEditServerSettingsDescriptionText READ getLineEditServerSettingsDescriptionText WRITE setLineEditServerSettingsDescriptionText NOTIFY lineEditServerSettingsDescriptionTextChanged)
|
||||||
|
Q_PROPERTY(QString labelServerSettingsCurrentVpnProtocolText READ getLabelServerSettingsCurrentVpnProtocolText WRITE setLabelServerSettingsCurrentVpnProtocolText NOTIFY labelServerSettingsCurrentVpnProtocolTextChanged)
|
||||||
|
|
||||||
|
Q_INVOKABLE void onPushButtonServerSettingsClearServer();
|
||||||
|
Q_INVOKABLE void onPushButtonServerSettingsForgetServer();
|
||||||
|
Q_INVOKABLE void onPushButtonServerSettingsShareFullClicked();
|
||||||
|
Q_INVOKABLE void onPushButtonServerSettingsClearClientCacheClicked();
|
||||||
|
Q_INVOKABLE void onLineEditServerSettingsDescriptionEditingFinished();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ServerSettingsLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
explicit ServerSettingsLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||||
~ServerSettingsLogic() = default;
|
~ServerSettingsLogic() = default;
|
||||||
|
|
||||||
|
bool getPageServerSettingsEnabled() const;
|
||||||
|
void setPageServerSettingsEnabled(bool pageServerSettingsEnabled);
|
||||||
|
|
||||||
|
bool getLabelServerSettingsWaitInfoVisible() const;
|
||||||
|
void setLabelServerSettingsWaitInfoVisible(bool labelServerSettingsWaitInfoVisible);
|
||||||
|
QString getLabelServerSettingsWaitInfoText() const;
|
||||||
|
void setLabelServerSettingsWaitInfoText(const QString &labelServerSettingsWaitInfoText);
|
||||||
|
bool getPushButtonServerSettingsClearVisible() const;
|
||||||
|
void setPushButtonServerSettingsClearVisible(bool pushButtonServerSettingsClearVisible);
|
||||||
|
bool getPushButtonServerSettingsClearClientCacheVisible() const;
|
||||||
|
void setPushButtonServerSettingsClearClientCacheVisible(bool pushButtonServerSettingsClearClientCacheVisible);
|
||||||
|
bool getPushButtonServerSettingsShareFullVisible() const;
|
||||||
|
void setPushButtonServerSettingsShareFullVisible(bool pushButtonServerSettingsShareFullVisible);
|
||||||
|
QString getLabelServerSettingsServerText() const;
|
||||||
|
void setLabelServerSettingsServerText(const QString &labelServerSettingsServerText);
|
||||||
|
QString getLineEditServerSettingsDescriptionText() const;
|
||||||
|
void setLineEditServerSettingsDescriptionText(const QString &lineEditServerSettingsDescriptionText);
|
||||||
|
QString getLabelServerSettingsCurrentVpnProtocolText() const;
|
||||||
|
void setLabelServerSettingsCurrentVpnProtocolText(const QString &labelServerSettingsCurrentVpnProtocolText);
|
||||||
|
|
||||||
|
QString getPushButtonServerSettingsClearText() const;
|
||||||
|
void setPushButtonServerSettingsClearText(const QString &pushButtonServerSettingsClearText);
|
||||||
|
QString getPushButtonServerSettingsClearClientCacheText() const;
|
||||||
|
void setPushButtonServerSettingsClearClientCacheText(const QString &pushButtonServerSettingsClearClientCacheText);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void pageServerSettingsEnabledChanged();
|
||||||
|
void labelServerSettingsWaitInfoVisibleChanged();
|
||||||
|
void labelServerSettingsWaitInfoTextChanged();
|
||||||
|
void pushButtonServerSettingsClearTextChanged();
|
||||||
|
void pushButtonServerSettingsClearVisibleChanged();
|
||||||
|
void pushButtonServerSettingsClearClientCacheVisibleChanged();
|
||||||
|
void pushButtonServerSettingsShareFullVisibleChanged();
|
||||||
|
void pushButtonServerSettingsClearClientCacheTextChanged();
|
||||||
|
void labelServerSettingsServerTextChanged();
|
||||||
|
void lineEditServerSettingsDescriptionTextChanged();
|
||||||
|
void labelServerSettingsCurrentVpnProtocolTextChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -29,7 +85,18 @@ private:
|
||||||
Settings m_settings;
|
Settings m_settings;
|
||||||
UiLogic *m_uiLogic;
|
UiLogic *m_uiLogic;
|
||||||
|
|
||||||
|
bool m_pageServerSettingsEnabled;
|
||||||
|
bool m_labelServerSettingsWaitInfoVisible;
|
||||||
|
bool m_pushButtonServerSettingsClearVisible;
|
||||||
|
bool m_pushButtonServerSettingsClearClientCacheVisible;
|
||||||
|
bool m_pushButtonServerSettingsShareFullVisible;
|
||||||
|
|
||||||
|
QString m_lineEditServerSettingsDescriptionText;
|
||||||
|
QString m_labelServerSettingsCurrentVpnProtocolText;
|
||||||
|
QString m_labelServerSettingsServerText;
|
||||||
|
QString m_labelServerSettingsWaitInfoText;
|
||||||
|
QString m_pushButtonServerSettingsClearText;
|
||||||
|
QString m_pushButtonServerSettingsClearClientCacheText;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // SERVER_SETTINGS_LOGIC_H
|
#endif // SERVER_SETTINGS_LOGIC_H
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include <QFile>
|
||||||
#include <QHostInfo>
|
#include <QHostInfo>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ Item {
|
||||||
y: 90
|
y: 90
|
||||||
width: 340
|
width: 340
|
||||||
height: 501
|
height: 501
|
||||||
model: UiLogic.serverListModel
|
model: ServerListLogic.serverListModel
|
||||||
spacing: 5
|
spacing: 5
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
height: 60
|
height: 60
|
||||||
|
@ -133,7 +133,7 @@ Item {
|
||||||
icon.source: checked ? "qrc:/images/check.png"
|
icon.source: checked ? "qrc:/images/check.png"
|
||||||
: "qrc:/images/uncheck.png"
|
: "qrc:/images/uncheck.png"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.onServerListPushbuttonDefaultClicked(index)
|
ServerListLogic.onServerListPushbuttonDefaultClicked(index)
|
||||||
}
|
}
|
||||||
checked: is_default
|
checked: is_default
|
||||||
enabled: !is_default
|
enabled: !is_default
|
||||||
|
@ -146,7 +146,7 @@ Item {
|
||||||
height: 24
|
height: 24
|
||||||
icon.source: "qrc:/images/settings.png"
|
icon.source: "qrc:/images/settings.png"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.onServerListPushbuttonSettingsClicked(index)
|
ServerListLogic.onServerListPushbuttonSettingsClicked(index)
|
||||||
}
|
}
|
||||||
OpacityAnimator {
|
OpacityAnimator {
|
||||||
id: mouseEnterAni
|
id: mouseEnterAni
|
|
@ -7,7 +7,7 @@ import "../Config"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
enabled: UiLogic.pageServerSettingsEnabled
|
enabled: ServerSettingsLogic.pageServerSettingsEnabled
|
||||||
|
|
||||||
ImageButtonType {
|
ImageButtonType {
|
||||||
id: back
|
id: back
|
||||||
|
@ -47,7 +47,7 @@ Item {
|
||||||
height: 31
|
height: 31
|
||||||
font.pixelSize: 20
|
font.pixelSize: 20
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: UiLogic.labelServerSettingsCurrentVpnProtocolText
|
text: ServerSettingsLogic.labelServerSettingsCurrentVpnProtocolText
|
||||||
}
|
}
|
||||||
LabelType {
|
LabelType {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
@ -56,25 +56,25 @@ Item {
|
||||||
height: 31
|
height: 31
|
||||||
font.pixelSize: 20
|
font.pixelSize: 20
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: UiLogic.labelServerSettingsServerText
|
text: ServerSettingsLogic.labelServerSettingsServerText
|
||||||
}
|
}
|
||||||
LabelType {
|
LabelType {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
y: 530
|
y: 530
|
||||||
width: 301
|
width: 301
|
||||||
height: 41
|
height: 41
|
||||||
text: UiLogic.labelServerSettingsWaitInfoText
|
text: ServerSettingsLogic.labelServerSettingsWaitInfoText
|
||||||
visible: UiLogic.labelServerSettingsWaitInfoVisible
|
visible: ServerSettingsLogic.labelServerSettingsWaitInfoVisible
|
||||||
}
|
}
|
||||||
TextFieldType {
|
TextFieldType {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
y: 80
|
y: 80
|
||||||
width: 251
|
width: 251
|
||||||
height: 31
|
height: 31
|
||||||
text: UiLogic.lineEditServerSettingsDescriptionText
|
text: UiLoServerSettingsLogicgic.lineEditServerSettingsDescriptionText
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
UiLogic.lineEditServerSettingsDescriptionText = text
|
ServerSettingsLogic.lineEditServerSettingsDescriptionText = text
|
||||||
UiLogic.onLineEditServerSettingsDescriptionEditingFinished()
|
ServerSettingsLogic.onLineEditServerSettingsDescriptionEditingFinished()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BlueButtonType {
|
BlueButtonType {
|
||||||
|
@ -82,10 +82,10 @@ Item {
|
||||||
y: 410
|
y: 410
|
||||||
width: 300
|
width: 300
|
||||||
height: 40
|
height: 40
|
||||||
text: UiLogic.pushButtonServerSettingsClearText
|
text: ServerSettingsLogic.pushButtonServerSettingsClearText
|
||||||
visible: UiLogic.pushButtonServerSettingsClearVisible
|
visible: ServerSettingsLogic.pushButtonServerSettingsClearVisible
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.onPushButtonClearServer()
|
ServerSettingsLogic.onPushButtonServerSettingsClearServer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BlueButtonType {
|
BlueButtonType {
|
||||||
|
@ -93,10 +93,10 @@ Item {
|
||||||
y: 350
|
y: 350
|
||||||
width: 300
|
width: 300
|
||||||
height: 40
|
height: 40
|
||||||
text: UiLogic.pushButtonServerSettingsClearClientCacheText
|
text: ServerSettingsLogic.pushButtonServerSettingsClearClientCacheText
|
||||||
visible: UiLogic.pushButtonServerSettingsClearClientCacheVisible
|
visible: ServerSettingsLogic.pushButtonServerSettingsClearClientCacheVisible
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.onPushButtonServerSettingsClearClientCacheClicked()
|
ServerSettingsLogic.onPushButtonServerSettingsClearClientCacheClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BlueButtonType {
|
BlueButtonType {
|
||||||
|
@ -106,7 +106,7 @@ Item {
|
||||||
height: 40
|
height: 40
|
||||||
text: qsTr("Forget this server")
|
text: qsTr("Forget this server")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.onPushButtonForgetServer()
|
ServerSettingsLogic.onPushButtonServerSettingsForgetServer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BlueButtonType {
|
BlueButtonType {
|
||||||
|
@ -116,7 +116,7 @@ Item {
|
||||||
height: 40
|
height: 40
|
||||||
text: qsTr("VPN protocols")
|
text: qsTr("VPN protocols")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.goToPage(PageEnum.ServerVpnProtocols)
|
ServerSettingsLogic.goToPage(PageEnum.ServerVpnProtocols)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BlueButtonType {
|
BlueButtonType {
|
||||||
|
@ -125,9 +125,9 @@ Item {
|
||||||
width: 300
|
width: 300
|
||||||
height: 40
|
height: 40
|
||||||
text: qsTr("Share Server (FULL ACCESS)")
|
text: qsTr("Share Server (FULL ACCESS)")
|
||||||
visible: UiLogic.pushButtonServerSettingsShareFullVisible
|
visible: ServerSettingsLogic.pushButtonServerSettingsShareFullVisible
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.onPushButtonServerSettingsShareFullClicked()
|
ServerSettingsLogic.onPushButtonServerSettingsShareFullClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ Window {
|
||||||
if (item instanceof PageServerProtocols) {
|
if (item instanceof PageServerProtocols) {
|
||||||
return PageEnum.ServerVpnProtocols
|
return PageEnum.ServerVpnProtocols
|
||||||
}
|
}
|
||||||
if (item instanceof PageServer) {
|
if (item instanceof PageServerList) {
|
||||||
return PageEnum.ServersList
|
return PageEnum.ServersList
|
||||||
}
|
}
|
||||||
if (item instanceof PageShareConnection) {
|
if (item instanceof PageShareConnection) {
|
||||||
|
@ -143,7 +143,7 @@ Window {
|
||||||
console.debug(pageComponent)
|
console.debug(pageComponent)
|
||||||
if (reset) {
|
if (reset) {
|
||||||
if (page === PageEnum.ServerSettings) {
|
if (page === PageEnum.ServerSettings) {
|
||||||
UiLogic.updateServerPage();
|
ServerSettingsLogic.updateServerSettingsPage();
|
||||||
}
|
}
|
||||||
if (page === PageEnum.ShareConnection) {}
|
if (page === PageEnum.ShareConnection) {}
|
||||||
if (page === PageEnum.Wizard) {
|
if (page === PageEnum.Wizard) {
|
||||||
|
@ -159,7 +159,7 @@ Window {
|
||||||
GeneralSettingsLogic.updateGeneralSettingPage();
|
GeneralSettingsLogic.updateGeneralSettingPage();
|
||||||
}
|
}
|
||||||
if (page === PageEnum.ServersList) {
|
if (page === PageEnum.ServersList) {
|
||||||
UiLogic.updateServersListPage();
|
ServerListLogic.updateServersListPage();
|
||||||
}
|
}
|
||||||
if (page === PageEnum.Start) {
|
if (page === PageEnum.Start) {
|
||||||
UiLogic.pushButtonBackFromStartVisible = !pageLoader.empty
|
UiLogic.pushButtonBackFromStartVisible = !pageLoader.empty
|
||||||
|
@ -303,7 +303,7 @@ Window {
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
id: page_servers
|
id: page_servers
|
||||||
PageServer {}
|
PageServerList {}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
id: page_app_settings
|
id: page_app_settings
|
||||||
|
|
|
@ -81,14 +81,8 @@ UiLogic::UiLogic(QObject *parent) :
|
||||||
m_radioButtonVpnModeExceptSitesChecked{false},
|
m_radioButtonVpnModeExceptSitesChecked{false},
|
||||||
m_pushButtonVpnAddSiteEnabled{true},
|
m_pushButtonVpnAddSiteEnabled{true},
|
||||||
|
|
||||||
m_labelServerSettingsWaitInfoVisible{true},
|
|
||||||
m_labelServerSettingsWaitInfoText{},
|
|
||||||
m_pushButtonServerSettingsClearVisible{true},
|
|
||||||
m_pushButtonServerSettingsClearClientCacheVisible{true},
|
|
||||||
m_pushButtonServerSettingsShareFullVisible{true},
|
|
||||||
m_labelServerSettingsServerText{},
|
|
||||||
m_lineEditServerSettingsDescriptionText{},
|
|
||||||
m_labelServerSettingsCurrentVpnProtocolText{},
|
|
||||||
m_currentPageValue{0},
|
m_currentPageValue{0},
|
||||||
m_trayIconUrl{},
|
m_trayIconUrl{},
|
||||||
m_trayActionDisconnectEnabled{true},
|
m_trayActionDisconnectEnabled{true},
|
||||||
|
@ -162,8 +156,6 @@ UiLogic::UiLogic(QObject *parent) :
|
||||||
m_pushButtonNewServerConnectEnabled{},
|
m_pushButtonNewServerConnectEnabled{},
|
||||||
m_pushButtonNewServerConnectText{tr("Connect")},
|
m_pushButtonNewServerConnectText{tr("Connect")},
|
||||||
m_dialogConnectErrorText{},
|
m_dialogConnectErrorText{},
|
||||||
m_pageServerSettingsEnabled{true},
|
|
||||||
m_pushButtonServerSettingsClearText{tr("Clear server from Amnezia software")},
|
|
||||||
m_pageShareAmneziaVisible{true},
|
m_pageShareAmneziaVisible{true},
|
||||||
m_pageShareOpenvpnVisible{true},
|
m_pageShareOpenvpnVisible{true},
|
||||||
m_pageShareShadowsocksVisible{true},
|
m_pageShareShadowsocksVisible{true},
|
||||||
|
@ -221,8 +213,6 @@ UiLogic::UiLogic(QObject *parent) :
|
||||||
m_labelProtoCloakInfoText{},
|
m_labelProtoCloakInfoText{},
|
||||||
m_progressBarProtoCloakResetValue{0},
|
m_progressBarProtoCloakResetValue{0},
|
||||||
m_progressBarProtoCloakResetMaximium{100},
|
m_progressBarProtoCloakResetMaximium{100},
|
||||||
m_serverListModel{nullptr},
|
|
||||||
m_pushButtonServerSettingsClearClientCacheText{tr("Clear client cached profile")},
|
|
||||||
m_vpnConnection(nullptr)
|
m_vpnConnection(nullptr)
|
||||||
{
|
{
|
||||||
m_vpnConnection = new VpnConnection(this);
|
m_vpnConnection = new VpnConnection(this);
|
||||||
|
@ -302,7 +292,6 @@ void UiLogic::initalizeUiLogic()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_serverListModel = new ServersModel(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UiLogic::getFrameWireguardSettingsVisible() const
|
bool UiLogic::getFrameWireguardSettingsVisible() const
|
||||||
|
@ -719,109 +708,6 @@ void UiLogic::setRadioButtonVpnModeExceptSitesChecked(bool radioButtonVpnModeExc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool UiLogic::getLabelServerSettingsWaitInfoVisible() const
|
|
||||||
{
|
|
||||||
return m_labelServerSettingsWaitInfoVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setLabelServerSettingsWaitInfoVisible(bool labelServerSettingsWaitInfoVisible)
|
|
||||||
{
|
|
||||||
if (m_labelServerSettingsWaitInfoVisible != labelServerSettingsWaitInfoVisible) {
|
|
||||||
m_labelServerSettingsWaitInfoVisible = labelServerSettingsWaitInfoVisible;
|
|
||||||
emit labelServerSettingsWaitInfoVisibleChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getLabelServerSettingsWaitInfoText() const
|
|
||||||
{
|
|
||||||
return m_labelServerSettingsWaitInfoText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setLabelServerSettingsWaitInfoText(const QString &labelServerSettingsWaitInfoText)
|
|
||||||
{
|
|
||||||
if (m_labelServerSettingsWaitInfoText != labelServerSettingsWaitInfoText) {
|
|
||||||
m_labelServerSettingsWaitInfoText = labelServerSettingsWaitInfoText;
|
|
||||||
emit labelServerSettingsWaitInfoTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPushButtonServerSettingsClearVisible() const
|
|
||||||
{
|
|
||||||
return m_pushButtonServerSettingsClearVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonServerSettingsClearVisible(bool pushButtonServerSettingsClearVisible)
|
|
||||||
{
|
|
||||||
if (m_pushButtonServerSettingsClearVisible != pushButtonServerSettingsClearVisible) {
|
|
||||||
m_pushButtonServerSettingsClearVisible = pushButtonServerSettingsClearVisible;
|
|
||||||
emit pushButtonServerSettingsClearVisibleChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPushButtonServerSettingsClearClientCacheVisible() const
|
|
||||||
{
|
|
||||||
return m_pushButtonServerSettingsClearClientCacheVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonServerSettingsClearClientCacheVisible(bool pushButtonServerSettingsClearClientCacheVisible)
|
|
||||||
{
|
|
||||||
if (m_pushButtonServerSettingsClearClientCacheVisible != pushButtonServerSettingsClearClientCacheVisible) {
|
|
||||||
m_pushButtonServerSettingsClearClientCacheVisible = pushButtonServerSettingsClearClientCacheVisible;
|
|
||||||
emit pushButtonServerSettingsClearClientCacheVisibleChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPushButtonServerSettingsShareFullVisible() const
|
|
||||||
{
|
|
||||||
return m_pushButtonServerSettingsShareFullVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonServerSettingsShareFullVisible(bool pushButtonServerSettingsShareFullVisible)
|
|
||||||
{
|
|
||||||
if (m_pushButtonServerSettingsShareFullVisible != pushButtonServerSettingsShareFullVisible) {
|
|
||||||
m_pushButtonServerSettingsShareFullVisible = pushButtonServerSettingsShareFullVisible;
|
|
||||||
emit pushButtonServerSettingsShareFullVisibleChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getLabelServerSettingsServerText() const
|
|
||||||
{
|
|
||||||
return m_labelServerSettingsServerText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setLabelServerSettingsServerText(const QString &labelServerSettingsServerText)
|
|
||||||
{
|
|
||||||
if (m_labelServerSettingsServerText != labelServerSettingsServerText) {
|
|
||||||
m_labelServerSettingsServerText = labelServerSettingsServerText;
|
|
||||||
emit labelServerSettingsServerTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getLineEditServerSettingsDescriptionText() const
|
|
||||||
{
|
|
||||||
return m_lineEditServerSettingsDescriptionText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setLineEditServerSettingsDescriptionText(const QString &lineEditServerSettingsDescriptionText)
|
|
||||||
{
|
|
||||||
if (m_lineEditServerSettingsDescriptionText != lineEditServerSettingsDescriptionText) {
|
|
||||||
m_lineEditServerSettingsDescriptionText = lineEditServerSettingsDescriptionText;
|
|
||||||
emit lineEditServerSettingsDescriptionTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getLabelServerSettingsCurrentVpnProtocolText() const
|
|
||||||
{
|
|
||||||
return m_labelServerSettingsCurrentVpnProtocolText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setLabelServerSettingsCurrentVpnProtocolText(const QString &labelServerSettingsCurrentVpnProtocolText)
|
|
||||||
{
|
|
||||||
if (m_labelServerSettingsCurrentVpnProtocolText != labelServerSettingsCurrentVpnProtocolText) {
|
|
||||||
m_labelServerSettingsCurrentVpnProtocolText = labelServerSettingsCurrentVpnProtocolText;
|
|
||||||
emit labelServerSettingsCurrentVpnProtocolTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QString UiLogic::getComboBoxProtoCloakCipherText() const
|
QString UiLogic::getComboBoxProtoCloakCipherText() const
|
||||||
{
|
{
|
||||||
return m_comboBoxProtoCloakCipherText;
|
return m_comboBoxProtoCloakCipherText;
|
||||||
|
@ -1771,31 +1657,8 @@ void UiLogic::setDialogConnectErrorText(const QString &dialogConnectErrorText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UiLogic::getPageServerSettingsEnabled() const
|
|
||||||
{
|
|
||||||
return m_pageServerSettingsEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPageServerSettingsEnabled(bool pageServerSettingsEnabled)
|
|
||||||
{
|
|
||||||
if (m_pageServerSettingsEnabled != pageServerSettingsEnabled) {
|
|
||||||
m_pageServerSettingsEnabled = pageServerSettingsEnabled;
|
|
||||||
emit pageServerSettingsEnabledChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getPushButtonServerSettingsClearText() const
|
|
||||||
{
|
|
||||||
return m_pushButtonServerSettingsClearText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonServerSettingsClearText(const QString &pushButtonServerSettingsClearText)
|
|
||||||
{
|
|
||||||
if (m_pushButtonServerSettingsClearText != pushButtonServerSettingsClearText) {
|
|
||||||
m_pushButtonServerSettingsClearText = pushButtonServerSettingsClearText;
|
|
||||||
emit pushButtonServerSettingsClearTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPageShareAmneziaVisible() const
|
bool UiLogic::getPageShareAmneziaVisible() const
|
||||||
{
|
{
|
||||||
|
@ -2534,23 +2397,7 @@ void UiLogic::setProgressBarProtoCloakResetMaximium(int progressBarProtoCloakRes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString UiLogic::getPushButtonServerSettingsClearClientCacheText() const
|
|
||||||
{
|
|
||||||
return m_pushButtonServerSettingsClearClientCacheText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonServerSettingsClearClientCacheText(const QString &pushButtonServerSettingsClearClientCacheText)
|
|
||||||
{
|
|
||||||
if (m_pushButtonServerSettingsClearClientCacheText != pushButtonServerSettingsClearClientCacheText) {
|
|
||||||
m_pushButtonServerSettingsClearClientCacheText = pushButtonServerSettingsClearClientCacheText;
|
|
||||||
emit pushButtonServerSettingsClearClientCacheTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QObject* UiLogic::getServerListModel() const
|
|
||||||
{
|
|
||||||
return m_serverListModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
UiLogic::~UiLogic()
|
UiLogic::~UiLogic()
|
||||||
{
|
{
|
||||||
|
@ -2650,23 +2497,7 @@ void UiLogic::onCloseWindow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UiLogic::onServerListPushbuttonDefaultClicked(int index)
|
|
||||||
{
|
|
||||||
m_settings.setDefaultServer(index);
|
|
||||||
updateServersListPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onServerListPushbuttonSettingsClicked(int index)
|
|
||||||
{
|
|
||||||
selectedServerIndex = index;
|
|
||||||
goToPage(Page::ServerSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonServerSettingsShareFullClicked()
|
|
||||||
{
|
|
||||||
updateSharingPage(selectedServerIndex, m_settings.serverCredentials(selectedServerIndex), DockerContainer::None);
|
|
||||||
goToPage(Page::ShareConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
//void UiLogic::showEvent(QShowEvent *event)
|
//void UiLogic::showEvent(QShowEvent *event)
|
||||||
//{
|
//{
|
||||||
|
@ -3145,89 +2976,6 @@ ErrorCode UiLogic::doInstallAction(const std::function<ErrorCode()> &action,
|
||||||
return ErrorCode::NoError;
|
return ErrorCode::NoError;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UiLogic::onPushButtonClearServer()
|
|
||||||
{
|
|
||||||
setPageServerSettingsEnabled(false);
|
|
||||||
setPushButtonServerSettingsClearText(tr("Uninstalling Amnezia software..."));
|
|
||||||
|
|
||||||
if (m_settings.defaultServerIndex() == selectedServerIndex) {
|
|
||||||
onDisconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorCode e = ServerController::removeAllContainers(m_settings.serverCredentials(selectedServerIndex));
|
|
||||||
ServerController::disconnectFromHost(m_settings.serverCredentials(selectedServerIndex));
|
|
||||||
if (e) {
|
|
||||||
setDialogConnectErrorText(
|
|
||||||
tr("Error occurred while configuring server.") + "\n" +
|
|
||||||
errorString(e) + "\n" +
|
|
||||||
tr("See logs for details."));
|
|
||||||
emit showConnectErrorDialog();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setLabelServerSettingsWaitInfoVisible(true);
|
|
||||||
setLabelServerSettingsWaitInfoText(tr("Amnezia server successfully uninstalled"));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_settings.setContainers(selectedServerIndex, {});
|
|
||||||
m_settings.setDefaultContainer(selectedServerIndex, DockerContainer::None);
|
|
||||||
|
|
||||||
setPageServerSettingsEnabled(true);
|
|
||||||
setPushButtonServerSettingsClearText(tr("Clear server from Amnezia software"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonForgetServer()
|
|
||||||
{
|
|
||||||
if (m_settings.defaultServerIndex() == selectedServerIndex && m_vpnConnection->isConnected()) {
|
|
||||||
onDisconnect();
|
|
||||||
}
|
|
||||||
m_settings.removeServer(selectedServerIndex);
|
|
||||||
|
|
||||||
if (m_settings.defaultServerIndex() == selectedServerIndex) {
|
|
||||||
m_settings.setDefaultServer(0);
|
|
||||||
}
|
|
||||||
else if (m_settings.defaultServerIndex() > selectedServerIndex) {
|
|
||||||
m_settings.setDefaultServer(m_settings.defaultServerIndex() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_settings.serversCount() == 0) {
|
|
||||||
m_settings.setDefaultServer(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
selectedServerIndex = -1;
|
|
||||||
|
|
||||||
updateServersListPage();
|
|
||||||
|
|
||||||
if (m_settings.serversCount() == 0) {
|
|
||||||
setStartPage(Page::Start);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
closePage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonServerSettingsClearClientCacheClicked()
|
|
||||||
{
|
|
||||||
setPushButtonServerSettingsClearClientCacheText(tr("Cache cleared"));
|
|
||||||
|
|
||||||
const auto &containers = m_settings.containers(selectedServerIndex);
|
|
||||||
for (DockerContainer container: containers.keys()) {
|
|
||||||
m_settings.clearLastConnectionConfig(selectedServerIndex, container);
|
|
||||||
}
|
|
||||||
|
|
||||||
QTimer::singleShot(3000, this, [this]() {
|
|
||||||
setPushButtonServerSettingsClearClientCacheText(tr("Clear client cached profile"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onLineEditServerSettingsDescriptionEditingFinished()
|
|
||||||
{
|
|
||||||
const QString &newText = getLineEditServerSettingsDescriptionText();
|
|
||||||
QJsonObject server = m_settings.server(selectedServerIndex);
|
|
||||||
server.insert(config_key::description, newText);
|
|
||||||
m_settings.editServer(selectedServerIndex, server);
|
|
||||||
updateServersListPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onBytesChanged(quint64 receivedData, quint64 sentData)
|
void UiLogic::onBytesChanged(quint64 receivedData, quint64 sentData)
|
||||||
{
|
{
|
||||||
|
@ -3939,24 +3687,7 @@ void UiLogic::updateVpnPage()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UiLogic::updateServerPage()
|
|
||||||
{
|
|
||||||
setLabelServerSettingsWaitInfoVisible(false);
|
|
||||||
setLabelServerSettingsWaitInfoText("");
|
|
||||||
setPushButtonServerSettingsClearVisible(m_settings.haveAuthData(selectedServerIndex));
|
|
||||||
setPushButtonServerSettingsClearClientCacheVisible(m_settings.haveAuthData(selectedServerIndex));
|
|
||||||
setPushButtonServerSettingsShareFullVisible(m_settings.haveAuthData(selectedServerIndex));
|
|
||||||
QJsonObject server = m_settings.server(selectedServerIndex);
|
|
||||||
QString port = server.value(config_key::port).toString();
|
|
||||||
setLabelServerSettingsServerText(QString("%1@%2%3%4")
|
|
||||||
.arg(server.value(config_key::userName).toString())
|
|
||||||
.arg(server.value(config_key::hostName).toString())
|
|
||||||
.arg(port.isEmpty() ? "" : ":")
|
|
||||||
.arg(port));
|
|
||||||
setLineEditServerSettingsDescriptionText(server.value(config_key::description).toString());
|
|
||||||
QString selectedContainerName = m_settings.defaultContainerName(selectedServerIndex);
|
|
||||||
setLabelServerSettingsCurrentVpnProtocolText(tr("Protocol: ") + selectedContainerName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonSetupWizardVpnModeFinishClicked()
|
void UiLogic::onPushButtonSetupWizardVpnModeFinishClicked()
|
||||||
|
@ -3997,24 +3728,6 @@ void UiLogic::onRadioButtonVpnModeExceptSitesToggled(bool checked)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UiLogic::updateServersListPage()
|
|
||||||
{
|
|
||||||
const QJsonArray &servers = m_settings.serversArray();
|
|
||||||
int defaultServer = m_settings.defaultServerIndex();
|
|
||||||
std::vector<ServerModelContent> serverListContent;
|
|
||||||
for(int i = 0; i < servers.size(); i++) {
|
|
||||||
ServerModelContent c;
|
|
||||||
auto server = servers.at(i).toObject();
|
|
||||||
c.desc = server.value(config_key::description).toString();
|
|
||||||
c.address = server.value(config_key::hostName).toString();
|
|
||||||
if (c.desc.isEmpty()) {
|
|
||||||
c.desc = c.address;
|
|
||||||
}
|
|
||||||
c.isDefault = (i == defaultServer);
|
|
||||||
serverListContent.push_back(c);
|
|
||||||
}
|
|
||||||
m_serverListModel->setContent(serverListContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::updateProtocolsPage()
|
void UiLogic::updateProtocolsPage()
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include "protocols/vpnprotocol.h"
|
#include "protocols/vpnprotocol.h"
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "serversmodel.h"
|
|
||||||
|
|
||||||
class AppSettingsLogic;
|
class AppSettingsLogic;
|
||||||
class GeneralSettingsLogic;
|
class GeneralSettingsLogic;
|
||||||
|
@ -60,14 +59,6 @@ class UiLogic : public QObject
|
||||||
Q_PROPERTY(bool pushButtonBackFromStartVisible READ getPushButtonBackFromStartVisible WRITE setPushButtonBackFromStartVisible NOTIFY pushButtonBackFromStartVisibleChanged)
|
Q_PROPERTY(bool pushButtonBackFromStartVisible READ getPushButtonBackFromStartVisible WRITE setPushButtonBackFromStartVisible NOTIFY pushButtonBackFromStartVisibleChanged)
|
||||||
Q_PROPERTY(bool pushButtonNewServerConnectVisible READ getPushButtonNewServerConnectVisible WRITE setPushButtonNewServerConnectVisible NOTIFY pushButtonNewServerConnectVisibleChanged)
|
Q_PROPERTY(bool pushButtonNewServerConnectVisible READ getPushButtonNewServerConnectVisible WRITE setPushButtonNewServerConnectVisible NOTIFY pushButtonNewServerConnectVisibleChanged)
|
||||||
|
|
||||||
Q_PROPERTY(bool labelServerSettingsWaitInfoVisible READ getLabelServerSettingsWaitInfoVisible WRITE setLabelServerSettingsWaitInfoVisible NOTIFY labelServerSettingsWaitInfoVisibleChanged)
|
|
||||||
Q_PROPERTY(QString labelServerSettingsWaitInfoText READ getLabelServerSettingsWaitInfoText WRITE setLabelServerSettingsWaitInfoText NOTIFY labelServerSettingsWaitInfoTextChanged)
|
|
||||||
Q_PROPERTY(bool pushButtonServerSettingsClearVisible READ getPushButtonServerSettingsClearVisible WRITE setPushButtonServerSettingsClearVisible NOTIFY pushButtonServerSettingsClearVisibleChanged)
|
|
||||||
Q_PROPERTY(bool pushButtonServerSettingsClearClientCacheVisible READ getPushButtonServerSettingsClearClientCacheVisible WRITE setPushButtonServerSettingsClearClientCacheVisible NOTIFY pushButtonServerSettingsClearClientCacheVisibleChanged)
|
|
||||||
Q_PROPERTY(bool pushButtonServerSettingsShareFullVisible READ getPushButtonServerSettingsShareFullVisible WRITE setPushButtonServerSettingsShareFullVisible NOTIFY pushButtonServerSettingsShareFullVisibleChanged)
|
|
||||||
Q_PROPERTY(QString labelServerSettingsServerText READ getLabelServerSettingsServerText WRITE setLabelServerSettingsServerText NOTIFY labelServerSettingsServerTextChanged)
|
|
||||||
Q_PROPERTY(QString lineEditServerSettingsDescriptionText READ getLineEditServerSettingsDescriptionText WRITE setLineEditServerSettingsDescriptionText NOTIFY lineEditServerSettingsDescriptionTextChanged)
|
|
||||||
Q_PROPERTY(QString labelServerSettingsCurrentVpnProtocolText READ getLabelServerSettingsCurrentVpnProtocolText WRITE setLabelServerSettingsCurrentVpnProtocolText NOTIFY labelServerSettingsCurrentVpnProtocolTextChanged)
|
|
||||||
Q_PROPERTY(int currentPageValue READ getCurrentPageValue WRITE setCurrentPageValue NOTIFY currentPageValueChanged)
|
Q_PROPERTY(int currentPageValue READ getCurrentPageValue WRITE setCurrentPageValue NOTIFY currentPageValueChanged)
|
||||||
Q_PROPERTY(QString trayIconUrl READ getTrayIconUrl WRITE setTrayIconUrl NOTIFY trayIconUrlChanged)
|
Q_PROPERTY(QString trayIconUrl READ getTrayIconUrl WRITE setTrayIconUrl NOTIFY trayIconUrlChanged)
|
||||||
Q_PROPERTY(bool trayActionDisconnectEnabled READ getTrayActionDisconnectEnabled WRITE setTrayActionDisconnectEnabled NOTIFY trayActionDisconnectEnabledChanged)
|
Q_PROPERTY(bool trayActionDisconnectEnabled READ getTrayActionDisconnectEnabled WRITE setTrayActionDisconnectEnabled NOTIFY trayActionDisconnectEnabledChanged)
|
||||||
|
@ -141,8 +132,6 @@ class UiLogic : public QObject
|
||||||
Q_PROPERTY(bool pushButtonNewServerConnectEnabled READ getPushButtonNewServerConnectEnabled WRITE setPushButtonNewServerConnectEnabled NOTIFY pushButtonNewServerConnectEnabledChanged)
|
Q_PROPERTY(bool pushButtonNewServerConnectEnabled READ getPushButtonNewServerConnectEnabled WRITE setPushButtonNewServerConnectEnabled NOTIFY pushButtonNewServerConnectEnabledChanged)
|
||||||
Q_PROPERTY(QString pushButtonNewServerConnectText READ getPushButtonNewServerConnectText WRITE setPushButtonNewServerConnectText NOTIFY pushButtonNewServerConnectTextChanged)
|
Q_PROPERTY(QString pushButtonNewServerConnectText READ getPushButtonNewServerConnectText WRITE setPushButtonNewServerConnectText NOTIFY pushButtonNewServerConnectTextChanged)
|
||||||
Q_PROPERTY(QString dialogConnectErrorText READ getDialogConnectErrorText WRITE setDialogConnectErrorText NOTIFY dialogConnectErrorTextChanged)
|
Q_PROPERTY(QString dialogConnectErrorText READ getDialogConnectErrorText WRITE setDialogConnectErrorText NOTIFY dialogConnectErrorTextChanged)
|
||||||
Q_PROPERTY(bool pageServerSettingsEnabled READ getPageServerSettingsEnabled WRITE setPageServerSettingsEnabled NOTIFY pageServerSettingsEnabledChanged)
|
|
||||||
Q_PROPERTY(QString pushButtonServerSettingsClearText READ getPushButtonServerSettingsClearText WRITE setPushButtonServerSettingsClearText NOTIFY pushButtonServerSettingsClearTextChanged)
|
|
||||||
Q_PROPERTY(bool pageShareAmneziaVisible READ getPageShareAmneziaVisible WRITE setPageShareAmneziaVisible NOTIFY pageShareAmneziaVisibleChanged)
|
Q_PROPERTY(bool pageShareAmneziaVisible READ getPageShareAmneziaVisible WRITE setPageShareAmneziaVisible NOTIFY pageShareAmneziaVisibleChanged)
|
||||||
Q_PROPERTY(bool pageShareOpenvpnVisible READ getPageShareOpenvpnVisible WRITE setPageShareOpenvpnVisible NOTIFY pageShareOpenvpnVisibleChanged)
|
Q_PROPERTY(bool pageShareOpenvpnVisible READ getPageShareOpenvpnVisible WRITE setPageShareOpenvpnVisible NOTIFY pageShareOpenvpnVisibleChanged)
|
||||||
Q_PROPERTY(bool pageShareShadowsocksVisible READ getPageShareShadowsocksVisible WRITE setPageShareShadowsocksVisible NOTIFY pageShareShadowsocksVisibleChanged)
|
Q_PROPERTY(bool pageShareShadowsocksVisible READ getPageShareShadowsocksVisible WRITE setPageShareShadowsocksVisible NOTIFY pageShareShadowsocksVisibleChanged)
|
||||||
|
@ -200,8 +189,6 @@ class UiLogic : public QObject
|
||||||
Q_PROPERTY(QString labelProtoCloakInfoText READ getLabelProtoCloakInfoText WRITE setLabelProtoCloakInfoText NOTIFY labelProtoCloakInfoTextChanged)
|
Q_PROPERTY(QString labelProtoCloakInfoText READ getLabelProtoCloakInfoText WRITE setLabelProtoCloakInfoText NOTIFY labelProtoCloakInfoTextChanged)
|
||||||
Q_PROPERTY(int progressBarProtoCloakResetValue READ getProgressBarProtoCloakResetValue WRITE setProgressBarProtoCloakResetValue NOTIFY progressBarProtoCloakResetValueChanged)
|
Q_PROPERTY(int progressBarProtoCloakResetValue READ getProgressBarProtoCloakResetValue WRITE setProgressBarProtoCloakResetValue NOTIFY progressBarProtoCloakResetValueChanged)
|
||||||
Q_PROPERTY(int progressBarProtoCloakResetMaximium READ getProgressBarProtoCloakResetMaximium WRITE setProgressBarProtoCloakResetMaximium NOTIFY progressBarProtoCloakResetMaximiumChanged)
|
Q_PROPERTY(int progressBarProtoCloakResetMaximium READ getProgressBarProtoCloakResetMaximium WRITE setProgressBarProtoCloakResetMaximium NOTIFY progressBarProtoCloakResetMaximiumChanged)
|
||||||
Q_PROPERTY(QObject* serverListModel READ getServerListModel CONSTANT)
|
|
||||||
Q_PROPERTY(QString pushButtonServerSettingsClearClientCacheText READ getPushButtonServerSettingsClearClientCacheText WRITE setPushButtonServerSettingsClearClientCacheText NOTIFY pushButtonServerSettingsClearClientCacheTextChanged)
|
|
||||||
|
|
||||||
|
|
||||||
Q_PROPERTY(bool pushButtonVpnAddSiteEnabled READ getPushButtonVpnAddSiteEnabled WRITE setPushButtonVpnAddSiteEnabled NOTIFY pushButtonVpnAddSiteEnabledChanged)
|
Q_PROPERTY(bool pushButtonVpnAddSiteEnabled READ getPushButtonVpnAddSiteEnabled WRITE setPushButtonVpnAddSiteEnabled NOTIFY pushButtonVpnAddSiteEnabledChanged)
|
||||||
|
@ -288,22 +275,8 @@ public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool getLabelServerSettingsWaitInfoVisible() const;
|
|
||||||
void setLabelServerSettingsWaitInfoVisible(bool labelServerSettingsWaitInfoVisible);
|
|
||||||
QString getLabelServerSettingsWaitInfoText() const;
|
|
||||||
void setLabelServerSettingsWaitInfoText(const QString &labelServerSettingsWaitInfoText);
|
|
||||||
bool getPushButtonServerSettingsClearVisible() const;
|
|
||||||
void setPushButtonServerSettingsClearVisible(bool pushButtonServerSettingsClearVisible);
|
|
||||||
bool getPushButtonServerSettingsClearClientCacheVisible() const;
|
|
||||||
void setPushButtonServerSettingsClearClientCacheVisible(bool pushButtonServerSettingsClearClientCacheVisible);
|
|
||||||
bool getPushButtonServerSettingsShareFullVisible() const;
|
|
||||||
void setPushButtonServerSettingsShareFullVisible(bool pushButtonServerSettingsShareFullVisible);
|
|
||||||
QString getLabelServerSettingsServerText() const;
|
|
||||||
void setLabelServerSettingsServerText(const QString &labelServerSettingsServerText);
|
|
||||||
QString getLineEditServerSettingsDescriptionText() const;
|
|
||||||
void setLineEditServerSettingsDescriptionText(const QString &lineEditServerSettingsDescriptionText);
|
|
||||||
QString getLabelServerSettingsCurrentVpnProtocolText() const;
|
|
||||||
void setLabelServerSettingsCurrentVpnProtocolText(const QString &labelServerSettingsCurrentVpnProtocolText);
|
|
||||||
int getCurrentPageValue() const;
|
int getCurrentPageValue() const;
|
||||||
void setCurrentPageValue(int currentPageValue);
|
void setCurrentPageValue(int currentPageValue);
|
||||||
QString getTrayIconUrl() const;
|
QString getTrayIconUrl() const;
|
||||||
|
@ -450,10 +423,8 @@ public:
|
||||||
void setPushButtonNewServerConnectText(const QString &pushButtonNewServerConnectText);
|
void setPushButtonNewServerConnectText(const QString &pushButtonNewServerConnectText);
|
||||||
QString getDialogConnectErrorText() const;
|
QString getDialogConnectErrorText() const;
|
||||||
void setDialogConnectErrorText(const QString &dialogConnectErrorText);
|
void setDialogConnectErrorText(const QString &dialogConnectErrorText);
|
||||||
bool getPageServerSettingsEnabled() const;
|
|
||||||
void setPageServerSettingsEnabled(bool pageServerSettingsEnabled);
|
|
||||||
QString getPushButtonServerSettingsClearText() const;
|
|
||||||
void setPushButtonServerSettingsClearText(const QString &pushButtonServerSettingsClearText);
|
|
||||||
bool getPageShareAmneziaVisible() const;
|
bool getPageShareAmneziaVisible() const;
|
||||||
void setPageShareAmneziaVisible(bool pageShareAmneziaVisible);
|
void setPageShareAmneziaVisible(bool pageShareAmneziaVisible);
|
||||||
bool getPageShareOpenvpnVisible() const;
|
bool getPageShareOpenvpnVisible() const;
|
||||||
|
@ -568,9 +539,6 @@ public:
|
||||||
void setProgressBarProtoCloakResetValue(int progressBarProtoCloakResetValue);
|
void setProgressBarProtoCloakResetValue(int progressBarProtoCloakResetValue);
|
||||||
int getProgressBarProtoCloakResetMaximium() const;
|
int getProgressBarProtoCloakResetMaximium() const;
|
||||||
void setProgressBarProtoCloakResetMaximium(int progressBarProtoCloakResetMaximium);
|
void setProgressBarProtoCloakResetMaximium(int progressBarProtoCloakResetMaximium);
|
||||||
QObject* getServerListModel() const;
|
|
||||||
QString getPushButtonServerSettingsClearClientCacheText() const;
|
|
||||||
void setPushButtonServerSettingsClearClientCacheText(const QString &pushButtonServerSettingsClearClientCacheText);
|
|
||||||
|
|
||||||
bool getRadioButtonVpnModeAllSitesChecked() const;
|
bool getRadioButtonVpnModeAllSitesChecked() const;
|
||||||
void setRadioButtonVpnModeAllSitesChecked(bool radioButtonVpnModeAllSitesChecked);
|
void setRadioButtonVpnModeAllSitesChecked(bool radioButtonVpnModeAllSitesChecked);
|
||||||
|
@ -585,7 +553,6 @@ public:
|
||||||
Q_INVOKABLE void updateNewServerProtocolsPage();
|
Q_INVOKABLE void updateNewServerProtocolsPage();
|
||||||
Q_INVOKABLE void updateStartPage();
|
Q_INVOKABLE void updateStartPage();
|
||||||
Q_INVOKABLE void updateVpnPage();
|
Q_INVOKABLE void updateVpnPage();
|
||||||
Q_INVOKABLE void updateServerPage();
|
|
||||||
|
|
||||||
Q_INVOKABLE void onPushButtonNewServerConnect();
|
Q_INVOKABLE void onPushButtonNewServerConnect();
|
||||||
Q_INVOKABLE void onPushButtonNewServerImport();
|
Q_INVOKABLE void onPushButtonNewServerImport();
|
||||||
|
@ -621,14 +588,11 @@ public:
|
||||||
Q_INVOKABLE void onPushButtonProtoShadowsocksSaveClicked();
|
Q_INVOKABLE void onPushButtonProtoShadowsocksSaveClicked();
|
||||||
Q_INVOKABLE void onPushButtonProtoCloakSaveClicked();
|
Q_INVOKABLE void onPushButtonProtoCloakSaveClicked();
|
||||||
Q_INVOKABLE void onCloseWindow();
|
Q_INVOKABLE void onCloseWindow();
|
||||||
Q_INVOKABLE void onServerListPushbuttonDefaultClicked(int index);
|
|
||||||
Q_INVOKABLE void onServerListPushbuttonSettingsClicked(int index);
|
|
||||||
Q_INVOKABLE void onPushButtonServerSettingsShareFullClicked();
|
|
||||||
Q_INVOKABLE void onPushButtonClearServer();
|
|
||||||
Q_INVOKABLE void onPushButtonForgetServer();
|
|
||||||
Q_INVOKABLE void onPushButtonServerSettingsClearClientCacheClicked();
|
|
||||||
Q_INVOKABLE void onLineEditServerSettingsDescriptionEditingFinished();
|
|
||||||
Q_INVOKABLE void updateServersListPage();
|
|
||||||
Q_INVOKABLE void updateProtocolsPage();
|
Q_INVOKABLE void updateProtocolsPage();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -664,16 +628,8 @@ signals:
|
||||||
void radioButtonVpnModeExceptSitesCheckedChanged();
|
void radioButtonVpnModeExceptSitesCheckedChanged();
|
||||||
void pushButtonVpnAddSiteEnabledChanged();
|
void pushButtonVpnAddSiteEnabledChanged();
|
||||||
|
|
||||||
void labelServerSettingsWaitInfoVisibleChanged();
|
|
||||||
void labelServerSettingsWaitInfoTextChanged();
|
|
||||||
|
|
||||||
|
|
||||||
void pushButtonServerSettingsClearVisibleChanged();
|
|
||||||
void pushButtonServerSettingsClearClientCacheVisibleChanged();
|
|
||||||
void pushButtonServerSettingsShareFullVisibleChanged();
|
|
||||||
void labelServerSettingsServerTextChanged();
|
|
||||||
void lineEditServerSettingsDescriptionTextChanged();
|
|
||||||
void labelServerSettingsCurrentVpnProtocolTextChanged();
|
|
||||||
void currentPageValueChanged();
|
void currentPageValueChanged();
|
||||||
void trayIconUrlChanged();
|
void trayIconUrlChanged();
|
||||||
void trayActionDisconnectEnabledChanged();
|
void trayActionDisconnectEnabledChanged();
|
||||||
|
@ -747,8 +703,6 @@ signals:
|
||||||
void pushButtonNewServerConnectEnabledChanged();
|
void pushButtonNewServerConnectEnabledChanged();
|
||||||
void pushButtonNewServerConnectTextChanged();
|
void pushButtonNewServerConnectTextChanged();
|
||||||
void dialogConnectErrorTextChanged();
|
void dialogConnectErrorTextChanged();
|
||||||
void pageServerSettingsEnabledChanged();
|
|
||||||
void pushButtonServerSettingsClearTextChanged();
|
|
||||||
void pageShareAmneziaVisibleChanged();
|
void pageShareAmneziaVisibleChanged();
|
||||||
void pageShareOpenvpnVisibleChanged();
|
void pageShareOpenvpnVisibleChanged();
|
||||||
void pageShareShadowsocksVisibleChanged();
|
void pageShareShadowsocksVisibleChanged();
|
||||||
|
@ -806,7 +760,6 @@ signals:
|
||||||
void labelProtoCloakInfoTextChanged();
|
void labelProtoCloakInfoTextChanged();
|
||||||
void progressBarProtoCloakResetValueChanged();
|
void progressBarProtoCloakResetValueChanged();
|
||||||
void progressBarProtoCloakResetMaximiumChanged();
|
void progressBarProtoCloakResetMaximiumChanged();
|
||||||
void pushButtonServerSettingsClearClientCacheTextChanged();
|
|
||||||
|
|
||||||
void goToPage(int page, bool reset = true, bool slide = true);
|
void goToPage(int page, bool reset = true, bool slide = true);
|
||||||
void closePage();
|
void closePage();
|
||||||
|
@ -862,14 +815,8 @@ private:
|
||||||
bool m_radioButtonVpnModeExceptSitesChecked;
|
bool m_radioButtonVpnModeExceptSitesChecked;
|
||||||
bool m_pushButtonVpnAddSiteEnabled;
|
bool m_pushButtonVpnAddSiteEnabled;
|
||||||
|
|
||||||
bool m_labelServerSettingsWaitInfoVisible;
|
|
||||||
QString m_labelServerSettingsWaitInfoText;
|
|
||||||
bool m_pushButtonServerSettingsClearVisible;
|
|
||||||
bool m_pushButtonServerSettingsClearClientCacheVisible;
|
|
||||||
bool m_pushButtonServerSettingsShareFullVisible;
|
|
||||||
QString m_labelServerSettingsServerText;
|
|
||||||
QString m_lineEditServerSettingsDescriptionText;
|
|
||||||
QString m_labelServerSettingsCurrentVpnProtocolText;
|
|
||||||
int m_currentPageValue;
|
int m_currentPageValue;
|
||||||
QString m_trayIconUrl;
|
QString m_trayIconUrl;
|
||||||
bool m_trayActionDisconnectEnabled;
|
bool m_trayActionDisconnectEnabled;
|
||||||
|
@ -944,8 +891,6 @@ private:
|
||||||
bool m_pushButtonNewServerConnectEnabled;
|
bool m_pushButtonNewServerConnectEnabled;
|
||||||
QString m_pushButtonNewServerConnectText;
|
QString m_pushButtonNewServerConnectText;
|
||||||
QString m_dialogConnectErrorText;
|
QString m_dialogConnectErrorText;
|
||||||
bool m_pageServerSettingsEnabled;
|
|
||||||
QString m_pushButtonServerSettingsClearText;
|
|
||||||
bool m_pageShareAmneziaVisible;
|
bool m_pageShareAmneziaVisible;
|
||||||
bool m_pageShareOpenvpnVisible;
|
bool m_pageShareOpenvpnVisible;
|
||||||
bool m_pageShareShadowsocksVisible;
|
bool m_pageShareShadowsocksVisible;
|
||||||
|
@ -1003,8 +948,6 @@ private:
|
||||||
QString m_labelProtoCloakInfoText;
|
QString m_labelProtoCloakInfoText;
|
||||||
int m_progressBarProtoCloakResetValue;
|
int m_progressBarProtoCloakResetValue;
|
||||||
int m_progressBarProtoCloakResetMaximium;
|
int m_progressBarProtoCloakResetMaximium;
|
||||||
ServersModel* m_serverListModel;
|
|
||||||
QString m_pushButtonServerSettingsClearClientCacheText;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onBytesChanged(quint64 receivedBytes, quint64 sentBytes);
|
void onBytesChanged(quint64 receivedBytes, quint64 sentBytes);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue