NewServerConfiguringLogic
NewServerProtocolsLogic
This commit is contained in:
parent
7c28fe2795
commit
4c0ff29488
12 changed files with 587 additions and 543 deletions
|
@ -16,6 +16,7 @@
|
|||
#include "ui/pages_logic/AppSettingsLogic.h"
|
||||
#include "ui/pages_logic/GeneralSettingsLogic.h"
|
||||
#include "ui/pages_logic/NetworkSettingsLogic.h"
|
||||
#include "ui/pages_logic/NewServerConfiguringLogic.h"
|
||||
#include "ui/pages_logic/NewServerProtocolsLogic.h"
|
||||
#include "ui/pages_logic/ProtocolSettingsLogic.h"
|
||||
#include "ui/pages_logic/ServerListLogic.h"
|
||||
|
@ -131,6 +132,7 @@ int main(int argc, char *argv[])
|
|||
engine.rootContext()->setContextProperty("AppSettingsLogic", uiLogic->appSettingsLogic());
|
||||
engine.rootContext()->setContextProperty("GeneralSettingsLogic", uiLogic->generalSettingsLogic());
|
||||
engine.rootContext()->setContextProperty("NetworkSettingsLogic", uiLogic->networkSettingsLogic());
|
||||
engine.rootContext()->setContextProperty("NewServerConfiguringLogic", uiLogic->newServerConfiguringLogic());
|
||||
engine.rootContext()->setContextProperty("NewServerProtocolsLogic", uiLogic->newServerProtocolsLogic());
|
||||
engine.rootContext()->setContextProperty("ProtocolSettingsLogic", uiLogic->protocolSettingsLogic());
|
||||
engine.rootContext()->setContextProperty("ServerListLogic", uiLogic->serverListLogic());
|
||||
|
|
|
@ -5,7 +5,120 @@ using namespace PageEnumNS;
|
|||
|
||||
NewServerConfiguringLogic::NewServerConfiguringLogic(UiLogic *uiLogic, QObject *parent):
|
||||
QObject(parent),
|
||||
m_uiLogic(uiLogic)
|
||||
m_uiLogic(uiLogic),
|
||||
m_progressBarNewServerConfiguringValue{0},
|
||||
m_pageNewServerConfiguringEnabled{true},
|
||||
m_labelNewServerConfiguringWaitInfoVisible{true},
|
||||
m_labelNewServerConfiguringWaitInfoText{tr("Please wait, configuring process may take up to 5 minutes")},
|
||||
m_progressBarNewServerConfiguringVisible{true},
|
||||
m_progressBarNewServerConfiguringMaximium{100},
|
||||
m_progressBarNewServerConfiguringTextVisible{true},
|
||||
m_progressBarNewServerConfiguringText{tr("Configuring...")}
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
double NewServerConfiguringLogic::getProgressBarNewServerConfiguringValue() const
|
||||
{
|
||||
return m_progressBarNewServerConfiguringValue;
|
||||
}
|
||||
|
||||
void NewServerConfiguringLogic::setProgressBarNewServerConfiguringValue(double progressBarNewServerConfiguringValue)
|
||||
{
|
||||
if (m_progressBarNewServerConfiguringValue != progressBarNewServerConfiguringValue) {
|
||||
m_progressBarNewServerConfiguringValue = progressBarNewServerConfiguringValue;
|
||||
emit progressBarNewServerConfiguringValueChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool NewServerConfiguringLogic::getPageNewServerConfiguringEnabled() const
|
||||
{
|
||||
return m_pageNewServerConfiguringEnabled;
|
||||
}
|
||||
|
||||
void NewServerConfiguringLogic::setPageNewServerConfiguringEnabled(bool pageNewServerConfiguringEnabled)
|
||||
{
|
||||
if (m_pageNewServerConfiguringEnabled != pageNewServerConfiguringEnabled) {
|
||||
m_pageNewServerConfiguringEnabled = pageNewServerConfiguringEnabled;
|
||||
emit pageNewServerConfiguringEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool NewServerConfiguringLogic::getLabelNewServerConfiguringWaitInfoVisible() const
|
||||
{
|
||||
return m_labelNewServerConfiguringWaitInfoVisible;
|
||||
}
|
||||
|
||||
void NewServerConfiguringLogic::setLabelNewServerConfiguringWaitInfoVisible(bool labelNewServerConfiguringWaitInfoVisible)
|
||||
{
|
||||
if (m_labelNewServerConfiguringWaitInfoVisible != labelNewServerConfiguringWaitInfoVisible) {
|
||||
m_labelNewServerConfiguringWaitInfoVisible = labelNewServerConfiguringWaitInfoVisible;
|
||||
emit labelNewServerConfiguringWaitInfoVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString NewServerConfiguringLogic::getLabelNewServerConfiguringWaitInfoText() const
|
||||
{
|
||||
return m_labelNewServerConfiguringWaitInfoText;
|
||||
}
|
||||
|
||||
void NewServerConfiguringLogic::setLabelNewServerConfiguringWaitInfoText(const QString &labelNewServerConfiguringWaitInfoText)
|
||||
{
|
||||
if (m_labelNewServerConfiguringWaitInfoText != labelNewServerConfiguringWaitInfoText) {
|
||||
m_labelNewServerConfiguringWaitInfoText = labelNewServerConfiguringWaitInfoText;
|
||||
emit labelNewServerConfiguringWaitInfoTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool NewServerConfiguringLogic::getProgressBarNewServerConfiguringVisible() const
|
||||
{
|
||||
return m_progressBarNewServerConfiguringVisible;
|
||||
}
|
||||
|
||||
void NewServerConfiguringLogic::setProgressBarNewServerConfiguringVisible(bool progressBarNewServerConfiguringVisible)
|
||||
{
|
||||
if (m_progressBarNewServerConfiguringVisible != progressBarNewServerConfiguringVisible) {
|
||||
m_progressBarNewServerConfiguringVisible = progressBarNewServerConfiguringVisible;
|
||||
emit progressBarNewServerConfiguringVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int NewServerConfiguringLogic::getProgressBarNewServerConfiguringMaximium() const
|
||||
{
|
||||
return m_progressBarNewServerConfiguringMaximium;
|
||||
}
|
||||
|
||||
void NewServerConfiguringLogic::setProgressBarNewServerConfiguringMaximium(int progressBarNewServerConfiguringMaximium)
|
||||
{
|
||||
if (m_progressBarNewServerConfiguringMaximium != progressBarNewServerConfiguringMaximium) {
|
||||
m_progressBarNewServerConfiguringMaximium = progressBarNewServerConfiguringMaximium;
|
||||
emit progressBarNewServerConfiguringMaximiumChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool NewServerConfiguringLogic::getProgressBarNewServerConfiguringTextVisible() const
|
||||
{
|
||||
return m_progressBarNewServerConfiguringTextVisible;
|
||||
}
|
||||
|
||||
void NewServerConfiguringLogic::setProgressBarNewServerConfiguringTextVisible(bool progressBarNewServerConfiguringTextVisible)
|
||||
{
|
||||
if (m_progressBarNewServerConfiguringTextVisible != progressBarNewServerConfiguringTextVisible) {
|
||||
m_progressBarNewServerConfiguringTextVisible = progressBarNewServerConfiguringTextVisible;
|
||||
emit progressBarNewServerConfiguringTextVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString NewServerConfiguringLogic::getProgressBarNewServerConfiguringText() const
|
||||
{
|
||||
return m_progressBarNewServerConfiguringText;
|
||||
}
|
||||
|
||||
void NewServerConfiguringLogic::setProgressBarNewServerConfiguringText(const QString &progressBarNewServerConfiguringText)
|
||||
{
|
||||
if (m_progressBarNewServerConfiguringText != progressBarNewServerConfiguringText) {
|
||||
m_progressBarNewServerConfiguringText = progressBarNewServerConfiguringText;
|
||||
emit progressBarNewServerConfiguringTextChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ class NewServerConfiguringLogic : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_PROPERTY(double progressBarNewServerConfiguringValue READ getProgressBarNewServerConfiguringValue WRITE setProgressBarNewServerConfiguringValue NOTIFY progressBarNewServerConfiguringValueChanged)
|
||||
Q_PROPERTY(bool pageNewServerConfiguringEnabled READ getPageNewServerConfiguringEnabled WRITE setPageNewServerConfiguringEnabled NOTIFY pageNewServerConfiguringEnabledChanged)
|
||||
Q_PROPERTY(bool labelNewServerConfiguringWaitInfoVisible READ getLabelNewServerConfiguringWaitInfoVisible WRITE setLabelNewServerConfiguringWaitInfoVisible NOTIFY labelNewServerConfiguringWaitInfoVisibleChanged)
|
||||
Q_PROPERTY(QString labelNewServerConfiguringWaitInfoText READ getLabelNewServerConfiguringWaitInfoText WRITE setLabelNewServerConfiguringWaitInfoText NOTIFY labelNewServerConfiguringWaitInfoTextChanged)
|
||||
|
@ -23,9 +24,33 @@ public:
|
|||
explicit NewServerConfiguringLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~NewServerConfiguringLogic() = default;
|
||||
|
||||
double getProgressBarNewServerConfiguringValue() const;
|
||||
void setProgressBarNewServerConfiguringValue(double progressBarNewServerConfiguringValue);
|
||||
|
||||
bool getPageNewServerConfiguringEnabled() const;
|
||||
void setPageNewServerConfiguringEnabled(bool pageNewServerConfiguringEnabled);
|
||||
bool getLabelNewServerConfiguringWaitInfoVisible() const;
|
||||
void setLabelNewServerConfiguringWaitInfoVisible(bool labelNewServerConfiguringWaitInfoVisible);
|
||||
QString getLabelNewServerConfiguringWaitInfoText() const;
|
||||
void setLabelNewServerConfiguringWaitInfoText(const QString &labelNewServerConfiguringWaitInfoText);
|
||||
bool getProgressBarNewServerConfiguringVisible() const;
|
||||
void setProgressBarNewServerConfiguringVisible(bool progressBarNewServerConfiguringVisible);
|
||||
int getProgressBarNewServerConfiguringMaximium() const;
|
||||
void setProgressBarNewServerConfiguringMaximium(int progressBarNewServerConfiguringMaximium);
|
||||
bool getProgressBarNewServerConfiguringTextVisible() const;
|
||||
void setProgressBarNewServerConfiguringTextVisible(bool progressBarNewServerConfiguringTextVisible);
|
||||
QString getProgressBarNewServerConfiguringText() const;
|
||||
void setProgressBarNewServerConfiguringText(const QString &progressBarNewServerConfiguringText);
|
||||
|
||||
signals:
|
||||
|
||||
void progressBarNewServerConfiguringValueChanged();
|
||||
void pageNewServerConfiguringEnabledChanged();
|
||||
void labelNewServerConfiguringWaitInfoVisibleChanged();
|
||||
void labelNewServerConfiguringWaitInfoTextChanged();
|
||||
void progressBarNewServerConfiguringVisibleChanged();
|
||||
void progressBarNewServerConfiguringMaximiumChanged();
|
||||
void progressBarNewServerConfiguringTextVisibleChanged();
|
||||
void progressBarNewServerConfiguringTextChanged();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -38,7 +63,14 @@ private:
|
|||
Settings m_settings;
|
||||
UiLogic *m_uiLogic;
|
||||
|
||||
|
||||
double m_progressBarNewServerConfiguringValue;
|
||||
bool m_pageNewServerConfiguringEnabled;
|
||||
bool m_labelNewServerConfiguringWaitInfoVisible;
|
||||
QString m_labelNewServerConfiguringWaitInfoText;
|
||||
bool m_progressBarNewServerConfiguringVisible;
|
||||
int m_progressBarNewServerConfiguringMaximium;
|
||||
bool m_progressBarNewServerConfiguringTextVisible;
|
||||
QString m_progressBarNewServerConfiguringText;
|
||||
|
||||
};
|
||||
#endif // NEW_SERVER_CONFIGURING_LOGIC_H
|
||||
|
|
|
@ -5,7 +5,281 @@ using namespace PageEnumNS;
|
|||
|
||||
NewServerProtocolsLogic::NewServerProtocolsLogic(UiLogic *uiLogic, QObject *parent):
|
||||
QObject(parent),
|
||||
m_uiLogic(uiLogic)
|
||||
m_uiLogic(uiLogic),
|
||||
m_pushButtonNewServerSettingsCloakChecked{false},
|
||||
m_pushButtonNewServerSettingsSsChecked{false},
|
||||
m_pushButtonNewServerSettingsOpenvpnChecked{false},
|
||||
m_lineEditNewServerCloakPortText{},
|
||||
m_lineEditNewServerCloakSiteText{},
|
||||
m_lineEditNewServerSsPortText{},
|
||||
m_comboBoxNewServerSsCipherText{"chacha20-ietf-poly1305"},
|
||||
m_lineEditNewServerOpenvpnPortText{},
|
||||
m_comboBoxNewServerOpenvpnProtoText{"udp"},
|
||||
m_frameNewServerSettingsParentWireguardVisible{false},
|
||||
m_checkBoxNewServerCloakChecked{true},
|
||||
m_checkBoxNewServerSsChecked{false},
|
||||
m_checkBoxNewServerOpenvpnChecked{false},
|
||||
m_progressBarNewServerConnectionMinimum{0},
|
||||
m_progressBarNewServerConnectionMaximum{100}
|
||||
{
|
||||
setFrameNewServerSettingsParentWireguardVisible(false);
|
||||
|
||||
}
|
||||
|
||||
bool NewServerProtocolsLogic::getFrameNewServerSettingsParentWireguardVisible() const
|
||||
{
|
||||
return m_frameNewServerSettingsParentWireguardVisible;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setFrameNewServerSettingsParentWireguardVisible(bool frameNewServerSettingsParentWireguardVisible)
|
||||
{
|
||||
if (m_frameNewServerSettingsParentWireguardVisible != frameNewServerSettingsParentWireguardVisible) {
|
||||
m_frameNewServerSettingsParentWireguardVisible = frameNewServerSettingsParentWireguardVisible;
|
||||
emit frameNewServerSettingsParentWireguardVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void NewServerProtocolsLogic::updateNewServerProtocolsPage()
|
||||
{
|
||||
setProgressBarNewServerConnectionMinimum(0);
|
||||
setProgressBarNewServerConnectionMaximum(300);
|
||||
|
||||
setPushButtonNewServerSettingsCloakChecked(true);
|
||||
setPushButtonNewServerSettingsCloakChecked(false);
|
||||
setPushButtonNewServerSettingsSsChecked(true);
|
||||
setPushButtonNewServerSettingsSsChecked(false);
|
||||
setLineEditNewServerCloakPortText(amnezia::protocols::cloak::defaultPort);
|
||||
setLineEditNewServerCloakSiteText(amnezia::protocols::cloak::defaultRedirSite);
|
||||
setLineEditNewServerSsPortText(amnezia::protocols::shadowsocks::defaultPort);
|
||||
setComboBoxNewServerSsCipherText(amnezia::protocols::shadowsocks::defaultCipher);
|
||||
setLineEditNewServerOpenvpnPortText(amnezia::protocols::openvpn::defaultPort);
|
||||
setComboBoxNewServerOpenvpnProtoText(amnezia::protocols::openvpn::defaultTransportProto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
QString NewServerProtocolsLogic::getComboBoxNewServerOpenvpnProtoText() const
|
||||
{
|
||||
return m_comboBoxNewServerOpenvpnProtoText;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setComboBoxNewServerOpenvpnProtoText(const QString &comboBoxNewServerOpenvpnProtoText)
|
||||
{
|
||||
if (m_comboBoxNewServerOpenvpnProtoText != comboBoxNewServerOpenvpnProtoText) {
|
||||
m_comboBoxNewServerOpenvpnProtoText = comboBoxNewServerOpenvpnProtoText;
|
||||
emit comboBoxNewServerOpenvpnProtoTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString NewServerProtocolsLogic::getLineEditNewServerCloakSiteText() const
|
||||
{
|
||||
return m_lineEditNewServerCloakSiteText;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setLineEditNewServerCloakSiteText(const QString &lineEditNewServerCloakSiteText)
|
||||
{
|
||||
if (m_lineEditNewServerCloakSiteText != lineEditNewServerCloakSiteText) {
|
||||
m_lineEditNewServerCloakSiteText = lineEditNewServerCloakSiteText;
|
||||
emit lineEditNewServerCloakSiteTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString NewServerProtocolsLogic::getLineEditNewServerSsPortText() const
|
||||
{
|
||||
return m_lineEditNewServerSsPortText;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setLineEditNewServerSsPortText(const QString &lineEditNewServerSsPortText)
|
||||
{
|
||||
if (m_lineEditNewServerSsPortText != lineEditNewServerSsPortText) {
|
||||
m_lineEditNewServerSsPortText = lineEditNewServerSsPortText;
|
||||
emit lineEditNewServerSsPortTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString NewServerProtocolsLogic::getComboBoxNewServerSsCipherText() const
|
||||
{
|
||||
return m_comboBoxNewServerSsCipherText;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setComboBoxNewServerSsCipherText(const QString &comboBoxNewServerSsCipherText)
|
||||
{
|
||||
if (m_comboBoxNewServerSsCipherText != comboBoxNewServerSsCipherText) {
|
||||
m_comboBoxNewServerSsCipherText = comboBoxNewServerSsCipherText;
|
||||
emit comboBoxNewServerSsCipherTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString NewServerProtocolsLogic::getlineEditNewServerOpenvpnPortText() const
|
||||
{
|
||||
return m_lineEditNewServerOpenvpnPortText;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setLineEditNewServerOpenvpnPortText(const QString &lineEditNewServerOpenvpnPortText)
|
||||
{
|
||||
if (m_lineEditNewServerOpenvpnPortText != lineEditNewServerOpenvpnPortText) {
|
||||
m_lineEditNewServerOpenvpnPortText = lineEditNewServerOpenvpnPortText;
|
||||
emit lineEditNewServerOpenvpnPortTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool NewServerProtocolsLogic::getPushButtonNewServerSettingsSsChecked() const
|
||||
{
|
||||
return m_pushButtonNewServerSettingsSsChecked;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setPushButtonNewServerSettingsSsChecked(bool pushButtonNewServerSettingsSsChecked)
|
||||
{
|
||||
if (m_pushButtonNewServerSettingsSsChecked != pushButtonNewServerSettingsSsChecked) {
|
||||
m_pushButtonNewServerSettingsSsChecked = pushButtonNewServerSettingsSsChecked;
|
||||
emit pushButtonNewServerSettingsSsCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool NewServerProtocolsLogic::getPushButtonNewServerSettingsOpenvpnChecked() const
|
||||
{
|
||||
return m_pushButtonNewServerSettingsOpenvpnChecked;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setPushButtonNewServerSettingsOpenvpnChecked(bool pushButtonNewServerSettingsOpenvpnChecked)
|
||||
{
|
||||
if (m_pushButtonNewServerSettingsOpenvpnChecked != pushButtonNewServerSettingsOpenvpnChecked) {
|
||||
m_pushButtonNewServerSettingsOpenvpnChecked = pushButtonNewServerSettingsOpenvpnChecked;
|
||||
emit pushButtonNewServerSettingsOpenvpnCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString NewServerProtocolsLogic::getLineEditNewServerCloakPortText() const
|
||||
{
|
||||
return m_lineEditNewServerCloakPortText;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setLineEditNewServerCloakPortText(const QString &lineEditNewServerCloakPortText)
|
||||
{
|
||||
if (m_lineEditNewServerCloakPortText != lineEditNewServerCloakPortText) {
|
||||
m_lineEditNewServerCloakPortText = lineEditNewServerCloakPortText;
|
||||
emit lineEditNewServerCloakPortTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool NewServerProtocolsLogic::getPushButtonNewServerSettingsCloakChecked() const
|
||||
{
|
||||
return m_pushButtonNewServerSettingsCloakChecked;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setPushButtonNewServerSettingsCloakChecked(bool pushButtonNewServerSettingsCloakChecked)
|
||||
{
|
||||
if (m_pushButtonNewServerSettingsCloakChecked != pushButtonNewServerSettingsCloakChecked) {
|
||||
m_pushButtonNewServerSettingsCloakChecked = pushButtonNewServerSettingsCloakChecked;
|
||||
emit pushButtonNewServerSettingsCloakCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool NewServerProtocolsLogic::getCheckBoxNewServerCloakChecked() const
|
||||
{
|
||||
return m_checkBoxNewServerCloakChecked;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setCheckBoxNewServerCloakChecked(bool checkBoxNewServerCloakChecked)
|
||||
{
|
||||
if (m_checkBoxNewServerCloakChecked != checkBoxNewServerCloakChecked) {
|
||||
m_checkBoxNewServerCloakChecked = checkBoxNewServerCloakChecked;
|
||||
emit checkBoxNewServerCloakCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool NewServerProtocolsLogic::getCheckBoxNewServerSsChecked() const
|
||||
{
|
||||
return m_checkBoxNewServerSsChecked;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setCheckBoxNewServerSsChecked(bool checkBoxNewServerSsChecked)
|
||||
{
|
||||
if (m_checkBoxNewServerSsChecked != checkBoxNewServerSsChecked) {
|
||||
m_checkBoxNewServerSsChecked = checkBoxNewServerSsChecked;
|
||||
emit checkBoxNewServerSsCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool NewServerProtocolsLogic::getCheckBoxNewServerOpenvpnChecked() const
|
||||
{
|
||||
return m_checkBoxNewServerOpenvpnChecked;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setCheckBoxNewServerOpenvpnChecked(bool checkBoxNewServerOpenvpnChecked)
|
||||
{
|
||||
if (m_checkBoxNewServerOpenvpnChecked != checkBoxNewServerOpenvpnChecked) {
|
||||
m_checkBoxNewServerOpenvpnChecked = checkBoxNewServerOpenvpnChecked;
|
||||
emit checkBoxNewServerOpenvpnCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
double NewServerProtocolsLogic::getProgressBarNewServerConnectionMinimum() const
|
||||
{
|
||||
return m_progressBarNewServerConnectionMinimum;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setProgressBarNewServerConnectionMinimum(double progressBarNewServerConnectionMinimum)
|
||||
{
|
||||
if (m_progressBarNewServerConnectionMinimum != progressBarNewServerConnectionMinimum) {
|
||||
m_progressBarNewServerConnectionMinimum = progressBarNewServerConnectionMinimum;
|
||||
emit progressBarNewServerConnectionMinimumChanged();
|
||||
}
|
||||
}
|
||||
|
||||
double NewServerProtocolsLogic::getProgressBarNewServerConnectionMaximum() const
|
||||
{
|
||||
return m_progressBarNewServerConnectionMaximum;
|
||||
}
|
||||
|
||||
void NewServerProtocolsLogic::setProgressBarNewServerConnectionMaximum(double progressBarNewServerConnectionMaximum)
|
||||
{
|
||||
if (m_progressBarNewServerConnectionMaximum != progressBarNewServerConnectionMaximum) {
|
||||
m_progressBarNewServerConnectionMaximum = progressBarNewServerConnectionMaximum;
|
||||
emit progressBarNewServerConnectionMaximumChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QMap<DockerContainer, QJsonObject> NewServerProtocolsLogic::getInstallConfigsFromProtocolsPage() const
|
||||
{
|
||||
QJsonObject cloakConfig {
|
||||
{ config_key::container, amnezia::containerToString(DockerContainer::OpenVpnOverCloak) },
|
||||
{ config_key::cloak, QJsonObject {
|
||||
{ config_key::port, getLineEditNewServerCloakPortText() },
|
||||
{ config_key::site, getLineEditNewServerCloakSiteText() }}
|
||||
}
|
||||
};
|
||||
QJsonObject ssConfig {
|
||||
{ config_key::container, amnezia::containerToString(DockerContainer::OpenVpnOverShadowSocks) },
|
||||
{ config_key::shadowsocks, QJsonObject {
|
||||
{ config_key::port, getLineEditNewServerSsPortText() },
|
||||
{ config_key::cipher, getComboBoxNewServerSsCipherText() }}
|
||||
}
|
||||
};
|
||||
QJsonObject openVpnConfig {
|
||||
{ config_key::container, amnezia::containerToString(DockerContainer::OpenVpn) },
|
||||
{ config_key::openvpn, QJsonObject {
|
||||
{ config_key::port, getlineEditNewServerOpenvpnPortText() },
|
||||
{ config_key::transport_proto, getComboBoxNewServerOpenvpnProtoText() }}
|
||||
}
|
||||
};
|
||||
|
||||
QMap<DockerContainer, QJsonObject> containers;
|
||||
|
||||
if (getCheckBoxNewServerCloakChecked()) {
|
||||
containers.insert(DockerContainer::OpenVpnOverCloak, cloakConfig);
|
||||
}
|
||||
|
||||
if (getCheckBoxNewServerSsChecked()) {
|
||||
containers.insert(DockerContainer::OpenVpnOverShadowSocks, ssConfig);
|
||||
}
|
||||
|
||||
if (getCheckBoxNewServerOpenvpnChecked()) {
|
||||
containers.insert(DockerContainer::OpenVpn, openVpnConfig);
|
||||
}
|
||||
|
||||
return containers;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,9 @@ class NewServerProtocolsLogic : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_INVOKABLE void updateNewServerProtocolsPage();
|
||||
|
||||
Q_PROPERTY(bool frameNewServerSettingsParentWireguardVisible READ getFrameNewServerSettingsParentWireguardVisible WRITE setFrameNewServerSettingsParentWireguardVisible NOTIFY frameNewServerSettingsParentWireguardVisibleChanged)
|
||||
Q_PROPERTY(double progressBarNewServerConfiguringValue READ getProgressBarNewServerConfiguringValue WRITE setProgressBarNewServerConfiguringValue NOTIFY progressBarNewServerConfiguringValueChanged)
|
||||
Q_PROPERTY(bool pushButtonNewServerSettingsCloakChecked READ getPushButtonNewServerSettingsCloakChecked WRITE setPushButtonNewServerSettingsCloakChecked NOTIFY pushButtonNewServerSettingsCloakCheckedChanged)
|
||||
Q_PROPERTY(bool pushButtonNewServerSettingsSsChecked READ getPushButtonNewServerSettingsSsChecked WRITE setPushButtonNewServerSettingsSsChecked NOTIFY pushButtonNewServerSettingsSsCheckedChanged)
|
||||
Q_PROPERTY(bool pushButtonNewServerSettingsOpenvpnChecked READ getPushButtonNewServerSettingsOpenvpnChecked WRITE setPushButtonNewServerSettingsOpenvpnChecked NOTIFY pushButtonNewServerSettingsOpenvpnCheckedChanged)
|
||||
|
@ -25,14 +26,69 @@ public:
|
|||
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(double progressBarNewServerConnectionMinimum READ getProgressBarNewServerConnectionMinimum WRITE setProgressBarNewServerConnectionMinimum NOTIFY progressBarNewServerConnectionMinimumChanged)
|
||||
Q_PROPERTY(double progressBarNewServerConnectionMaximum READ getProgressBarNewServerConnectionMaximum WRITE setProgressBarNewServerConnectionMaximum NOTIFY progressBarNewServerConnectionMaximumChanged)
|
||||
|
||||
public:
|
||||
explicit NewServerProtocolsLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~NewServerProtocolsLogic() = default;
|
||||
|
||||
QMap<DockerContainer, QJsonObject> getInstallConfigsFromProtocolsPage() const;
|
||||
|
||||
bool getFrameNewServerSettingsParentWireguardVisible() const;
|
||||
void setFrameNewServerSettingsParentWireguardVisible(bool frameNewServerSettingsParentWireguardVisible);
|
||||
|
||||
bool getPushButtonNewServerSettingsCloakChecked() const;
|
||||
void setPushButtonNewServerSettingsCloakChecked(bool pushButtonNewServerSettingsCloakChecked);
|
||||
bool getPushButtonNewServerSettingsSsChecked() const;
|
||||
void setPushButtonNewServerSettingsSsChecked(bool pushButtonNewServerSettingsSsChecked);
|
||||
bool getPushButtonNewServerSettingsOpenvpnChecked() const;
|
||||
void setPushButtonNewServerSettingsOpenvpnChecked(bool pushButtonNewServerSettingsOpenvpnChecked);
|
||||
QString getLineEditNewServerCloakPortText() const;
|
||||
void setLineEditNewServerCloakPortText(const QString &lineEditNewServerCloakPortText);
|
||||
QString getLineEditNewServerCloakSiteText() const;
|
||||
void setLineEditNewServerCloakSiteText(const QString &lineEditNewServerCloakSiteText);
|
||||
QString getLineEditNewServerSsPortText() const;
|
||||
void setLineEditNewServerSsPortText(const QString &lineEditNewServerSsPortText);
|
||||
QString getComboBoxNewServerSsCipherText() const;
|
||||
void setComboBoxNewServerSsCipherText(const QString &comboBoxNewServerSsCipherText);
|
||||
QString getlineEditNewServerOpenvpnPortText() const;
|
||||
void setLineEditNewServerOpenvpnPortText(const QString &lineEditNewServerOpenvpnPortText);
|
||||
QString getComboBoxNewServerOpenvpnProtoText() const;
|
||||
void setComboBoxNewServerOpenvpnProtoText(const QString &comboBoxNewServerOpenvpnProtoText);
|
||||
|
||||
bool getCheckBoxNewServerCloakChecked() const;
|
||||
void setCheckBoxNewServerCloakChecked(bool checkBoxNewServerCloakChecked);
|
||||
bool getCheckBoxNewServerSsChecked() const;
|
||||
void setCheckBoxNewServerSsChecked(bool checkBoxNewServerSsChecked);
|
||||
bool getCheckBoxNewServerOpenvpnChecked() const;
|
||||
void setCheckBoxNewServerOpenvpnChecked(bool checkBoxNewServerOpenvpnChecked);
|
||||
|
||||
double getProgressBarNewServerConnectionMinimum() const;
|
||||
void setProgressBarNewServerConnectionMinimum(double progressBarNewServerConnectionMinimum);
|
||||
double getProgressBarNewServerConnectionMaximum() const;
|
||||
void setProgressBarNewServerConnectionMaximum(double progressBarNewServerConnectionMaximum);
|
||||
|
||||
signals:
|
||||
void frameNewServerSettingsParentWireguardVisibleChanged();
|
||||
void pushButtonNewServerConnectConfigureClicked();
|
||||
|
||||
void pushButtonNewServerSettingsCloakCheckedChanged();
|
||||
void pushButtonNewServerSettingsSsCheckedChanged();
|
||||
void pushButtonNewServerSettingsOpenvpnCheckedChanged();
|
||||
void lineEditNewServerCloakPortTextChanged();
|
||||
void lineEditNewServerCloakSiteTextChanged();
|
||||
void lineEditNewServerSsPortTextChanged();
|
||||
void comboBoxNewServerSsCipherTextChanged();
|
||||
void lineEditNewServerOpenvpnPortTextChanged();
|
||||
void comboBoxNewServerOpenvpnProtoTextChanged();
|
||||
|
||||
void checkBoxNewServerCloakCheckedChanged();
|
||||
void checkBoxNewServerSsCheckedChanged();
|
||||
void checkBoxNewServerOpenvpnCheckedChanged();
|
||||
|
||||
void progressBarNewServerConnectionMinimumChanged();
|
||||
void progressBarNewServerConnectionMaximumChanged();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -45,7 +101,23 @@ private:
|
|||
Settings m_settings;
|
||||
UiLogic *m_uiLogic;
|
||||
|
||||
bool m_frameNewServerSettingsParentWireguardVisible;
|
||||
|
||||
bool m_pushButtonNewServerSettingsCloakChecked;
|
||||
bool m_pushButtonNewServerSettingsSsChecked;
|
||||
bool m_pushButtonNewServerSettingsOpenvpnChecked;
|
||||
QString m_lineEditNewServerCloakPortText;
|
||||
QString m_lineEditNewServerCloakSiteText;
|
||||
QString m_lineEditNewServerSsPortText;
|
||||
QString m_comboBoxNewServerSsCipherText;
|
||||
QString m_lineEditNewServerOpenvpnPortText;
|
||||
QString m_comboBoxNewServerOpenvpnProtoText;
|
||||
|
||||
bool m_checkBoxNewServerCloakChecked;
|
||||
bool m_checkBoxNewServerSsChecked;
|
||||
bool m_checkBoxNewServerOpenvpnChecked;
|
||||
|
||||
double m_progressBarNewServerConnectionMinimum;
|
||||
double m_progressBarNewServerConnectionMaximum;
|
||||
};
|
||||
#endif // NEW_SERVER_PROTOCOLS_LOGIC_H
|
||||
|
|
|
@ -19,8 +19,6 @@ StartPageLogic::StartPageLogic(UiLogic *uiLogic, QObject *parent):
|
|||
m_lineEditNewServerLoginText{},
|
||||
m_labelNewServerWaitInfoVisible{true},
|
||||
m_labelNewServerWaitInfoText{},
|
||||
m_progressBarNewServerConnectionMinimum{0},
|
||||
m_progressBarNewServerConnectionMaximum{100},
|
||||
m_pushButtonBackFromStartVisible{true},
|
||||
m_pushButtonNewServerConnectVisible{true}
|
||||
{
|
||||
|
@ -38,8 +36,6 @@ void StartPageLogic::updateStartPage()
|
|||
|
||||
setLabelNewServerWaitInfoVisible(false);
|
||||
setLabelNewServerWaitInfoText("");
|
||||
setProgressBarNewServerConnectionMinimum(0);
|
||||
setProgressBarNewServerConnectionMaximum(300);
|
||||
setPushButtonNewServerConnectVisible(true);
|
||||
}
|
||||
|
||||
|
@ -147,32 +143,6 @@ void StartPageLogic::setLabelNewServerWaitInfoText(const QString &labelNewServer
|
|||
}
|
||||
}
|
||||
|
||||
double StartPageLogic::getProgressBarNewServerConnectionMinimum() const
|
||||
{
|
||||
return m_progressBarNewServerConnectionMinimum;
|
||||
}
|
||||
|
||||
void StartPageLogic::setProgressBarNewServerConnectionMinimum(double progressBarNewServerConnectionMinimum)
|
||||
{
|
||||
if (m_progressBarNewServerConnectionMinimum != progressBarNewServerConnectionMinimum) {
|
||||
m_progressBarNewServerConnectionMinimum = progressBarNewServerConnectionMinimum;
|
||||
emit progressBarNewServerConnectionMinimumChanged();
|
||||
}
|
||||
}
|
||||
|
||||
double StartPageLogic::getProgressBarNewServerConnectionMaximum() const
|
||||
{
|
||||
return m_progressBarNewServerConnectionMaximum;
|
||||
}
|
||||
|
||||
void StartPageLogic::setProgressBarNewServerConnectionMaximum(double progressBarNewServerConnectionMaximum)
|
||||
{
|
||||
if (m_progressBarNewServerConnectionMaximum != progressBarNewServerConnectionMaximum) {
|
||||
m_progressBarNewServerConnectionMaximum = progressBarNewServerConnectionMaximum;
|
||||
emit progressBarNewServerConnectionMaximumChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool StartPageLogic::getPushButtonNewServerConnectVisible() const
|
||||
{
|
||||
return m_pushButtonNewServerConnectVisible;
|
||||
|
|
|
@ -23,8 +23,6 @@ public:
|
|||
Q_PROPERTY(QString lineEditNewServerLoginText READ getLineEditNewServerLoginText WRITE setLineEditNewServerLoginText NOTIFY lineEditNewServerLoginTextChanged)
|
||||
Q_PROPERTY(bool labelNewServerWaitInfoVisible READ getLabelNewServerWaitInfoVisible WRITE setLabelNewServerWaitInfoVisible NOTIFY labelNewServerWaitInfoVisibleChanged)
|
||||
Q_PROPERTY(QString labelNewServerWaitInfoText READ getLabelNewServerWaitInfoText WRITE setLabelNewServerWaitInfoText NOTIFY labelNewServerWaitInfoTextChanged)
|
||||
Q_PROPERTY(double progressBarNewServerConnectionMinimum READ getProgressBarNewServerConnectionMinimum WRITE setProgressBarNewServerConnectionMinimum NOTIFY progressBarNewServerConnectionMinimumChanged)
|
||||
Q_PROPERTY(double progressBarNewServerConnectionMaximum READ getProgressBarNewServerConnectionMaximum WRITE setProgressBarNewServerConnectionMaximum NOTIFY progressBarNewServerConnectionMaximumChanged)
|
||||
Q_PROPERTY(bool pushButtonBackFromStartVisible READ getPushButtonBackFromStartVisible WRITE setPushButtonBackFromStartVisible NOTIFY pushButtonBackFromStartVisibleChanged)
|
||||
Q_PROPERTY(bool pushButtonNewServerConnectVisible READ getPushButtonNewServerConnectVisible WRITE setPushButtonNewServerConnectVisible NOTIFY pushButtonNewServerConnectVisibleChanged)
|
||||
|
||||
|
@ -58,10 +56,6 @@ public:
|
|||
void setLabelNewServerWaitInfoVisible(bool labelNewServerWaitInfoVisible);
|
||||
QString getLabelNewServerWaitInfoText() const;
|
||||
void setLabelNewServerWaitInfoText(const QString &labelNewServerWaitInfoText);
|
||||
double getProgressBarNewServerConnectionMinimum() const;
|
||||
void setProgressBarNewServerConnectionMinimum(double progressBarNewServerConnectionMinimum);
|
||||
double getProgressBarNewServerConnectionMaximum() const;
|
||||
void setProgressBarNewServerConnectionMaximum(double progressBarNewServerConnectionMaximum);
|
||||
|
||||
QString getPushButtonNewServerConnectText() const;
|
||||
void setPushButtonNewServerConnectText(const QString &pushButtonNewServerConnectText);
|
||||
|
@ -75,8 +69,6 @@ signals:
|
|||
void lineEditNewServerLoginTextChanged();
|
||||
void labelNewServerWaitInfoVisibleChanged();
|
||||
void labelNewServerWaitInfoTextChanged();
|
||||
void progressBarNewServerConnectionMinimumChanged();
|
||||
void progressBarNewServerConnectionMaximumChanged();
|
||||
void pushButtonBackFromStartVisibleChanged();
|
||||
void pushButtonNewServerConnectVisibleChanged();
|
||||
void pushButtonNewServerConnectEnabledChanged();
|
||||
|
@ -103,8 +95,6 @@ private:
|
|||
QString m_lineEditNewServerLoginText;
|
||||
bool m_labelNewServerWaitInfoVisible;
|
||||
QString m_labelNewServerWaitInfoText;
|
||||
double m_progressBarNewServerConnectionMinimum;
|
||||
double m_progressBarNewServerConnectionMaximum;
|
||||
bool m_pushButtonBackFromStartVisible;
|
||||
bool m_pushButtonNewServerConnectVisible;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ import "../Config"
|
|||
|
||||
Item {
|
||||
id: root
|
||||
enabled: UiLogic.pageNewServerConfiguringEnabled
|
||||
enabled: NewServerConfiguringLogic.pageNewServerConfiguringEnabled
|
||||
Text {
|
||||
font.family: "Lato"
|
||||
font.styleName: "normal"
|
||||
|
@ -32,8 +32,8 @@ Item {
|
|||
y: 560
|
||||
width: 301
|
||||
height: 41
|
||||
text: UiLogic.labelNewServerConfiguringWaitInfoText
|
||||
visible: UiLogic.labelNewServerConfiguringWaitInfoVisible
|
||||
text: NewServerConfiguringLogic.labelNewServerConfiguringWaitInfoText
|
||||
visible: NewServerConfiguringLogic.labelNewServerConfiguringWaitInfoVisible
|
||||
}
|
||||
ProgressBar {
|
||||
id: pr
|
||||
|
@ -42,9 +42,9 @@ Item {
|
|||
width: 301
|
||||
height: 40
|
||||
from: 0
|
||||
to: UiLogic.progressBarNewServerConfiguringMaximium
|
||||
value: UiLogic.progressBarNewServerConfiguringValue
|
||||
visible: UiLogic.progressBarNewServerConfiguringVisible
|
||||
to: NewServerConfiguringLogic.progressBarNewServerConfiguringMaximium
|
||||
value: NewServerConfiguringLogic.progressBarNewServerConfiguringValue
|
||||
visible: NewServerConfiguringLogic.progressBarNewServerConfiguringVisible
|
||||
background: Rectangle {
|
||||
implicitWidth: parent.width
|
||||
implicitHeight: parent.height
|
||||
|
@ -65,13 +65,13 @@ Item {
|
|||
|
||||
LabelType {
|
||||
anchors.fill: parent
|
||||
text: UiLogic.progressBarNewServerConfiguringText
|
||||
text: NewServerConfiguringLogic.progressBarNewServerConfiguringText
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.family: "Lato"
|
||||
font.styleName: "normal"
|
||||
font.pixelSize: 16
|
||||
color: "#D4D4D4"
|
||||
visible: UiLogic.progressBarNewServerConfiguringTextVisible
|
||||
visible: NewServerConfiguringLogic.progressBarNewServerConfiguringTextVisible
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,8 +36,8 @@ Item {
|
|||
y: 570
|
||||
width: 301
|
||||
height: 40
|
||||
from: UiLogic.progressBarNewServerConnectionMinimum
|
||||
to: UiLogic.progressBarNewServerConnectionMaximum
|
||||
from: NewServerProtocolsLogic.progressBarNewServerConnectionMinimum
|
||||
to: NewServerProtocolsLogic.progressBarNewServerConnectionMaximum
|
||||
value: 0
|
||||
background: Rectangle {
|
||||
implicitWidth: parent.width
|
||||
|
@ -74,7 +74,7 @@ Item {
|
|||
height: 40
|
||||
text: qsTr("Setup server")
|
||||
onClicked: {
|
||||
UiLogic.pushButtonNewServerConnectConfigureClicked()
|
||||
NewServerProtocolsLogic.pushButtonNewServerConnectConfigureClicked()
|
||||
}
|
||||
}
|
||||
ScrollView {
|
||||
|
@ -120,9 +120,9 @@ Item {
|
|||
TextFieldType {
|
||||
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
||||
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
||||
text: UiLogic.lineEditNewServerCloakPortText
|
||||
text: NewServerProtocolsLogic.lineEditNewServerCloakPortText
|
||||
onEditingFinished: {
|
||||
UiLogic.lineEditNewServerCloakPortText = text
|
||||
NewServerProtocolsLogic.lineEditNewServerCloakPortText = text
|
||||
}
|
||||
}
|
||||
LabelType {
|
||||
|
@ -133,9 +133,9 @@ Item {
|
|||
TextFieldType {
|
||||
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
||||
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
||||
text: UiLogic.lineEditNewServerCloakSiteText
|
||||
text: NewServerProtocolsLogic.lineEditNewServerCloakSiteText
|
||||
onEditingFinished: {
|
||||
UiLogic.lineEditNewServerCloakSiteText = text
|
||||
NewServerProtocolsLogic.lineEditNewServerCloakSiteText = text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,9 +151,9 @@ Item {
|
|||
text: qsTr("OpenVPN and ShadowSocks\n with masking using Cloak plugin")
|
||||
height: parent.height
|
||||
width: 308
|
||||
checked: UiLogic.checkBoxNewServerCloakChecked
|
||||
checked: NewServerProtocolsLogic.checkBoxNewServerCloakChecked
|
||||
onCheckedChanged: {
|
||||
UiLogic.checkBoxNewServerCloakChecked = checked
|
||||
NewServerProtocolsLogic.checkBoxNewServerCloakChecked = checked
|
||||
}
|
||||
}
|
||||
ImageButtonType {
|
||||
|
@ -162,9 +162,9 @@ Item {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
icon.source: "qrc:/images/settings.png"
|
||||
checkable: true
|
||||
checked: UiLogic.pushButtonNewServerSettingsCloakChecked
|
||||
checked: NewServerProtocolsLogic.pushButtonNewServerSettingsCloakChecked
|
||||
onCheckedChanged: {
|
||||
UiLogic.pushButtonNewServerSettingsCloakChecked = checked
|
||||
NewServerProtocolsLogic.pushButtonNewServerSettingsCloakChecked = checked
|
||||
if (checked) {
|
||||
frame_new_server_setting_cloak.visible = true
|
||||
} else {
|
||||
|
@ -209,9 +209,9 @@ Item {
|
|||
TextFieldType {
|
||||
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
||||
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
||||
text: UiLogic.lineEditNewServerSsPortText
|
||||
text: NewServerProtocolsLogic.lineEditNewServerSsPortText
|
||||
onEditingFinished: {
|
||||
UiLogic.lineEditNewServerSsPortText = text
|
||||
NewServerProtocolsLogic.lineEditNewServerSsPortText = text
|
||||
}
|
||||
}
|
||||
LabelType {
|
||||
|
@ -231,14 +231,14 @@ Item {
|
|||
]
|
||||
currentIndex: {
|
||||
for (let i = 0; i < model.length; ++i) {
|
||||
if (UiLogic.comboBoxNewServerSsCipherText === model[i]) {
|
||||
if (NewServerProtocolsLogic.comboBoxNewServerSsCipherText === model[i]) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
onCurrentTextChanged: {
|
||||
UiLogic.comboBoxNewServerSsCipherText = currentText
|
||||
NewServerProtocolsLogic.comboBoxNewServerSsCipherText = currentText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -254,9 +254,9 @@ Item {
|
|||
text: qsTr("ShadowSocks")
|
||||
height: parent.height
|
||||
width: 308
|
||||
checked: UiLogic.checkBoxNewServerSsChecked
|
||||
checked: NewServerProtocolsLogic.checkBoxNewServerSsChecked
|
||||
onCheckedChanged: {
|
||||
UiLogic.checkBoxNewServerSsChecked = checked
|
||||
NewServerProtocolsLogic.checkBoxNewServerSsChecked = checked
|
||||
}
|
||||
}
|
||||
ImageButtonType {
|
||||
|
@ -264,10 +264,10 @@ Item {
|
|||
height: 35
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
icon.source: "qrc:/images/settings.png"
|
||||
checked: UiLogic.pushButtonNewServerSettingsSsChecked
|
||||
checked: NewServerProtocolsLogic.pushButtonNewServerSettingsSsChecked
|
||||
checkable: true
|
||||
onCheckedChanged: {
|
||||
UiLogic.pushButtonNewServerSettingsSsChecked = checked
|
||||
NewServerProtocolsLogic.pushButtonNewServerSettingsSsChecked = checked
|
||||
if (checked) {
|
||||
frame_new_server_settings_ss.visible = true
|
||||
} else {
|
||||
|
@ -312,9 +312,9 @@ Item {
|
|||
TextFieldType {
|
||||
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
||||
height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
||||
text: UiLogic.lineEditNewServerOpenvpnPortText
|
||||
text: NewServerProtocolsLogic.lineEditNewServerOpenvpnPortText
|
||||
onEditingFinished: {
|
||||
UiLogic.lineEditNewServerOpenvpnPortText = text
|
||||
NewServerProtocolsLogic.lineEditNewServerOpenvpnPortText = text
|
||||
}
|
||||
}
|
||||
LabelType {
|
||||
|
@ -331,14 +331,14 @@ Item {
|
|||
]
|
||||
currentIndex: {
|
||||
for (let i = 0; i < model.length; ++i) {
|
||||
if (UiLogic.comboBoxNewServerOpenvpnProtoText === model[i]) {
|
||||
if (NewServerProtocolsLogic.comboBoxNewServerOpenvpnProtoText === model[i]) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
onCurrentTextChanged: {
|
||||
UiLogic.comboBoxNewServerOpenvpnProtoText = currentText
|
||||
NewServerProtocolsLogic.comboBoxNewServerOpenvpnProtoText = currentText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -354,9 +354,9 @@ Item {
|
|||
text: qsTr("OpenVPN")
|
||||
height: parent.height
|
||||
width: 308
|
||||
checked: UiLogic.checkBoxNewServerOpenvpnChecked
|
||||
checked: NewServerProtocolsLogic.checkBoxNewServerOpenvpnChecked
|
||||
onCheckedChanged: {
|
||||
UiLogic.checkBoxNewServerOpenvpnChecked = checked
|
||||
NewServerProtocolsLogic.checkBoxNewServerOpenvpnChecked = checked
|
||||
}
|
||||
}
|
||||
ImageButtonType {
|
||||
|
@ -364,10 +364,10 @@ Item {
|
|||
height: 35
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
icon.source: "qrc:/images/settings.png"
|
||||
checked: UiLogic.pushButtonNewServerSettingsOpenvpnChecked
|
||||
checked: NewServerProtocolsLogic.pushButtonNewServerSettingsOpenvpnChecked
|
||||
checkable: true
|
||||
onCheckedChanged: {
|
||||
UiLogic.pushButtonNewServerSettingsOpenvpnChecked = checked
|
||||
NewServerProtocolsLogic.pushButtonNewServerSettingsOpenvpnChecked = checked
|
||||
if (checked) {
|
||||
frame_new_server_settings_openvpn.visible = true
|
||||
} else {
|
||||
|
@ -379,7 +379,7 @@ Item {
|
|||
}
|
||||
Rectangle {
|
||||
id: frame_new_server_settings_parent_wireguard
|
||||
visible: UiLogic.frameNewServerSettingsParentWireguardVisible
|
||||
visible: NewServerProtocolsLogic.frameNewServerSettingsParentWireguardVisible
|
||||
x: 5
|
||||
y: 5
|
||||
width: 368
|
||||
|
|
|
@ -167,7 +167,7 @@ Window {
|
|||
StartPageLogic.updateStartPage();
|
||||
}
|
||||
if (page === PageEnum.NewServerProtocols) {
|
||||
UiLogic.updateNewServerProtocolsPage()
|
||||
NewServerProtocolsLogic.updateNewServerProtocolsPage()
|
||||
}
|
||||
if (page === PageEnum.ServerVpnProtocols) {
|
||||
UiLogic.updateProtocolsPage()
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "pages_logic/AppSettingsLogic.h"
|
||||
#include "pages_logic/GeneralSettingsLogic.h"
|
||||
#include "pages_logic/NetworkSettingsLogic.h"
|
||||
#include "pages_logic/NewServerConfiguringLogic.h"
|
||||
#include "pages_logic/NewServerProtocolsLogic.h"
|
||||
#include "pages_logic/ProtocolSettingsLogic.h"
|
||||
#include "pages_logic/ServerListLogic.h"
|
||||
|
@ -70,18 +71,8 @@ UiLogic::UiLogic(QObject *parent) :
|
|||
QObject(parent),
|
||||
m_frameWireguardSettingsVisible{false},
|
||||
m_frameWireguardVisible{false},
|
||||
m_frameNewServerSettingsParentWireguardVisible{false},
|
||||
|
||||
m_progressBarNewServerConfiguringValue{0},
|
||||
m_pushButtonNewServerSettingsCloakChecked{false},
|
||||
m_pushButtonNewServerSettingsSsChecked{false},
|
||||
m_pushButtonNewServerSettingsOpenvpnChecked{false},
|
||||
m_lineEditNewServerCloakPortText{},
|
||||
m_lineEditNewServerCloakSiteText{},
|
||||
m_lineEditNewServerSsPortText{},
|
||||
m_comboBoxNewServerSsCipherText{"chacha20-ietf-poly1305"},
|
||||
m_lineEditNewServerOpenvpnPortText{},
|
||||
m_comboBoxNewServerOpenvpnProtoText{"udp"},
|
||||
|
||||
m_radioButtonVpnModeAllSitesChecked{true},
|
||||
m_radioButtonVpnModeForwardSitesChecked{false},
|
||||
m_radioButtonVpnModeExceptSitesChecked{false},
|
||||
|
@ -93,9 +84,8 @@ UiLogic::UiLogic(QObject *parent) :
|
|||
m_trayIconUrl{},
|
||||
m_trayActionDisconnectEnabled{true},
|
||||
m_trayActionConnectEnabled{true},
|
||||
m_checkBoxNewServerCloakChecked{true},
|
||||
m_checkBoxNewServerSsChecked{false},
|
||||
m_checkBoxNewServerOpenvpnChecked{false},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -134,13 +124,10 @@ UiLogic::UiLogic(QObject *parent) :
|
|||
m_widgetVpnModeEnabled{false},
|
||||
m_labelErrorText{tr("Error text")},
|
||||
m_dialogConnectErrorText{},
|
||||
m_pageNewServerConfiguringEnabled{true},
|
||||
m_labelNewServerConfiguringWaitInfoVisible{true},
|
||||
m_labelNewServerConfiguringWaitInfoText{tr("Please wait, configuring process may take up to 5 minutes")},
|
||||
m_progressBarNewServerConfiguringVisible{true},
|
||||
m_progressBarNewServerConfiguringMaximium{100},
|
||||
m_progressBarNewServerConfiguringTextVisible{true},
|
||||
m_progressBarNewServerConfiguringText{tr("Configuring...")},
|
||||
|
||||
|
||||
|
||||
|
||||
m_pageServerProtocolsEnabled{true},
|
||||
m_progressBarProtocolsContainerReinstallValue{0},
|
||||
m_progressBarProtocolsContainerReinstallMaximium{100},
|
||||
|
@ -153,6 +140,7 @@ UiLogic::UiLogic(QObject *parent) :
|
|||
m_appSettingsLogic = new AppSettingsLogic(this);
|
||||
m_generalSettingsLogic = new GeneralSettingsLogic(this);
|
||||
m_networkSettingsLogic = new NetworkSettingsLogic(this);
|
||||
m_newServerConfiguringLogic = new NewServerConfiguringLogic(this);
|
||||
m_newServerProtocolsLogic = new NewServerProtocolsLogic(this);
|
||||
m_protocolSettingsLogic = new ProtocolSettingsLogic(this);
|
||||
m_serverListLogic = new ServerListLogic(this);
|
||||
|
@ -177,7 +165,6 @@ void UiLogic::initalizeUiLogic()
|
|||
{
|
||||
setFrameWireguardSettingsVisible(false);
|
||||
setFrameWireguardVisible(false);
|
||||
setFrameNewServerSettingsParentWireguardVisible(false);
|
||||
|
||||
setupTray();
|
||||
setupNewServerConnections();
|
||||
|
@ -271,166 +258,7 @@ void UiLogic::setFrameWireguardVisible(bool frameWireguardVisible)
|
|||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getFrameNewServerSettingsParentWireguardVisible() const
|
||||
{
|
||||
return m_frameNewServerSettingsParentWireguardVisible;
|
||||
}
|
||||
|
||||
void UiLogic::setFrameNewServerSettingsParentWireguardVisible(bool frameNewServerSettingsParentWireguardVisible)
|
||||
{
|
||||
if (m_frameNewServerSettingsParentWireguardVisible != frameNewServerSettingsParentWireguardVisible) {
|
||||
m_frameNewServerSettingsParentWireguardVisible = frameNewServerSettingsParentWireguardVisible;
|
||||
emit frameNewServerSettingsParentWireguardVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UiLogic::updateNewServerProtocolsPage()
|
||||
{
|
||||
setPushButtonNewServerSettingsCloakChecked(true);
|
||||
setPushButtonNewServerSettingsCloakChecked(false);
|
||||
setPushButtonNewServerSettingsSsChecked(true);
|
||||
setPushButtonNewServerSettingsSsChecked(false);
|
||||
setLineEditNewServerCloakPortText(amnezia::protocols::cloak::defaultPort);
|
||||
setLineEditNewServerCloakSiteText(amnezia::protocols::cloak::defaultRedirSite);
|
||||
setLineEditNewServerSsPortText(amnezia::protocols::shadowsocks::defaultPort);
|
||||
setComboBoxNewServerSsCipherText(amnezia::protocols::shadowsocks::defaultCipher);
|
||||
setLineEditNewServerOpenvpnPortText(amnezia::protocols::openvpn::defaultPort);
|
||||
setComboBoxNewServerOpenvpnProtoText(amnezia::protocols::openvpn::defaultTransportProto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
QString UiLogic::getComboBoxNewServerOpenvpnProtoText() const
|
||||
{
|
||||
return m_comboBoxNewServerOpenvpnProtoText;
|
||||
}
|
||||
|
||||
void UiLogic::setComboBoxNewServerOpenvpnProtoText(const QString &comboBoxNewServerOpenvpnProtoText)
|
||||
{
|
||||
if (m_comboBoxNewServerOpenvpnProtoText != comboBoxNewServerOpenvpnProtoText) {
|
||||
m_comboBoxNewServerOpenvpnProtoText = comboBoxNewServerOpenvpnProtoText;
|
||||
emit comboBoxNewServerOpenvpnProtoTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getLineEditNewServerCloakSiteText() const
|
||||
{
|
||||
return m_lineEditNewServerCloakSiteText;
|
||||
}
|
||||
|
||||
void UiLogic::setLineEditNewServerCloakSiteText(const QString &lineEditNewServerCloakSiteText)
|
||||
{
|
||||
if (m_lineEditNewServerCloakSiteText != lineEditNewServerCloakSiteText) {
|
||||
m_lineEditNewServerCloakSiteText = lineEditNewServerCloakSiteText;
|
||||
emit lineEditNewServerCloakSiteTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getLineEditNewServerSsPortText() const
|
||||
{
|
||||
return m_lineEditNewServerSsPortText;
|
||||
}
|
||||
|
||||
void UiLogic::setLineEditNewServerSsPortText(const QString &lineEditNewServerSsPortText)
|
||||
{
|
||||
if (m_lineEditNewServerSsPortText != lineEditNewServerSsPortText) {
|
||||
m_lineEditNewServerSsPortText = lineEditNewServerSsPortText;
|
||||
emit lineEditNewServerSsPortTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getComboBoxNewServerSsCipherText() const
|
||||
{
|
||||
return m_comboBoxNewServerSsCipherText;
|
||||
}
|
||||
|
||||
void UiLogic::setComboBoxNewServerSsCipherText(const QString &comboBoxNewServerSsCipherText)
|
||||
{
|
||||
if (m_comboBoxNewServerSsCipherText != comboBoxNewServerSsCipherText) {
|
||||
m_comboBoxNewServerSsCipherText = comboBoxNewServerSsCipherText;
|
||||
emit comboBoxNewServerSsCipherTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getlineEditNewServerOpenvpnPortText() const
|
||||
{
|
||||
return m_lineEditNewServerOpenvpnPortText;
|
||||
}
|
||||
|
||||
void UiLogic::setLineEditNewServerOpenvpnPortText(const QString &lineEditNewServerOpenvpnPortText)
|
||||
{
|
||||
if (m_lineEditNewServerOpenvpnPortText != lineEditNewServerOpenvpnPortText) {
|
||||
m_lineEditNewServerOpenvpnPortText = lineEditNewServerOpenvpnPortText;
|
||||
emit lineEditNewServerOpenvpnPortTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getPushButtonNewServerSettingsSsChecked() const
|
||||
{
|
||||
return m_pushButtonNewServerSettingsSsChecked;
|
||||
}
|
||||
|
||||
void UiLogic::setPushButtonNewServerSettingsSsChecked(bool pushButtonNewServerSettingsSsChecked)
|
||||
{
|
||||
if (m_pushButtonNewServerSettingsSsChecked != pushButtonNewServerSettingsSsChecked) {
|
||||
m_pushButtonNewServerSettingsSsChecked = pushButtonNewServerSettingsSsChecked;
|
||||
emit pushButtonNewServerSettingsSsCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getPushButtonNewServerSettingsOpenvpnChecked() const
|
||||
{
|
||||
return m_pushButtonNewServerSettingsOpenvpnChecked;
|
||||
}
|
||||
|
||||
void UiLogic::setPushButtonNewServerSettingsOpenvpnChecked(bool pushButtonNewServerSettingsOpenvpnChecked)
|
||||
{
|
||||
if (m_pushButtonNewServerSettingsOpenvpnChecked != pushButtonNewServerSettingsOpenvpnChecked) {
|
||||
m_pushButtonNewServerSettingsOpenvpnChecked = pushButtonNewServerSettingsOpenvpnChecked;
|
||||
emit pushButtonNewServerSettingsOpenvpnCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getLineEditNewServerCloakPortText() const
|
||||
{
|
||||
return m_lineEditNewServerCloakPortText;
|
||||
}
|
||||
|
||||
void UiLogic::setLineEditNewServerCloakPortText(const QString &lineEditNewServerCloakPortText)
|
||||
{
|
||||
if (m_lineEditNewServerCloakPortText != lineEditNewServerCloakPortText) {
|
||||
m_lineEditNewServerCloakPortText = lineEditNewServerCloakPortText;
|
||||
emit lineEditNewServerCloakPortTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getPushButtonNewServerSettingsCloakChecked() const
|
||||
{
|
||||
return m_pushButtonNewServerSettingsCloakChecked;
|
||||
}
|
||||
|
||||
void UiLogic::setPushButtonNewServerSettingsCloakChecked(bool pushButtonNewServerSettingsCloakChecked)
|
||||
{
|
||||
if (m_pushButtonNewServerSettingsCloakChecked != pushButtonNewServerSettingsCloakChecked) {
|
||||
m_pushButtonNewServerSettingsCloakChecked = pushButtonNewServerSettingsCloakChecked;
|
||||
emit pushButtonNewServerSettingsCloakCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
double UiLogic::getProgressBarNewServerConfiguringValue() const
|
||||
{
|
||||
return m_progressBarNewServerConfiguringValue;
|
||||
}
|
||||
|
||||
void UiLogic::setProgressBarNewServerConfiguringValue(double progressBarNewServerConfiguringValue)
|
||||
{
|
||||
if (m_progressBarNewServerConfiguringValue != progressBarNewServerConfiguringValue) {
|
||||
m_progressBarNewServerConfiguringValue = progressBarNewServerConfiguringValue;
|
||||
emit progressBarNewServerConfiguringValueChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -537,44 +365,7 @@ void UiLogic::setTrayActionConnectEnabled(bool trayActionConnectEnabled)
|
|||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getCheckBoxNewServerCloakChecked() const
|
||||
{
|
||||
return m_checkBoxNewServerCloakChecked;
|
||||
}
|
||||
|
||||
void UiLogic::setCheckBoxNewServerCloakChecked(bool checkBoxNewServerCloakChecked)
|
||||
{
|
||||
if (m_checkBoxNewServerCloakChecked != checkBoxNewServerCloakChecked) {
|
||||
m_checkBoxNewServerCloakChecked = checkBoxNewServerCloakChecked;
|
||||
emit checkBoxNewServerCloakCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getCheckBoxNewServerSsChecked() const
|
||||
{
|
||||
return m_checkBoxNewServerSsChecked;
|
||||
}
|
||||
|
||||
void UiLogic::setCheckBoxNewServerSsChecked(bool checkBoxNewServerSsChecked)
|
||||
{
|
||||
if (m_checkBoxNewServerSsChecked != checkBoxNewServerSsChecked) {
|
||||
m_checkBoxNewServerSsChecked = checkBoxNewServerSsChecked;
|
||||
emit checkBoxNewServerSsCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getCheckBoxNewServerOpenvpnChecked() const
|
||||
{
|
||||
return m_checkBoxNewServerOpenvpnChecked;
|
||||
}
|
||||
|
||||
void UiLogic::setCheckBoxNewServerOpenvpnChecked(bool checkBoxNewServerOpenvpnChecked)
|
||||
{
|
||||
if (m_checkBoxNewServerOpenvpnChecked != checkBoxNewServerOpenvpnChecked) {
|
||||
m_checkBoxNewServerOpenvpnChecked = checkBoxNewServerOpenvpnChecked;
|
||||
emit checkBoxNewServerOpenvpnCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1026,96 +817,7 @@ void UiLogic::setDialogConnectErrorText(const QString &dialogConnectErrorText)
|
|||
|
||||
|
||||
|
||||
bool UiLogic::getPageNewServerConfiguringEnabled() const
|
||||
{
|
||||
return m_pageNewServerConfiguringEnabled;
|
||||
}
|
||||
|
||||
void UiLogic::setPageNewServerConfiguringEnabled(bool pageNewServerConfiguringEnabled)
|
||||
{
|
||||
if (m_pageNewServerConfiguringEnabled != pageNewServerConfiguringEnabled) {
|
||||
m_pageNewServerConfiguringEnabled = pageNewServerConfiguringEnabled;
|
||||
emit pageNewServerConfiguringEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getLabelNewServerConfiguringWaitInfoVisible() const
|
||||
{
|
||||
return m_labelNewServerConfiguringWaitInfoVisible;
|
||||
}
|
||||
|
||||
void UiLogic::setLabelNewServerConfiguringWaitInfoVisible(bool labelNewServerConfiguringWaitInfoVisible)
|
||||
{
|
||||
if (m_labelNewServerConfiguringWaitInfoVisible != labelNewServerConfiguringWaitInfoVisible) {
|
||||
m_labelNewServerConfiguringWaitInfoVisible = labelNewServerConfiguringWaitInfoVisible;
|
||||
emit labelNewServerConfiguringWaitInfoVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getLabelNewServerConfiguringWaitInfoText() const
|
||||
{
|
||||
return m_labelNewServerConfiguringWaitInfoText;
|
||||
}
|
||||
|
||||
void UiLogic::setLabelNewServerConfiguringWaitInfoText(const QString &labelNewServerConfiguringWaitInfoText)
|
||||
{
|
||||
if (m_labelNewServerConfiguringWaitInfoText != labelNewServerConfiguringWaitInfoText) {
|
||||
m_labelNewServerConfiguringWaitInfoText = labelNewServerConfiguringWaitInfoText;
|
||||
emit labelNewServerConfiguringWaitInfoTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getProgressBarNewServerConfiguringVisible() const
|
||||
{
|
||||
return m_progressBarNewServerConfiguringVisible;
|
||||
}
|
||||
|
||||
void UiLogic::setProgressBarNewServerConfiguringVisible(bool progressBarNewServerConfiguringVisible)
|
||||
{
|
||||
if (m_progressBarNewServerConfiguringVisible != progressBarNewServerConfiguringVisible) {
|
||||
m_progressBarNewServerConfiguringVisible = progressBarNewServerConfiguringVisible;
|
||||
emit progressBarNewServerConfiguringVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int UiLogic::getProgressBarNewServerConfiguringMaximium() const
|
||||
{
|
||||
return m_progressBarNewServerConfiguringMaximium;
|
||||
}
|
||||
|
||||
void UiLogic::setProgressBarNewServerConfiguringMaximium(int progressBarNewServerConfiguringMaximium)
|
||||
{
|
||||
if (m_progressBarNewServerConfiguringMaximium != progressBarNewServerConfiguringMaximium) {
|
||||
m_progressBarNewServerConfiguringMaximium = progressBarNewServerConfiguringMaximium;
|
||||
emit progressBarNewServerConfiguringMaximiumChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getProgressBarNewServerConfiguringTextVisible() const
|
||||
{
|
||||
return m_progressBarNewServerConfiguringTextVisible;
|
||||
}
|
||||
|
||||
void UiLogic::setProgressBarNewServerConfiguringTextVisible(bool progressBarNewServerConfiguringTextVisible)
|
||||
{
|
||||
if (m_progressBarNewServerConfiguringTextVisible != progressBarNewServerConfiguringTextVisible) {
|
||||
m_progressBarNewServerConfiguringTextVisible = progressBarNewServerConfiguringTextVisible;
|
||||
emit progressBarNewServerConfiguringTextVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString UiLogic::getProgressBarNewServerConfiguringText() const
|
||||
{
|
||||
return m_progressBarNewServerConfiguringText;
|
||||
}
|
||||
|
||||
void UiLogic::setProgressBarNewServerConfiguringText(const QString &progressBarNewServerConfiguringText)
|
||||
{
|
||||
if (m_progressBarNewServerConfiguringText != progressBarNewServerConfiguringText) {
|
||||
m_progressBarNewServerConfiguringText = progressBarNewServerConfiguringText;
|
||||
emit progressBarNewServerConfiguringTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool UiLogic::getPageServerProtocolsEnabled() const
|
||||
{
|
||||
|
@ -1287,46 +989,6 @@ void UiLogic::onCloseWindow()
|
|||
//}
|
||||
|
||||
|
||||
QMap<DockerContainer, QJsonObject> UiLogic::getInstallConfigsFromProtocolsPage() const
|
||||
{
|
||||
QJsonObject cloakConfig {
|
||||
{ config_key::container, amnezia::containerToString(DockerContainer::OpenVpnOverCloak) },
|
||||
{ config_key::cloak, QJsonObject {
|
||||
{ config_key::port, getLineEditNewServerCloakPortText() },
|
||||
{ config_key::site, getLineEditNewServerCloakSiteText() }}
|
||||
}
|
||||
};
|
||||
QJsonObject ssConfig {
|
||||
{ config_key::container, amnezia::containerToString(DockerContainer::OpenVpnOverShadowSocks) },
|
||||
{ config_key::shadowsocks, QJsonObject {
|
||||
{ config_key::port, getLineEditNewServerSsPortText() },
|
||||
{ config_key::cipher, getComboBoxNewServerSsCipherText() }}
|
||||
}
|
||||
};
|
||||
QJsonObject openVpnConfig {
|
||||
{ config_key::container, amnezia::containerToString(DockerContainer::OpenVpn) },
|
||||
{ config_key::openvpn, QJsonObject {
|
||||
{ config_key::port, getlineEditNewServerOpenvpnPortText() },
|
||||
{ config_key::transport_proto, getComboBoxNewServerOpenvpnProtoText() }}
|
||||
}
|
||||
};
|
||||
|
||||
QMap<DockerContainer, QJsonObject> containers;
|
||||
|
||||
if (getCheckBoxNewServerCloakChecked()) {
|
||||
containers.insert(DockerContainer::OpenVpnOverCloak, cloakConfig);
|
||||
}
|
||||
|
||||
if (getCheckBoxNewServerSsChecked()) {
|
||||
containers.insert(DockerContainer::OpenVpnOverShadowSocks, ssConfig);
|
||||
}
|
||||
|
||||
if (getCheckBoxNewServerOpenvpnChecked()) {
|
||||
containers.insert(DockerContainer::OpenVpn, openVpnConfig);
|
||||
}
|
||||
|
||||
return containers;
|
||||
}
|
||||
|
||||
|
||||
void UiLogic::installServer(const QMap<DockerContainer, QJsonObject> &containers)
|
||||
|
@ -1341,34 +1003,34 @@ void UiLogic::installServer(const QMap<DockerContainer, QJsonObject> &containers
|
|||
|
||||
PageFunc page_new_server_configuring;
|
||||
page_new_server_configuring.setEnabledFunc = [this] (bool enabled) -> void {
|
||||
setPageNewServerConfiguringEnabled(enabled);
|
||||
newServerConfiguringLogic()->setPageNewServerConfiguringEnabled(enabled);
|
||||
};
|
||||
ButtonFunc no_button;
|
||||
LabelFunc label_new_server_configuring_wait_info;
|
||||
label_new_server_configuring_wait_info.setTextFunc = [this] (const QString& text) -> void {
|
||||
setLabelNewServerConfiguringWaitInfoText(text);
|
||||
newServerConfiguringLogic()->setLabelNewServerConfiguringWaitInfoText(text);
|
||||
};
|
||||
label_new_server_configuring_wait_info.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setLabelNewServerConfiguringWaitInfoVisible(visible);
|
||||
newServerConfiguringLogic()->setLabelNewServerConfiguringWaitInfoVisible(visible);
|
||||
};
|
||||
ProgressFunc progressBar_new_server_configuring;
|
||||
progressBar_new_server_configuring.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setProgressBarNewServerConfiguringVisible(visible);
|
||||
newServerConfiguringLogic()->setProgressBarNewServerConfiguringVisible(visible);
|
||||
};
|
||||
progressBar_new_server_configuring.setValueFunc = [this] (int value) ->void {
|
||||
setProgressBarNewServerConfiguringValue(value);
|
||||
newServerConfiguringLogic()->setProgressBarNewServerConfiguringValue(value);
|
||||
};
|
||||
progressBar_new_server_configuring.getValueFunc = [this] (void) -> int {
|
||||
return getProgressBarNewServerConfiguringValue();
|
||||
return newServerConfiguringLogic()->getProgressBarNewServerConfiguringValue();
|
||||
};
|
||||
progressBar_new_server_configuring.getMaximiumFunc = [this] (void) -> int {
|
||||
return getProgressBarNewServerConfiguringMaximium();
|
||||
return newServerConfiguringLogic()->getProgressBarNewServerConfiguringMaximium();
|
||||
};
|
||||
progressBar_new_server_configuring.setTextVisibleFunc = [this] (bool visible) ->void {
|
||||
setProgressBarNewServerConfiguringTextVisible(visible);
|
||||
newServerConfiguringLogic()->setProgressBarNewServerConfiguringTextVisible(visible);
|
||||
};
|
||||
progressBar_new_server_configuring.setTextFunc = [this] (const QString& text) ->void {
|
||||
setProgressBarNewServerConfiguringText(text);
|
||||
newServerConfiguringLogic()->setProgressBarNewServerConfiguringText(text);
|
||||
};
|
||||
bool ok = installContainers(installCredentials, containers,
|
||||
page_new_server_configuring,
|
||||
|
@ -1667,8 +1329,8 @@ PageEnumNS::Page UiLogic::currentPage()
|
|||
|
||||
void UiLogic::setupNewServerConnections()
|
||||
{
|
||||
connect(this, &UiLogic::pushButtonNewServerConnectConfigureClicked, this, [this](){
|
||||
installServer(getInstallConfigsFromProtocolsPage());
|
||||
connect(newServerProtocolsLogic(), &NewServerProtocolsLogic::pushButtonNewServerConnectConfigureClicked, this, [this](){
|
||||
installServer(newServerProtocolsLogic()->getInstallConfigsFromProtocolsPage());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ class AppSettingsLogic;
|
|||
class GeneralSettingsLogic;
|
||||
class NetworkSettingsLogic;
|
||||
class NewServerProtocolsLogic;
|
||||
class NewServerConfiguringLogic;
|
||||
class ProtocolSettingsLogic;
|
||||
class ServerListLogic;
|
||||
class ServerSettingsLogic;
|
||||
|
@ -94,6 +95,7 @@ public:
|
|||
friend class AppSettingsLogic;
|
||||
friend class GeneralSettingsLogic;
|
||||
friend class NetworkSettingsLogic;
|
||||
friend class NewServerConfiguringLogic;
|
||||
friend class NewServerProtocolsLogic;
|
||||
friend class ProtocolSettingsLogic;
|
||||
friend class ServerListLogic;
|
||||
|
@ -116,28 +118,7 @@ public:
|
|||
void setFrameWireguardSettingsVisible(bool frameWireguardSettingsVisible);
|
||||
bool getFrameWireguardVisible() const;
|
||||
void setFrameWireguardVisible(bool frameWireguardVisible);
|
||||
bool getFrameNewServerSettingsParentWireguardVisible() const;
|
||||
void setFrameNewServerSettingsParentWireguardVisible(bool frameNewServerSettingsParentWireguardVisible);
|
||||
double getProgressBarNewServerConfiguringValue() const;
|
||||
void setProgressBarNewServerConfiguringValue(double progressBarNewServerConfiguringValue);
|
||||
bool getPushButtonNewServerSettingsCloakChecked() const;
|
||||
void setPushButtonNewServerSettingsCloakChecked(bool pushButtonNewServerSettingsCloakChecked);
|
||||
bool getPushButtonNewServerSettingsSsChecked() const;
|
||||
void setPushButtonNewServerSettingsSsChecked(bool pushButtonNewServerSettingsSsChecked);
|
||||
bool getPushButtonNewServerSettingsOpenvpnChecked() const;
|
||||
void setPushButtonNewServerSettingsOpenvpnChecked(bool pushButtonNewServerSettingsOpenvpnChecked);
|
||||
QString getLineEditNewServerCloakPortText() const;
|
||||
void setLineEditNewServerCloakPortText(const QString &lineEditNewServerCloakPortText);
|
||||
QString getLineEditNewServerCloakSiteText() const;
|
||||
void setLineEditNewServerCloakSiteText(const QString &lineEditNewServerCloakSiteText);
|
||||
QString getLineEditNewServerSsPortText() const;
|
||||
void setLineEditNewServerSsPortText(const QString &lineEditNewServerSsPortText);
|
||||
QString getComboBoxNewServerSsCipherText() const;
|
||||
void setComboBoxNewServerSsCipherText(const QString &comboBoxNewServerSsCipherText);
|
||||
QString getlineEditNewServerOpenvpnPortText() const;
|
||||
void setLineEditNewServerOpenvpnPortText(const QString &lineEditNewServerOpenvpnPortText);
|
||||
QString getComboBoxNewServerOpenvpnProtoText() const;
|
||||
void setComboBoxNewServerOpenvpnProtoText(const QString &comboBoxNewServerOpenvpnProtoText);
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -150,12 +131,9 @@ public:
|
|||
void setTrayActionDisconnectEnabled(bool trayActionDisconnectEnabled);
|
||||
bool getTrayActionConnectEnabled() const;
|
||||
void setTrayActionConnectEnabled(bool trayActionConnectEnabled);
|
||||
bool getCheckBoxNewServerCloakChecked() const;
|
||||
void setCheckBoxNewServerCloakChecked(bool checkBoxNewServerCloakChecked);
|
||||
bool getCheckBoxNewServerSsChecked() const;
|
||||
void setCheckBoxNewServerSsChecked(bool checkBoxNewServerSsChecked);
|
||||
bool getCheckBoxNewServerOpenvpnChecked() const;
|
||||
void setCheckBoxNewServerOpenvpnChecked(bool checkBoxNewServerOpenvpnChecked);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool getPushButtonConnectChecked() const;
|
||||
|
@ -229,20 +207,7 @@ public:
|
|||
|
||||
|
||||
|
||||
bool getPageNewServerConfiguringEnabled() const;
|
||||
void setPageNewServerConfiguringEnabled(bool pageNewServerConfiguringEnabled);
|
||||
bool getLabelNewServerConfiguringWaitInfoVisible() const;
|
||||
void setLabelNewServerConfiguringWaitInfoVisible(bool labelNewServerConfiguringWaitInfoVisible);
|
||||
QString getLabelNewServerConfiguringWaitInfoText() const;
|
||||
void setLabelNewServerConfiguringWaitInfoText(const QString &labelNewServerConfiguringWaitInfoText);
|
||||
bool getProgressBarNewServerConfiguringVisible() const;
|
||||
void setProgressBarNewServerConfiguringVisible(bool progressBarNewServerConfiguringVisible);
|
||||
int getProgressBarNewServerConfiguringMaximium() const;
|
||||
void setProgressBarNewServerConfiguringMaximium(int progressBarNewServerConfiguringMaximium);
|
||||
bool getProgressBarNewServerConfiguringTextVisible() const;
|
||||
void setProgressBarNewServerConfiguringTextVisible(bool progressBarNewServerConfiguringTextVisible);
|
||||
QString getProgressBarNewServerConfiguringText() const;
|
||||
void setProgressBarNewServerConfiguringText(const QString &progressBarNewServerConfiguringText);
|
||||
|
||||
bool getPageServerProtocolsEnabled() const;
|
||||
void setPageServerProtocolsEnabled(bool pageServerProtocolsEnabled);
|
||||
int getProgressBarProtocolsContainerReinstallValue() const;
|
||||
|
@ -260,7 +225,6 @@ public:
|
|||
bool getPushButtonVpnAddSiteEnabled() const;
|
||||
void setPushButtonVpnAddSiteEnabled(bool pushButtonVpnAddSiteEnabled);
|
||||
|
||||
Q_INVOKABLE void updateNewServerProtocolsPage();
|
||||
Q_INVOKABLE void updateVpnPage();
|
||||
|
||||
Q_INVOKABLE void onRadioButtonVpnModeAllSitesToggled(bool checked);
|
||||
|
@ -285,18 +249,7 @@ public:
|
|||
signals:
|
||||
void frameWireguardSettingsVisibleChanged();
|
||||
void frameWireguardVisibleChanged();
|
||||
void frameNewServerSettingsParentWireguardVisibleChanged();
|
||||
|
||||
void progressBarNewServerConfiguringValueChanged();
|
||||
void pushButtonNewServerSettingsCloakCheckedChanged();
|
||||
void pushButtonNewServerSettingsSsCheckedChanged();
|
||||
void pushButtonNewServerSettingsOpenvpnCheckedChanged();
|
||||
void lineEditNewServerCloakPortTextChanged();
|
||||
void lineEditNewServerCloakSiteTextChanged();
|
||||
void lineEditNewServerSsPortTextChanged();
|
||||
void comboBoxNewServerSsCipherTextChanged();
|
||||
void lineEditNewServerOpenvpnPortTextChanged();
|
||||
void comboBoxNewServerOpenvpnProtoTextChanged();
|
||||
|
||||
|
||||
void radioButtonVpnModeAllSitesCheckedChanged();
|
||||
|
@ -310,9 +263,9 @@ signals:
|
|||
void trayIconUrlChanged();
|
||||
void trayActionDisconnectEnabledChanged();
|
||||
void trayActionConnectEnabledChanged();
|
||||
void checkBoxNewServerCloakCheckedChanged();
|
||||
void checkBoxNewServerSsCheckedChanged();
|
||||
void checkBoxNewServerOpenvpnCheckedChanged();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -354,13 +307,7 @@ signals:
|
|||
|
||||
void dialogConnectErrorTextChanged();
|
||||
|
||||
void pageNewServerConfiguringEnabledChanged();
|
||||
void labelNewServerConfiguringWaitInfoVisibleChanged();
|
||||
void labelNewServerConfiguringWaitInfoTextChanged();
|
||||
void progressBarNewServerConfiguringVisibleChanged();
|
||||
void progressBarNewServerConfiguringMaximiumChanged();
|
||||
void progressBarNewServerConfiguringTextVisibleChanged();
|
||||
void progressBarNewServerConfiguringTextChanged();
|
||||
|
||||
void pageServerProtocolsEnabledChanged();
|
||||
void progressBarProtocolsContainerReinstallValueChanged();
|
||||
void progressBarProtocolsContainerReinstallMaximiumChanged();
|
||||
|
@ -371,7 +318,6 @@ signals:
|
|||
void goToPage(int page, bool reset = true, bool slide = true);
|
||||
void closePage();
|
||||
void setStartPage(int page, bool slide = true);
|
||||
void pushButtonNewServerConnectConfigureClicked();
|
||||
void showPublicKeyWarning();
|
||||
void showConnectErrorDialog();
|
||||
void show();
|
||||
|
@ -392,18 +338,7 @@ signals:
|
|||
private:
|
||||
bool m_frameWireguardSettingsVisible;
|
||||
bool m_frameWireguardVisible;
|
||||
bool m_frameNewServerSettingsParentWireguardVisible;
|
||||
|
||||
double m_progressBarNewServerConfiguringValue;
|
||||
bool m_pushButtonNewServerSettingsCloakChecked;
|
||||
bool m_pushButtonNewServerSettingsSsChecked;
|
||||
bool m_pushButtonNewServerSettingsOpenvpnChecked;
|
||||
QString m_lineEditNewServerCloakPortText;
|
||||
QString m_lineEditNewServerCloakSiteText;
|
||||
QString m_lineEditNewServerSsPortText;
|
||||
QString m_comboBoxNewServerSsCipherText;
|
||||
QString m_lineEditNewServerOpenvpnPortText;
|
||||
QString m_comboBoxNewServerOpenvpnProtoText;
|
||||
|
||||
|
||||
|
||||
|
@ -418,9 +353,8 @@ private:
|
|||
QString m_trayIconUrl;
|
||||
bool m_trayActionDisconnectEnabled;
|
||||
bool m_trayActionConnectEnabled;
|
||||
bool m_checkBoxNewServerCloakChecked;
|
||||
bool m_checkBoxNewServerSsChecked;
|
||||
bool m_checkBoxNewServerOpenvpnChecked;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -462,13 +396,7 @@ private:
|
|||
QString m_labelErrorText;
|
||||
QString m_dialogConnectErrorText;
|
||||
|
||||
bool m_pageNewServerConfiguringEnabled;
|
||||
bool m_labelNewServerConfiguringWaitInfoVisible;
|
||||
QString m_labelNewServerConfiguringWaitInfoText;
|
||||
bool m_progressBarNewServerConfiguringVisible;
|
||||
int m_progressBarNewServerConfiguringMaximium;
|
||||
bool m_progressBarNewServerConfiguringTextVisible;
|
||||
QString m_progressBarNewServerConfiguringText;
|
||||
|
||||
bool m_pageServerProtocolsEnabled;
|
||||
int m_progressBarProtocolsContainerReinstallValue;
|
||||
int m_progressBarProtocolsContainerReinstallMaximium;
|
||||
|
@ -532,12 +460,12 @@ private:
|
|||
|
||||
|
||||
|
||||
QMap<DockerContainer, QJsonObject> getInstallConfigsFromProtocolsPage() const;
|
||||
|
||||
public:
|
||||
AppSettingsLogic *appSettingsLogic() { return m_appSettingsLogic; }
|
||||
GeneralSettingsLogic *generalSettingsLogic() { return m_generalSettingsLogic; }
|
||||
NetworkSettingsLogic *networkSettingsLogic() { return m_networkSettingsLogic; }
|
||||
NewServerConfiguringLogic *newServerConfiguringLogic() { return m_newServerConfiguringLogic; }
|
||||
NewServerProtocolsLogic *newServerProtocolsLogic() { return m_newServerProtocolsLogic; }
|
||||
ProtocolSettingsLogic *protocolSettingsLogic() { return m_protocolSettingsLogic; }
|
||||
ServerListLogic *serverListLogic() { return m_serverListLogic; }
|
||||
|
@ -557,6 +485,7 @@ private:
|
|||
AppSettingsLogic *m_appSettingsLogic;
|
||||
GeneralSettingsLogic *m_generalSettingsLogic;
|
||||
NetworkSettingsLogic *m_networkSettingsLogic;
|
||||
NewServerConfiguringLogic *m_newServerConfiguringLogic;
|
||||
NewServerProtocolsLogic *m_newServerProtocolsLogic;
|
||||
ProtocolSettingsLogic *m_protocolSettingsLogic;
|
||||
ServerListLogic *m_serverListLogic;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue