OpenVpnLogic added

This commit is contained in:
pokamest 2021-09-06 13:41:45 +03:00
parent d1ea625435
commit a6e5cfff8a
12 changed files with 899 additions and 578 deletions

View file

@ -47,6 +47,9 @@ HEADERS += \
ui/pages_logic/StartPageLogic.h \
ui/pages_logic/VpnLogic.h \
ui/pages_logic/WizardLogic.h \
ui/pages_logic/protocols/CloakLogic.h \
ui/pages_logic/protocols/OpenVpnLogic.h \
ui/pages_logic/protocols/ShadowSocksLogic.h \
ui/serversmodel.h \
ui/uilogic.h \
ui/qautostart.h \
@ -89,6 +92,9 @@ SOURCES += \
ui/pages_logic/StartPageLogic.cpp \
ui/pages_logic/VpnLogic.cpp \
ui/pages_logic/WizardLogic.cpp \
ui/pages_logic/protocols/CloakLogic.cpp \
ui/pages_logic/protocols/OpenVpnLogic.cpp \
ui/pages_logic/protocols/ShadowSocksLogic.cpp \
ui/serversmodel.cpp \
ui/uilogic.cpp \
ui/qautostart.cpp \

View file

@ -27,6 +27,11 @@
#include "ui/pages_logic/VpnLogic.h"
#include "ui/pages_logic/WizardLogic.h"
#include "ui/pages_logic/protocols/CloakLogic.h"
#include "ui/pages_logic/protocols/OpenVpnLogic.h"
#include "ui/pages_logic/protocols/ShadowSocksLogic.h"
#include "ui/uilogic.h"
#include "debug.h"
#include "defines.h"
@ -151,6 +156,10 @@ int main(int argc, char *argv[])
engine.rootContext()->setContextProperty("VpnLogic", uiLogic->vpnLogic());
engine.rootContext()->setContextProperty("WizardLogic", uiLogic->wizardLogic());
engine.rootContext()->setContextProperty("OpenVpnLogic", uiLogic->openVpnLogic());
engine.rootContext()->setContextProperty("ShadowSocksLogic", uiLogic->shadowSocksLogic());
engine.rootContext()->setContextProperty("CloakLogic", uiLogic->cloakLogic());
engine.load(url);
// TODO - fix

View file

@ -1,7 +1,7 @@
#include "GeneralSettingsLogic.h"
#include "ShareConnectionLogic.h"
#include "../uilogic.h"
#include "ShareConnectionLogic.h"
using namespace amnezia;
using namespace PageEnumNS;

View file

@ -0,0 +1,51 @@
#include <QApplication>
#include <QClipboard>
#include <QDebug>
#include <QDesktopServices>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QHostInfo>
#include <QItemSelectionModel>
#include <QJsonDocument>
#include <QJsonObject>
#include <QKeyEvent>
#include <QMenu>
#include <QMessageBox>
#include <QMetaEnum>
#include <QSysInfo>
#include <QThread>
#include <QTimer>
#include <QRegularExpression>
#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 "CloakLogic.h"
#include "utils.h"
#include "vpnconnection.h"
#include <functional>
using namespace amnezia;
using namespace PageEnumNS;
CloakLogic::CloakLogic(UiLogic *uiLogic, QObject *parent):
QObject(parent),
m_uiLogic(uiLogic)
{
}

View file

@ -0,0 +1,34 @@
#ifndef CLOAK_LOGIC_H
#define CLOAK_LOGIC_H
#include "../../pages.h"
#include "settings.h"
class UiLogic;
class CloakLogic : public QObject
{
Q_OBJECT
public:
explicit CloakLogic(UiLogic *uiLogic, QObject *parent = nullptr);
~CloakLogic() = default;
signals:
private:
private slots:
private:
Settings m_settings;
UiLogic *m_uiLogic;
};
#endif // CLOAK_LOGIC_H

View file

@ -0,0 +1,474 @@
//#include <QApplication>
//#include <QClipboard>
//#include <QDebug>
//#include <QDesktopServices>
//#include <QFileDialog>
//#include <QHBoxLayout>
//#include <QHostInfo>
//#include <QItemSelectionModel>
//#include <QJsonDocument>
//#include <QJsonObject>
//#include <QKeyEvent>
//#include <QMenu>
//#include <QMessageBox>
//#include <QMetaEnum>
//#include <QSysInfo>
//#include <QThread>
//#include <QTimer>
//#include <QRegularExpression>
//#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 "OpenVpnLogic.h"
#include "utils.h"
#include "vpnconnection.h"
#include <functional>
#include "../../uilogic.h"
using namespace amnezia;
using namespace PageEnumNS;
OpenVpnLogic::OpenVpnLogic(UiLogic *uiLogic, QObject *parent):
QObject(parent),
m_uiLogic(uiLogic),
m_lineEditProtoOpenvpnSubnetText{},
m_radioButtonProtoOpenvpnUdpChecked{false},
m_checkBoxProtoOpenvpnAutoEncryptionChecked{},
m_comboBoxProtoOpenvpnCipherText{"AES-256-GCM"},
m_comboBoxProtoOpenvpnHashText{"SHA512"},
m_checkBoxProtoOpenvpnBlockDnsChecked{false},
m_lineEditProtoOpenvpnPortText{},
m_checkBoxProtoOpenvpnTlsAuthChecked{false},
m_widgetProtoOpenvpnEnabled{false},
m_pushButtonProtoOpenvpnSaveVisible{false},
m_progressBarProtoOpenvpnResetVisible{false},
m_radioButtonProtoOpenvpnUdpEnabled{false},
m_radioButtonProtoOpenvpnTcpEnabled{false},
m_radioButtonProtoOpenvpnTcpChecked{false},
m_lineEditProtoOpenvpnPortEnabled{false},
m_comboBoxProtoOpenvpnCipherEnabled{true},
m_comboBoxProtoOpenvpnHashEnabled{true},
m_pageProtoOpenvpnEnabled{true},
m_labelProtoOpenvpnInfoVisible{true},
m_labelProtoOpenvpnInfoText{},
m_progressBarProtoOpenvpnResetValue{0},
m_progressBarProtoOpenvpnResetMaximium{100}
{
}
void OpenVpnLogic::updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container, bool haveAuthData)
{
setWidgetProtoOpenvpnEnabled(haveAuthData);
setPushButtonProtoOpenvpnSaveVisible(haveAuthData);
setProgressBarProtoOpenvpnResetVisible(haveAuthData);
setRadioButtonProtoOpenvpnUdpEnabled(true);
setRadioButtonProtoOpenvpnTcpEnabled(true);
setLineEditProtoOpenvpnSubnetText(openvpnConfig.value(config_key::subnet_address).
toString(protocols::openvpn::defaultSubnetAddress));
QString trasnsport = openvpnConfig.value(config_key::transport_proto).
toString(protocols::openvpn::defaultTransportProto);
setRadioButtonProtoOpenvpnUdpChecked(trasnsport == protocols::openvpn::defaultTransportProto);
setRadioButtonProtoOpenvpnTcpChecked(trasnsport != protocols::openvpn::defaultTransportProto);
setComboBoxProtoOpenvpnCipherText(openvpnConfig.value(config_key::cipher).
toString(protocols::openvpn::defaultCipher));
setComboBoxProtoOpenvpnHashText(openvpnConfig.value(config_key::hash).
toString(protocols::openvpn::defaultHash));
bool blockOutsideDns = openvpnConfig.value(config_key::block_outside_dns).toBool(protocols::openvpn::defaultBlockOutsideDns);
setCheckBoxProtoOpenvpnBlockDnsChecked(blockOutsideDns);
bool isNcpDisabled = openvpnConfig.value(config_key::ncp_disable).toBool(protocols::openvpn::defaultNcpDisable);
setCheckBoxProtoOpenvpnAutoEncryptionChecked(!isNcpDisabled);
bool isTlsAuth = openvpnConfig.value(config_key::tls_auth).toBool(protocols::openvpn::defaultTlsAuth);
setCheckBoxProtoOpenvpnTlsAuthChecked(isTlsAuth);
if (container == DockerContainer::OpenVpnOverShadowSocks) {
setRadioButtonProtoOpenvpnUdpEnabled(false);
setRadioButtonProtoOpenvpnTcpEnabled(false);
setRadioButtonProtoOpenvpnTcpChecked(true);
}
setLineEditProtoOpenvpnPortText(openvpnConfig.value(config_key::port).
toString(protocols::openvpn::defaultPort));
setLineEditProtoOpenvpnPortEnabled(container == DockerContainer::OpenVpn);
}
QString OpenVpnLogic::getLineEditProtoOpenvpnSubnetText() const
{
return m_lineEditProtoOpenvpnSubnetText;
}
void OpenVpnLogic::setLineEditProtoOpenvpnSubnetText(const QString &lineEditProtoOpenvpnSubnetText)
{
if (m_lineEditProtoOpenvpnSubnetText != lineEditProtoOpenvpnSubnetText) {
m_lineEditProtoOpenvpnSubnetText = lineEditProtoOpenvpnSubnetText;
emit lineEditProtoOpenvpnSubnetTextChanged();
}
}
bool OpenVpnLogic::getRadioButtonProtoOpenvpnUdpChecked() const
{
return m_radioButtonProtoOpenvpnUdpChecked;
}
void OpenVpnLogic::setRadioButtonProtoOpenvpnUdpChecked(bool radioButtonProtoOpenvpnUdpChecked)
{
if (m_radioButtonProtoOpenvpnUdpChecked != radioButtonProtoOpenvpnUdpChecked) {
m_radioButtonProtoOpenvpnUdpChecked = radioButtonProtoOpenvpnUdpChecked;
emit radioButtonProtoOpenvpnUdpCheckedChanged();
}
}
bool OpenVpnLogic::getCheckBoxProtoOpenvpnAutoEncryptionChecked() const
{
return m_checkBoxProtoOpenvpnAutoEncryptionChecked;
}
void OpenVpnLogic::setCheckBoxProtoOpenvpnAutoEncryptionChecked(bool checkBoxProtoOpenvpnAutoEncryptionChecked)
{
if (m_checkBoxProtoOpenvpnAutoEncryptionChecked != checkBoxProtoOpenvpnAutoEncryptionChecked) {
m_checkBoxProtoOpenvpnAutoEncryptionChecked = checkBoxProtoOpenvpnAutoEncryptionChecked;
emit checkBoxProtoOpenvpnAutoEncryptionCheckedChanged();
}
}
QString OpenVpnLogic::getComboBoxProtoOpenvpnCipherText() const
{
return m_comboBoxProtoOpenvpnCipherText;
}
void OpenVpnLogic::setComboBoxProtoOpenvpnCipherText(const QString &comboBoxProtoOpenvpnCipherText)
{
if (m_comboBoxProtoOpenvpnCipherText != comboBoxProtoOpenvpnCipherText) {
m_comboBoxProtoOpenvpnCipherText = comboBoxProtoOpenvpnCipherText;
emit comboBoxProtoOpenvpnCipherTextChanged();
}
}
QString OpenVpnLogic::getComboBoxProtoOpenvpnHashText() const
{
return m_comboBoxProtoOpenvpnHashText;
}
void OpenVpnLogic::setComboBoxProtoOpenvpnHashText(const QString &comboBoxProtoOpenvpnHashText)
{
if (m_comboBoxProtoOpenvpnHashText != comboBoxProtoOpenvpnHashText) {
m_comboBoxProtoOpenvpnHashText = comboBoxProtoOpenvpnHashText;
emit comboBoxProtoOpenvpnHashTextChanged();
}
}
bool OpenVpnLogic::getCheckBoxProtoOpenvpnBlockDnsChecked() const
{
return m_checkBoxProtoOpenvpnBlockDnsChecked;
}
void OpenVpnLogic::setCheckBoxProtoOpenvpnBlockDnsChecked(bool checkBoxProtoOpenvpnBlockDnsChecked)
{
if (m_checkBoxProtoOpenvpnBlockDnsChecked != checkBoxProtoOpenvpnBlockDnsChecked) {
m_checkBoxProtoOpenvpnBlockDnsChecked = checkBoxProtoOpenvpnBlockDnsChecked;
emit checkBoxProtoOpenvpnBlockDnsCheckedChanged();
}
}
QString OpenVpnLogic::getLineEditProtoOpenvpnPortText() const
{
return m_lineEditProtoOpenvpnPortText;
}
void OpenVpnLogic::setLineEditProtoOpenvpnPortText(const QString &lineEditProtoOpenvpnPortText)
{
if (m_lineEditProtoOpenvpnPortText != lineEditProtoOpenvpnPortText) {
m_lineEditProtoOpenvpnPortText = lineEditProtoOpenvpnPortText;
emit lineEditProtoOpenvpnPortTextChanged();
}
}
bool OpenVpnLogic::getCheckBoxProtoOpenvpnTlsAuthChecked() const
{
return m_checkBoxProtoOpenvpnTlsAuthChecked;
}
void OpenVpnLogic::setCheckBoxProtoOpenvpnTlsAuthChecked(bool checkBoxProtoOpenvpnTlsAuthChecked)
{
if (m_checkBoxProtoOpenvpnTlsAuthChecked != checkBoxProtoOpenvpnTlsAuthChecked) {
m_checkBoxProtoOpenvpnTlsAuthChecked = checkBoxProtoOpenvpnTlsAuthChecked;
emit checkBoxProtoOpenvpnTlsAuthCheckedChanged();
}
}
bool OpenVpnLogic::getWidgetProtoOpenvpnEnabled() const
{
return m_widgetProtoOpenvpnEnabled;
}
void OpenVpnLogic::setWidgetProtoOpenvpnEnabled(bool widgetProtoOpenvpnEnabled)
{
if (m_widgetProtoOpenvpnEnabled != widgetProtoOpenvpnEnabled) {
m_widgetProtoOpenvpnEnabled = widgetProtoOpenvpnEnabled;
emit widgetProtoOpenvpnEnabledChanged();
}
}
bool OpenVpnLogic::getPushButtonProtoOpenvpnSaveVisible() const
{
return m_pushButtonProtoOpenvpnSaveVisible;
}
void OpenVpnLogic::setPushButtonProtoOpenvpnSaveVisible(bool pushButtonProtoOpenvpnSaveVisible)
{
if (m_pushButtonProtoOpenvpnSaveVisible != pushButtonProtoOpenvpnSaveVisible) {
m_pushButtonProtoOpenvpnSaveVisible = pushButtonProtoOpenvpnSaveVisible;
emit pushButtonProtoOpenvpnSaveVisibleChanged();
}
}
bool OpenVpnLogic::getProgressBarProtoOpenvpnResetVisible() const
{
return m_progressBarProtoOpenvpnResetVisible;
}
void OpenVpnLogic::setProgressBarProtoOpenvpnResetVisible(bool progressBarProtoOpenvpnResetVisible)
{
if (m_progressBarProtoOpenvpnResetVisible != progressBarProtoOpenvpnResetVisible) {
m_progressBarProtoOpenvpnResetVisible = progressBarProtoOpenvpnResetVisible;
emit progressBarProtoOpenvpnResetVisibleChanged();
}
}
bool OpenVpnLogic::getRadioButtonProtoOpenvpnUdpEnabled() const
{
return m_radioButtonProtoOpenvpnUdpEnabled;
}
void OpenVpnLogic::setRadioButtonProtoOpenvpnUdpEnabled(bool radioButtonProtoOpenvpnUdpEnabled)
{
if (m_radioButtonProtoOpenvpnUdpEnabled != radioButtonProtoOpenvpnUdpEnabled) {
m_radioButtonProtoOpenvpnUdpEnabled = radioButtonProtoOpenvpnUdpEnabled;
emit radioButtonProtoOpenvpnUdpEnabledChanged();
}
}
bool OpenVpnLogic::getRadioButtonProtoOpenvpnTcpEnabled() const
{
return m_radioButtonProtoOpenvpnTcpEnabled;
}
void OpenVpnLogic::setRadioButtonProtoOpenvpnTcpEnabled(bool radioButtonProtoOpenvpnTcpEnabled)
{
if (m_radioButtonProtoOpenvpnTcpEnabled != radioButtonProtoOpenvpnTcpEnabled) {
m_radioButtonProtoOpenvpnTcpEnabled = radioButtonProtoOpenvpnTcpEnabled;
emit radioButtonProtoOpenvpnTcpEnabledChanged();
}
}
bool OpenVpnLogic::getRadioButtonProtoOpenvpnTcpChecked() const
{
return m_radioButtonProtoOpenvpnTcpChecked;
}
void OpenVpnLogic::setRadioButtonProtoOpenvpnTcpChecked(bool radioButtonProtoOpenvpnTcpChecked)
{
if (m_radioButtonProtoOpenvpnTcpChecked != radioButtonProtoOpenvpnTcpChecked) {
m_radioButtonProtoOpenvpnTcpChecked = radioButtonProtoOpenvpnTcpChecked;
emit radioButtonProtoOpenvpnTcpCheckedChanged();
}
}
bool OpenVpnLogic::getLineEditProtoOpenvpnPortEnabled() const
{
return m_lineEditProtoOpenvpnPortEnabled;
}
void OpenVpnLogic::setLineEditProtoOpenvpnPortEnabled(bool lineEditProtoOpenvpnPortEnabled)
{
if (m_lineEditProtoOpenvpnPortEnabled != lineEditProtoOpenvpnPortEnabled) {
m_lineEditProtoOpenvpnPortEnabled = lineEditProtoOpenvpnPortEnabled;
emit lineEditProtoOpenvpnPortEnabledChanged();
}
}
bool OpenVpnLogic::getComboBoxProtoOpenvpnCipherEnabled() const
{
return m_comboBoxProtoOpenvpnCipherEnabled;
}
void OpenVpnLogic::setComboBoxProtoOpenvpnCipherEnabled(bool comboBoxProtoOpenvpnCipherEnabled)
{
if (m_comboBoxProtoOpenvpnCipherEnabled != comboBoxProtoOpenvpnCipherEnabled) {
m_comboBoxProtoOpenvpnCipherEnabled = comboBoxProtoOpenvpnCipherEnabled;
emit comboBoxProtoOpenvpnCipherEnabledChanged();
}
}
bool OpenVpnLogic::getComboBoxProtoOpenvpnHashEnabled() const
{
return m_comboBoxProtoOpenvpnHashEnabled;
}
void OpenVpnLogic::setComboBoxProtoOpenvpnHashEnabled(bool comboBoxProtoOpenvpnHashEnabled)
{
if (m_comboBoxProtoOpenvpnHashEnabled != comboBoxProtoOpenvpnHashEnabled) {
m_comboBoxProtoOpenvpnHashEnabled = comboBoxProtoOpenvpnHashEnabled;
emit comboBoxProtoOpenvpnHashEnabledChanged();
}
}
bool OpenVpnLogic::getPageProtoOpenvpnEnabled() const
{
return m_pageProtoOpenvpnEnabled;
}
void OpenVpnLogic::setPageProtoOpenvpnEnabled(bool pageProtoOpenvpnEnabled)
{
if (m_pageProtoOpenvpnEnabled != pageProtoOpenvpnEnabled) {
m_pageProtoOpenvpnEnabled = pageProtoOpenvpnEnabled;
emit pageProtoOpenvpnEnabledChanged();
}
}
bool OpenVpnLogic::getLabelProtoOpenvpnInfoVisible() const
{
return m_labelProtoOpenvpnInfoVisible;
}
void OpenVpnLogic::setLabelProtoOpenvpnInfoVisible(bool labelProtoOpenvpnInfoVisible)
{
if (m_labelProtoOpenvpnInfoVisible != labelProtoOpenvpnInfoVisible) {
m_labelProtoOpenvpnInfoVisible = labelProtoOpenvpnInfoVisible;
emit labelProtoOpenvpnInfoVisibleChanged();
}
}
QString OpenVpnLogic::getLabelProtoOpenvpnInfoText() const
{
return m_labelProtoOpenvpnInfoText;
}
void OpenVpnLogic::setLabelProtoOpenvpnInfoText(const QString &labelProtoOpenvpnInfoText)
{
if (m_labelProtoOpenvpnInfoText != labelProtoOpenvpnInfoText) {
m_labelProtoOpenvpnInfoText = labelProtoOpenvpnInfoText;
emit labelProtoOpenvpnInfoTextChanged();
}
}
int OpenVpnLogic::getProgressBarProtoOpenvpnResetValue() const
{
return m_progressBarProtoOpenvpnResetValue;
}
void OpenVpnLogic::setProgressBarProtoOpenvpnResetValue(int progressBarProtoOpenvpnResetValue)
{
if (m_progressBarProtoOpenvpnResetValue != progressBarProtoOpenvpnResetValue) {
m_progressBarProtoOpenvpnResetValue = progressBarProtoOpenvpnResetValue;
emit progressBarProtoOpenvpnResetValueChanged();
}
}
int OpenVpnLogic::getProgressBarProtoOpenvpnResetMaximium() const
{
return m_progressBarProtoOpenvpnResetMaximium;
}
void OpenVpnLogic::setProgressBarProtoOpenvpnResetMaximium(int progressBarProtoOpenvpnResetMaximium)
{
if (m_progressBarProtoOpenvpnResetMaximium != progressBarProtoOpenvpnResetMaximium) {
m_progressBarProtoOpenvpnResetMaximium = progressBarProtoOpenvpnResetMaximium;
emit progressBarProtoOpenvpnResetMaximiumChanged();
}
}
void OpenVpnLogic::onCheckBoxProtoOpenvpnAutoEncryptionClicked()
{
setComboBoxProtoOpenvpnCipherEnabled(!getCheckBoxProtoOpenvpnAutoEncryptionChecked());
setComboBoxProtoOpenvpnHashEnabled(!getCheckBoxProtoOpenvpnAutoEncryptionChecked());
}
void OpenVpnLogic::onPushButtonProtoOpenvpnSaveClicked()
{
QJsonObject protocolConfig = m_settings.protocolConfig(m_uiLogic->selectedServerIndex, m_uiLogic->selectedDockerContainer, Protocol::OpenVpn);
protocolConfig = getOpenVpnConfigFromPage(protocolConfig);
QJsonObject containerConfig = m_settings.containerConfig(m_uiLogic->selectedServerIndex, m_uiLogic->selectedDockerContainer);
QJsonObject newContainerConfig = containerConfig;
newContainerConfig.insert(config_key::openvpn, protocolConfig);
UiLogic::PageFunc page_proto_openvpn;
page_proto_openvpn.setEnabledFunc = [this] (bool enabled) -> void {
setPageProtoOpenvpnEnabled(enabled);
};
UiLogic::ButtonFunc pushButton_proto_openvpn_save;
pushButton_proto_openvpn_save.setVisibleFunc = [this] (bool visible) ->void {
setPushButtonProtoOpenvpnSaveVisible(visible);
};
UiLogic::LabelFunc label_proto_openvpn_info;
label_proto_openvpn_info.setVisibleFunc = [this] (bool visible) ->void {
setLabelProtoOpenvpnInfoVisible(visible);
};
label_proto_openvpn_info.setTextFunc = [this] (const QString& text) ->void {
setLabelProtoOpenvpnInfoText(text);
};
UiLogic::ProgressFunc progressBar_proto_openvpn_reset;
progressBar_proto_openvpn_reset.setVisibleFunc = [this] (bool visible) ->void {
setProgressBarProtoOpenvpnResetVisible(visible);
};
progressBar_proto_openvpn_reset.setValueFunc = [this] (int value) ->void {
setProgressBarProtoOpenvpnResetValue(value);
};
progressBar_proto_openvpn_reset.getValueFunc = [this] (void) -> int {
return getProgressBarProtoOpenvpnResetValue();
};
progressBar_proto_openvpn_reset.getMaximiumFunc = [this] (void) -> int {
return getProgressBarProtoOpenvpnResetMaximium();
};
ErrorCode e = m_uiLogic->doInstallAction([this, containerConfig, newContainerConfig](){
return ServerController::updateContainer(m_settings.serverCredentials(m_uiLogic->selectedServerIndex), m_uiLogic->selectedDockerContainer, containerConfig, newContainerConfig);
},
page_proto_openvpn, progressBar_proto_openvpn_reset,
pushButton_proto_openvpn_save, label_proto_openvpn_info);
if (!e) {
m_settings.setContainerConfig(m_uiLogic->selectedServerIndex, m_uiLogic->selectedDockerContainer, newContainerConfig);
m_settings.clearLastConnectionConfig(m_uiLogic->selectedServerIndex, m_uiLogic->selectedDockerContainer);
}
qDebug() << "Protocol saved with code:" << e << "for" << m_uiLogic->selectedServerIndex << m_uiLogic->selectedDockerContainer;
}
QJsonObject OpenVpnLogic::getOpenVpnConfigFromPage(QJsonObject oldConfig)
{
oldConfig.insert(config_key::subnet_address, getLineEditProtoOpenvpnSubnetText());
oldConfig.insert(config_key::transport_proto, getRadioButtonProtoOpenvpnUdpChecked() ? protocols::UDP : protocols::TCP);
oldConfig.insert(config_key::ncp_disable, ! getCheckBoxProtoOpenvpnAutoEncryptionChecked());
oldConfig.insert(config_key::cipher, getComboBoxProtoOpenvpnCipherText());
oldConfig.insert(config_key::hash, getComboBoxProtoOpenvpnHashText());
oldConfig.insert(config_key::block_outside_dns, getCheckBoxProtoOpenvpnBlockDnsChecked());
oldConfig.insert(config_key::port, getLineEditProtoOpenvpnPortText());
oldConfig.insert(config_key::tls_auth, getCheckBoxProtoOpenvpnTlsAuthChecked());
return oldConfig;
}

View file

@ -0,0 +1,155 @@
#ifndef OPENVPN_LOGIC_H
#define OPENVPN_LOGIC_H
#include "../../pages.h"
#include "settings.h"
class UiLogic;
class OpenVpnLogic : public QObject
{
Q_OBJECT
public:
Q_PROPERTY(QString lineEditProtoOpenvpnSubnetText READ getLineEditProtoOpenvpnSubnetText WRITE setLineEditProtoOpenvpnSubnetText NOTIFY lineEditProtoOpenvpnSubnetTextChanged)
Q_PROPERTY(bool radioButtonProtoOpenvpnUdpChecked READ getRadioButtonProtoOpenvpnUdpChecked WRITE setRadioButtonProtoOpenvpnUdpChecked NOTIFY radioButtonProtoOpenvpnUdpCheckedChanged)
Q_PROPERTY(bool checkBoxProtoOpenvpnAutoEncryptionChecked READ getCheckBoxProtoOpenvpnAutoEncryptionChecked WRITE setCheckBoxProtoOpenvpnAutoEncryptionChecked NOTIFY checkBoxProtoOpenvpnAutoEncryptionCheckedChanged)
Q_PROPERTY(QString comboBoxProtoOpenvpnCipherText READ getComboBoxProtoOpenvpnCipherText WRITE setComboBoxProtoOpenvpnCipherText NOTIFY comboBoxProtoOpenvpnCipherTextChanged)
Q_PROPERTY(QString comboBoxProtoOpenvpnHashText READ getComboBoxProtoOpenvpnHashText WRITE setComboBoxProtoOpenvpnHashText NOTIFY comboBoxProtoOpenvpnHashTextChanged)
Q_PROPERTY(bool checkBoxProtoOpenvpnBlockDnsChecked READ getCheckBoxProtoOpenvpnBlockDnsChecked WRITE setCheckBoxProtoOpenvpnBlockDnsChecked NOTIFY checkBoxProtoOpenvpnBlockDnsCheckedChanged)
Q_PROPERTY(QString lineEditProtoOpenvpnPortText READ getLineEditProtoOpenvpnPortText WRITE setLineEditProtoOpenvpnPortText NOTIFY lineEditProtoOpenvpnPortTextChanged)
Q_PROPERTY(bool checkBoxProtoOpenvpnTlsAuthChecked READ getCheckBoxProtoOpenvpnTlsAuthChecked WRITE setCheckBoxProtoOpenvpnTlsAuthChecked NOTIFY checkBoxProtoOpenvpnTlsAuthCheckedChanged)
Q_PROPERTY(bool widgetProtoOpenvpnEnabled READ getWidgetProtoOpenvpnEnabled WRITE setWidgetProtoOpenvpnEnabled NOTIFY widgetProtoOpenvpnEnabledChanged)
Q_PROPERTY(bool pushButtonProtoOpenvpnSaveVisible READ getPushButtonProtoOpenvpnSaveVisible WRITE setPushButtonProtoOpenvpnSaveVisible NOTIFY pushButtonProtoOpenvpnSaveVisibleChanged)
Q_PROPERTY(bool progressBarProtoOpenvpnResetVisible READ getProgressBarProtoOpenvpnResetVisible WRITE setProgressBarProtoOpenvpnResetVisible NOTIFY progressBarProtoOpenvpnResetVisibleChanged)
Q_PROPERTY(bool radioButtonProtoOpenvpnUdpEnabled READ getRadioButtonProtoOpenvpnUdpEnabled WRITE setRadioButtonProtoOpenvpnUdpEnabled NOTIFY radioButtonProtoOpenvpnUdpEnabledChanged)
Q_PROPERTY(bool radioButtonProtoOpenvpnTcpEnabled READ getRadioButtonProtoOpenvpnTcpEnabled WRITE setRadioButtonProtoOpenvpnTcpEnabled NOTIFY radioButtonProtoOpenvpnTcpEnabledChanged)
Q_PROPERTY(bool radioButtonProtoOpenvpnTcpChecked READ getRadioButtonProtoOpenvpnTcpChecked WRITE setRadioButtonProtoOpenvpnTcpChecked NOTIFY radioButtonProtoOpenvpnTcpCheckedChanged)
Q_PROPERTY(bool lineEditProtoOpenvpnPortEnabled READ getLineEditProtoOpenvpnPortEnabled WRITE setLineEditProtoOpenvpnPortEnabled NOTIFY lineEditProtoOpenvpnPortEnabledChanged)
Q_PROPERTY(bool comboBoxProtoOpenvpnCipherEnabled READ getComboBoxProtoOpenvpnCipherEnabled WRITE setComboBoxProtoOpenvpnCipherEnabled NOTIFY comboBoxProtoOpenvpnCipherEnabledChanged)
Q_PROPERTY(bool comboBoxProtoOpenvpnHashEnabled READ getComboBoxProtoOpenvpnHashEnabled WRITE setComboBoxProtoOpenvpnHashEnabled NOTIFY comboBoxProtoOpenvpnHashEnabledChanged)
Q_PROPERTY(bool pageProtoOpenvpnEnabled READ getPageProtoOpenvpnEnabled WRITE setPageProtoOpenvpnEnabled NOTIFY pageProtoOpenvpnEnabledChanged)
Q_PROPERTY(bool labelProtoOpenvpnInfoVisible READ getLabelProtoOpenvpnInfoVisible WRITE setLabelProtoOpenvpnInfoVisible NOTIFY labelProtoOpenvpnInfoVisibleChanged)
Q_PROPERTY(QString labelProtoOpenvpnInfoText READ getLabelProtoOpenvpnInfoText WRITE setLabelProtoOpenvpnInfoText NOTIFY labelProtoOpenvpnInfoTextChanged)
Q_PROPERTY(int progressBarProtoOpenvpnResetValue READ getProgressBarProtoOpenvpnResetValue WRITE setProgressBarProtoOpenvpnResetValue NOTIFY progressBarProtoOpenvpnResetValueChanged)
Q_PROPERTY(int progressBarProtoOpenvpnResetMaximium READ getProgressBarProtoOpenvpnResetMaximium WRITE setProgressBarProtoOpenvpnResetMaximium NOTIFY progressBarProtoOpenvpnResetMaximiumChanged)
public:
explicit OpenVpnLogic(UiLogic *uiLogic, QObject *parent = nullptr);
~OpenVpnLogic() = default;
void updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container, bool haveAuthData);
QJsonObject getOpenVpnConfigFromPage(QJsonObject oldConfig);
QString getLineEditProtoOpenvpnSubnetText() const;
void setLineEditProtoOpenvpnSubnetText(const QString &lineEditProtoOpenvpnSubnetText);
bool getRadioButtonProtoOpenvpnUdpChecked() const;
void setRadioButtonProtoOpenvpnUdpChecked(bool radioButtonProtoOpenvpnUdpChecked);
bool getCheckBoxProtoOpenvpnAutoEncryptionChecked() const;
void setCheckBoxProtoOpenvpnAutoEncryptionChecked(bool checkBoxProtoOpenvpnAutoEncryptionChecked);
QString getComboBoxProtoOpenvpnCipherText() const;
void setComboBoxProtoOpenvpnCipherText(const QString &comboBoxProtoOpenvpnCipherText);
QString getComboBoxProtoOpenvpnHashText() const;
void setComboBoxProtoOpenvpnHashText(const QString &comboBoxProtoOpenvpnHashText);
bool getCheckBoxProtoOpenvpnBlockDnsChecked() const;
void setCheckBoxProtoOpenvpnBlockDnsChecked(bool checkBoxProtoOpenvpnBlockDnsChecked);
QString getLineEditProtoOpenvpnPortText() const;
void setLineEditProtoOpenvpnPortText(const QString &lineEditProtoOpenvpnPortText);
bool getCheckBoxProtoOpenvpnTlsAuthChecked() const;
void setCheckBoxProtoOpenvpnTlsAuthChecked(bool checkBoxProtoOpenvpnTlsAuthChecked);
bool getWidgetProtoOpenvpnEnabled() const;
void setWidgetProtoOpenvpnEnabled(bool widgetProtoOpenvpnEnabled);
bool getPushButtonProtoOpenvpnSaveVisible() const;
void setPushButtonProtoOpenvpnSaveVisible(bool pushButtonProtoOpenvpnSaveVisible);
bool getProgressBarProtoOpenvpnResetVisible() const;
void setProgressBarProtoOpenvpnResetVisible(bool progressBarProtoOpenvpnResetVisible);
bool getRadioButtonProtoOpenvpnUdpEnabled() const;
void setRadioButtonProtoOpenvpnUdpEnabled(bool radioButtonProtoOpenvpnUdpEnabled);
bool getRadioButtonProtoOpenvpnTcpEnabled() const;
void setRadioButtonProtoOpenvpnTcpEnabled(bool radioButtonProtoOpenvpnTcpEnabled);
bool getRadioButtonProtoOpenvpnTcpChecked() const;
void setRadioButtonProtoOpenvpnTcpChecked(bool radioButtonProtoOpenvpnTcpChecked);
bool getLineEditProtoOpenvpnPortEnabled() const;
void setLineEditProtoOpenvpnPortEnabled(bool lineEditProtoOpenvpnPortEnabled);
bool getComboBoxProtoOpenvpnCipherEnabled() const;
void setComboBoxProtoOpenvpnCipherEnabled(bool comboBoxProtoOpenvpnCipherEnabled);
bool getComboBoxProtoOpenvpnHashEnabled() const;
void setComboBoxProtoOpenvpnHashEnabled(bool comboBoxProtoOpenvpnHashEnabled);
bool getPageProtoOpenvpnEnabled() const;
void setPageProtoOpenvpnEnabled(bool pageProtoOpenvpnEnabled);
bool getLabelProtoOpenvpnInfoVisible() const;
void setLabelProtoOpenvpnInfoVisible(bool labelProtoOpenvpnInfoVisible);
QString getLabelProtoOpenvpnInfoText() const;
void setLabelProtoOpenvpnInfoText(const QString &labelProtoOpenvpnInfoText);
int getProgressBarProtoOpenvpnResetValue() const;
void setProgressBarProtoOpenvpnResetValue(int progressBarProtoOpenvpnResetValue);
int getProgressBarProtoOpenvpnResetMaximium() const;
void setProgressBarProtoOpenvpnResetMaximium(int progressBarProtoOpenvpnResetMaximium);
Q_INVOKABLE void onCheckBoxProtoOpenvpnAutoEncryptionClicked();
Q_INVOKABLE void onPushButtonProtoOpenvpnSaveClicked();
signals:
void lineEditProtoOpenvpnSubnetTextChanged();
void radioButtonProtoOpenvpnUdpCheckedChanged();
void checkBoxProtoOpenvpnAutoEncryptionCheckedChanged();
void comboBoxProtoOpenvpnCipherTextChanged();
void comboBoxProtoOpenvpnHashTextChanged();
void checkBoxProtoOpenvpnBlockDnsCheckedChanged();
void lineEditProtoOpenvpnPortTextChanged();
void checkBoxProtoOpenvpnTlsAuthCheckedChanged();
void widgetProtoOpenvpnEnabledChanged();
void pushButtonProtoOpenvpnSaveVisibleChanged();
void progressBarProtoOpenvpnResetVisibleChanged();
void radioButtonProtoOpenvpnUdpEnabledChanged();
void radioButtonProtoOpenvpnTcpEnabledChanged();
void radioButtonProtoOpenvpnTcpCheckedChanged();
void lineEditProtoOpenvpnPortEnabledChanged();
void comboBoxProtoOpenvpnCipherEnabledChanged();
void comboBoxProtoOpenvpnHashEnabledChanged();
void pageProtoOpenvpnEnabledChanged();
void labelProtoOpenvpnInfoVisibleChanged();
void labelProtoOpenvpnInfoTextChanged();
void progressBarProtoOpenvpnResetValueChanged();
void progressBarProtoOpenvpnResetMaximiumChanged();
private:
private slots:
private:
Settings m_settings;
UiLogic *m_uiLogic;
QString m_lineEditProtoOpenvpnSubnetText;
bool m_radioButtonProtoOpenvpnUdpChecked;
bool m_checkBoxProtoOpenvpnAutoEncryptionChecked;
QString m_comboBoxProtoOpenvpnCipherText;
QString m_comboBoxProtoOpenvpnHashText;
bool m_checkBoxProtoOpenvpnBlockDnsChecked;
QString m_lineEditProtoOpenvpnPortText;
bool m_checkBoxProtoOpenvpnTlsAuthChecked;
bool m_widgetProtoOpenvpnEnabled;
bool m_pushButtonProtoOpenvpnSaveVisible;
bool m_progressBarProtoOpenvpnResetVisible;
bool m_radioButtonProtoOpenvpnUdpEnabled;
bool m_radioButtonProtoOpenvpnTcpEnabled;
bool m_radioButtonProtoOpenvpnTcpChecked;
bool m_lineEditProtoOpenvpnPortEnabled;
bool m_comboBoxProtoOpenvpnCipherEnabled;
bool m_comboBoxProtoOpenvpnHashEnabled;
bool m_pageProtoOpenvpnEnabled;
bool m_labelProtoOpenvpnInfoVisible;
QString m_labelProtoOpenvpnInfoText;
int m_progressBarProtoOpenvpnResetValue;
int m_progressBarProtoOpenvpnResetMaximium;
};
#endif // OPENVPN_LOGIC_H

View file

@ -0,0 +1,50 @@
#include <QApplication>
#include <QClipboard>
#include <QDebug>
#include <QDesktopServices>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QHostInfo>
#include <QItemSelectionModel>
#include <QJsonDocument>
#include <QJsonObject>
#include <QKeyEvent>
#include <QMenu>
#include <QMessageBox>
#include <QMetaEnum>
#include <QSysInfo>
#include <QThread>
#include <QTimer>
#include <QRegularExpression>
#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 "ShadowSocksLogic.h"
#include "utils.h"
#include "vpnconnection.h"
#include <functional>
using namespace amnezia;
using namespace PageEnumNS;
ShadowSocksLogic::ShadowSocksLogic(UiLogic *uiLogic, QObject *parent):
QObject(parent),
m_uiLogic(uiLogic)
{
}

View file

@ -0,0 +1,34 @@
#ifndef SHADOWSOCKS_LOGIC_H
#define SHADOWSOCKS_LOGIC_H
#include "../../pages.h"
#include "settings.h"
class UiLogic;
class ShadowSocksLogic : public QObject
{
Q_OBJECT
public:
explicit ShadowSocksLogic(UiLogic *uiLogic, QObject *parent = nullptr);
~ShadowSocksLogic() = default;
signals:
private:
private slots:
private:
Settings m_settings;
UiLogic *m_uiLogic;
};
#endif // SHADOWSOCKS_LOGIC_H

View file

@ -6,7 +6,7 @@ import "../../Config"
Item {
id: root
enabled: UiLogic.pageProtoOpenvpnEnabled
enabled: OpenVpnLogic.pageProtoOpenvpnEnabled
ImageButtonType {
id: back
x: 10
@ -23,19 +23,19 @@ Item {
y: 40
width: 380
height: 600
enabled: UiLogic.widgetProtoOpenvpnEnabled
enabled: OpenVpnLogic.widgetProtoOpenvpnEnabled
CheckBoxType {
x: 30
y: 280
width: 321
height: 21
text: qsTr("Auto-negotiate encryption")
checked: UiLogic.checkBoxProtoOpenvpnAutoEncryptionChecked
checked: OpenVpnLogic.checkBoxProtoOpenvpnAutoEncryptionChecked
onCheckedChanged: {
UiLogic.checkBoxProtoOpenvpnAutoEncryptionChecked = checked
OpenVpnLogic.checkBoxProtoOpenvpnAutoEncryptionChecked = checked
}
onClicked: {
UiLogic.checkBoxProtoOpenvpnAutoEncryptionClicked()
OpenVpnLogic.checkBoxProtoOpenvpnAutoEncryptionClicked()
}
}
CheckBoxType {
@ -44,9 +44,9 @@ Item {
width: 321
height: 21
text: qsTr("Block DNS requests outside of VPN")
checked: UiLogic.checkBoxProtoOpenvpnBlockDnsChecked
checked: OpenVpnLogic.checkBoxProtoOpenvpnBlockDnsChecked
onCheckedChanged: {
UiLogic.checkBoxProtoOpenvpnBlockDnsChecked = checked
OpenVpnLogic.checkBoxProtoOpenvpnBlockDnsChecked = checked
}
}
CheckBoxType {
@ -55,9 +55,9 @@ Item {
width: 321
height: 21
text: qsTr("Enable TLS auth")
checked: UiLogic.checkBoxProtoOpenvpnTlsAuthChecked
checked: OpenVpnLogic.checkBoxProtoOpenvpnTlsAuthChecked
onCheckedChanged: {
UiLogic.checkBoxProtoOpenvpnTlsAuthChecked = checked
OpenVpnLogic.checkBoxProtoOpenvpnTlsAuthChecked = checked
}
}
@ -80,16 +80,16 @@ Item {
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (UiLogic.comboBoxProtoOpenvpnCipherText === model[i]) {
if (OpenVpnLogic.comboBoxProtoOpenvpnCipherText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
UiLogic.comboBoxProtoOpenvpnCipherText = currentText
OpenVpnLogic.comboBoxProtoOpenvpnCipherText = currentText
}
enabled: UiLogic.comboBoxProtoOpenvpnCipherEnabled
enabled: OpenVpnLogic.comboBoxProtoOpenvpnCipherEnabled
}
ComboBoxType {
x: 200
@ -110,16 +110,16 @@ Item {
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (UiLogic.comboBoxProtoOpenvpnHashText === model[i]) {
if (OpenVpnLogic.comboBoxProtoOpenvpnHashText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
UiLogic.comboBoxProtoOpenvpnHashText = currentText
OpenVpnLogic.comboBoxProtoOpenvpnHashText = currentText
}
enabled: UiLogic.comboBoxProtoOpenvpnHashEnabled
enabled: OpenVpnLogic.comboBoxProtoOpenvpnHashEnabled
}
Rectangle {
x: 30
@ -135,8 +135,8 @@ Item {
width: 171
height: 19
text: qsTr("TCP")
enabled: UiLogic.radioButtonProtoOpenvpnTcpEnabled
checked: UiLogic.radioButtonProtoOpenvpnTcpChecked
enabled: OpenVpnLogic.radioButtonProtoOpenvpnTcpEnabled
checked: OpenVpnLogic.radioButtonProtoOpenvpnTcpChecked
onCheckedChanged: {
UiLogic.radioButtonProtoOpenvpnTcpChecked = checked
}
@ -147,11 +147,11 @@ Item {
width: 171
height: 19
text: qsTr("UDP")
checked: UiLogic.radioButtonProtoOpenvpnUdpChecked
checked: OpenVpnLogic.radioButtonProtoOpenvpnUdpChecked
onCheckedChanged: {
UiLogic.radioButtonProtoOpenvpnUdpChecked = checked
OpenVpnLogic.radioButtonProtoOpenvpnUdpChecked = checked
}
enabled: UiLogic.radioButtonProtoOpenvpnUdpEnabled
enabled: OpenVpnLogic.radioButtonProtoOpenvpnUdpEnabled
}
}
LabelType {
@ -208,8 +208,8 @@ Item {
y: 550
width: 321
height: 41
visible: UiLogic.labelProtoOpenvpnInfoVisible
text: UiLogic.labelProtoOpenvpnInfoText
visible: OpenVpnLogic.labelProtoOpenvpnInfoVisible
text: OpenVpnLogic.labelProtoOpenvpnInfoText
}
TextFieldType {
id: lineEdit_proto_openvpn_port
@ -217,11 +217,11 @@ Item {
y: 230
width: 151
height: 31
text: UiLogic.lineEditProtoOpenvpnPortText
text: OpenVpnLogic.lineEditProtoOpenvpnPortText
onEditingFinished: {
UiLogic.lineEditProtoOpenvpnPortText = text
OpenVpnLogic.lineEditProtoOpenvpnPortText = text
}
enabled: UiLogic.lineEditProtoOpenvpnPortEnabled
enabled: OpenVpnLogic.lineEditProtoOpenvpnPortEnabled
}
TextFieldType {
id: lineEdit_proto_openvpn_subnet
@ -229,9 +229,9 @@ Item {
y: 65
width: 321
height: 31
text: UiLogic.lineEditProtoOpenvpnSubnetText
text: OpenVpnLogic.lineEditProtoOpenvpnSubnetText
onEditingFinished: {
UiLogic.lineEditProtoOpenvpnSubnetText = text
OpenVpnLogic.lineEditProtoOpenvpnSubnetText = text
}
}
ProgressBar {
@ -241,9 +241,9 @@ Item {
width: 321
height: 40
from: 0
to: UiLogic.progressBarProtoOpenvpnResetMaximium
value: UiLogic.progressBarProtoOpenvpnResetValue
visible: UiLogic.progressBarProtoOpenvpnResetVisible
to: OpenVpnLogic.progressBarProtoOpenvpnResetMaximium
value: OpenVpnLogic.progressBarProtoOpenvpnResetValue
visible: OpenVpnLogic.progressBarProtoOpenvpnResetVisible
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
@ -268,9 +268,9 @@ Item {
width: 321
height: 40
text: qsTr("Save and restart VPN")
visible: UiLogic.pushButtonProtoOpenvpnSaveVisible
visible: OpenVpnLogic.pushButtonProtoOpenvpnSaveVisible
onClicked: {
UiLogic.onPushButtonProtoOpenvpnSaveClicked()
OpenVpnLogic.onPushButtonProtoOpenvpnSaveClicked()
}
}
}

View file

@ -58,6 +58,11 @@
#include "pages_logic/VpnLogic.h"
#include "pages_logic/WizardLogic.h"
#include "pages_logic/protocols/CloakLogic.h"
#include "pages_logic/protocols/OpenVpnLogic.h"
#include "pages_logic/protocols/ShadowSocksLogic.h"
using namespace amnezia;
using namespace PageEnumNS;
@ -96,14 +101,7 @@ UiLogic::UiLogic(QObject *parent) :
m_lineEditProtoCloakPortText{},
m_comboBoxProtoShadowsocksCipherText{"chacha20-poly1305"},
m_lineEditProtoShadowsocksPortText{},
m_lineEditProtoOpenvpnSubnetText{},
m_radioButtonProtoOpenvpnUdpChecked{false},
m_checkBoxProtoOpenvpnAutoEncryptionChecked{},
m_comboBoxProtoOpenvpnCipherText{"AES-256-GCM"},
m_comboBoxProtoOpenvpnHashText{"SHA512"},
m_checkBoxProtoOpenvpnBlockDnsChecked{false},
m_lineEditProtoOpenvpnPortText{},
m_checkBoxProtoOpenvpnTlsAuthChecked{false},
m_pushButtonConnectChecked{false},
@ -115,13 +113,7 @@ UiLogic::UiLogic(QObject *parent) :
m_pushButtonProtoShadowsocksSaveVisible{false},
m_progressBarProtoShadowsocksResetVisible{false},
m_lineEditProtoShadowsocksPortEnabled{false},
m_widgetProtoOpenvpnEnabled{false},
m_pushButtonProtoOpenvpnSaveVisible{false},
m_progressBarProtoOpenvpnResetVisible{false},
m_radioButtonProtoOpenvpnUdpEnabled{false},
m_radioButtonProtoOpenvpnTcpEnabled{false},
m_radioButtonProtoOpenvpnTcpChecked{false},
m_lineEditProtoOpenvpnPortEnabled{false},
m_pushButtonProtoOpenvpnContInstallChecked{false},
m_pushButtonProtoSsOpenvpnContInstallChecked{false},
m_pushButtonProtoCloakOpenvpnContInstallChecked{false},
@ -163,13 +155,7 @@ UiLogic::UiLogic(QObject *parent) :
m_pageServerProtocolsEnabled{true},
m_progressBarProtocolsContainerReinstallValue{0},
m_progressBarProtocolsContainerReinstallMaximium{100},
m_comboBoxProtoOpenvpnCipherEnabled{true},
m_comboBoxProtoOpenvpnHashEnabled{true},
m_pageProtoOpenvpnEnabled{true},
m_labelProtoOpenvpnInfoVisible{true},
m_labelProtoOpenvpnInfoText{},
m_progressBarProtoOpenvpnResetValue{0},
m_progressBarProtoOpenvpnResetMaximium{100},
m_pageProtoShadowsocksEnabled{true},
m_labelProtoShadowsocksInfoVisible{true},
m_labelProtoShadowsocksInfoText{},
@ -198,6 +184,9 @@ UiLogic::UiLogic(QObject *parent) :
m_vpnLogic = new VpnLogic(this);
m_wizardLogic = new WizardLogic(this);
m_openVpnLogic = new OpenVpnLogic(this);
m_shadowSocksLogic = new ShadowSocksLogic(this);
m_cloakLogic = new CloakLogic(this);
connect(m_vpnConnection, SIGNAL(bytesChanged(quint64, quint64)), this, SLOT(onBytesChanged(quint64, quint64)));
connect(m_vpnConnection, SIGNAL(connectionStateChanged(VpnProtocol::ConnectionState)), this, SLOT(onConnectionStateChanged(VpnProtocol::ConnectionState)));
@ -670,109 +659,7 @@ void UiLogic::setLineEditProtoShadowsocksPortText(const QString &lineEditProtoSh
}
}
QString UiLogic::getLineEditProtoOpenvpnSubnetText() const
{
return m_lineEditProtoOpenvpnSubnetText;
}
void UiLogic::setLineEditProtoOpenvpnSubnetText(const QString &lineEditProtoOpenvpnSubnetText)
{
if (m_lineEditProtoOpenvpnSubnetText != lineEditProtoOpenvpnSubnetText) {
m_lineEditProtoOpenvpnSubnetText = lineEditProtoOpenvpnSubnetText;
emit lineEditProtoOpenvpnSubnetTextChanged();
}
}
bool UiLogic::getRadioButtonProtoOpenvpnUdpChecked() const
{
return m_radioButtonProtoOpenvpnUdpChecked;
}
void UiLogic::setRadioButtonProtoOpenvpnUdpChecked(bool radioButtonProtoOpenvpnUdpChecked)
{
if (m_radioButtonProtoOpenvpnUdpChecked != radioButtonProtoOpenvpnUdpChecked) {
m_radioButtonProtoOpenvpnUdpChecked = radioButtonProtoOpenvpnUdpChecked;
emit radioButtonProtoOpenvpnUdpCheckedChanged();
}
}
bool UiLogic::getCheckBoxProtoOpenvpnAutoEncryptionChecked() const
{
return m_checkBoxProtoOpenvpnAutoEncryptionChecked;
}
void UiLogic::setCheckBoxProtoOpenvpnAutoEncryptionChecked(bool checkBoxProtoOpenvpnAutoEncryptionChecked)
{
if (m_checkBoxProtoOpenvpnAutoEncryptionChecked != checkBoxProtoOpenvpnAutoEncryptionChecked) {
m_checkBoxProtoOpenvpnAutoEncryptionChecked = checkBoxProtoOpenvpnAutoEncryptionChecked;
emit checkBoxProtoOpenvpnAutoEncryptionCheckedChanged();
}
}
QString UiLogic::getComboBoxProtoOpenvpnCipherText() const
{
return m_comboBoxProtoOpenvpnCipherText;
}
void UiLogic::setComboBoxProtoOpenvpnCipherText(const QString &comboBoxProtoOpenvpnCipherText)
{
if (m_comboBoxProtoOpenvpnCipherText != comboBoxProtoOpenvpnCipherText) {
m_comboBoxProtoOpenvpnCipherText = comboBoxProtoOpenvpnCipherText;
emit comboBoxProtoOpenvpnCipherTextChanged();
}
}
QString UiLogic::getComboBoxProtoOpenvpnHashText() const
{
return m_comboBoxProtoOpenvpnHashText;
}
void UiLogic::setComboBoxProtoOpenvpnHashText(const QString &comboBoxProtoOpenvpnHashText)
{
if (m_comboBoxProtoOpenvpnHashText != comboBoxProtoOpenvpnHashText) {
m_comboBoxProtoOpenvpnHashText = comboBoxProtoOpenvpnHashText;
emit comboBoxProtoOpenvpnHashTextChanged();
}
}
bool UiLogic::getCheckBoxProtoOpenvpnBlockDnsChecked() const
{
return m_checkBoxProtoOpenvpnBlockDnsChecked;
}
void UiLogic::setCheckBoxProtoOpenvpnBlockDnsChecked(bool checkBoxProtoOpenvpnBlockDnsChecked)
{
if (m_checkBoxProtoOpenvpnBlockDnsChecked != checkBoxProtoOpenvpnBlockDnsChecked) {
m_checkBoxProtoOpenvpnBlockDnsChecked = checkBoxProtoOpenvpnBlockDnsChecked;
emit checkBoxProtoOpenvpnBlockDnsCheckedChanged();
}
}
QString UiLogic::getLineEditProtoOpenvpnPortText() const
{
return m_lineEditProtoOpenvpnPortText;
}
void UiLogic::setLineEditProtoOpenvpnPortText(const QString &lineEditProtoOpenvpnPortText)
{
if (m_lineEditProtoOpenvpnPortText != lineEditProtoOpenvpnPortText) {
m_lineEditProtoOpenvpnPortText = lineEditProtoOpenvpnPortText;
emit lineEditProtoOpenvpnPortTextChanged();
}
}
bool UiLogic::getCheckBoxProtoOpenvpnTlsAuthChecked() const
{
return m_checkBoxProtoOpenvpnTlsAuthChecked;
}
void UiLogic::setCheckBoxProtoOpenvpnTlsAuthChecked(bool checkBoxProtoOpenvpnTlsAuthChecked)
{
if (m_checkBoxProtoOpenvpnTlsAuthChecked != checkBoxProtoOpenvpnTlsAuthChecked) {
m_checkBoxProtoOpenvpnTlsAuthChecked = checkBoxProtoOpenvpnTlsAuthChecked;
emit checkBoxProtoOpenvpnTlsAuthCheckedChanged();
}
}
@ -907,96 +794,7 @@ void UiLogic::setLineEditProtoShadowsocksPortEnabled(bool lineEditProtoShadowsoc
}
}
bool UiLogic::getWidgetProtoOpenvpnEnabled() const
{
return m_widgetProtoOpenvpnEnabled;
}
void UiLogic::setWidgetProtoOpenvpnEnabled(bool widgetProtoOpenvpnEnabled)
{
if (m_widgetProtoOpenvpnEnabled != widgetProtoOpenvpnEnabled) {
m_widgetProtoOpenvpnEnabled = widgetProtoOpenvpnEnabled;
emit widgetProtoOpenvpnEnabledChanged();
}
}
bool UiLogic::getPushButtonProtoOpenvpnSaveVisible() const
{
return m_pushButtonProtoOpenvpnSaveVisible;
}
void UiLogic::setPushButtonProtoOpenvpnSaveVisible(bool pushButtonProtoOpenvpnSaveVisible)
{
if (m_pushButtonProtoOpenvpnSaveVisible != pushButtonProtoOpenvpnSaveVisible) {
m_pushButtonProtoOpenvpnSaveVisible = pushButtonProtoOpenvpnSaveVisible;
emit pushButtonProtoOpenvpnSaveVisibleChanged();
}
}
bool UiLogic::getProgressBarProtoOpenvpnResetVisible() const
{
return m_progressBarProtoOpenvpnResetVisible;
}
void UiLogic::setProgressBarProtoOpenvpnResetVisible(bool progressBarProtoOpenvpnResetVisible)
{
if (m_progressBarProtoOpenvpnResetVisible != progressBarProtoOpenvpnResetVisible) {
m_progressBarProtoOpenvpnResetVisible = progressBarProtoOpenvpnResetVisible;
emit progressBarProtoOpenvpnResetVisibleChanged();
}
}
bool UiLogic::getRadioButtonProtoOpenvpnUdpEnabled() const
{
return m_radioButtonProtoOpenvpnUdpEnabled;
}
void UiLogic::setRadioButtonProtoOpenvpnUdpEnabled(bool radioButtonProtoOpenvpnUdpEnabled)
{
if (m_radioButtonProtoOpenvpnUdpEnabled != radioButtonProtoOpenvpnUdpEnabled) {
m_radioButtonProtoOpenvpnUdpEnabled = radioButtonProtoOpenvpnUdpEnabled;
emit radioButtonProtoOpenvpnUdpEnabledChanged();
}
}
bool UiLogic::getRadioButtonProtoOpenvpnTcpEnabled() const
{
return m_radioButtonProtoOpenvpnTcpEnabled;
}
void UiLogic::setRadioButtonProtoOpenvpnTcpEnabled(bool radioButtonProtoOpenvpnTcpEnabled)
{
if (m_radioButtonProtoOpenvpnTcpEnabled != radioButtonProtoOpenvpnTcpEnabled) {
m_radioButtonProtoOpenvpnTcpEnabled = radioButtonProtoOpenvpnTcpEnabled;
emit radioButtonProtoOpenvpnTcpEnabledChanged();
}
}
bool UiLogic::getRadioButtonProtoOpenvpnTcpChecked() const
{
return m_radioButtonProtoOpenvpnTcpChecked;
}
void UiLogic::setRadioButtonProtoOpenvpnTcpChecked(bool radioButtonProtoOpenvpnTcpChecked)
{
if (m_radioButtonProtoOpenvpnTcpChecked != radioButtonProtoOpenvpnTcpChecked) {
m_radioButtonProtoOpenvpnTcpChecked = radioButtonProtoOpenvpnTcpChecked;
emit radioButtonProtoOpenvpnTcpCheckedChanged();
}
}
bool UiLogic::getLineEditProtoOpenvpnPortEnabled() const
{
return m_lineEditProtoOpenvpnPortEnabled;
}
void UiLogic::setLineEditProtoOpenvpnPortEnabled(bool lineEditProtoOpenvpnPortEnabled)
{
if (m_lineEditProtoOpenvpnPortEnabled != lineEditProtoOpenvpnPortEnabled) {
m_lineEditProtoOpenvpnPortEnabled = lineEditProtoOpenvpnPortEnabled;
emit lineEditProtoOpenvpnPortEnabledChanged();
}
}
bool UiLogic::getPushButtonProtoOpenvpnContInstallChecked() const
{
@ -1537,95 +1335,7 @@ void UiLogic::setProgressBarProtocolsContainerReinstallMaximium(int progressBarP
}
}
bool UiLogic::getComboBoxProtoOpenvpnCipherEnabled() const
{
return m_comboBoxProtoOpenvpnCipherEnabled;
}
void UiLogic::setComboBoxProtoOpenvpnCipherEnabled(bool comboBoxProtoOpenvpnCipherEnabled)
{
if (m_comboBoxProtoOpenvpnCipherEnabled != comboBoxProtoOpenvpnCipherEnabled) {
m_comboBoxProtoOpenvpnCipherEnabled = comboBoxProtoOpenvpnCipherEnabled;
emit comboBoxProtoOpenvpnCipherEnabledChanged();
}
}
bool UiLogic::getComboBoxProtoOpenvpnHashEnabled() const
{
return m_comboBoxProtoOpenvpnHashEnabled;
}
void UiLogic::setComboBoxProtoOpenvpnHashEnabled(bool comboBoxProtoOpenvpnHashEnabled)
{
if (m_comboBoxProtoOpenvpnHashEnabled != comboBoxProtoOpenvpnHashEnabled) {
m_comboBoxProtoOpenvpnHashEnabled = comboBoxProtoOpenvpnHashEnabled;
emit comboBoxProtoOpenvpnHashEnabledChanged();
}
}
bool UiLogic::getPageProtoOpenvpnEnabled() const
{
return m_pageProtoOpenvpnEnabled;
}
void UiLogic::setPageProtoOpenvpnEnabled(bool pageProtoOpenvpnEnabled)
{
if (m_pageProtoOpenvpnEnabled != pageProtoOpenvpnEnabled) {
m_pageProtoOpenvpnEnabled = pageProtoOpenvpnEnabled;
emit pageProtoOpenvpnEnabledChanged();
}
}
bool UiLogic::getLabelProtoOpenvpnInfoVisible() const
{
return m_labelProtoOpenvpnInfoVisible;
}
void UiLogic::setLabelProtoOpenvpnInfoVisible(bool labelProtoOpenvpnInfoVisible)
{
if (m_labelProtoOpenvpnInfoVisible != labelProtoOpenvpnInfoVisible) {
m_labelProtoOpenvpnInfoVisible = labelProtoOpenvpnInfoVisible;
emit labelProtoOpenvpnInfoVisibleChanged();
}
}
QString UiLogic::getLabelProtoOpenvpnInfoText() const
{
return m_labelProtoOpenvpnInfoText;
}
void UiLogic::setLabelProtoOpenvpnInfoText(const QString &labelProtoOpenvpnInfoText)
{
if (m_labelProtoOpenvpnInfoText != labelProtoOpenvpnInfoText) {
m_labelProtoOpenvpnInfoText = labelProtoOpenvpnInfoText;
emit labelProtoOpenvpnInfoTextChanged();
}
}
int UiLogic::getProgressBarProtoOpenvpnResetValue() const
{
return m_progressBarProtoOpenvpnResetValue;
}
void UiLogic::setProgressBarProtoOpenvpnResetValue(int progressBarProtoOpenvpnResetValue)
{
if (m_progressBarProtoOpenvpnResetValue != progressBarProtoOpenvpnResetValue) {
m_progressBarProtoOpenvpnResetValue = progressBarProtoOpenvpnResetValue;
emit progressBarProtoOpenvpnResetValueChanged();
}
}
int UiLogic::getProgressBarProtoOpenvpnResetMaximium() const
{
return m_progressBarProtoOpenvpnResetMaximium;
}
void UiLogic::setProgressBarProtoOpenvpnResetMaximium(int progressBarProtoOpenvpnResetMaximium)
{
if (m_progressBarProtoOpenvpnResetMaximium != progressBarProtoOpenvpnResetMaximium) {
m_progressBarProtoOpenvpnResetMaximium = progressBarProtoOpenvpnResetMaximium;
emit progressBarProtoOpenvpnResetMaximiumChanged();
}
}
bool UiLogic::getPageProtoShadowsocksEnabled() const
{
return m_pageProtoShadowsocksEnabled;
@ -1690,6 +1400,7 @@ void UiLogic::setProgressBarProtoShadowsocksResetMaximium(int progressBarProtoSh
emit progressBarProtoShadowsocksResetMaximiumChanged();
}
}
bool UiLogic::getPageProtoCloakEnabled() const
{
return m_pageProtoCloakEnabled;
@ -2495,7 +2206,7 @@ void UiLogic::onDisconnect()
void UiLogic::onPushButtonProtoOpenvpnContOpenvpnConfigClicked()
{
selectedDockerContainer = DockerContainer::OpenVpn;
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn),
m_openVpnLogic->updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn),
selectedDockerContainer, m_settings.haveAuthData(selectedServerIndex));
goToPage(Page::OpenVpnSettings);
}
@ -2503,7 +2214,7 @@ void UiLogic::onPushButtonProtoOpenvpnContOpenvpnConfigClicked()
void UiLogic::onPushButtonProtoSsOpenvpnContOpenvpnConfigClicked()
{
selectedDockerContainer = DockerContainer::OpenVpnOverShadowSocks;
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn),
m_openVpnLogic->updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn),
selectedDockerContainer, m_settings.haveAuthData(selectedServerIndex));
goToPage(Page::OpenVpnSettings);
}
@ -2519,7 +2230,7 @@ void UiLogic::onPushButtonProtoSsOpenvpnContSsConfigClicked()
void UiLogic::onPushButtonProtoCloakOpenvpnContOpenvpnConfigClicked()
{
selectedDockerContainer = DockerContainer::OpenVpnOverCloak;
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn),
m_openVpnLogic->updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn),
selectedDockerContainer, m_settings.haveAuthData(selectedServerIndex));
goToPage(Page::OpenVpnSettings);
}
@ -2540,63 +2251,6 @@ void UiLogic::onPushButtonProtoCloakOpenvpnContCloakConfigClicked()
goToPage(Page::CloakSettings);
}
void UiLogic::onCheckBoxProtoOpenvpnAutoEncryptionClicked()
{
setComboBoxProtoOpenvpnCipherEnabled(!getCheckBoxProtoOpenvpnAutoEncryptionChecked());
setComboBoxProtoOpenvpnHashEnabled(!getCheckBoxProtoOpenvpnAutoEncryptionChecked());
}
void UiLogic::onPushButtonProtoOpenvpnSaveClicked()
{
QJsonObject protocolConfig = m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn);
protocolConfig = getOpenVpnConfigFromPage(protocolConfig);
QJsonObject containerConfig = m_settings.containerConfig(selectedServerIndex, selectedDockerContainer);
QJsonObject newContainerConfig = containerConfig;
newContainerConfig.insert(config_key::openvpn, protocolConfig);
PageFunc page_proto_openvpn;
page_proto_openvpn.setEnabledFunc = [this] (bool enabled) -> void {
setPageProtoOpenvpnEnabled(enabled);
};
ButtonFunc pushButton_proto_openvpn_save;
pushButton_proto_openvpn_save.setVisibleFunc = [this] (bool visible) ->void {
setPushButtonProtoOpenvpnSaveVisible(visible);
};
LabelFunc label_proto_openvpn_info;
label_proto_openvpn_info.setVisibleFunc = [this] (bool visible) ->void {
setLabelProtoOpenvpnInfoVisible(visible);
};
label_proto_openvpn_info.setTextFunc = [this] (const QString& text) ->void {
setLabelProtoOpenvpnInfoText(text);
};
ProgressFunc progressBar_proto_openvpn_reset;
progressBar_proto_openvpn_reset.setVisibleFunc = [this] (bool visible) ->void {
setProgressBarProtoOpenvpnResetVisible(visible);
};
progressBar_proto_openvpn_reset.setValueFunc = [this] (int value) ->void {
setProgressBarProtoOpenvpnResetValue(value);
};
progressBar_proto_openvpn_reset.getValueFunc = [this] (void) -> int {
return getProgressBarProtoOpenvpnResetValue();
};
progressBar_proto_openvpn_reset.getMaximiumFunc = [this] (void) -> int {
return getProgressBarProtoOpenvpnResetMaximium();
};
ErrorCode e = doInstallAction([this, containerConfig, newContainerConfig](){
return ServerController::updateContainer(m_settings.serverCredentials(selectedServerIndex), selectedDockerContainer, containerConfig, newContainerConfig);
},
page_proto_openvpn, progressBar_proto_openvpn_reset,
pushButton_proto_openvpn_save, label_proto_openvpn_info);
if (!e) {
m_settings.setContainerConfig(selectedServerIndex, selectedDockerContainer, newContainerConfig);
m_settings.clearLastConnectionConfig(selectedServerIndex, selectedDockerContainer);
}
qDebug() << "Protocol saved with code:" << e << "for" << selectedServerIndex << selectedDockerContainer;
}
void UiLogic::onPushButtonProtoShadowsocksSaveClicked()
{
QJsonObject protocolConfig = m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::ShadowSocks);
@ -2622,7 +2276,7 @@ void UiLogic::onPushButtonProtoShadowsocksSaveClicked()
};
ProgressFunc progressBar_proto_shadowsocks_reset;
progressBar_proto_shadowsocks_reset.setVisibleFunc = [this] (bool visible) ->void {
setProgressBarProtoOpenvpnResetVisible(visible);
setProgressBarProtoShadowsocksResetVisible(visible);
};
progressBar_proto_shadowsocks_reset.setValueFunc = [this] (int value) ->void {
setProgressBarProtoShadowsocksResetValue(value);
@ -2810,50 +2464,7 @@ void UiLogic::updateProtocolsPage()
}
}
void UiLogic::updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container, bool haveAuthData)
{
setWidgetProtoOpenvpnEnabled(haveAuthData);
setPushButtonProtoOpenvpnSaveVisible(haveAuthData);
setProgressBarProtoOpenvpnResetVisible(haveAuthData);
setRadioButtonProtoOpenvpnUdpEnabled(true);
setRadioButtonProtoOpenvpnTcpEnabled(true);
setLineEditProtoOpenvpnSubnetText(openvpnConfig.value(config_key::subnet_address).
toString(protocols::openvpn::defaultSubnetAddress));
QString trasnsport = openvpnConfig.value(config_key::transport_proto).
toString(protocols::openvpn::defaultTransportProto);
setRadioButtonProtoOpenvpnUdpChecked(trasnsport == protocols::openvpn::defaultTransportProto);
setRadioButtonProtoOpenvpnTcpChecked(trasnsport != protocols::openvpn::defaultTransportProto);
setComboBoxProtoOpenvpnCipherText(openvpnConfig.value(config_key::cipher).
toString(protocols::openvpn::defaultCipher));
setComboBoxProtoOpenvpnHashText(openvpnConfig.value(config_key::hash).
toString(protocols::openvpn::defaultHash));
bool blockOutsideDns = openvpnConfig.value(config_key::block_outside_dns).toBool(protocols::openvpn::defaultBlockOutsideDns);
setCheckBoxProtoOpenvpnBlockDnsChecked(blockOutsideDns);
bool isNcpDisabled = openvpnConfig.value(config_key::ncp_disable).toBool(protocols::openvpn::defaultNcpDisable);
setCheckBoxProtoOpenvpnAutoEncryptionChecked(!isNcpDisabled);
bool isTlsAuth = openvpnConfig.value(config_key::tls_auth).toBool(protocols::openvpn::defaultTlsAuth);
setCheckBoxProtoOpenvpnTlsAuthChecked(isTlsAuth);
if (container == DockerContainer::OpenVpnOverShadowSocks) {
setRadioButtonProtoOpenvpnUdpEnabled(false);
setRadioButtonProtoOpenvpnTcpEnabled(false);
setRadioButtonProtoOpenvpnTcpChecked(true);
}
setLineEditProtoOpenvpnPortText(openvpnConfig.value(config_key::port).
toString(protocols::openvpn::defaultPort));
setLineEditProtoOpenvpnPortEnabled(container == DockerContainer::OpenVpn);
}
void UiLogic::updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData)
{
@ -2888,18 +2499,6 @@ void UiLogic::updateCloakPage(const QJsonObject &ckConfig, DockerContainer conta
setLineEditProtoCloakPortEnabled(container == DockerContainer::OpenVpnOverCloak);
}
QJsonObject UiLogic::getOpenVpnConfigFromPage(QJsonObject oldConfig)
{
oldConfig.insert(config_key::subnet_address, getLineEditProtoOpenvpnSubnetText());
oldConfig.insert(config_key::transport_proto, getRadioButtonProtoOpenvpnUdpChecked() ? protocols::UDP : protocols::TCP);
oldConfig.insert(config_key::ncp_disable, ! getCheckBoxProtoOpenvpnAutoEncryptionChecked());
oldConfig.insert(config_key::cipher, getComboBoxProtoOpenvpnCipherText());
oldConfig.insert(config_key::hash, getComboBoxProtoOpenvpnHashText());
oldConfig.insert(config_key::block_outside_dns, getCheckBoxProtoOpenvpnBlockDnsChecked());
oldConfig.insert(config_key::port, getLineEditProtoOpenvpnPortText());
oldConfig.insert(config_key::tls_auth, getCheckBoxProtoOpenvpnTlsAuthChecked());
return oldConfig;
}
QJsonObject UiLogic::getShadowSocksConfigFromPage(QJsonObject oldConfig)
{

View file

@ -24,8 +24,11 @@ class StartPageLogic;
class VpnLogic;
class WizardLogic;
class VpnConnection;
class OpenVpnLogic;
class ShadowSocksLogic;
class CloakLogic;
class VpnConnection;
class UiLogic : public QObject
@ -58,14 +61,6 @@ class UiLogic : public QObject
Q_PROPERTY(QString lineEditProtoCloakPortText READ getLineEditProtoCloakPortText WRITE setLineEditProtoCloakPortText NOTIFY lineEditProtoCloakPortTextChanged)
Q_PROPERTY(QString comboBoxProtoShadowsocksCipherText READ getComboBoxProtoShadowsocksCipherText WRITE setComboBoxProtoShadowsocksCipherText NOTIFY comboBoxProtoShadowsocksCipherTextChanged)
Q_PROPERTY(QString lineEditProtoShadowsocksPortText READ getLineEditProtoShadowsocksPortText WRITE setLineEditProtoShadowsocksPortText NOTIFY lineEditProtoShadowsocksPortTextChanged)
Q_PROPERTY(QString lineEditProtoOpenvpnSubnetText READ getLineEditProtoOpenvpnSubnetText WRITE setLineEditProtoOpenvpnSubnetText NOTIFY lineEditProtoOpenvpnSubnetTextChanged)
Q_PROPERTY(bool radioButtonProtoOpenvpnUdpChecked READ getRadioButtonProtoOpenvpnUdpChecked WRITE setRadioButtonProtoOpenvpnUdpChecked NOTIFY radioButtonProtoOpenvpnUdpCheckedChanged)
Q_PROPERTY(bool checkBoxProtoOpenvpnAutoEncryptionChecked READ getCheckBoxProtoOpenvpnAutoEncryptionChecked WRITE setCheckBoxProtoOpenvpnAutoEncryptionChecked NOTIFY checkBoxProtoOpenvpnAutoEncryptionCheckedChanged)
Q_PROPERTY(QString comboBoxProtoOpenvpnCipherText READ getComboBoxProtoOpenvpnCipherText WRITE setComboBoxProtoOpenvpnCipherText NOTIFY comboBoxProtoOpenvpnCipherTextChanged)
Q_PROPERTY(QString comboBoxProtoOpenvpnHashText READ getComboBoxProtoOpenvpnHashText WRITE setComboBoxProtoOpenvpnHashText NOTIFY comboBoxProtoOpenvpnHashTextChanged)
Q_PROPERTY(bool checkBoxProtoOpenvpnBlockDnsChecked READ getCheckBoxProtoOpenvpnBlockDnsChecked WRITE setCheckBoxProtoOpenvpnBlockDnsChecked NOTIFY checkBoxProtoOpenvpnBlockDnsCheckedChanged)
Q_PROPERTY(QString lineEditProtoOpenvpnPortText READ getLineEditProtoOpenvpnPortText WRITE setLineEditProtoOpenvpnPortText NOTIFY lineEditProtoOpenvpnPortTextChanged)
Q_PROPERTY(bool checkBoxProtoOpenvpnTlsAuthChecked READ getCheckBoxProtoOpenvpnTlsAuthChecked WRITE setCheckBoxProtoOpenvpnTlsAuthChecked NOTIFY checkBoxProtoOpenvpnTlsAuthCheckedChanged)
Q_PROPERTY(bool pushButtonConnectChecked READ getPushButtonConnectChecked WRITE setPushButtonConnectChecked NOTIFY pushButtonConnectCheckedChanged)
Q_PROPERTY(bool widgetProtoCloakEnabled READ getWidgetProtoCloakEnabled WRITE setWidgetProtoCloakEnabled NOTIFY widgetProtoCloakEnabledChanged)
@ -76,13 +71,6 @@ class UiLogic : public QObject
Q_PROPERTY(bool pushButtonProtoShadowsocksSaveVisible READ getPushButtonProtoShadowsocksSaveVisible WRITE setPushButtonProtoShadowsocksSaveVisible NOTIFY pushButtonProtoShadowsocksSaveVisibleChanged)
Q_PROPERTY(bool progressBarProtoShadowsocksResetVisible READ getProgressBarProtoShadowsocksResetVisible WRITE setProgressBarProtoShadowsocksResetVisible NOTIFY progressBarProtoShadowsocksResetVisibleChanged)
Q_PROPERTY(bool lineEditProtoShadowsocksPortEnabled READ getLineEditProtoShadowsocksPortEnabled WRITE setLineEditProtoShadowsocksPortEnabled NOTIFY lineEditProtoShadowsocksPortEnabledChanged)
Q_PROPERTY(bool widgetProtoOpenvpnEnabled READ getWidgetProtoOpenvpnEnabled WRITE setWidgetProtoOpenvpnEnabled NOTIFY widgetProtoOpenvpnEnabledChanged)
Q_PROPERTY(bool pushButtonProtoOpenvpnSaveVisible READ getPushButtonProtoOpenvpnSaveVisible WRITE setPushButtonProtoOpenvpnSaveVisible NOTIFY pushButtonProtoOpenvpnSaveVisibleChanged)
Q_PROPERTY(bool progressBarProtoOpenvpnResetVisible READ getProgressBarProtoOpenvpnResetVisible WRITE setProgressBarProtoOpenvpnResetVisible NOTIFY progressBarProtoOpenvpnResetVisibleChanged)
Q_PROPERTY(bool radioButtonProtoOpenvpnUdpEnabled READ getRadioButtonProtoOpenvpnUdpEnabled WRITE setRadioButtonProtoOpenvpnUdpEnabled NOTIFY radioButtonProtoOpenvpnUdpEnabledChanged)
Q_PROPERTY(bool radioButtonProtoOpenvpnTcpEnabled READ getRadioButtonProtoOpenvpnTcpEnabled WRITE setRadioButtonProtoOpenvpnTcpEnabled NOTIFY radioButtonProtoOpenvpnTcpEnabledChanged)
Q_PROPERTY(bool radioButtonProtoOpenvpnTcpChecked READ getRadioButtonProtoOpenvpnTcpChecked WRITE setRadioButtonProtoOpenvpnTcpChecked NOTIFY radioButtonProtoOpenvpnTcpCheckedChanged)
Q_PROPERTY(bool lineEditProtoOpenvpnPortEnabled READ getLineEditProtoOpenvpnPortEnabled WRITE setLineEditProtoOpenvpnPortEnabled NOTIFY lineEditProtoOpenvpnPortEnabledChanged)
Q_PROPERTY(bool pushButtonProtoOpenvpnContInstallChecked READ getPushButtonProtoOpenvpnContInstallChecked WRITE setPushButtonProtoOpenvpnContInstallChecked NOTIFY pushButtonProtoOpenvpnContInstallCheckedChanged)
Q_PROPERTY(bool pushButtonProtoSsOpenvpnContInstallChecked READ getPushButtonProtoSsOpenvpnContInstallChecked WRITE setPushButtonProtoSsOpenvpnContInstallChecked NOTIFY pushButtonProtoSsOpenvpnContInstallCheckedChanged)
Q_PROPERTY(bool pushButtonProtoCloakOpenvpnContInstallChecked READ getPushButtonProtoCloakOpenvpnContInstallChecked WRITE setPushButtonProtoCloakOpenvpnContInstallChecked NOTIFY pushButtonProtoCloakOpenvpnContInstallCheckedChanged)
@ -124,13 +112,6 @@ class UiLogic : public QObject
Q_PROPERTY(bool pageServerProtocolsEnabled READ getPageServerProtocolsEnabled WRITE setPageServerProtocolsEnabled NOTIFY pageServerProtocolsEnabledChanged)
Q_PROPERTY(int progressBarProtocolsContainerReinstallValue READ getProgressBarProtocolsContainerReinstallValue WRITE setProgressBarProtocolsContainerReinstallValue NOTIFY progressBarProtocolsContainerReinstallValueChanged)
Q_PROPERTY(int progressBarProtocolsContainerReinstallMaximium READ getProgressBarProtocolsContainerReinstallMaximium WRITE setProgressBarProtocolsContainerReinstallMaximium NOTIFY progressBarProtocolsContainerReinstallMaximiumChanged)
Q_PROPERTY(bool comboBoxProtoOpenvpnCipherEnabled READ getComboBoxProtoOpenvpnCipherEnabled WRITE setComboBoxProtoOpenvpnCipherEnabled NOTIFY comboBoxProtoOpenvpnCipherEnabledChanged)
Q_PROPERTY(bool comboBoxProtoOpenvpnHashEnabled READ getComboBoxProtoOpenvpnHashEnabled WRITE setComboBoxProtoOpenvpnHashEnabled NOTIFY comboBoxProtoOpenvpnHashEnabledChanged)
Q_PROPERTY(bool pageProtoOpenvpnEnabled READ getPageProtoOpenvpnEnabled WRITE setPageProtoOpenvpnEnabled NOTIFY pageProtoOpenvpnEnabledChanged)
Q_PROPERTY(bool labelProtoOpenvpnInfoVisible READ getLabelProtoOpenvpnInfoVisible WRITE setLabelProtoOpenvpnInfoVisible NOTIFY labelProtoOpenvpnInfoVisibleChanged)
Q_PROPERTY(QString labelProtoOpenvpnInfoText READ getLabelProtoOpenvpnInfoText WRITE setLabelProtoOpenvpnInfoText NOTIFY labelProtoOpenvpnInfoTextChanged)
Q_PROPERTY(int progressBarProtoOpenvpnResetValue READ getProgressBarProtoOpenvpnResetValue WRITE setProgressBarProtoOpenvpnResetValue NOTIFY progressBarProtoOpenvpnResetValueChanged)
Q_PROPERTY(int progressBarProtoOpenvpnResetMaximium READ getProgressBarProtoOpenvpnResetMaximium WRITE setProgressBarProtoOpenvpnResetMaximium NOTIFY progressBarProtoOpenvpnResetMaximiumChanged)
Q_PROPERTY(bool pageProtoShadowsocksEnabled READ getPageProtoShadowsocksEnabled WRITE setPageProtoShadowsocksEnabled NOTIFY pageProtoShadowsocksEnabledChanged)
Q_PROPERTY(bool labelProtoShadowsocksInfoVisible READ getLabelProtoShadowsocksInfoVisible WRITE setLabelProtoShadowsocksInfoVisible NOTIFY labelProtoShadowsocksInfoVisibleChanged)
Q_PROPERTY(QString labelProtoShadowsocksInfoText READ getLabelProtoShadowsocksInfoText WRITE setLabelProtoShadowsocksInfoText NOTIFY labelProtoShadowsocksInfoTextChanged)
@ -168,6 +149,10 @@ public:
friend class VpnLogic;
friend class WizardLogic;
friend class OpenVpnLogic;
friend class ShadowSocksLogic;
friend class CloakLogic;
Q_INVOKABLE void initalizeUiLogic();
@ -225,22 +210,6 @@ public:
void setComboBoxProtoShadowsocksCipherText(const QString &comboBoxProtoShadowsocksCipherText);
QString getLineEditProtoShadowsocksPortText() const;
void setLineEditProtoShadowsocksPortText(const QString &lineEditProtoShadowsocksPortText);
QString getLineEditProtoOpenvpnSubnetText() const;
void setLineEditProtoOpenvpnSubnetText(const QString &lineEditProtoOpenvpnSubnetText);
bool getRadioButtonProtoOpenvpnUdpChecked() const;
void setRadioButtonProtoOpenvpnUdpChecked(bool radioButtonProtoOpenvpnUdpChecked);
bool getCheckBoxProtoOpenvpnAutoEncryptionChecked() const;
void setCheckBoxProtoOpenvpnAutoEncryptionChecked(bool checkBoxProtoOpenvpnAutoEncryptionChecked);
QString getComboBoxProtoOpenvpnCipherText() const;
void setComboBoxProtoOpenvpnCipherText(const QString &comboBoxProtoOpenvpnCipherText);
QString getComboBoxProtoOpenvpnHashText() const;
void setComboBoxProtoOpenvpnHashText(const QString &comboBoxProtoOpenvpnHashText);
bool getCheckBoxProtoOpenvpnBlockDnsChecked() const;
void setCheckBoxProtoOpenvpnBlockDnsChecked(bool checkBoxProtoOpenvpnBlockDnsChecked);
QString getLineEditProtoOpenvpnPortText() const;
void setLineEditProtoOpenvpnPortText(const QString &lineEditProtoOpenvpnPortText);
bool getCheckBoxProtoOpenvpnTlsAuthChecked() const;
void setCheckBoxProtoOpenvpnTlsAuthChecked(bool checkBoxProtoOpenvpnTlsAuthChecked);
bool getPushButtonConnectChecked() const;
void setPushButtonConnectChecked(bool pushButtonConnectChecked);
@ -261,20 +230,7 @@ public:
void setProgressBarProtoShadowsocksResetVisible(bool progressBarProtoShadowsocksResetVisible);
bool getLineEditProtoShadowsocksPortEnabled() const;
void setLineEditProtoShadowsocksPortEnabled(bool lineEditProtoShadowsocksPortEnabled);
bool getWidgetProtoOpenvpnEnabled() const;
void setWidgetProtoOpenvpnEnabled(bool widgetProtoOpenvpnEnabled);
bool getPushButtonProtoOpenvpnSaveVisible() const;
void setPushButtonProtoOpenvpnSaveVisible(bool pushButtonProtoOpenvpnSaveVisible);
bool getProgressBarProtoOpenvpnResetVisible() const;
void setProgressBarProtoOpenvpnResetVisible(bool progressBarProtoOpenvpnResetVisible);
bool getRadioButtonProtoOpenvpnUdpEnabled() const;
void setRadioButtonProtoOpenvpnUdpEnabled(bool radioButtonProtoOpenvpnUdpEnabled);
bool getRadioButtonProtoOpenvpnTcpEnabled() const;
void setRadioButtonProtoOpenvpnTcpEnabled(bool radioButtonProtoOpenvpnTcpEnabled);
bool getRadioButtonProtoOpenvpnTcpChecked() const;
void setRadioButtonProtoOpenvpnTcpChecked(bool radioButtonProtoOpenvpnTcpChecked);
bool getLineEditProtoOpenvpnPortEnabled() const;
void setLineEditProtoOpenvpnPortEnabled(bool lineEditProtoOpenvpnPortEnabled);
bool getPushButtonProtoOpenvpnContInstallChecked() const;
void setPushButtonProtoOpenvpnContInstallChecked(bool pushButtonProtoOpenvpnContInstallChecked);
bool getPushButtonProtoSsOpenvpnContInstallChecked() const;
@ -362,20 +318,6 @@ public:
void setProgressBarProtocolsContainerReinstallValue(int progressBarProtocolsContainerReinstallValue);
int getProgressBarProtocolsContainerReinstallMaximium() const;
void setProgressBarProtocolsContainerReinstallMaximium(int progressBarProtocolsContainerReinstallMaximium);
bool getComboBoxProtoOpenvpnCipherEnabled() const;
void setComboBoxProtoOpenvpnCipherEnabled(bool comboBoxProtoOpenvpnCipherEnabled);
bool getComboBoxProtoOpenvpnHashEnabled() const;
void setComboBoxProtoOpenvpnHashEnabled(bool comboBoxProtoOpenvpnHashEnabled);
bool getPageProtoOpenvpnEnabled() const;
void setPageProtoOpenvpnEnabled(bool pageProtoOpenvpnEnabled);
bool getLabelProtoOpenvpnInfoVisible() const;
void setLabelProtoOpenvpnInfoVisible(bool labelProtoOpenvpnInfoVisible);
QString getLabelProtoOpenvpnInfoText() const;
void setLabelProtoOpenvpnInfoText(const QString &labelProtoOpenvpnInfoText);
int getProgressBarProtoOpenvpnResetValue() const;
void setProgressBarProtoOpenvpnResetValue(int progressBarProtoOpenvpnResetValue);
int getProgressBarProtoOpenvpnResetMaximium() const;
void setProgressBarProtoOpenvpnResetMaximium(int progressBarProtoOpenvpnResetMaximium);
bool getPageProtoShadowsocksEnabled() const;
void setPageProtoShadowsocksEnabled(bool pageProtoShadowsocksEnabled);
bool getLabelProtoShadowsocksInfoVisible() const;
@ -427,8 +369,7 @@ public:
Q_INVOKABLE void onPushButtonProtoCloakOpenvpnContOpenvpnConfigClicked();
Q_INVOKABLE void onPushButtonProtoCloakOpenvpnContSsConfigClicked();
Q_INVOKABLE void onPushButtonProtoCloakOpenvpnContCloakConfigClicked();
Q_INVOKABLE void onCheckBoxProtoOpenvpnAutoEncryptionClicked();
Q_INVOKABLE void onPushButtonProtoOpenvpnSaveClicked();
Q_INVOKABLE void onPushButtonProtoShadowsocksSaveClicked();
Q_INVOKABLE void onPushButtonProtoCloakSaveClicked();
Q_INVOKABLE void onCloseWindow();
@ -475,14 +416,7 @@ signals:
void lineEditProtoCloakPortTextChanged();
void comboBoxProtoShadowsocksCipherTextChanged();
void lineEditProtoShadowsocksPortTextChanged();
void lineEditProtoOpenvpnSubnetTextChanged();
void radioButtonProtoOpenvpnUdpCheckedChanged();
void checkBoxProtoOpenvpnAutoEncryptionCheckedChanged();
void comboBoxProtoOpenvpnCipherTextChanged();
void comboBoxProtoOpenvpnHashTextChanged();
void checkBoxProtoOpenvpnBlockDnsCheckedChanged();
void lineEditProtoOpenvpnPortTextChanged();
void checkBoxProtoOpenvpnTlsAuthCheckedChanged();
void pushButtonConnectCheckedChanged();
@ -495,13 +429,7 @@ signals:
void pushButtonProtoShadowsocksSaveVisibleChanged();
void progressBarProtoShadowsocksResetVisibleChanged();
void lineEditProtoShadowsocksPortEnabledChanged();
void widgetProtoOpenvpnEnabledChanged();
void pushButtonProtoOpenvpnSaveVisibleChanged();
void progressBarProtoOpenvpnResetVisibleChanged();
void radioButtonProtoOpenvpnUdpEnabledChanged();
void radioButtonProtoOpenvpnTcpEnabledChanged();
void radioButtonProtoOpenvpnTcpCheckedChanged();
void lineEditProtoOpenvpnPortEnabledChanged();
void pushButtonProtoOpenvpnContInstallCheckedChanged();
void pushButtonProtoSsOpenvpnContInstallCheckedChanged();
void pushButtonProtoCloakOpenvpnContInstallCheckedChanged();
@ -545,13 +473,7 @@ signals:
void pageServerProtocolsEnabledChanged();
void progressBarProtocolsContainerReinstallValueChanged();
void progressBarProtocolsContainerReinstallMaximiumChanged();
void comboBoxProtoOpenvpnCipherEnabledChanged();
void comboBoxProtoOpenvpnHashEnabledChanged();
void pageProtoOpenvpnEnabledChanged();
void labelProtoOpenvpnInfoVisibleChanged();
void labelProtoOpenvpnInfoTextChanged();
void progressBarProtoOpenvpnResetValueChanged();
void progressBarProtoOpenvpnResetMaximiumChanged();
void pageProtoShadowsocksEnabledChanged();
void labelProtoShadowsocksInfoVisibleChanged();
void labelProtoShadowsocksInfoTextChanged();
@ -621,14 +543,7 @@ private:
QString m_lineEditProtoCloakPortText;
QString m_comboBoxProtoShadowsocksCipherText;
QString m_lineEditProtoShadowsocksPortText;
QString m_lineEditProtoOpenvpnSubnetText;
bool m_radioButtonProtoOpenvpnUdpChecked;
bool m_checkBoxProtoOpenvpnAutoEncryptionChecked;
QString m_comboBoxProtoOpenvpnCipherText;
QString m_comboBoxProtoOpenvpnHashText;
bool m_checkBoxProtoOpenvpnBlockDnsChecked;
QString m_lineEditProtoOpenvpnPortText;
bool m_checkBoxProtoOpenvpnTlsAuthChecked;
bool m_pushButtonConnectChecked;
@ -641,13 +556,7 @@ private:
bool m_pushButtonProtoShadowsocksSaveVisible;
bool m_progressBarProtoShadowsocksResetVisible;
bool m_lineEditProtoShadowsocksPortEnabled;
bool m_widgetProtoOpenvpnEnabled;
bool m_pushButtonProtoOpenvpnSaveVisible;
bool m_progressBarProtoOpenvpnResetVisible;
bool m_radioButtonProtoOpenvpnUdpEnabled;
bool m_radioButtonProtoOpenvpnTcpEnabled;
bool m_radioButtonProtoOpenvpnTcpChecked;
bool m_lineEditProtoOpenvpnPortEnabled;
bool m_pushButtonProtoOpenvpnContInstallChecked;
bool m_pushButtonProtoSsOpenvpnContInstallChecked;
bool m_pushButtonProtoCloakOpenvpnContInstallChecked;
@ -690,13 +599,7 @@ private:
bool m_pageServerProtocolsEnabled;
int m_progressBarProtocolsContainerReinstallValue;
int m_progressBarProtocolsContainerReinstallMaximium;
bool m_comboBoxProtoOpenvpnCipherEnabled;
bool m_comboBoxProtoOpenvpnHashEnabled;
bool m_pageProtoOpenvpnEnabled;
bool m_labelProtoOpenvpnInfoVisible;
QString m_labelProtoOpenvpnInfoText;
int m_progressBarProtoOpenvpnResetValue;
int m_progressBarProtoOpenvpnResetMaximium;
bool m_pageProtoShadowsocksEnabled;
bool m_labelProtoShadowsocksInfoVisible;
QString m_labelProtoShadowsocksInfoText;
@ -761,32 +664,34 @@ private:
// void setupSitesPageConnections();
void setupProtocolsPageConnections();
void updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container, bool haveAuthData);
void updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData);
void updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData);
QJsonObject getOpenVpnConfigFromPage(QJsonObject oldConfig);
QJsonObject getShadowSocksConfigFromPage(QJsonObject oldConfig);
QJsonObject getCloakConfigFromPage(QJsonObject oldConfig);
QMap<DockerContainer, QJsonObject> getInstallConfigsFromProtocolsPage() const;
public:
AppSettingsLogic *appSettingsLogic() { return m_appSettingsLogic;}
GeneralSettingsLogic *generalSettingsLogic() { return m_generalSettingsLogic;}
NetworkSettingsLogic *networkSettingsLogic() { return m_networkSettingsLogic;}
NewServerLogic *newServerLogic() { return m_newServerLogic;}
ProtocolSettingsLogic *protocolSettingsLogic() { return m_protocolSettingsLogic;}
ServerListLogic *serverListLogic() { return m_serverListLogic;}
ServerSettingsLogic *serverSettingsLogic() { return m_serverSettingsLogic;}
ServerVpnProtocolsLogic *serverVpnProtocolsLogic() { return m_serverVpnProtocolsLogic;}
ShareConnectionLogic *shareConnectionLogic() { return m_shareConnectionLogic;}
SitesLogic *sitesLogic() { return m_sitesLogic;}
StartPageLogic *startPageLogic() { return m_startPageLogic;}
VpnLogic *vpnLogic() { return m_vpnLogic;}
WizardLogic *wizardLogic() { return m_wizardLogic;}
AppSettingsLogic *appSettingsLogic() { return m_appSettingsLogic; }
GeneralSettingsLogic *generalSettingsLogic() { return m_generalSettingsLogic; }
NetworkSettingsLogic *networkSettingsLogic() { return m_networkSettingsLogic; }
NewServerLogic *newServerLogic() { return m_newServerLogic; }
ProtocolSettingsLogic *protocolSettingsLogic() { return m_protocolSettingsLogic; }
ServerListLogic *serverListLogic() { return m_serverListLogic; }
ServerSettingsLogic *serverSettingsLogic() { return m_serverSettingsLogic; }
ServerVpnProtocolsLogic *serverVpnProtocolsLogic() { return m_serverVpnProtocolsLogic; }
ShareConnectionLogic *shareConnectionLogic() { return m_shareConnectionLogic; }
SitesLogic *sitesLogic() { return m_sitesLogic; }
StartPageLogic *startPageLogic() { return m_startPageLogic; }
VpnLogic *vpnLogic() { return m_vpnLogic; }
WizardLogic *wizardLogic() { return m_wizardLogic; }
OpenVpnLogic *openVpnLogic() { return m_openVpnLogic; }
ShadowSocksLogic *shadowSocksLogic() { return m_shadowSocksLogic; }
CloakLogic *cloakLogic() { return m_cloakLogic; }
private:
AppSettingsLogic *m_appSettingsLogic;
@ -803,6 +708,10 @@ private:
VpnLogic *m_vpnLogic;
WizardLogic *m_wizardLogic;
OpenVpnLogic *m_openVpnLogic;
ShadowSocksLogic *m_shadowSocksLogic;
CloakLogic *m_cloakLogic;
VpnConnection* m_vpnConnection;
Settings m_settings;