ShadowSocksLogic
CloakLogic
This commit is contained in:
parent
a6e5cfff8a
commit
deda2e158e
13 changed files with 684 additions and 762 deletions
|
@ -102,6 +102,6 @@
|
|||
<file>images/background_connected@2x.png</file>
|
||||
<file>ui/qml/Pages/Protocols/PageProtoCloak.qml</file>
|
||||
<file>ui/qml/Pages/Protocols/PageProtoOpenVPN.qml</file>
|
||||
<file>ui/qml/Pages/Protocols/PageProtoShadowSock.qml</file>
|
||||
<file>ui/qml/Pages/Protocols/PageProtoShadowSocks.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -1,51 +1,264 @@
|
|||
#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 "core/servercontroller.h"
|
||||
#include <functional>
|
||||
|
||||
#include "../../uilogic.h"
|
||||
|
||||
using namespace amnezia;
|
||||
using namespace PageEnumNS;
|
||||
|
||||
|
||||
CloakLogic::CloakLogic(UiLogic *uiLogic, QObject *parent):
|
||||
QObject(parent),
|
||||
m_uiLogic(uiLogic)
|
||||
m_uiLogic(uiLogic),
|
||||
m_comboBoxProtoCloakCipherText{"chacha20-poly1305"},
|
||||
m_lineEditProtoCloakSiteText{"tile.openstreetmap.org"},
|
||||
m_lineEditProtoCloakPortText{},
|
||||
m_widgetProtoCloakEnabled{false},
|
||||
m_pushButtonProtoCloakSaveVisible{false},
|
||||
m_progressBarProtoCloakResetVisible{false},
|
||||
m_lineEditProtoCloakPortEnabled{false},
|
||||
m_pageProtoCloakEnabled{true},
|
||||
m_labelProtoCloakInfoVisible{true},
|
||||
m_labelProtoCloakInfoText{},
|
||||
m_progressBarProtoCloakResetValue{0},
|
||||
m_progressBarProtoCloakResetMaximium{100}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CloakLogic::updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData)
|
||||
{
|
||||
setWidgetProtoCloakEnabled(haveAuthData);
|
||||
setPushButtonProtoCloakSaveVisible(haveAuthData);
|
||||
setProgressBarProtoCloakResetVisible(haveAuthData);
|
||||
|
||||
setComboBoxProtoCloakCipherText(ckConfig.value(config_key::cipher).
|
||||
toString(protocols::cloak::defaultCipher));
|
||||
|
||||
setLineEditProtoCloakSiteText(ckConfig.value(config_key::site).
|
||||
toString(protocols::cloak::defaultRedirSite));
|
||||
|
||||
setLineEditProtoCloakPortText(ckConfig.value(config_key::port).
|
||||
toString(protocols::cloak::defaultPort));
|
||||
|
||||
setLineEditProtoCloakPortEnabled(container == DockerContainer::OpenVpnOverCloak);
|
||||
}
|
||||
|
||||
|
||||
|
||||
QJsonObject CloakLogic::getCloakConfigFromPage(QJsonObject oldConfig)
|
||||
{
|
||||
oldConfig.insert(config_key::cipher, getComboBoxProtoCloakCipherText());
|
||||
oldConfig.insert(config_key::site, getLineEditProtoCloakSiteText());
|
||||
oldConfig.insert(config_key::port, getLineEditProtoCloakPortText());
|
||||
|
||||
return oldConfig;
|
||||
}
|
||||
|
||||
QString CloakLogic::getComboBoxProtoCloakCipherText() const
|
||||
{
|
||||
return m_comboBoxProtoCloakCipherText;
|
||||
}
|
||||
|
||||
void CloakLogic::setComboBoxProtoCloakCipherText(const QString &comboBoxProtoCloakCipherText)
|
||||
{
|
||||
if (m_comboBoxProtoCloakCipherText != comboBoxProtoCloakCipherText) {
|
||||
m_comboBoxProtoCloakCipherText = comboBoxProtoCloakCipherText;
|
||||
emit comboBoxProtoCloakCipherTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString CloakLogic::getLineEditProtoCloakPortText() const
|
||||
{
|
||||
return m_lineEditProtoCloakPortText;
|
||||
}
|
||||
|
||||
void CloakLogic::setLineEditProtoCloakPortText(const QString &lineEditProtoCloakPortText)
|
||||
{
|
||||
if (m_lineEditProtoCloakPortText != lineEditProtoCloakPortText) {
|
||||
m_lineEditProtoCloakPortText = lineEditProtoCloakPortText;
|
||||
emit lineEditProtoCloakPortTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString CloakLogic::getLineEditProtoCloakSiteText() const
|
||||
{
|
||||
return m_lineEditProtoCloakSiteText;
|
||||
}
|
||||
|
||||
void CloakLogic::setLineEditProtoCloakSiteText(const QString &lineEditProtoCloakSiteText)
|
||||
{
|
||||
if (m_lineEditProtoCloakSiteText != lineEditProtoCloakSiteText) {
|
||||
m_lineEditProtoCloakSiteText = lineEditProtoCloakSiteText;
|
||||
emit lineEditProtoCloakSiteTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool CloakLogic::getWidgetProtoCloakEnabled() const
|
||||
{
|
||||
return m_widgetProtoCloakEnabled;
|
||||
}
|
||||
|
||||
void CloakLogic::setWidgetProtoCloakEnabled(bool widgetProtoCloakEnabled)
|
||||
{
|
||||
if (m_widgetProtoCloakEnabled != widgetProtoCloakEnabled) {
|
||||
m_widgetProtoCloakEnabled = widgetProtoCloakEnabled;
|
||||
emit widgetProtoCloakEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool CloakLogic::getPushButtonProtoCloakSaveVisible() const
|
||||
{
|
||||
return m_pushButtonProtoCloakSaveVisible;
|
||||
}
|
||||
|
||||
void CloakLogic::setPushButtonProtoCloakSaveVisible(bool pushButtonProtoCloakSaveVisible)
|
||||
{
|
||||
if (m_pushButtonProtoCloakSaveVisible != pushButtonProtoCloakSaveVisible) {
|
||||
m_pushButtonProtoCloakSaveVisible = pushButtonProtoCloakSaveVisible;
|
||||
emit pushButtonProtoCloakSaveVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool CloakLogic::getProgressBarProtoCloakResetVisible() const
|
||||
{
|
||||
return m_progressBarProtoCloakResetVisible;
|
||||
}
|
||||
|
||||
void CloakLogic::setProgressBarProtoCloakResetVisible(bool progressBarProtoCloakResetVisible)
|
||||
{
|
||||
if (m_progressBarProtoCloakResetVisible != progressBarProtoCloakResetVisible) {
|
||||
m_progressBarProtoCloakResetVisible = progressBarProtoCloakResetVisible;
|
||||
emit progressBarProtoCloakResetVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool CloakLogic::getLineEditProtoCloakPortEnabled() const
|
||||
{
|
||||
return m_lineEditProtoCloakPortEnabled;
|
||||
}
|
||||
|
||||
void CloakLogic::setLineEditProtoCloakPortEnabled(bool lineEditProtoCloakPortEnabled)
|
||||
{
|
||||
if (m_lineEditProtoCloakPortEnabled != lineEditProtoCloakPortEnabled) {
|
||||
m_lineEditProtoCloakPortEnabled = lineEditProtoCloakPortEnabled;
|
||||
emit lineEditProtoCloakPortEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool CloakLogic::getPageProtoCloakEnabled() const
|
||||
{
|
||||
return m_pageProtoCloakEnabled;
|
||||
}
|
||||
|
||||
void CloakLogic::setPageProtoCloakEnabled(bool pageProtoCloakEnabled)
|
||||
{
|
||||
if (m_pageProtoCloakEnabled != pageProtoCloakEnabled) {
|
||||
m_pageProtoCloakEnabled = pageProtoCloakEnabled;
|
||||
emit pageProtoCloakEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool CloakLogic::getLabelProtoCloakInfoVisible() const
|
||||
{
|
||||
return m_labelProtoCloakInfoVisible;
|
||||
}
|
||||
|
||||
void CloakLogic::setLabelProtoCloakInfoVisible(bool labelProtoCloakInfoVisible)
|
||||
{
|
||||
if (m_labelProtoCloakInfoVisible != labelProtoCloakInfoVisible) {
|
||||
m_labelProtoCloakInfoVisible = labelProtoCloakInfoVisible;
|
||||
emit labelProtoCloakInfoVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString CloakLogic::getLabelProtoCloakInfoText() const
|
||||
{
|
||||
return m_labelProtoCloakInfoText;
|
||||
}
|
||||
|
||||
void CloakLogic::setLabelProtoCloakInfoText(const QString &labelProtoCloakInfoText)
|
||||
{
|
||||
if (m_labelProtoCloakInfoText != labelProtoCloakInfoText) {
|
||||
m_labelProtoCloakInfoText = labelProtoCloakInfoText;
|
||||
emit labelProtoCloakInfoTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int CloakLogic::getProgressBarProtoCloakResetValue() const
|
||||
{
|
||||
return m_progressBarProtoCloakResetValue;
|
||||
}
|
||||
|
||||
void CloakLogic::setProgressBarProtoCloakResetValue(int progressBarProtoCloakResetValue)
|
||||
{
|
||||
if (m_progressBarProtoCloakResetValue != progressBarProtoCloakResetValue) {
|
||||
m_progressBarProtoCloakResetValue = progressBarProtoCloakResetValue;
|
||||
emit progressBarProtoCloakResetValueChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int CloakLogic::getProgressBarProtoCloakResetMaximium() const
|
||||
{
|
||||
return m_progressBarProtoCloakResetMaximium;
|
||||
}
|
||||
|
||||
void CloakLogic::setProgressBarProtoCloakResetMaximium(int progressBarProtoCloakResetMaximium)
|
||||
{
|
||||
if (m_progressBarProtoCloakResetMaximium != progressBarProtoCloakResetMaximium) {
|
||||
m_progressBarProtoCloakResetMaximium = progressBarProtoCloakResetMaximium;
|
||||
emit progressBarProtoCloakResetMaximiumChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CloakLogic::onPushButtonProtoCloakSaveClicked()
|
||||
{
|
||||
QJsonObject protocolConfig = m_settings.protocolConfig(m_uiLogic->selectedServerIndex, m_uiLogic->selectedDockerContainer, Protocol::Cloak);
|
||||
protocolConfig = getCloakConfigFromPage(protocolConfig);
|
||||
|
||||
QJsonObject containerConfig = m_settings.containerConfig(m_uiLogic->selectedServerIndex, m_uiLogic->selectedDockerContainer);
|
||||
QJsonObject newContainerConfig = containerConfig;
|
||||
newContainerConfig.insert(config_key::cloak, protocolConfig);
|
||||
|
||||
UiLogic::PageFunc page_proto_cloak;
|
||||
page_proto_cloak.setEnabledFunc = [this] (bool enabled) -> void {
|
||||
setPageProtoCloakEnabled(enabled);
|
||||
};
|
||||
UiLogic::ButtonFunc pushButton_proto_cloak_save;
|
||||
pushButton_proto_cloak_save.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setPushButtonProtoCloakSaveVisible(visible);
|
||||
};
|
||||
UiLogic::LabelFunc label_proto_cloak_info;
|
||||
label_proto_cloak_info.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setLabelProtoCloakInfoVisible(visible);
|
||||
};
|
||||
label_proto_cloak_info.setTextFunc = [this] (const QString& text) ->void {
|
||||
setLabelProtoCloakInfoText(text);
|
||||
};
|
||||
UiLogic::ProgressFunc progressBar_proto_cloak_reset;
|
||||
progressBar_proto_cloak_reset.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setProgressBarProtoCloakResetVisible(visible);
|
||||
};
|
||||
progressBar_proto_cloak_reset.setValueFunc = [this] (int value) ->void {
|
||||
setProgressBarProtoCloakResetValue(value);
|
||||
};
|
||||
progressBar_proto_cloak_reset.getValueFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoCloakResetValue();
|
||||
};
|
||||
progressBar_proto_cloak_reset.getMaximiumFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoCloakResetMaximium();
|
||||
};
|
||||
|
||||
ErrorCode e = m_uiLogic->doInstallAction([this, containerConfig, newContainerConfig](){
|
||||
return ServerController::updateContainer(m_settings.serverCredentials(m_uiLogic->selectedServerIndex), m_uiLogic->selectedDockerContainer, containerConfig, newContainerConfig);
|
||||
},
|
||||
page_proto_cloak, progressBar_proto_cloak_reset,
|
||||
pushButton_proto_cloak_save, label_proto_cloak_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;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,66 @@ class CloakLogic : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_PROPERTY(QString comboBoxProtoCloakCipherText READ getComboBoxProtoCloakCipherText WRITE setComboBoxProtoCloakCipherText NOTIFY comboBoxProtoCloakCipherTextChanged)
|
||||
Q_PROPERTY(QString lineEditProtoCloakSiteText READ getLineEditProtoCloakSiteText WRITE setLineEditProtoCloakSiteText NOTIFY lineEditProtoCloakSiteTextChanged)
|
||||
Q_PROPERTY(QString lineEditProtoCloakPortText READ getLineEditProtoCloakPortText WRITE setLineEditProtoCloakPortText NOTIFY lineEditProtoCloakPortTextChanged)
|
||||
Q_PROPERTY(bool widgetProtoCloakEnabled READ getWidgetProtoCloakEnabled WRITE setWidgetProtoCloakEnabled NOTIFY widgetProtoCloakEnabledChanged)
|
||||
Q_PROPERTY(bool pushButtonProtoCloakSaveVisible READ getPushButtonProtoCloakSaveVisible WRITE setPushButtonProtoCloakSaveVisible NOTIFY pushButtonProtoCloakSaveVisibleChanged)
|
||||
Q_PROPERTY(bool progressBarProtoCloakResetVisible READ getProgressBarProtoCloakResetVisible WRITE setProgressBarProtoCloakResetVisible NOTIFY progressBarProtoCloakResetVisibleChanged)
|
||||
Q_PROPERTY(bool lineEditProtoCloakPortEnabled READ getLineEditProtoCloakPortEnabled WRITE setLineEditProtoCloakPortEnabled NOTIFY lineEditProtoCloakPortEnabledChanged)
|
||||
Q_PROPERTY(bool pageProtoCloakEnabled READ getPageProtoCloakEnabled WRITE setPageProtoCloakEnabled NOTIFY pageProtoCloakEnabledChanged)
|
||||
Q_PROPERTY(bool labelProtoCloakInfoVisible READ getLabelProtoCloakInfoVisible WRITE setLabelProtoCloakInfoVisible NOTIFY labelProtoCloakInfoVisibleChanged)
|
||||
Q_PROPERTY(QString labelProtoCloakInfoText READ getLabelProtoCloakInfoText WRITE setLabelProtoCloakInfoText NOTIFY labelProtoCloakInfoTextChanged)
|
||||
Q_PROPERTY(int progressBarProtoCloakResetValue READ getProgressBarProtoCloakResetValue WRITE setProgressBarProtoCloakResetValue NOTIFY progressBarProtoCloakResetValueChanged)
|
||||
Q_PROPERTY(int progressBarProtoCloakResetMaximium READ getProgressBarProtoCloakResetMaximium WRITE setProgressBarProtoCloakResetMaximium NOTIFY progressBarProtoCloakResetMaximiumChanged)
|
||||
|
||||
Q_INVOKABLE void onPushButtonProtoCloakSaveClicked();
|
||||
public:
|
||||
explicit CloakLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~CloakLogic() = default;
|
||||
|
||||
signals:
|
||||
void updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData);
|
||||
QJsonObject getCloakConfigFromPage(QJsonObject oldConfig);
|
||||
|
||||
QString getComboBoxProtoCloakCipherText() const;
|
||||
void setComboBoxProtoCloakCipherText(const QString &comboBoxProtoCloakCipherText);
|
||||
QString getLineEditProtoCloakSiteText() const;
|
||||
void setLineEditProtoCloakSiteText(const QString &lineEditProtoCloakSiteText);
|
||||
QString getLineEditProtoCloakPortText() const;
|
||||
void setLineEditProtoCloakPortText(const QString &lineEditProtoCloakPortText);
|
||||
bool getWidgetProtoCloakEnabled() const;
|
||||
void setWidgetProtoCloakEnabled(bool widgetProtoCloakEnabled);
|
||||
bool getPushButtonProtoCloakSaveVisible() const;
|
||||
void setPushButtonProtoCloakSaveVisible(bool pushButtonProtoCloakSaveVisible);
|
||||
bool getProgressBarProtoCloakResetVisible() const;
|
||||
void setProgressBarProtoCloakResetVisible(bool progressBarProtoCloakResetVisible);
|
||||
bool getLineEditProtoCloakPortEnabled() const;
|
||||
void setLineEditProtoCloakPortEnabled(bool lineEditProtoCloakPortEnabled);
|
||||
bool getPageProtoCloakEnabled() const;
|
||||
void setPageProtoCloakEnabled(bool pageProtoCloakEnabled);
|
||||
bool getLabelProtoCloakInfoVisible() const;
|
||||
void setLabelProtoCloakInfoVisible(bool labelProtoCloakInfoVisible);
|
||||
QString getLabelProtoCloakInfoText() const;
|
||||
void setLabelProtoCloakInfoText(const QString &labelProtoCloakInfoText);
|
||||
int getProgressBarProtoCloakResetValue() const;
|
||||
void setProgressBarProtoCloakResetValue(int progressBarProtoCloakResetValue);
|
||||
int getProgressBarProtoCloakResetMaximium() const;
|
||||
void setProgressBarProtoCloakResetMaximium(int progressBarProtoCloakResetMaximium);
|
||||
|
||||
signals:
|
||||
void comboBoxProtoCloakCipherTextChanged();
|
||||
void lineEditProtoCloakSiteTextChanged();
|
||||
void lineEditProtoCloakPortTextChanged();
|
||||
void widgetProtoCloakEnabledChanged();
|
||||
void pushButtonProtoCloakSaveVisibleChanged();
|
||||
void progressBarProtoCloakResetVisibleChanged();
|
||||
void lineEditProtoCloakPortEnabledChanged();
|
||||
void pageProtoCloakEnabledChanged();
|
||||
void labelProtoCloakInfoVisibleChanged();
|
||||
void labelProtoCloakInfoTextChanged();
|
||||
void progressBarProtoCloakResetValueChanged();
|
||||
void progressBarProtoCloakResetMaximiumChanged();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -28,7 +82,18 @@ private:
|
|||
Settings m_settings;
|
||||
UiLogic *m_uiLogic;
|
||||
|
||||
|
||||
QString m_comboBoxProtoCloakCipherText;
|
||||
QString m_lineEditProtoCloakSiteText;
|
||||
QString m_lineEditProtoCloakPortText;
|
||||
bool m_widgetProtoCloakEnabled;
|
||||
bool m_pushButtonProtoCloakSaveVisible;
|
||||
bool m_progressBarProtoCloakResetVisible;
|
||||
bool m_lineEditProtoCloakPortEnabled;
|
||||
bool m_pageProtoCloakEnabled;
|
||||
bool m_labelProtoCloakInfoVisible;
|
||||
QString m_labelProtoCloakInfoText;
|
||||
int m_progressBarProtoCloakResetValue;
|
||||
int m_progressBarProtoCloakResetMaximium;
|
||||
|
||||
};
|
||||
#endif // CLOAK_LOGIC_H
|
||||
|
|
|
@ -1,41 +1,5 @@
|
|||
//#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 "core/servercontroller.h"
|
||||
#include <functional>
|
||||
#include "../../uilogic.h"
|
||||
|
||||
|
|
|
@ -36,6 +36,9 @@ public:
|
|||
Q_PROPERTY(int progressBarProtoOpenvpnResetValue READ getProgressBarProtoOpenvpnResetValue WRITE setProgressBarProtoOpenvpnResetValue NOTIFY progressBarProtoOpenvpnResetValueChanged)
|
||||
Q_PROPERTY(int progressBarProtoOpenvpnResetMaximium READ getProgressBarProtoOpenvpnResetMaximium WRITE setProgressBarProtoOpenvpnResetMaximium NOTIFY progressBarProtoOpenvpnResetMaximiumChanged)
|
||||
|
||||
Q_INVOKABLE void onCheckBoxProtoOpenvpnAutoEncryptionClicked();
|
||||
Q_INVOKABLE void onPushButtonProtoOpenvpnSaveClicked();
|
||||
|
||||
public:
|
||||
explicit OpenVpnLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~OpenVpnLogic() = default;
|
||||
|
@ -91,9 +94,6 @@ public:
|
|||
int getProgressBarProtoOpenvpnResetMaximium() const;
|
||||
void setProgressBarProtoOpenvpnResetMaximium(int progressBarProtoOpenvpnResetMaximium);
|
||||
|
||||
Q_INVOKABLE void onCheckBoxProtoOpenvpnAutoEncryptionClicked();
|
||||
Q_INVOKABLE void onPushButtonProtoOpenvpnSaveClicked();
|
||||
|
||||
signals:
|
||||
void lineEditProtoOpenvpnSubnetTextChanged();
|
||||
void radioButtonProtoOpenvpnUdpCheckedChanged();
|
||||
|
|
|
@ -1,50 +1,241 @@
|
|||
#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 "core/servercontroller.h"
|
||||
#include <functional>
|
||||
#include "../../uilogic.h"
|
||||
|
||||
using namespace amnezia;
|
||||
using namespace PageEnumNS;
|
||||
|
||||
|
||||
ShadowSocksLogic::ShadowSocksLogic(UiLogic *uiLogic, QObject *parent):
|
||||
QObject(parent),
|
||||
m_uiLogic(uiLogic)
|
||||
m_uiLogic(uiLogic),
|
||||
m_widgetProtoSsEnabled{false},
|
||||
m_comboBoxProtoShadowsocksCipherText{"chacha20-poly1305"},
|
||||
m_lineEditProtoShadowsocksPortText{},
|
||||
m_pushButtonProtoShadowsocksSaveVisible{false},
|
||||
m_progressBarProtoShadowsocksResetVisible{false},
|
||||
m_lineEditProtoShadowsocksPortEnabled{false},
|
||||
m_pageProtoShadowsocksEnabled{true},
|
||||
m_labelProtoShadowsocksInfoVisible{true},
|
||||
m_labelProtoShadowsocksInfoText{},
|
||||
m_progressBarProtoShadowsocksResetValue{0},
|
||||
m_progressBarProtoShadowsocksResetMaximium{100}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData)
|
||||
{
|
||||
setWidgetProtoSsEnabled(haveAuthData);
|
||||
setPushButtonProtoShadowsocksSaveVisible(haveAuthData);
|
||||
setProgressBarProtoShadowsocksResetVisible(haveAuthData);
|
||||
|
||||
setComboBoxProtoShadowsocksCipherText(ssConfig.value(config_key::cipher).
|
||||
toString(protocols::shadowsocks::defaultCipher));
|
||||
|
||||
setLineEditProtoShadowsocksPortText(ssConfig.value(config_key::port).
|
||||
toString(protocols::shadowsocks::defaultPort));
|
||||
|
||||
setLineEditProtoShadowsocksPortEnabled(container == DockerContainer::OpenVpnOverShadowSocks);
|
||||
}
|
||||
|
||||
QJsonObject ShadowSocksLogic::getShadowSocksConfigFromPage(QJsonObject oldConfig)
|
||||
{
|
||||
oldConfig.insert(config_key::cipher, getComboBoxProtoShadowsocksCipherText());
|
||||
oldConfig.insert(config_key::port, getLineEditProtoShadowsocksPortText());
|
||||
|
||||
return oldConfig;
|
||||
}
|
||||
|
||||
QString ShadowSocksLogic::getComboBoxProtoShadowsocksCipherText() const
|
||||
{
|
||||
return m_comboBoxProtoShadowsocksCipherText;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::setComboBoxProtoShadowsocksCipherText(const QString &comboBoxProtoShadowsocksCipherText)
|
||||
{
|
||||
if (m_comboBoxProtoShadowsocksCipherText != comboBoxProtoShadowsocksCipherText) {
|
||||
m_comboBoxProtoShadowsocksCipherText = comboBoxProtoShadowsocksCipherText;
|
||||
emit comboBoxProtoShadowsocksCipherTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString ShadowSocksLogic::getLineEditProtoShadowsocksPortText() const
|
||||
{
|
||||
return m_lineEditProtoShadowsocksPortText;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::setLineEditProtoShadowsocksPortText(const QString &lineEditProtoShadowsocksPortText)
|
||||
{
|
||||
if (m_lineEditProtoShadowsocksPortText != lineEditProtoShadowsocksPortText) {
|
||||
m_lineEditProtoShadowsocksPortText = lineEditProtoShadowsocksPortText;
|
||||
emit lineEditProtoShadowsocksPortTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool ShadowSocksLogic::getPushButtonProtoShadowsocksSaveVisible() const
|
||||
{
|
||||
return m_pushButtonProtoShadowsocksSaveVisible;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::setPushButtonProtoShadowsocksSaveVisible(bool pushButtonProtoShadowsocksSaveVisible)
|
||||
{
|
||||
if (m_pushButtonProtoShadowsocksSaveVisible != pushButtonProtoShadowsocksSaveVisible) {
|
||||
m_pushButtonProtoShadowsocksSaveVisible = pushButtonProtoShadowsocksSaveVisible;
|
||||
emit pushButtonProtoShadowsocksSaveVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool ShadowSocksLogic::getProgressBarProtoShadowsocksResetVisible() const
|
||||
{
|
||||
return m_progressBarProtoShadowsocksResetVisible;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::setProgressBarProtoShadowsocksResetVisible(bool progressBarProtoShadowsocksResetVisible)
|
||||
{
|
||||
if (m_progressBarProtoShadowsocksResetVisible != progressBarProtoShadowsocksResetVisible) {
|
||||
m_progressBarProtoShadowsocksResetVisible = progressBarProtoShadowsocksResetVisible;
|
||||
emit progressBarProtoShadowsocksResetVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool ShadowSocksLogic::getLineEditProtoShadowsocksPortEnabled() const
|
||||
{
|
||||
return m_lineEditProtoShadowsocksPortEnabled;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::setLineEditProtoShadowsocksPortEnabled(bool lineEditProtoShadowsocksPortEnabled)
|
||||
{
|
||||
if (m_lineEditProtoShadowsocksPortEnabled != lineEditProtoShadowsocksPortEnabled) {
|
||||
m_lineEditProtoShadowsocksPortEnabled = lineEditProtoShadowsocksPortEnabled;
|
||||
emit lineEditProtoShadowsocksPortEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool ShadowSocksLogic::getPageProtoShadowsocksEnabled() const
|
||||
{
|
||||
return m_pageProtoShadowsocksEnabled;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::setPageProtoShadowsocksEnabled(bool pageProtoShadowsocksEnabled)
|
||||
{
|
||||
if (m_pageProtoShadowsocksEnabled != pageProtoShadowsocksEnabled) {
|
||||
m_pageProtoShadowsocksEnabled = pageProtoShadowsocksEnabled;
|
||||
emit pageProtoShadowsocksEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool ShadowSocksLogic::getLabelProtoShadowsocksInfoVisible() const
|
||||
{
|
||||
return m_labelProtoShadowsocksInfoVisible;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::setLabelProtoShadowsocksInfoVisible(bool labelProtoShadowsocksInfoVisible)
|
||||
{
|
||||
if (m_labelProtoShadowsocksInfoVisible != labelProtoShadowsocksInfoVisible) {
|
||||
m_labelProtoShadowsocksInfoVisible = labelProtoShadowsocksInfoVisible;
|
||||
emit labelProtoShadowsocksInfoVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString ShadowSocksLogic::getLabelProtoShadowsocksInfoText() const
|
||||
{
|
||||
return m_labelProtoShadowsocksInfoText;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::setLabelProtoShadowsocksInfoText(const QString &labelProtoShadowsocksInfoText)
|
||||
{
|
||||
if (m_labelProtoShadowsocksInfoText != labelProtoShadowsocksInfoText) {
|
||||
m_labelProtoShadowsocksInfoText = labelProtoShadowsocksInfoText;
|
||||
emit labelProtoShadowsocksInfoTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int ShadowSocksLogic::getProgressBarProtoShadowsocksResetValue() const
|
||||
{
|
||||
return m_progressBarProtoShadowsocksResetValue;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::setProgressBarProtoShadowsocksResetValue(int progressBarProtoShadowsocksResetValue)
|
||||
{
|
||||
if (m_progressBarProtoShadowsocksResetValue != progressBarProtoShadowsocksResetValue) {
|
||||
m_progressBarProtoShadowsocksResetValue = progressBarProtoShadowsocksResetValue;
|
||||
emit progressBarProtoShadowsocksResetValueChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int ShadowSocksLogic::getProgressBarProtoShadowsocksResetMaximium() const
|
||||
{
|
||||
return m_progressBarProtoShadowsocksResetMaximium;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::setProgressBarProtoShadowsocksResetMaximium(int progressBarProtoShadowsocksResetMaximium)
|
||||
{
|
||||
if (m_progressBarProtoShadowsocksResetMaximium != progressBarProtoShadowsocksResetMaximium) {
|
||||
m_progressBarProtoShadowsocksResetMaximium = progressBarProtoShadowsocksResetMaximium;
|
||||
emit progressBarProtoShadowsocksResetMaximiumChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool ShadowSocksLogic::getWidgetProtoSsEnabled() const
|
||||
{
|
||||
return m_widgetProtoSsEnabled;
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::setWidgetProtoSsEnabled(bool widgetProtoSsEnabled)
|
||||
{
|
||||
if (m_widgetProtoSsEnabled != widgetProtoSsEnabled) {
|
||||
m_widgetProtoSsEnabled = widgetProtoSsEnabled;
|
||||
emit widgetProtoSsEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void ShadowSocksLogic::onPushButtonProtoShadowsocksSaveClicked()
|
||||
{
|
||||
QJsonObject protocolConfig = m_settings.protocolConfig(m_uiLogic->selectedServerIndex, m_uiLogic->selectedDockerContainer, Protocol::ShadowSocks);
|
||||
protocolConfig = getShadowSocksConfigFromPage(protocolConfig);
|
||||
|
||||
QJsonObject containerConfig = m_settings.containerConfig(m_uiLogic->selectedServerIndex, m_uiLogic->selectedDockerContainer);
|
||||
QJsonObject newContainerConfig = containerConfig;
|
||||
newContainerConfig.insert(config_key::shadowsocks, protocolConfig);
|
||||
UiLogic::PageFunc page_proto_shadowsocks;
|
||||
page_proto_shadowsocks.setEnabledFunc = [this] (bool enabled) -> void {
|
||||
setPageProtoShadowsocksEnabled(enabled);
|
||||
};
|
||||
UiLogic::ButtonFunc pushButton_proto_shadowsocks_save;
|
||||
pushButton_proto_shadowsocks_save.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setPushButtonProtoShadowsocksSaveVisible(visible);
|
||||
};
|
||||
UiLogic::LabelFunc label_proto_shadowsocks_info;
|
||||
label_proto_shadowsocks_info.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setLabelProtoShadowsocksInfoVisible(visible);
|
||||
};
|
||||
label_proto_shadowsocks_info.setTextFunc = [this] (const QString& text) ->void {
|
||||
setLabelProtoShadowsocksInfoText(text);
|
||||
};
|
||||
UiLogic::ProgressFunc progressBar_proto_shadowsocks_reset;
|
||||
progressBar_proto_shadowsocks_reset.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setProgressBarProtoShadowsocksResetVisible(visible);
|
||||
};
|
||||
progressBar_proto_shadowsocks_reset.setValueFunc = [this] (int value) ->void {
|
||||
setProgressBarProtoShadowsocksResetValue(value);
|
||||
};
|
||||
progressBar_proto_shadowsocks_reset.getValueFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoShadowsocksResetValue();
|
||||
};
|
||||
progressBar_proto_shadowsocks_reset.getMaximiumFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoShadowsocksResetMaximium();
|
||||
};
|
||||
|
||||
ErrorCode e = m_uiLogic->doInstallAction([this, containerConfig, newContainerConfig](){
|
||||
return ServerController::updateContainer(m_settings.serverCredentials(m_uiLogic->selectedServerIndex), m_uiLogic->selectedDockerContainer, containerConfig, newContainerConfig);
|
||||
},
|
||||
page_proto_shadowsocks, progressBar_proto_shadowsocks_reset,
|
||||
pushButton_proto_shadowsocks_save, label_proto_shadowsocks_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;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,65 @@ class ShadowSocksLogic : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_PROPERTY(bool widgetProtoSsEnabled READ getWidgetProtoSsEnabled WRITE setWidgetProtoSsEnabled NOTIFY widgetProtoSsEnabledChanged)
|
||||
Q_PROPERTY(QString comboBoxProtoShadowsocksCipherText READ getComboBoxProtoShadowsocksCipherText WRITE setComboBoxProtoShadowsocksCipherText NOTIFY comboBoxProtoShadowsocksCipherTextChanged)
|
||||
Q_PROPERTY(QString lineEditProtoShadowsocksPortText READ getLineEditProtoShadowsocksPortText WRITE setLineEditProtoShadowsocksPortText NOTIFY lineEditProtoShadowsocksPortTextChanged)
|
||||
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 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)
|
||||
Q_PROPERTY(int progressBarProtoShadowsocksResetValue READ getProgressBarProtoShadowsocksResetValue WRITE setProgressBarProtoShadowsocksResetValue NOTIFY progressBarProtoShadowsocksResetValueChanged)
|
||||
Q_PROPERTY(int progressBarProtoShadowsocksResetMaximium READ getProgressBarProtoShadowsocksResetMaximium WRITE setProgressBarProtoShadowsocksResetMaximium NOTIFY progressBarProtoShadowsocksResetMaximiumChanged)
|
||||
|
||||
Q_INVOKABLE void onPushButtonProtoShadowsocksSaveClicked();
|
||||
|
||||
public:
|
||||
explicit ShadowSocksLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~ShadowSocksLogic() = default;
|
||||
|
||||
signals:
|
||||
void updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData);
|
||||
QJsonObject getShadowSocksConfigFromPage(QJsonObject oldConfig);
|
||||
|
||||
bool getWidgetProtoSsEnabled() const;
|
||||
void setWidgetProtoSsEnabled(bool widgetProtoSsEnabled);
|
||||
QString getComboBoxProtoShadowsocksCipherText() const;
|
||||
void setComboBoxProtoShadowsocksCipherText(const QString &comboBoxProtoShadowsocksCipherText);
|
||||
QString getLineEditProtoShadowsocksPortText() const;
|
||||
void setLineEditProtoShadowsocksPortText(const QString &lineEditProtoShadowsocksPortText);
|
||||
|
||||
bool getPushButtonProtoShadowsocksSaveVisible() const;
|
||||
void setPushButtonProtoShadowsocksSaveVisible(bool pushButtonProtoShadowsocksSaveVisible);
|
||||
bool getProgressBarProtoShadowsocksResetVisible() const;
|
||||
void setProgressBarProtoShadowsocksResetVisible(bool progressBarProtoShadowsocksResetVisible);
|
||||
bool getLineEditProtoShadowsocksPortEnabled() const;
|
||||
void setLineEditProtoShadowsocksPortEnabled(bool lineEditProtoShadowsocksPortEnabled);
|
||||
|
||||
bool getPageProtoShadowsocksEnabled() const;
|
||||
void setPageProtoShadowsocksEnabled(bool pageProtoShadowsocksEnabled);
|
||||
bool getLabelProtoShadowsocksInfoVisible() const;
|
||||
void setLabelProtoShadowsocksInfoVisible(bool labelProtoShadowsocksInfoVisible);
|
||||
QString getLabelProtoShadowsocksInfoText() const;
|
||||
void setLabelProtoShadowsocksInfoText(const QString &labelProtoShadowsocksInfoText);
|
||||
int getProgressBarProtoShadowsocksResetValue() const;
|
||||
void setProgressBarProtoShadowsocksResetValue(int progressBarProtoShadowsocksResetValue);
|
||||
int getProgressBarProtoShadowsocksResetMaximium() const;
|
||||
void setProgressBarProtoShadowsocksResetMaximium(int progressBarProtoShadowsocksResetMaximium);
|
||||
|
||||
signals:
|
||||
void widgetProtoSsEnabledChanged();
|
||||
void comboBoxProtoShadowsocksCipherTextChanged();
|
||||
void lineEditProtoShadowsocksPortTextChanged();
|
||||
void pushButtonProtoShadowsocksSaveVisibleChanged();
|
||||
void progressBarProtoShadowsocksResetVisibleChanged();
|
||||
void lineEditProtoShadowsocksPortEnabledChanged();
|
||||
void pageProtoShadowsocksEnabledChanged();
|
||||
void labelProtoShadowsocksInfoVisibleChanged();
|
||||
void labelProtoShadowsocksInfoTextChanged();
|
||||
void progressBarProtoShadowsocksResetValueChanged();
|
||||
void progressBarProtoShadowsocksResetMaximiumChanged();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -28,7 +81,17 @@ private:
|
|||
Settings m_settings;
|
||||
UiLogic *m_uiLogic;
|
||||
|
||||
|
||||
bool m_widgetProtoSsEnabled;
|
||||
QString m_comboBoxProtoShadowsocksCipherText;
|
||||
QString m_lineEditProtoShadowsocksPortText;
|
||||
bool m_pushButtonProtoShadowsocksSaveVisible;
|
||||
bool m_progressBarProtoShadowsocksResetVisible;
|
||||
bool m_lineEditProtoShadowsocksPortEnabled;
|
||||
bool m_pageProtoShadowsocksEnabled;
|
||||
bool m_labelProtoShadowsocksInfoVisible;
|
||||
QString m_labelProtoShadowsocksInfoText;
|
||||
int m_progressBarProtoShadowsocksResetValue;
|
||||
int m_progressBarProtoShadowsocksResetMaximium;
|
||||
|
||||
};
|
||||
#endif // SHADOWSOCKS_LOGIC_H
|
||||
|
|
|
@ -173,7 +173,7 @@ Item {
|
|||
text: qsTr("ShadowSocks settings")
|
||||
icon.source: "qrc:/images/settings.png"
|
||||
onClicked: {
|
||||
UiLogic.pushButtonProtoCloakOpenvpnContSsConfigClicked()
|
||||
UiLogic.onPushButtonProtoCloakOpenvpnContSsConfigClicked()
|
||||
}
|
||||
}
|
||||
SettingButtonType {
|
||||
|
|
|
@ -6,7 +6,7 @@ import "../../Config"
|
|||
|
||||
Item {
|
||||
id: root
|
||||
enabled: UiLogic.pageProtoCloakEnabled
|
||||
enabled: CloakLogic.pageProtoCloakEnabled
|
||||
ImageButtonType {
|
||||
id: back
|
||||
x: 10
|
||||
|
@ -23,7 +23,7 @@ Item {
|
|||
y: 40
|
||||
width: 380
|
||||
height: 600
|
||||
enabled: UiLogic.widgetProtoCloakEnabled
|
||||
enabled: CloakLogic.widgetProtoCloakEnabled
|
||||
ComboBoxType {
|
||||
x: 190
|
||||
y: 60
|
||||
|
@ -37,14 +37,14 @@ Item {
|
|||
]
|
||||
currentIndex: {
|
||||
for (let i = 0; i < model.length; ++i) {
|
||||
if (UiLogic.comboBoxProtoCloakCipherText === model[i]) {
|
||||
if (CloakLogic.comboBoxProtoCloakCipherText === model[i]) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
onCurrentTextChanged: {
|
||||
UiLogic.comboBoxProtoCloakCipherText = currentText
|
||||
CloakLogic.comboBoxProtoCloakCipherText = currentText
|
||||
}
|
||||
}
|
||||
LabelType {
|
||||
|
@ -88,8 +88,8 @@ Item {
|
|||
y: 550
|
||||
width: 321
|
||||
height: 41
|
||||
visible: UiLogic.labelProtoCloakInfoVisible
|
||||
text: UiLogic.labelProtoCloakInfoText
|
||||
visible: CloakLogic.labelProtoCloakInfoVisible
|
||||
text: CloakLogic.labelProtoCloakInfoText
|
||||
}
|
||||
TextFieldType {
|
||||
id: lineEdit_proto_cloak_port
|
||||
|
@ -97,11 +97,11 @@ Item {
|
|||
y: 160
|
||||
width: 151
|
||||
height: 31
|
||||
text: UiLogic.lineEditProtoCloakPortText
|
||||
text: CloakLogic.lineEditProtoCloakPortText
|
||||
onEditingFinished: {
|
||||
UiLogic.lineEditProtoCloakPortText = text
|
||||
CloakLogic.lineEditProtoCloakPortText = text
|
||||
}
|
||||
enabled: UiLogic.lineEditProtoCloakPortEnabled
|
||||
enabled: CloakLogic.lineEditProtoCloakPortEnabled
|
||||
}
|
||||
TextFieldType {
|
||||
id: lineEdit_proto_cloak_site
|
||||
|
@ -109,9 +109,9 @@ Item {
|
|||
y: 110
|
||||
width: 151
|
||||
height: 31
|
||||
text: UiLogic.lineEditProtoCloakSiteText
|
||||
text: CloakLogic.lineEditProtoCloakSiteText
|
||||
onEditingFinished: {
|
||||
UiLogic.lineEditProtoCloakSiteText = text
|
||||
CloakLogic.lineEditProtoCloakSiteText = text
|
||||
}
|
||||
}
|
||||
ProgressBar {
|
||||
|
@ -121,8 +121,8 @@ Item {
|
|||
width: 321
|
||||
height: 40
|
||||
from: 0
|
||||
to: UiLogic.progressBarProtoCloakResetMaximium
|
||||
value: UiLogic.progressBarProtoCloakResetValue
|
||||
to: CloakLogic.progressBarProtoCloakResetMaximium
|
||||
value: CloakLogic.progressBarProtoCloakResetValue
|
||||
background: Rectangle {
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: parent.height
|
||||
|
@ -140,7 +140,7 @@ Item {
|
|||
color: Qt.rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
}
|
||||
visible: UiLogic.progressBarProtoCloakResetVisible
|
||||
visible: CloakLogic.progressBarProtoCloakResetVisible
|
||||
}
|
||||
BlueButtonType {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
@ -148,9 +148,9 @@ Item {
|
|||
width: 321
|
||||
height: 40
|
||||
text: qsTr("Save and restart VPN")
|
||||
visible: UiLogic.pushButtonProtoCloakSaveVisible
|
||||
visible: CloakLogic.pushButtonProtoCloakSaveVisible
|
||||
onClicked: {
|
||||
UiLogic.onPushButtonProtoCloakSaveClicked()
|
||||
CloakLogic.onPushButtonProtoCloakSaveClicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import "../../Config"
|
|||
|
||||
Item {
|
||||
id: root
|
||||
enabled: UiLogic.pageProtoShadowsocksEnabled
|
||||
enabled: ShadowSocksLogic.pageProtoShadowsocksEnabled
|
||||
ImageButtonType {
|
||||
id: back
|
||||
x: 10
|
||||
|
@ -23,7 +23,7 @@ Item {
|
|||
y: 40
|
||||
width: 380
|
||||
height: 600
|
||||
enabled: UiLogic.widgetProtoSsEnabled
|
||||
enabled: ShadowSocksLogic.widgetProtoSsEnabled
|
||||
ComboBoxType {
|
||||
x: 190
|
||||
y: 60
|
||||
|
@ -36,14 +36,14 @@ Item {
|
|||
]
|
||||
currentIndex: {
|
||||
for (let i = 0; i < model.length; ++i) {
|
||||
if (UiLogic.comboBoxProtoShadowsocksCipherText === model[i]) {
|
||||
if (ShadowSocksLogic.comboBoxProtoShadowsocksCipherText === model[i]) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
onCurrentTextChanged: {
|
||||
UiLogic.comboBoxProtoShadowsocksCipherText = currentText
|
||||
ShadowSocksLogic.comboBoxProtoShadowsocksCipherText = currentText
|
||||
}
|
||||
}
|
||||
LabelType {
|
||||
|
@ -79,8 +79,8 @@ Item {
|
|||
y: 550
|
||||
width: 321
|
||||
height: 41
|
||||
visible: UiLogic.labelProtoShadowsocksInfoVisible
|
||||
text: UiLogic.labelProtoShadowsocksInfoText
|
||||
visible: ShadowSocksLogic.labelProtoShadowsocksInfoVisible
|
||||
text: ShadowSocksLogic.labelProtoShadowsocksInfoText
|
||||
}
|
||||
TextFieldType {
|
||||
id: lineEdit_proto_shadowsocks_port
|
||||
|
@ -88,11 +88,11 @@ Item {
|
|||
y: 110
|
||||
width: 151
|
||||
height: 31
|
||||
text: UiLogic.lineEditProtoShadowsocksPortText
|
||||
text: ShadowSocksLogic.lineEditProtoShadowsocksPortText
|
||||
onEditingFinished: {
|
||||
UiLogic.lineEditProtoShadowsocksPortText = text
|
||||
ShadowSocksLogic.lineEditProtoShadowsocksPortText = text
|
||||
}
|
||||
enabled: UiLogic.lineEditProtoShadowsocksPortEnabled
|
||||
enabled: ShadowSocksLogic.lineEditProtoShadowsocksPortEnabled
|
||||
}
|
||||
ProgressBar {
|
||||
id: progressBar_proto_shadowsocks_reset
|
||||
|
@ -101,9 +101,9 @@ Item {
|
|||
width: 321
|
||||
height: 40
|
||||
from: 0
|
||||
to: UiLogic.progressBarProtoShadowsocksResetMaximium
|
||||
value: UiLogic.progressBarProtoShadowsocksResetValue
|
||||
visible: UiLogic.progressBarProtoShadowsocksResetVisible
|
||||
to: ShadowSocksLogic.progressBarProtoShadowsocksResetMaximium
|
||||
value: ShadowSocksLogic.progressBarProtoShadowsocksResetValue
|
||||
visible: ShadowSocksLogic.progressBarProtoShadowsocksResetVisible
|
||||
background: Rectangle {
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: parent.height
|
||||
|
@ -128,9 +128,9 @@ Item {
|
|||
width: 321
|
||||
height: 40
|
||||
text: qsTr("Save and restart VPN")
|
||||
visible: UiLogic.pushButtonProtoShadowsocksSaveVisible
|
||||
visible: ShadowSocksLogic.pushButtonProtoShadowsocksSaveVisible
|
||||
onClicked: {
|
||||
UiLogic.onPushButtonProtoShadowsocksSaveClicked()
|
||||
ShadowSocksLogic.onPushButtonProtoShadowsocksSaveClicked()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -130,7 +130,7 @@ Window {
|
|||
if (item instanceof PageProtoOpenVPN) {
|
||||
return PageEnum.OpenVpnSettings
|
||||
}
|
||||
if (item instanceof PageProtoShadowSock) {
|
||||
if (item instanceof PageProtoShadowSocks) {
|
||||
return PageEnum.ShadowSocksSettings
|
||||
}
|
||||
if (item instanceof PageProtoCloak) {
|
||||
|
@ -332,7 +332,7 @@ Window {
|
|||
}
|
||||
Component {
|
||||
id: page_proto_shadowsocks
|
||||
PageProtoShadowSock {}
|
||||
PageProtoShadowSocks {}
|
||||
}
|
||||
Component {
|
||||
id: page_proto_cloak
|
||||
|
|
|
@ -96,23 +96,12 @@ UiLogic::UiLogic(QObject *parent) :
|
|||
m_checkBoxNewServerCloakChecked{true},
|
||||
m_checkBoxNewServerSsChecked{false},
|
||||
m_checkBoxNewServerOpenvpnChecked{false},
|
||||
m_comboBoxProtoCloakCipherText{"chacha20-poly1305"},
|
||||
m_lineEditProtoCloakSiteText{"tile.openstreetmap.org"},
|
||||
m_lineEditProtoCloakPortText{},
|
||||
m_comboBoxProtoShadowsocksCipherText{"chacha20-poly1305"},
|
||||
m_lineEditProtoShadowsocksPortText{},
|
||||
|
||||
|
||||
|
||||
|
||||
m_pushButtonConnectChecked{false},
|
||||
|
||||
m_widgetProtoCloakEnabled{false},
|
||||
m_pushButtonProtoCloakSaveVisible{false},
|
||||
m_progressBarProtoCloakResetVisible{false},
|
||||
m_lineEditProtoCloakPortEnabled{false},
|
||||
m_widgetProtoSsEnabled{false},
|
||||
m_pushButtonProtoShadowsocksSaveVisible{false},
|
||||
m_progressBarProtoShadowsocksResetVisible{false},
|
||||
m_lineEditProtoShadowsocksPortEnabled{false},
|
||||
|
||||
m_pushButtonProtoOpenvpnContInstallChecked{false},
|
||||
m_pushButtonProtoSsOpenvpnContInstallChecked{false},
|
||||
|
@ -156,16 +145,7 @@ UiLogic::UiLogic(QObject *parent) :
|
|||
m_progressBarProtocolsContainerReinstallValue{0},
|
||||
m_progressBarProtocolsContainerReinstallMaximium{100},
|
||||
|
||||
m_pageProtoShadowsocksEnabled{true},
|
||||
m_labelProtoShadowsocksInfoVisible{true},
|
||||
m_labelProtoShadowsocksInfoText{},
|
||||
m_progressBarProtoShadowsocksResetValue{0},
|
||||
m_progressBarProtoShadowsocksResetMaximium{100},
|
||||
m_pageProtoCloakEnabled{true},
|
||||
m_labelProtoCloakInfoVisible{true},
|
||||
m_labelProtoCloakInfoText{},
|
||||
m_progressBarProtoCloakResetValue{0},
|
||||
m_progressBarProtoCloakResetMaximium{100},
|
||||
|
||||
m_vpnConnection(nullptr)
|
||||
{
|
||||
m_vpnConnection = new VpnConnection(this);
|
||||
|
@ -503,44 +483,7 @@ void UiLogic::setRadioButtonVpnModeExceptSitesChecked(bool radioButtonVpnModeExc
|
|||
|
||||
|
||||
|
||||
QString UiLogic::getComboBoxProtoCloakCipherText() const
|
||||
{
|
||||
return m_comboBoxProtoCloakCipherText;
|
||||
}
|
||||
|
||||
void UiLogic::setComboBoxProtoCloakCipherText(const QString &comboBoxProtoCloakCipherText)
|
||||
{
|
||||
if (m_comboBoxProtoCloakCipherText != comboBoxProtoCloakCipherText) {
|
||||
m_comboBoxProtoCloakCipherText = comboBoxProtoCloakCipherText;
|
||||
emit comboBoxProtoCloakCipherTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getLineEditProtoCloakPortText() const
|
||||
{
|
||||
return m_lineEditProtoCloakPortText;
|
||||
}
|
||||
|
||||
void UiLogic::setLineEditProtoCloakPortText(const QString &lineEditProtoCloakPortText)
|
||||
{
|
||||
if (m_lineEditProtoCloakPortText != lineEditProtoCloakPortText) {
|
||||
m_lineEditProtoCloakPortText = lineEditProtoCloakPortText;
|
||||
emit lineEditProtoCloakPortTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getLineEditProtoCloakSiteText() const
|
||||
{
|
||||
return m_lineEditProtoCloakSiteText;
|
||||
}
|
||||
|
||||
void UiLogic::setLineEditProtoCloakSiteText(const QString &lineEditProtoCloakSiteText)
|
||||
{
|
||||
if (m_lineEditProtoCloakSiteText != lineEditProtoCloakSiteText) {
|
||||
m_lineEditProtoCloakSiteText = lineEditProtoCloakSiteText;
|
||||
emit lineEditProtoCloakSiteTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int UiLogic::getCurrentPageValue() const
|
||||
{
|
||||
|
@ -633,31 +576,7 @@ void UiLogic::setCheckBoxNewServerOpenvpnChecked(bool checkBoxNewServerOpenvpnCh
|
|||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getComboBoxProtoShadowsocksCipherText() const
|
||||
{
|
||||
return m_comboBoxProtoShadowsocksCipherText;
|
||||
}
|
||||
|
||||
void UiLogic::setComboBoxProtoShadowsocksCipherText(const QString &comboBoxProtoShadowsocksCipherText)
|
||||
{
|
||||
if (m_comboBoxProtoShadowsocksCipherText != comboBoxProtoShadowsocksCipherText) {
|
||||
m_comboBoxProtoShadowsocksCipherText = comboBoxProtoShadowsocksCipherText;
|
||||
emit comboBoxProtoShadowsocksCipherTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getLineEditProtoShadowsocksPortText() const
|
||||
{
|
||||
return m_lineEditProtoShadowsocksPortText;
|
||||
}
|
||||
|
||||
void UiLogic::setLineEditProtoShadowsocksPortText(const QString &lineEditProtoShadowsocksPortText)
|
||||
{
|
||||
if (m_lineEditProtoShadowsocksPortText != lineEditProtoShadowsocksPortText) {
|
||||
m_lineEditProtoShadowsocksPortText = lineEditProtoShadowsocksPortText;
|
||||
emit lineEditProtoShadowsocksPortTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -691,108 +610,10 @@ void UiLogic::setPushButtonVpnAddSiteEnabled(bool pushButtonVpnAddSiteEnabled)
|
|||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getWidgetProtoCloakEnabled() const
|
||||
{
|
||||
return m_widgetProtoCloakEnabled;
|
||||
}
|
||||
|
||||
void UiLogic::setWidgetProtoCloakEnabled(bool widgetProtoCloakEnabled)
|
||||
{
|
||||
if (m_widgetProtoCloakEnabled != widgetProtoCloakEnabled) {
|
||||
m_widgetProtoCloakEnabled = widgetProtoCloakEnabled;
|
||||
emit widgetProtoCloakEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getPushButtonProtoCloakSaveVisible() const
|
||||
{
|
||||
return m_pushButtonProtoCloakSaveVisible;
|
||||
}
|
||||
|
||||
void UiLogic::setPushButtonProtoCloakSaveVisible(bool pushButtonProtoCloakSaveVisible)
|
||||
{
|
||||
if (m_pushButtonProtoCloakSaveVisible != pushButtonProtoCloakSaveVisible) {
|
||||
m_pushButtonProtoCloakSaveVisible = pushButtonProtoCloakSaveVisible;
|
||||
emit pushButtonProtoCloakSaveVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getProgressBarProtoCloakResetVisible() const
|
||||
{
|
||||
return m_progressBarProtoCloakResetVisible;
|
||||
}
|
||||
|
||||
void UiLogic::setProgressBarProtoCloakResetVisible(bool progressBarProtoCloakResetVisible)
|
||||
{
|
||||
if (m_progressBarProtoCloakResetVisible != progressBarProtoCloakResetVisible) {
|
||||
m_progressBarProtoCloakResetVisible = progressBarProtoCloakResetVisible;
|
||||
emit progressBarProtoCloakResetVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getLineEditProtoCloakPortEnabled() const
|
||||
{
|
||||
return m_lineEditProtoCloakPortEnabled;
|
||||
}
|
||||
|
||||
void UiLogic::setLineEditProtoCloakPortEnabled(bool lineEditProtoCloakPortEnabled)
|
||||
{
|
||||
if (m_lineEditProtoCloakPortEnabled != lineEditProtoCloakPortEnabled) {
|
||||
m_lineEditProtoCloakPortEnabled = lineEditProtoCloakPortEnabled;
|
||||
emit lineEditProtoCloakPortEnabledChanged();
|
||||
}
|
||||
}
|
||||
bool UiLogic::getWidgetProtoSsEnabled() const
|
||||
{
|
||||
return m_widgetProtoSsEnabled;
|
||||
}
|
||||
|
||||
void UiLogic::setWidgetProtoSsEnabled(bool widgetProtoSsEnabled)
|
||||
{
|
||||
if (m_widgetProtoSsEnabled != widgetProtoSsEnabled) {
|
||||
m_widgetProtoSsEnabled = widgetProtoSsEnabled;
|
||||
emit widgetProtoSsEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getPushButtonProtoShadowsocksSaveVisible() const
|
||||
{
|
||||
return m_pushButtonProtoShadowsocksSaveVisible;
|
||||
}
|
||||
|
||||
void UiLogic::setPushButtonProtoShadowsocksSaveVisible(bool pushButtonProtoShadowsocksSaveVisible)
|
||||
{
|
||||
if (m_pushButtonProtoShadowsocksSaveVisible != pushButtonProtoShadowsocksSaveVisible) {
|
||||
m_pushButtonProtoShadowsocksSaveVisible = pushButtonProtoShadowsocksSaveVisible;
|
||||
emit pushButtonProtoShadowsocksSaveVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getProgressBarProtoShadowsocksResetVisible() const
|
||||
{
|
||||
return m_progressBarProtoShadowsocksResetVisible;
|
||||
}
|
||||
|
||||
void UiLogic::setProgressBarProtoShadowsocksResetVisible(bool progressBarProtoShadowsocksResetVisible)
|
||||
{
|
||||
if (m_progressBarProtoShadowsocksResetVisible != progressBarProtoShadowsocksResetVisible) {
|
||||
m_progressBarProtoShadowsocksResetVisible = progressBarProtoShadowsocksResetVisible;
|
||||
emit progressBarProtoShadowsocksResetVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getLineEditProtoShadowsocksPortEnabled() const
|
||||
{
|
||||
return m_lineEditProtoShadowsocksPortEnabled;
|
||||
}
|
||||
|
||||
void UiLogic::setLineEditProtoShadowsocksPortEnabled(bool lineEditProtoShadowsocksPortEnabled)
|
||||
{
|
||||
if (m_lineEditProtoShadowsocksPortEnabled != lineEditProtoShadowsocksPortEnabled) {
|
||||
m_lineEditProtoShadowsocksPortEnabled = lineEditProtoShadowsocksPortEnabled;
|
||||
emit lineEditProtoShadowsocksPortEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1336,135 +1157,9 @@ void UiLogic::setProgressBarProtocolsContainerReinstallMaximium(int progressBarP
|
|||
}
|
||||
|
||||
|
||||
bool UiLogic::getPageProtoShadowsocksEnabled() const
|
||||
{
|
||||
return m_pageProtoShadowsocksEnabled;
|
||||
}
|
||||
|
||||
void UiLogic::setPageProtoShadowsocksEnabled(bool pageProtoShadowsocksEnabled)
|
||||
{
|
||||
if (m_pageProtoShadowsocksEnabled != pageProtoShadowsocksEnabled) {
|
||||
m_pageProtoShadowsocksEnabled = pageProtoShadowsocksEnabled;
|
||||
emit pageProtoShadowsocksEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getLabelProtoShadowsocksInfoVisible() const
|
||||
{
|
||||
return m_labelProtoShadowsocksInfoVisible;
|
||||
}
|
||||
|
||||
void UiLogic::setLabelProtoShadowsocksInfoVisible(bool labelProtoShadowsocksInfoVisible)
|
||||
{
|
||||
if (m_labelProtoShadowsocksInfoVisible != labelProtoShadowsocksInfoVisible) {
|
||||
m_labelProtoShadowsocksInfoVisible = labelProtoShadowsocksInfoVisible;
|
||||
emit labelProtoShadowsocksInfoVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getLabelProtoShadowsocksInfoText() const
|
||||
{
|
||||
return m_labelProtoShadowsocksInfoText;
|
||||
}
|
||||
|
||||
void UiLogic::setLabelProtoShadowsocksInfoText(const QString &labelProtoShadowsocksInfoText)
|
||||
{
|
||||
if (m_labelProtoShadowsocksInfoText != labelProtoShadowsocksInfoText) {
|
||||
m_labelProtoShadowsocksInfoText = labelProtoShadowsocksInfoText;
|
||||
emit labelProtoShadowsocksInfoTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int UiLogic::getProgressBarProtoShadowsocksResetValue() const
|
||||
{
|
||||
return m_progressBarProtoShadowsocksResetValue;
|
||||
}
|
||||
|
||||
void UiLogic::setProgressBarProtoShadowsocksResetValue(int progressBarProtoShadowsocksResetValue)
|
||||
{
|
||||
if (m_progressBarProtoShadowsocksResetValue != progressBarProtoShadowsocksResetValue) {
|
||||
m_progressBarProtoShadowsocksResetValue = progressBarProtoShadowsocksResetValue;
|
||||
emit progressBarProtoShadowsocksResetValueChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int UiLogic::getProgressBarProtoShadowsocksResetMaximium() const
|
||||
{
|
||||
return m_progressBarProtoShadowsocksResetMaximium;
|
||||
}
|
||||
|
||||
void UiLogic::setProgressBarProtoShadowsocksResetMaximium(int progressBarProtoShadowsocksResetMaximium)
|
||||
{
|
||||
if (m_progressBarProtoShadowsocksResetMaximium != progressBarProtoShadowsocksResetMaximium) {
|
||||
m_progressBarProtoShadowsocksResetMaximium = progressBarProtoShadowsocksResetMaximium;
|
||||
emit progressBarProtoShadowsocksResetMaximiumChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getPageProtoCloakEnabled() const
|
||||
{
|
||||
return m_pageProtoCloakEnabled;
|
||||
}
|
||||
|
||||
void UiLogic::setPageProtoCloakEnabled(bool pageProtoCloakEnabled)
|
||||
{
|
||||
if (m_pageProtoCloakEnabled != pageProtoCloakEnabled) {
|
||||
m_pageProtoCloakEnabled = pageProtoCloakEnabled;
|
||||
emit pageProtoCloakEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getLabelProtoCloakInfoVisible() const
|
||||
{
|
||||
return m_labelProtoCloakInfoVisible;
|
||||
}
|
||||
|
||||
void UiLogic::setLabelProtoCloakInfoVisible(bool labelProtoCloakInfoVisible)
|
||||
{
|
||||
if (m_labelProtoCloakInfoVisible != labelProtoCloakInfoVisible) {
|
||||
m_labelProtoCloakInfoVisible = labelProtoCloakInfoVisible;
|
||||
emit labelProtoCloakInfoVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getLabelProtoCloakInfoText() const
|
||||
{
|
||||
return m_labelProtoCloakInfoText;
|
||||
}
|
||||
|
||||
void UiLogic::setLabelProtoCloakInfoText(const QString &labelProtoCloakInfoText)
|
||||
{
|
||||
if (m_labelProtoCloakInfoText != labelProtoCloakInfoText) {
|
||||
m_labelProtoCloakInfoText = labelProtoCloakInfoText;
|
||||
emit labelProtoCloakInfoTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int UiLogic::getProgressBarProtoCloakResetValue() const
|
||||
{
|
||||
return m_progressBarProtoCloakResetValue;
|
||||
}
|
||||
|
||||
void UiLogic::setProgressBarProtoCloakResetValue(int progressBarProtoCloakResetValue)
|
||||
{
|
||||
if (m_progressBarProtoCloakResetValue != progressBarProtoCloakResetValue) {
|
||||
m_progressBarProtoCloakResetValue = progressBarProtoCloakResetValue;
|
||||
emit progressBarProtoCloakResetValueChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int UiLogic::getProgressBarProtoCloakResetMaximium() const
|
||||
{
|
||||
return m_progressBarProtoCloakResetMaximium;
|
||||
}
|
||||
|
||||
void UiLogic::setProgressBarProtoCloakResetMaximium(int progressBarProtoCloakResetMaximium)
|
||||
{
|
||||
if (m_progressBarProtoCloakResetMaximium != progressBarProtoCloakResetMaximium) {
|
||||
m_progressBarProtoCloakResetMaximium = progressBarProtoCloakResetMaximium;
|
||||
emit progressBarProtoCloakResetMaximiumChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -2222,136 +1917,14 @@ void UiLogic::onPushButtonProtoSsOpenvpnContOpenvpnConfigClicked()
|
|||
void UiLogic::onPushButtonProtoSsOpenvpnContSsConfigClicked()
|
||||
{
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverShadowSocks;
|
||||
updateShadowSocksPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::ShadowSocks),
|
||||
shadowSocksLogic()->updateShadowSocksPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::ShadowSocks),
|
||||
selectedDockerContainer, m_settings.haveAuthData(selectedServerIndex));
|
||||
goToPage(Page::ShadowSocksSettings);
|
||||
}
|
||||
|
||||
void UiLogic::onPushButtonProtoCloakOpenvpnContOpenvpnConfigClicked()
|
||||
{
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverCloak;
|
||||
m_openVpnLogic->updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn),
|
||||
selectedDockerContainer, m_settings.haveAuthData(selectedServerIndex));
|
||||
goToPage(Page::OpenVpnSettings);
|
||||
}
|
||||
|
||||
void UiLogic::onPushButtonProtoCloakOpenvpnContSsConfigClicked()
|
||||
{
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverCloak;
|
||||
updateShadowSocksPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::ShadowSocks),
|
||||
selectedDockerContainer, m_settings.haveAuthData(selectedServerIndex));
|
||||
goToPage(Page::ShadowSocksSettings);
|
||||
}
|
||||
|
||||
void UiLogic::onPushButtonProtoCloakOpenvpnContCloakConfigClicked()
|
||||
{
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverCloak;
|
||||
updateCloakPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::Cloak),
|
||||
selectedDockerContainer, m_settings.haveAuthData(selectedServerIndex));
|
||||
goToPage(Page::CloakSettings);
|
||||
}
|
||||
|
||||
void UiLogic::onPushButtonProtoShadowsocksSaveClicked()
|
||||
{
|
||||
QJsonObject protocolConfig = m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::ShadowSocks);
|
||||
protocolConfig = getShadowSocksConfigFromPage(protocolConfig);
|
||||
|
||||
QJsonObject containerConfig = m_settings.containerConfig(selectedServerIndex, selectedDockerContainer);
|
||||
QJsonObject newContainerConfig = containerConfig;
|
||||
newContainerConfig.insert(config_key::shadowsocks, protocolConfig);
|
||||
PageFunc page_proto_shadowsocks;
|
||||
page_proto_shadowsocks.setEnabledFunc = [this] (bool enabled) -> void {
|
||||
setPageProtoShadowsocksEnabled(enabled);
|
||||
};
|
||||
ButtonFunc pushButton_proto_shadowsocks_save;
|
||||
pushButton_proto_shadowsocks_save.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setPushButtonProtoShadowsocksSaveVisible(visible);
|
||||
};
|
||||
LabelFunc label_proto_shadowsocks_info;
|
||||
label_proto_shadowsocks_info.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setLabelProtoShadowsocksInfoVisible(visible);
|
||||
};
|
||||
label_proto_shadowsocks_info.setTextFunc = [this] (const QString& text) ->void {
|
||||
setLabelProtoShadowsocksInfoText(text);
|
||||
};
|
||||
ProgressFunc progressBar_proto_shadowsocks_reset;
|
||||
progressBar_proto_shadowsocks_reset.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setProgressBarProtoShadowsocksResetVisible(visible);
|
||||
};
|
||||
progressBar_proto_shadowsocks_reset.setValueFunc = [this] (int value) ->void {
|
||||
setProgressBarProtoShadowsocksResetValue(value);
|
||||
};
|
||||
progressBar_proto_shadowsocks_reset.getValueFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoShadowsocksResetValue();
|
||||
};
|
||||
progressBar_proto_shadowsocks_reset.getMaximiumFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoShadowsocksResetMaximium();
|
||||
};
|
||||
|
||||
ErrorCode e = doInstallAction([this, containerConfig, newContainerConfig](){
|
||||
return ServerController::updateContainer(m_settings.serverCredentials(selectedServerIndex), selectedDockerContainer, containerConfig, newContainerConfig);
|
||||
},
|
||||
page_proto_shadowsocks, progressBar_proto_shadowsocks_reset,
|
||||
pushButton_proto_shadowsocks_save, label_proto_shadowsocks_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::onPushButtonProtoCloakSaveClicked()
|
||||
{
|
||||
QJsonObject protocolConfig = m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::Cloak);
|
||||
protocolConfig = getCloakConfigFromPage(protocolConfig);
|
||||
|
||||
QJsonObject containerConfig = m_settings.containerConfig(selectedServerIndex, selectedDockerContainer);
|
||||
QJsonObject newContainerConfig = containerConfig;
|
||||
newContainerConfig.insert(config_key::cloak, protocolConfig);
|
||||
|
||||
PageFunc page_proto_cloak;
|
||||
page_proto_cloak.setEnabledFunc = [this] (bool enabled) -> void {
|
||||
setPageProtoCloakEnabled(enabled);
|
||||
};
|
||||
ButtonFunc pushButton_proto_cloak_save;
|
||||
pushButton_proto_cloak_save.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setPushButtonProtoCloakSaveVisible(visible);
|
||||
};
|
||||
LabelFunc label_proto_cloak_info;
|
||||
label_proto_cloak_info.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setLabelProtoCloakInfoVisible(visible);
|
||||
};
|
||||
label_proto_cloak_info.setTextFunc = [this] (const QString& text) ->void {
|
||||
setLabelProtoCloakInfoText(text);
|
||||
};
|
||||
ProgressFunc progressBar_proto_cloak_reset;
|
||||
progressBar_proto_cloak_reset.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setProgressBarProtoCloakResetVisible(visible);
|
||||
};
|
||||
progressBar_proto_cloak_reset.setValueFunc = [this] (int value) ->void {
|
||||
setProgressBarProtoCloakResetValue(value);
|
||||
};
|
||||
progressBar_proto_cloak_reset.getValueFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoCloakResetValue();
|
||||
};
|
||||
progressBar_proto_cloak_reset.getMaximiumFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoCloakResetMaximium();
|
||||
};
|
||||
|
||||
ErrorCode e = doInstallAction([this, containerConfig, newContainerConfig](){
|
||||
return ServerController::updateContainer(m_settings.serverCredentials(selectedServerIndex), selectedDockerContainer, containerConfig, newContainerConfig);
|
||||
},
|
||||
page_proto_cloak, progressBar_proto_cloak_reset,
|
||||
pushButton_proto_cloak_save, label_proto_cloak_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::updateVpnPage()
|
||||
|
@ -2465,54 +2038,26 @@ void UiLogic::updateProtocolsPage()
|
|||
}
|
||||
|
||||
|
||||
|
||||
void UiLogic::updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData)
|
||||
void UiLogic::onPushButtonProtoCloakOpenvpnContOpenvpnConfigClicked()
|
||||
{
|
||||
setWidgetProtoSsEnabled(haveAuthData);
|
||||
setPushButtonProtoShadowsocksSaveVisible(haveAuthData);
|
||||
setProgressBarProtoShadowsocksResetVisible(haveAuthData);
|
||||
|
||||
setComboBoxProtoShadowsocksCipherText(ssConfig.value(config_key::cipher).
|
||||
toString(protocols::shadowsocks::defaultCipher));
|
||||
|
||||
setLineEditProtoShadowsocksPortText(ssConfig.value(config_key::port).
|
||||
toString(protocols::shadowsocks::defaultPort));
|
||||
|
||||
setLineEditProtoShadowsocksPortEnabled(container == DockerContainer::OpenVpnOverShadowSocks);
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverCloak;
|
||||
m_openVpnLogic->updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn),
|
||||
selectedDockerContainer, m_settings.haveAuthData(selectedServerIndex));
|
||||
goToPage(Page::OpenVpnSettings);
|
||||
}
|
||||
|
||||
void UiLogic::updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData)
|
||||
void UiLogic::onPushButtonProtoCloakOpenvpnContSsConfigClicked()
|
||||
{
|
||||
setWidgetProtoCloakEnabled(haveAuthData);
|
||||
setPushButtonProtoCloakSaveVisible(haveAuthData);
|
||||
setProgressBarProtoCloakResetVisible(haveAuthData);
|
||||
|
||||
setComboBoxProtoCloakCipherText(ckConfig.value(config_key::cipher).
|
||||
toString(protocols::cloak::defaultCipher));
|
||||
|
||||
setLineEditProtoCloakSiteText(ckConfig.value(config_key::site).
|
||||
toString(protocols::cloak::defaultRedirSite));
|
||||
|
||||
setLineEditProtoCloakPortText(ckConfig.value(config_key::port).
|
||||
toString(protocols::cloak::defaultPort));
|
||||
|
||||
setLineEditProtoCloakPortEnabled(container == DockerContainer::OpenVpnOverCloak);
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverCloak;
|
||||
shadowSocksLogic()->updateShadowSocksPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::ShadowSocks),
|
||||
selectedDockerContainer, m_settings.haveAuthData(selectedServerIndex));
|
||||
goToPage(Page::ShadowSocksSettings);
|
||||
}
|
||||
|
||||
|
||||
QJsonObject UiLogic::getShadowSocksConfigFromPage(QJsonObject oldConfig)
|
||||
void UiLogic::onPushButtonProtoCloakOpenvpnContCloakConfigClicked()
|
||||
{
|
||||
oldConfig.insert(config_key::cipher, getComboBoxProtoShadowsocksCipherText());
|
||||
oldConfig.insert(config_key::port, getLineEditProtoShadowsocksPortText());
|
||||
|
||||
return oldConfig;
|
||||
}
|
||||
|
||||
QJsonObject UiLogic::getCloakConfigFromPage(QJsonObject oldConfig)
|
||||
{
|
||||
oldConfig.insert(config_key::cipher, getComboBoxProtoCloakCipherText());
|
||||
oldConfig.insert(config_key::site, getLineEditProtoCloakSiteText());
|
||||
oldConfig.insert(config_key::port, getLineEditProtoCloakPortText());
|
||||
|
||||
return oldConfig;
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverCloak;
|
||||
cloakLogic()->updateCloakPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::Cloak),
|
||||
selectedDockerContainer, m_settings.haveAuthData(selectedServerIndex));
|
||||
goToPage(Page::CloakSettings);
|
||||
}
|
||||
|
|
|
@ -56,21 +56,8 @@ class UiLogic : public QObject
|
|||
Q_PROPERTY(bool checkBoxNewServerCloakChecked READ getCheckBoxNewServerCloakChecked WRITE setCheckBoxNewServerCloakChecked NOTIFY checkBoxNewServerCloakCheckedChanged)
|
||||
Q_PROPERTY(bool checkBoxNewServerSsChecked READ getCheckBoxNewServerSsChecked WRITE setCheckBoxNewServerSsChecked NOTIFY checkBoxNewServerSsCheckedChanged)
|
||||
Q_PROPERTY(bool checkBoxNewServerOpenvpnChecked READ getCheckBoxNewServerOpenvpnChecked WRITE setCheckBoxNewServerOpenvpnChecked NOTIFY checkBoxNewServerOpenvpnCheckedChanged)
|
||||
Q_PROPERTY(QString comboBoxProtoCloakCipherText READ getComboBoxProtoCloakCipherText WRITE setComboBoxProtoCloakCipherText NOTIFY comboBoxProtoCloakCipherTextChanged)
|
||||
Q_PROPERTY(QString lineEditProtoCloakSiteText READ getLineEditProtoCloakSiteText WRITE setLineEditProtoCloakSiteText NOTIFY lineEditProtoCloakSiteTextChanged)
|
||||
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(bool pushButtonConnectChecked READ getPushButtonConnectChecked WRITE setPushButtonConnectChecked NOTIFY pushButtonConnectCheckedChanged)
|
||||
Q_PROPERTY(bool widgetProtoCloakEnabled READ getWidgetProtoCloakEnabled WRITE setWidgetProtoCloakEnabled NOTIFY widgetProtoCloakEnabledChanged)
|
||||
Q_PROPERTY(bool pushButtonProtoCloakSaveVisible READ getPushButtonProtoCloakSaveVisible WRITE setPushButtonProtoCloakSaveVisible NOTIFY pushButtonProtoCloakSaveVisibleChanged)
|
||||
Q_PROPERTY(bool progressBarProtoCloakResetVisible READ getProgressBarProtoCloakResetVisible WRITE setProgressBarProtoCloakResetVisible NOTIFY progressBarProtoCloakResetVisibleChanged)
|
||||
Q_PROPERTY(bool lineEditProtoCloakPortEnabled READ getLineEditProtoCloakPortEnabled WRITE setLineEditProtoCloakPortEnabled NOTIFY lineEditProtoCloakPortEnabledChanged)
|
||||
Q_PROPERTY(bool widgetProtoSsEnabled READ getWidgetProtoSsEnabled WRITE setWidgetProtoSsEnabled NOTIFY widgetProtoSsEnabledChanged)
|
||||
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 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)
|
||||
|
@ -112,16 +99,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 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)
|
||||
Q_PROPERTY(int progressBarProtoShadowsocksResetValue READ getProgressBarProtoShadowsocksResetValue WRITE setProgressBarProtoShadowsocksResetValue NOTIFY progressBarProtoShadowsocksResetValueChanged)
|
||||
Q_PROPERTY(int progressBarProtoShadowsocksResetMaximium READ getProgressBarProtoShadowsocksResetMaximium WRITE setProgressBarProtoShadowsocksResetMaximium NOTIFY progressBarProtoShadowsocksResetMaximiumChanged)
|
||||
Q_PROPERTY(bool pageProtoCloakEnabled READ getPageProtoCloakEnabled WRITE setPageProtoCloakEnabled NOTIFY pageProtoCloakEnabledChanged)
|
||||
Q_PROPERTY(bool labelProtoCloakInfoVisible READ getLabelProtoCloakInfoVisible WRITE setLabelProtoCloakInfoVisible NOTIFY labelProtoCloakInfoVisibleChanged)
|
||||
Q_PROPERTY(QString labelProtoCloakInfoText READ getLabelProtoCloakInfoText WRITE setLabelProtoCloakInfoText NOTIFY labelProtoCloakInfoTextChanged)
|
||||
Q_PROPERTY(int progressBarProtoCloakResetValue READ getProgressBarProtoCloakResetValue WRITE setProgressBarProtoCloakResetValue NOTIFY progressBarProtoCloakResetValueChanged)
|
||||
Q_PROPERTY(int progressBarProtoCloakResetMaximium READ getProgressBarProtoCloakResetMaximium WRITE setProgressBarProtoCloakResetMaximium NOTIFY progressBarProtoCloakResetMaximiumChanged)
|
||||
|
||||
|
||||
Q_PROPERTY(bool pushButtonVpnAddSiteEnabled READ getPushButtonVpnAddSiteEnabled WRITE setPushButtonVpnAddSiteEnabled NOTIFY pushButtonVpnAddSiteEnabledChanged)
|
||||
|
@ -200,36 +177,11 @@ public:
|
|||
void setCheckBoxNewServerSsChecked(bool checkBoxNewServerSsChecked);
|
||||
bool getCheckBoxNewServerOpenvpnChecked() const;
|
||||
void setCheckBoxNewServerOpenvpnChecked(bool checkBoxNewServerOpenvpnChecked);
|
||||
QString getComboBoxProtoCloakCipherText() const;
|
||||
void setComboBoxProtoCloakCipherText(const QString &comboBoxProtoCloakCipherText);
|
||||
QString getLineEditProtoCloakSiteText() const;
|
||||
void setLineEditProtoCloakSiteText(const QString &lineEditProtoCloakSiteText);
|
||||
QString getLineEditProtoCloakPortText() const;
|
||||
void setLineEditProtoCloakPortText(const QString &lineEditProtoCloakPortText);
|
||||
QString getComboBoxProtoShadowsocksCipherText() const;
|
||||
void setComboBoxProtoShadowsocksCipherText(const QString &comboBoxProtoShadowsocksCipherText);
|
||||
QString getLineEditProtoShadowsocksPortText() const;
|
||||
void setLineEditProtoShadowsocksPortText(const QString &lineEditProtoShadowsocksPortText);
|
||||
|
||||
|
||||
bool getPushButtonConnectChecked() const;
|
||||
void setPushButtonConnectChecked(bool pushButtonConnectChecked);
|
||||
|
||||
bool getWidgetProtoCloakEnabled() const;
|
||||
void setWidgetProtoCloakEnabled(bool widgetProtoCloakEnabled);
|
||||
bool getPushButtonProtoCloakSaveVisible() const;
|
||||
void setPushButtonProtoCloakSaveVisible(bool pushButtonProtoCloakSaveVisible);
|
||||
bool getProgressBarProtoCloakResetVisible() const;
|
||||
void setProgressBarProtoCloakResetVisible(bool progressBarProtoCloakResetVisible);
|
||||
bool getLineEditProtoCloakPortEnabled() const;
|
||||
void setLineEditProtoCloakPortEnabled(bool lineEditProtoCloakPortEnabled);
|
||||
bool getWidgetProtoSsEnabled() const;
|
||||
void setWidgetProtoSsEnabled(bool widgetProtoSsEnabled);
|
||||
bool getPushButtonProtoShadowsocksSaveVisible() const;
|
||||
void setPushButtonProtoShadowsocksSaveVisible(bool pushButtonProtoShadowsocksSaveVisible);
|
||||
bool getProgressBarProtoShadowsocksResetVisible() const;
|
||||
void setProgressBarProtoShadowsocksResetVisible(bool progressBarProtoShadowsocksResetVisible);
|
||||
bool getLineEditProtoShadowsocksPortEnabled() const;
|
||||
void setLineEditProtoShadowsocksPortEnabled(bool lineEditProtoShadowsocksPortEnabled);
|
||||
|
||||
bool getPushButtonProtoOpenvpnContInstallChecked() const;
|
||||
void setPushButtonProtoOpenvpnContInstallChecked(bool pushButtonProtoOpenvpnContInstallChecked);
|
||||
|
@ -318,26 +270,7 @@ public:
|
|||
void setProgressBarProtocolsContainerReinstallValue(int progressBarProtocolsContainerReinstallValue);
|
||||
int getProgressBarProtocolsContainerReinstallMaximium() const;
|
||||
void setProgressBarProtocolsContainerReinstallMaximium(int progressBarProtocolsContainerReinstallMaximium);
|
||||
bool getPageProtoShadowsocksEnabled() const;
|
||||
void setPageProtoShadowsocksEnabled(bool pageProtoShadowsocksEnabled);
|
||||
bool getLabelProtoShadowsocksInfoVisible() const;
|
||||
void setLabelProtoShadowsocksInfoVisible(bool labelProtoShadowsocksInfoVisible);
|
||||
QString getLabelProtoShadowsocksInfoText() const;
|
||||
void setLabelProtoShadowsocksInfoText(const QString &labelProtoShadowsocksInfoText);
|
||||
int getProgressBarProtoShadowsocksResetValue() const;
|
||||
void setProgressBarProtoShadowsocksResetValue(int progressBarProtoShadowsocksResetValue);
|
||||
int getProgressBarProtoShadowsocksResetMaximium() const;
|
||||
void setProgressBarProtoShadowsocksResetMaximium(int progressBarProtoShadowsocksResetMaximium);
|
||||
bool getPageProtoCloakEnabled() const;
|
||||
void setPageProtoCloakEnabled(bool pageProtoCloakEnabled);
|
||||
bool getLabelProtoCloakInfoVisible() const;
|
||||
void setLabelProtoCloakInfoVisible(bool labelProtoCloakInfoVisible);
|
||||
QString getLabelProtoCloakInfoText() const;
|
||||
void setLabelProtoCloakInfoText(const QString &labelProtoCloakInfoText);
|
||||
int getProgressBarProtoCloakResetValue() const;
|
||||
void setProgressBarProtoCloakResetValue(int progressBarProtoCloakResetValue);
|
||||
int getProgressBarProtoCloakResetMaximium() const;
|
||||
void setProgressBarProtoCloakResetMaximium(int progressBarProtoCloakResetMaximium);
|
||||
|
||||
|
||||
bool getRadioButtonVpnModeAllSitesChecked() const;
|
||||
void setRadioButtonVpnModeAllSitesChecked(bool radioButtonVpnModeAllSitesChecked);
|
||||
|
@ -351,33 +284,23 @@ public:
|
|||
Q_INVOKABLE void updateNewServerProtocolsPage();
|
||||
Q_INVOKABLE void updateVpnPage();
|
||||
|
||||
|
||||
|
||||
Q_INVOKABLE void onRadioButtonVpnModeAllSitesToggled(bool checked);
|
||||
Q_INVOKABLE void onRadioButtonVpnModeForwardSitesToggled(bool checked);
|
||||
Q_INVOKABLE void onRadioButtonVpnModeExceptSitesToggled(bool checked);
|
||||
|
||||
Q_INVOKABLE void onPushButtonConnectClicked(bool checked);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Q_INVOKABLE void onPushButtonProtoOpenvpnContOpenvpnConfigClicked();
|
||||
Q_INVOKABLE void onPushButtonProtoSsOpenvpnContOpenvpnConfigClicked();
|
||||
Q_INVOKABLE void onPushButtonProtoSsOpenvpnContSsConfigClicked();
|
||||
|
||||
Q_INVOKABLE void onPushButtonProtoCloakOpenvpnContOpenvpnConfigClicked();
|
||||
Q_INVOKABLE void onPushButtonProtoCloakOpenvpnContSsConfigClicked();
|
||||
Q_INVOKABLE void onPushButtonProtoCloakOpenvpnContCloakConfigClicked();
|
||||
|
||||
Q_INVOKABLE void onPushButtonProtoShadowsocksSaveClicked();
|
||||
Q_INVOKABLE void onPushButtonProtoCloakSaveClicked();
|
||||
|
||||
Q_INVOKABLE void onCloseWindow();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Q_INVOKABLE void updateProtocolsPage();
|
||||
|
||||
signals:
|
||||
|
@ -411,24 +334,13 @@ signals:
|
|||
void checkBoxNewServerCloakCheckedChanged();
|
||||
void checkBoxNewServerSsCheckedChanged();
|
||||
void checkBoxNewServerOpenvpnCheckedChanged();
|
||||
void comboBoxProtoCloakCipherTextChanged();
|
||||
void lineEditProtoCloakSiteTextChanged();
|
||||
void lineEditProtoCloakPortTextChanged();
|
||||
void comboBoxProtoShadowsocksCipherTextChanged();
|
||||
void lineEditProtoShadowsocksPortTextChanged();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void pushButtonConnectCheckedChanged();
|
||||
|
||||
void widgetProtoCloakEnabledChanged();
|
||||
void pushButtonProtoCloakSaveVisibleChanged();
|
||||
void progressBarProtoCloakResetVisibleChanged();
|
||||
void lineEditProtoCloakPortEnabledChanged();
|
||||
void widgetProtoSsEnabledChanged();
|
||||
void pushButtonProtoShadowsocksSaveVisibleChanged();
|
||||
void progressBarProtoShadowsocksResetVisibleChanged();
|
||||
void lineEditProtoShadowsocksPortEnabledChanged();
|
||||
|
||||
void pushButtonProtoOpenvpnContInstallCheckedChanged();
|
||||
void pushButtonProtoSsOpenvpnContInstallCheckedChanged();
|
||||
|
@ -474,16 +386,8 @@ signals:
|
|||
void progressBarProtocolsContainerReinstallValueChanged();
|
||||
void progressBarProtocolsContainerReinstallMaximiumChanged();
|
||||
|
||||
void pageProtoShadowsocksEnabledChanged();
|
||||
void labelProtoShadowsocksInfoVisibleChanged();
|
||||
void labelProtoShadowsocksInfoTextChanged();
|
||||
void progressBarProtoShadowsocksResetValueChanged();
|
||||
void progressBarProtoShadowsocksResetMaximiumChanged();
|
||||
void pageProtoCloakEnabledChanged();
|
||||
void labelProtoCloakInfoVisibleChanged();
|
||||
void labelProtoCloakInfoTextChanged();
|
||||
void progressBarProtoCloakResetValueChanged();
|
||||
void progressBarProtoCloakResetMaximiumChanged();
|
||||
|
||||
|
||||
|
||||
void goToPage(int page, bool reset = true, bool slide = true);
|
||||
void closePage();
|
||||
|
@ -538,24 +442,14 @@ private:
|
|||
bool m_checkBoxNewServerCloakChecked;
|
||||
bool m_checkBoxNewServerSsChecked;
|
||||
bool m_checkBoxNewServerOpenvpnChecked;
|
||||
QString m_comboBoxProtoCloakCipherText;
|
||||
QString m_lineEditProtoCloakSiteText;
|
||||
QString m_lineEditProtoCloakPortText;
|
||||
QString m_comboBoxProtoShadowsocksCipherText;
|
||||
QString m_lineEditProtoShadowsocksPortText;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool m_pushButtonConnectChecked;
|
||||
|
||||
bool m_widgetProtoCloakEnabled;
|
||||
bool m_pushButtonProtoCloakSaveVisible;
|
||||
bool m_progressBarProtoCloakResetVisible;
|
||||
bool m_lineEditProtoCloakPortEnabled;
|
||||
bool m_widgetProtoSsEnabled;
|
||||
bool m_pushButtonProtoShadowsocksSaveVisible;
|
||||
bool m_progressBarProtoShadowsocksResetVisible;
|
||||
bool m_lineEditProtoShadowsocksPortEnabled;
|
||||
|
||||
|
||||
bool m_pushButtonProtoOpenvpnContInstallChecked;
|
||||
bool m_pushButtonProtoSsOpenvpnContInstallChecked;
|
||||
|
@ -600,16 +494,7 @@ private:
|
|||
int m_progressBarProtocolsContainerReinstallValue;
|
||||
int m_progressBarProtocolsContainerReinstallMaximium;
|
||||
|
||||
bool m_pageProtoShadowsocksEnabled;
|
||||
bool m_labelProtoShadowsocksInfoVisible;
|
||||
QString m_labelProtoShadowsocksInfoText;
|
||||
int m_progressBarProtoShadowsocksResetValue;
|
||||
int m_progressBarProtoShadowsocksResetMaximium;
|
||||
bool m_pageProtoCloakEnabled;
|
||||
bool m_labelProtoCloakInfoVisible;
|
||||
QString m_labelProtoCloakInfoText;
|
||||
int m_progressBarProtoCloakResetValue;
|
||||
int m_progressBarProtoCloakResetMaximium;
|
||||
|
||||
|
||||
private slots:
|
||||
void onBytesChanged(quint64 receivedBytes, quint64 sentBytes);
|
||||
|
@ -664,13 +549,9 @@ private:
|
|||
// void setupSitesPageConnections();
|
||||
void setupProtocolsPageConnections();
|
||||
|
||||
void updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData);
|
||||
void updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData);
|
||||
|
||||
|
||||
|
||||
QJsonObject getShadowSocksConfigFromPage(QJsonObject oldConfig);
|
||||
QJsonObject getCloakConfigFromPage(QJsonObject oldConfig);
|
||||
|
||||
QMap<DockerContainer, QJsonObject> getInstallConfigsFromProtocolsPage() const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue