AUTO_PROPERTY finished
This commit is contained in:
parent
63ffa4a212
commit
16e887dcf0
34 changed files with 510 additions and 3156 deletions
|
@ -12,7 +12,7 @@ CloakLogic::CloakLogic(UiLogic *logic, QObject *parent):
|
|||
m_lineEditProtoCloakSiteText{"tile.openstreetmap.org"},
|
||||
m_lineEditProtoCloakPortText{},
|
||||
m_widgetProtoCloakEnabled{false},
|
||||
m_pushButtonProtoCloakSaveVisible{false},
|
||||
m_pushButtonCloakSaveVisible{false},
|
||||
m_progressBarProtoCloakResetVisible{false},
|
||||
m_lineEditProtoCloakPortEnabled{false},
|
||||
m_pageProtoCloakEnabled{true},
|
||||
|
@ -26,190 +26,31 @@ CloakLogic::CloakLogic(UiLogic *logic, QObject *parent):
|
|||
|
||||
void CloakLogic::updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData)
|
||||
{
|
||||
setWidgetProtoCloakEnabled(haveAuthData);
|
||||
setPushButtonProtoCloakSaveVisible(haveAuthData);
|
||||
setProgressBarProtoCloakResetVisible(haveAuthData);
|
||||
set_widgetProtoCloakEnabled(haveAuthData);
|
||||
set_pushButtonCloakSaveVisible(haveAuthData);
|
||||
set_progressBarProtoCloakResetVisible(haveAuthData);
|
||||
|
||||
setComboBoxProtoCloakCipherText(ckConfig.value(config_key::cipher).
|
||||
set_comboBoxProtoCloakCipherText(ckConfig.value(config_key::cipher).
|
||||
toString(protocols::cloak::defaultCipher));
|
||||
|
||||
setLineEditProtoCloakSiteText(ckConfig.value(config_key::site).
|
||||
set_lineEditProtoCloakSiteText(ckConfig.value(config_key::site).
|
||||
toString(protocols::cloak::defaultRedirSite));
|
||||
|
||||
setLineEditProtoCloakPortText(ckConfig.value(config_key::port).
|
||||
set_lineEditProtoCloakPortText(ckConfig.value(config_key::port).
|
||||
toString(protocols::cloak::defaultPort));
|
||||
|
||||
setLineEditProtoCloakPortEnabled(container == DockerContainer::OpenVpnOverCloak);
|
||||
set_lineEditProtoCloakPortEnabled(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());
|
||||
oldConfig.insert(config_key::cipher, comboBoxProtoCloakCipherText());
|
||||
oldConfig.insert(config_key::site, lineEditProtoCloakSiteText());
|
||||
oldConfig.insert(config_key::port, lineEditProtoCloakPortText());
|
||||
|
||||
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(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, Protocol::Cloak);
|
||||
|
@ -221,31 +62,31 @@ void CloakLogic::onPushButtonProtoCloakSaveClicked()
|
|||
|
||||
UiLogic::PageFunc page_proto_cloak;
|
||||
page_proto_cloak.setEnabledFunc = [this] (bool enabled) -> void {
|
||||
setPageProtoCloakEnabled(enabled);
|
||||
set_pageProtoCloakEnabled(enabled);
|
||||
};
|
||||
UiLogic::ButtonFunc pushButton_proto_cloak_save;
|
||||
pushButton_proto_cloak_save.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setPushButtonProtoCloakSaveVisible(visible);
|
||||
set_pushButtonCloakSaveVisible(visible);
|
||||
};
|
||||
UiLogic::LabelFunc label_proto_cloak_info;
|
||||
label_proto_cloak_info.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setLabelProtoCloakInfoVisible(visible);
|
||||
set_labelProtoCloakInfoVisible(visible);
|
||||
};
|
||||
label_proto_cloak_info.setTextFunc = [this] (const QString& text) ->void {
|
||||
setLabelProtoCloakInfoText(text);
|
||||
set_labelProtoCloakInfoText(text);
|
||||
};
|
||||
UiLogic::ProgressFunc progressBar_proto_cloak_reset;
|
||||
progressBar_proto_cloak_reset.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setProgressBarProtoCloakResetVisible(visible);
|
||||
set_progressBarProtoCloakResetVisible(visible);
|
||||
};
|
||||
progressBar_proto_cloak_reset.setValueFunc = [this] (int value) ->void {
|
||||
setProgressBarProtoCloakResetValue(value);
|
||||
set_progressBarProtoCloakResetValue(value);
|
||||
};
|
||||
progressBar_proto_cloak_reset.getValueFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoCloakResetValue();
|
||||
return progressBarProtoCloakResetValue();
|
||||
};
|
||||
progressBar_proto_cloak_reset.getMaximiumFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoCloakResetMaximium();
|
||||
return progressBarProtoCloakResetMaximium();
|
||||
};
|
||||
|
||||
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, newContainerConfig](){
|
||||
|
|
|
@ -9,21 +9,22 @@ class CloakLogic : public PageLogicBase
|
|||
{
|
||||
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)
|
||||
AUTO_PROPERTY(QString, comboBoxProtoCloakCipherText)
|
||||
AUTO_PROPERTY(QString, lineEditProtoCloakSiteText)
|
||||
AUTO_PROPERTY(QString, lineEditProtoCloakPortText)
|
||||
AUTO_PROPERTY(bool, widgetProtoCloakEnabled)
|
||||
AUTO_PROPERTY(bool, pushButtonCloakSaveVisible)
|
||||
AUTO_PROPERTY(bool, progressBarProtoCloakResetVisible)
|
||||
AUTO_PROPERTY(bool, lineEditProtoCloakPortEnabled)
|
||||
AUTO_PROPERTY(bool, pageProtoCloakEnabled)
|
||||
AUTO_PROPERTY(bool, labelProtoCloakInfoVisible)
|
||||
AUTO_PROPERTY(QString, labelProtoCloakInfoText)
|
||||
AUTO_PROPERTY(int, progressBarProtoCloakResetValue)
|
||||
AUTO_PROPERTY(int, progressBarProtoCloakResetMaximium)
|
||||
|
||||
public:
|
||||
Q_INVOKABLE void onPushButtonProtoCloakSaveClicked();
|
||||
|
||||
public:
|
||||
explicit CloakLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~CloakLogic() = default;
|
||||
|
@ -31,68 +32,9 @@ public:
|
|||
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:
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
|
|
@ -17,7 +17,7 @@ OpenVpnLogic::OpenVpnLogic(UiLogic *logic, QObject *parent):
|
|||
m_lineEditProtoOpenvpnPortText{},
|
||||
m_checkBoxProtoOpenvpnTlsAuthChecked{false},
|
||||
m_widgetProtoOpenvpnEnabled{false},
|
||||
m_pushButtonProtoOpenvpnSaveVisible{false},
|
||||
m_pushButtonOpenvpnSaveVisible{false},
|
||||
m_progressBarProtoOpenvpnResetVisible{false},
|
||||
m_radioButtonProtoOpenvpnUdpEnabled{false},
|
||||
m_radioButtonProtoOpenvpnTcpEnabled{false},
|
||||
|
@ -36,340 +36,53 @@ OpenVpnLogic::OpenVpnLogic(UiLogic *logic, QObject *parent):
|
|||
|
||||
void OpenVpnLogic::updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container, bool haveAuthData)
|
||||
{
|
||||
setWidgetProtoOpenvpnEnabled(haveAuthData);
|
||||
setPushButtonProtoOpenvpnSaveVisible(haveAuthData);
|
||||
setProgressBarProtoOpenvpnResetVisible(haveAuthData);
|
||||
set_widgetProtoOpenvpnEnabled(haveAuthData);
|
||||
set_pushButtonOpenvpnSaveVisible(haveAuthData);
|
||||
set_progressBarProtoOpenvpnResetVisible(haveAuthData);
|
||||
|
||||
setRadioButtonProtoOpenvpnUdpEnabled(true);
|
||||
setRadioButtonProtoOpenvpnTcpEnabled(true);
|
||||
set_radioButtonProtoOpenvpnUdpEnabled(true);
|
||||
set_radioButtonProtoOpenvpnTcpEnabled(true);
|
||||
|
||||
setLineEditProtoOpenvpnSubnetText(openvpnConfig.value(config_key::subnet_address).
|
||||
set_lineEditProtoOpenvpnSubnetText(openvpnConfig.value(config_key::subnet_address).
|
||||
toString(protocols::openvpn::defaultSubnetAddress));
|
||||
|
||||
QString trasnsport = openvpnConfig.value(config_key::transport_proto).
|
||||
toString(protocols::openvpn::defaultTransportProto);
|
||||
|
||||
setRadioButtonProtoOpenvpnUdpChecked(trasnsport == protocols::openvpn::defaultTransportProto);
|
||||
setRadioButtonProtoOpenvpnTcpChecked(trasnsport != protocols::openvpn::defaultTransportProto);
|
||||
set_radioButtonProtoOpenvpnUdpChecked(trasnsport == protocols::openvpn::defaultTransportProto);
|
||||
set_radioButtonProtoOpenvpnTcpChecked(trasnsport != protocols::openvpn::defaultTransportProto);
|
||||
|
||||
setComboBoxProtoOpenvpnCipherText(openvpnConfig.value(config_key::cipher).
|
||||
set_comboBoxProtoOpenvpnCipherText(openvpnConfig.value(config_key::cipher).
|
||||
toString(protocols::openvpn::defaultCipher));
|
||||
|
||||
setComboBoxProtoOpenvpnHashText(openvpnConfig.value(config_key::hash).
|
||||
set_comboBoxProtoOpenvpnHashText(openvpnConfig.value(config_key::hash).
|
||||
toString(protocols::openvpn::defaultHash));
|
||||
|
||||
bool blockOutsideDns = openvpnConfig.value(config_key::block_outside_dns).toBool(protocols::openvpn::defaultBlockOutsideDns);
|
||||
setCheckBoxProtoOpenvpnBlockDnsChecked(blockOutsideDns);
|
||||
set_checkBoxProtoOpenvpnBlockDnsChecked(blockOutsideDns);
|
||||
|
||||
bool isNcpDisabled = openvpnConfig.value(config_key::ncp_disable).toBool(protocols::openvpn::defaultNcpDisable);
|
||||
setCheckBoxProtoOpenvpnAutoEncryptionChecked(!isNcpDisabled);
|
||||
set_checkBoxProtoOpenvpnAutoEncryptionChecked(!isNcpDisabled);
|
||||
|
||||
bool isTlsAuth = openvpnConfig.value(config_key::tls_auth).toBool(protocols::openvpn::defaultTlsAuth);
|
||||
setCheckBoxProtoOpenvpnTlsAuthChecked(isTlsAuth);
|
||||
set_checkBoxProtoOpenvpnTlsAuthChecked(isTlsAuth);
|
||||
|
||||
if (container == DockerContainer::OpenVpnOverShadowSocks) {
|
||||
setRadioButtonProtoOpenvpnUdpEnabled(false);
|
||||
setRadioButtonProtoOpenvpnTcpEnabled(false);
|
||||
setRadioButtonProtoOpenvpnTcpChecked(true);
|
||||
set_radioButtonProtoOpenvpnUdpEnabled(false);
|
||||
set_radioButtonProtoOpenvpnTcpEnabled(false);
|
||||
set_radioButtonProtoOpenvpnTcpChecked(true);
|
||||
}
|
||||
|
||||
setLineEditProtoOpenvpnPortText(openvpnConfig.value(config_key::port).
|
||||
set_lineEditProtoOpenvpnPortText(openvpnConfig.value(config_key::port).
|
||||
toString(protocols::openvpn::defaultPort));
|
||||
|
||||
setLineEditProtoOpenvpnPortEnabled(container == DockerContainer::OpenVpn);
|
||||
}
|
||||
|
||||
QString OpenVpnLogic::getLineEditProtoOpenvpnSubnetText() const
|
||||
{
|
||||
return m_lineEditProtoOpenvpnSubnetText;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setLineEditProtoOpenvpnSubnetText(const QString &lineEditProtoOpenvpnSubnetText)
|
||||
{
|
||||
if (m_lineEditProtoOpenvpnSubnetText != lineEditProtoOpenvpnSubnetText) {
|
||||
m_lineEditProtoOpenvpnSubnetText = lineEditProtoOpenvpnSubnetText;
|
||||
emit lineEditProtoOpenvpnSubnetTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getRadioButtonProtoOpenvpnUdpChecked() const
|
||||
{
|
||||
return m_radioButtonProtoOpenvpnUdpChecked;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setRadioButtonProtoOpenvpnUdpChecked(bool radioButtonProtoOpenvpnUdpChecked)
|
||||
{
|
||||
if (m_radioButtonProtoOpenvpnUdpChecked != radioButtonProtoOpenvpnUdpChecked) {
|
||||
m_radioButtonProtoOpenvpnUdpChecked = radioButtonProtoOpenvpnUdpChecked;
|
||||
emit radioButtonProtoOpenvpnUdpCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getCheckBoxProtoOpenvpnAutoEncryptionChecked() const
|
||||
{
|
||||
return m_checkBoxProtoOpenvpnAutoEncryptionChecked;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setCheckBoxProtoOpenvpnAutoEncryptionChecked(bool checkBoxProtoOpenvpnAutoEncryptionChecked)
|
||||
{
|
||||
if (m_checkBoxProtoOpenvpnAutoEncryptionChecked != checkBoxProtoOpenvpnAutoEncryptionChecked) {
|
||||
m_checkBoxProtoOpenvpnAutoEncryptionChecked = checkBoxProtoOpenvpnAutoEncryptionChecked;
|
||||
emit checkBoxProtoOpenvpnAutoEncryptionCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString OpenVpnLogic::getComboBoxProtoOpenvpnCipherText() const
|
||||
{
|
||||
return m_comboBoxProtoOpenvpnCipherText;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setComboBoxProtoOpenvpnCipherText(const QString &comboBoxProtoOpenvpnCipherText)
|
||||
{
|
||||
if (m_comboBoxProtoOpenvpnCipherText != comboBoxProtoOpenvpnCipherText) {
|
||||
m_comboBoxProtoOpenvpnCipherText = comboBoxProtoOpenvpnCipherText;
|
||||
emit comboBoxProtoOpenvpnCipherTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString OpenVpnLogic::getComboBoxProtoOpenvpnHashText() const
|
||||
{
|
||||
return m_comboBoxProtoOpenvpnHashText;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setComboBoxProtoOpenvpnHashText(const QString &comboBoxProtoOpenvpnHashText)
|
||||
{
|
||||
if (m_comboBoxProtoOpenvpnHashText != comboBoxProtoOpenvpnHashText) {
|
||||
m_comboBoxProtoOpenvpnHashText = comboBoxProtoOpenvpnHashText;
|
||||
emit comboBoxProtoOpenvpnHashTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getCheckBoxProtoOpenvpnBlockDnsChecked() const
|
||||
{
|
||||
return m_checkBoxProtoOpenvpnBlockDnsChecked;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setCheckBoxProtoOpenvpnBlockDnsChecked(bool checkBoxProtoOpenvpnBlockDnsChecked)
|
||||
{
|
||||
if (m_checkBoxProtoOpenvpnBlockDnsChecked != checkBoxProtoOpenvpnBlockDnsChecked) {
|
||||
m_checkBoxProtoOpenvpnBlockDnsChecked = checkBoxProtoOpenvpnBlockDnsChecked;
|
||||
emit checkBoxProtoOpenvpnBlockDnsCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString OpenVpnLogic::getLineEditProtoOpenvpnPortText() const
|
||||
{
|
||||
return m_lineEditProtoOpenvpnPortText;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setLineEditProtoOpenvpnPortText(const QString &lineEditProtoOpenvpnPortText)
|
||||
{
|
||||
if (m_lineEditProtoOpenvpnPortText != lineEditProtoOpenvpnPortText) {
|
||||
m_lineEditProtoOpenvpnPortText = lineEditProtoOpenvpnPortText;
|
||||
emit lineEditProtoOpenvpnPortTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getCheckBoxProtoOpenvpnTlsAuthChecked() const
|
||||
{
|
||||
return m_checkBoxProtoOpenvpnTlsAuthChecked;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setCheckBoxProtoOpenvpnTlsAuthChecked(bool checkBoxProtoOpenvpnTlsAuthChecked)
|
||||
{
|
||||
if (m_checkBoxProtoOpenvpnTlsAuthChecked != checkBoxProtoOpenvpnTlsAuthChecked) {
|
||||
m_checkBoxProtoOpenvpnTlsAuthChecked = checkBoxProtoOpenvpnTlsAuthChecked;
|
||||
emit checkBoxProtoOpenvpnTlsAuthCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getWidgetProtoOpenvpnEnabled() const
|
||||
{
|
||||
return m_widgetProtoOpenvpnEnabled;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setWidgetProtoOpenvpnEnabled(bool widgetProtoOpenvpnEnabled)
|
||||
{
|
||||
if (m_widgetProtoOpenvpnEnabled != widgetProtoOpenvpnEnabled) {
|
||||
m_widgetProtoOpenvpnEnabled = widgetProtoOpenvpnEnabled;
|
||||
emit widgetProtoOpenvpnEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getPushButtonProtoOpenvpnSaveVisible() const
|
||||
{
|
||||
return m_pushButtonProtoOpenvpnSaveVisible;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setPushButtonProtoOpenvpnSaveVisible(bool pushButtonProtoOpenvpnSaveVisible)
|
||||
{
|
||||
if (m_pushButtonProtoOpenvpnSaveVisible != pushButtonProtoOpenvpnSaveVisible) {
|
||||
m_pushButtonProtoOpenvpnSaveVisible = pushButtonProtoOpenvpnSaveVisible;
|
||||
emit pushButtonProtoOpenvpnSaveVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getProgressBarProtoOpenvpnResetVisible() const
|
||||
{
|
||||
return m_progressBarProtoOpenvpnResetVisible;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setProgressBarProtoOpenvpnResetVisible(bool progressBarProtoOpenvpnResetVisible)
|
||||
{
|
||||
if (m_progressBarProtoOpenvpnResetVisible != progressBarProtoOpenvpnResetVisible) {
|
||||
m_progressBarProtoOpenvpnResetVisible = progressBarProtoOpenvpnResetVisible;
|
||||
emit progressBarProtoOpenvpnResetVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getRadioButtonProtoOpenvpnUdpEnabled() const
|
||||
{
|
||||
return m_radioButtonProtoOpenvpnUdpEnabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void OpenVpnLogic::setRadioButtonProtoOpenvpnUdpEnabled(bool radioButtonProtoOpenvpnUdpEnabled)
|
||||
{
|
||||
if (m_radioButtonProtoOpenvpnUdpEnabled != radioButtonProtoOpenvpnUdpEnabled) {
|
||||
m_radioButtonProtoOpenvpnUdpEnabled = radioButtonProtoOpenvpnUdpEnabled;
|
||||
emit radioButtonProtoOpenvpnUdpEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getRadioButtonProtoOpenvpnTcpEnabled() const
|
||||
{
|
||||
return m_radioButtonProtoOpenvpnTcpEnabled;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setRadioButtonProtoOpenvpnTcpEnabled(bool radioButtonProtoOpenvpnTcpEnabled)
|
||||
{
|
||||
if (m_radioButtonProtoOpenvpnTcpEnabled != radioButtonProtoOpenvpnTcpEnabled) {
|
||||
m_radioButtonProtoOpenvpnTcpEnabled = radioButtonProtoOpenvpnTcpEnabled;
|
||||
emit radioButtonProtoOpenvpnTcpEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getRadioButtonProtoOpenvpnTcpChecked() const
|
||||
{
|
||||
return m_radioButtonProtoOpenvpnTcpChecked;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setRadioButtonProtoOpenvpnTcpChecked(bool radioButtonProtoOpenvpnTcpChecked)
|
||||
{
|
||||
if (m_radioButtonProtoOpenvpnTcpChecked != radioButtonProtoOpenvpnTcpChecked) {
|
||||
m_radioButtonProtoOpenvpnTcpChecked = radioButtonProtoOpenvpnTcpChecked;
|
||||
emit radioButtonProtoOpenvpnTcpCheckedChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getLineEditProtoOpenvpnPortEnabled() const
|
||||
{
|
||||
return m_lineEditProtoOpenvpnPortEnabled;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setLineEditProtoOpenvpnPortEnabled(bool lineEditProtoOpenvpnPortEnabled)
|
||||
{
|
||||
if (m_lineEditProtoOpenvpnPortEnabled != lineEditProtoOpenvpnPortEnabled) {
|
||||
m_lineEditProtoOpenvpnPortEnabled = lineEditProtoOpenvpnPortEnabled;
|
||||
emit lineEditProtoOpenvpnPortEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getComboBoxProtoOpenvpnCipherEnabled() const
|
||||
{
|
||||
return m_comboBoxProtoOpenvpnCipherEnabled;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setComboBoxProtoOpenvpnCipherEnabled(bool comboBoxProtoOpenvpnCipherEnabled)
|
||||
{
|
||||
if (m_comboBoxProtoOpenvpnCipherEnabled != comboBoxProtoOpenvpnCipherEnabled) {
|
||||
m_comboBoxProtoOpenvpnCipherEnabled = comboBoxProtoOpenvpnCipherEnabled;
|
||||
emit comboBoxProtoOpenvpnCipherEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getComboBoxProtoOpenvpnHashEnabled() const
|
||||
{
|
||||
return m_comboBoxProtoOpenvpnHashEnabled;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setComboBoxProtoOpenvpnHashEnabled(bool comboBoxProtoOpenvpnHashEnabled)
|
||||
{
|
||||
if (m_comboBoxProtoOpenvpnHashEnabled != comboBoxProtoOpenvpnHashEnabled) {
|
||||
m_comboBoxProtoOpenvpnHashEnabled = comboBoxProtoOpenvpnHashEnabled;
|
||||
emit comboBoxProtoOpenvpnHashEnabledChanged();
|
||||
}
|
||||
}
|
||||
bool OpenVpnLogic::getPageProtoOpenvpnEnabled() const
|
||||
{
|
||||
return m_pageProtoOpenvpnEnabled;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setPageProtoOpenvpnEnabled(bool pageProtoOpenvpnEnabled)
|
||||
{
|
||||
if (m_pageProtoOpenvpnEnabled != pageProtoOpenvpnEnabled) {
|
||||
m_pageProtoOpenvpnEnabled = pageProtoOpenvpnEnabled;
|
||||
emit pageProtoOpenvpnEnabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVpnLogic::getLabelProtoOpenvpnInfoVisible() const
|
||||
{
|
||||
return m_labelProtoOpenvpnInfoVisible;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setLabelProtoOpenvpnInfoVisible(bool labelProtoOpenvpnInfoVisible)
|
||||
{
|
||||
if (m_labelProtoOpenvpnInfoVisible != labelProtoOpenvpnInfoVisible) {
|
||||
m_labelProtoOpenvpnInfoVisible = labelProtoOpenvpnInfoVisible;
|
||||
emit labelProtoOpenvpnInfoVisibleChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString OpenVpnLogic::getLabelProtoOpenvpnInfoText() const
|
||||
{
|
||||
return m_labelProtoOpenvpnInfoText;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setLabelProtoOpenvpnInfoText(const QString &labelProtoOpenvpnInfoText)
|
||||
{
|
||||
if (m_labelProtoOpenvpnInfoText != labelProtoOpenvpnInfoText) {
|
||||
m_labelProtoOpenvpnInfoText = labelProtoOpenvpnInfoText;
|
||||
emit labelProtoOpenvpnInfoTextChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int OpenVpnLogic::getProgressBarProtoOpenvpnResetValue() const
|
||||
{
|
||||
return m_progressBarProtoOpenvpnResetValue;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setProgressBarProtoOpenvpnResetValue(int progressBarProtoOpenvpnResetValue)
|
||||
{
|
||||
if (m_progressBarProtoOpenvpnResetValue != progressBarProtoOpenvpnResetValue) {
|
||||
m_progressBarProtoOpenvpnResetValue = progressBarProtoOpenvpnResetValue;
|
||||
emit progressBarProtoOpenvpnResetValueChanged();
|
||||
}
|
||||
}
|
||||
|
||||
int OpenVpnLogic::getProgressBarProtoOpenvpnResetMaximium() const
|
||||
{
|
||||
return m_progressBarProtoOpenvpnResetMaximium;
|
||||
}
|
||||
|
||||
void OpenVpnLogic::setProgressBarProtoOpenvpnResetMaximium(int progressBarProtoOpenvpnResetMaximium)
|
||||
{
|
||||
if (m_progressBarProtoOpenvpnResetMaximium != progressBarProtoOpenvpnResetMaximium) {
|
||||
m_progressBarProtoOpenvpnResetMaximium = progressBarProtoOpenvpnResetMaximium;
|
||||
emit progressBarProtoOpenvpnResetMaximiumChanged();
|
||||
}
|
||||
set_lineEditProtoOpenvpnPortEnabled(container == DockerContainer::OpenVpn);
|
||||
}
|
||||
|
||||
void OpenVpnLogic::onCheckBoxProtoOpenvpnAutoEncryptionClicked()
|
||||
{
|
||||
setComboBoxProtoOpenvpnCipherEnabled(!getCheckBoxProtoOpenvpnAutoEncryptionChecked());
|
||||
setComboBoxProtoOpenvpnHashEnabled(!getCheckBoxProtoOpenvpnAutoEncryptionChecked());
|
||||
set_comboBoxProtoOpenvpnCipherEnabled(!checkBoxProtoOpenvpnAutoEncryptionChecked());
|
||||
set_comboBoxProtoOpenvpnHashEnabled(!checkBoxProtoOpenvpnAutoEncryptionChecked());
|
||||
}
|
||||
|
||||
void OpenVpnLogic::onPushButtonProtoOpenvpnSaveClicked()
|
||||
|
@ -383,31 +96,31 @@ void OpenVpnLogic::onPushButtonProtoOpenvpnSaveClicked()
|
|||
|
||||
UiLogic::PageFunc page_proto_openvpn;
|
||||
page_proto_openvpn.setEnabledFunc = [this] (bool enabled) -> void {
|
||||
setPageProtoOpenvpnEnabled(enabled);
|
||||
set_pageProtoOpenvpnEnabled(enabled);
|
||||
};
|
||||
UiLogic::ButtonFunc pushButton_proto_openvpn_save;
|
||||
pushButton_proto_openvpn_save.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setPushButtonProtoOpenvpnSaveVisible(visible);
|
||||
set_pushButtonOpenvpnSaveVisible(visible);
|
||||
};
|
||||
UiLogic::LabelFunc label_proto_openvpn_info;
|
||||
label_proto_openvpn_info.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setLabelProtoOpenvpnInfoVisible(visible);
|
||||
set_labelProtoOpenvpnInfoVisible(visible);
|
||||
};
|
||||
label_proto_openvpn_info.setTextFunc = [this] (const QString& text) ->void {
|
||||
setLabelProtoOpenvpnInfoText(text);
|
||||
set_labelProtoOpenvpnInfoText(text);
|
||||
};
|
||||
UiLogic::ProgressFunc progressBar_proto_openvpn_reset;
|
||||
progressBar_proto_openvpn_reset.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setProgressBarProtoOpenvpnResetVisible(visible);
|
||||
set_progressBarProtoOpenvpnResetVisible(visible);
|
||||
};
|
||||
progressBar_proto_openvpn_reset.setValueFunc = [this] (int value) ->void {
|
||||
setProgressBarProtoOpenvpnResetValue(value);
|
||||
set_progressBarProtoOpenvpnResetValue(value);
|
||||
};
|
||||
progressBar_proto_openvpn_reset.getValueFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoOpenvpnResetValue();
|
||||
return progressBarProtoOpenvpnResetValue();
|
||||
};
|
||||
progressBar_proto_openvpn_reset.getMaximiumFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoOpenvpnResetMaximium();
|
||||
return progressBarProtoOpenvpnResetMaximium();
|
||||
};
|
||||
|
||||
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, newContainerConfig](){
|
||||
|
@ -425,13 +138,13 @@ void OpenVpnLogic::onPushButtonProtoOpenvpnSaveClicked()
|
|||
|
||||
QJsonObject OpenVpnLogic::getOpenVpnConfigFromPage(QJsonObject oldConfig)
|
||||
{
|
||||
oldConfig.insert(config_key::subnet_address, getLineEditProtoOpenvpnSubnetText());
|
||||
oldConfig.insert(config_key::transport_proto, getRadioButtonProtoOpenvpnUdpChecked() ? protocols::UDP : protocols::TCP);
|
||||
oldConfig.insert(config_key::ncp_disable, ! getCheckBoxProtoOpenvpnAutoEncryptionChecked());
|
||||
oldConfig.insert(config_key::cipher, getComboBoxProtoOpenvpnCipherText());
|
||||
oldConfig.insert(config_key::hash, getComboBoxProtoOpenvpnHashText());
|
||||
oldConfig.insert(config_key::block_outside_dns, getCheckBoxProtoOpenvpnBlockDnsChecked());
|
||||
oldConfig.insert(config_key::port, getLineEditProtoOpenvpnPortText());
|
||||
oldConfig.insert(config_key::tls_auth, getCheckBoxProtoOpenvpnTlsAuthChecked());
|
||||
oldConfig.insert(config_key::subnet_address, lineEditProtoOpenvpnSubnetText());
|
||||
oldConfig.insert(config_key::transport_proto, radioButtonProtoOpenvpnUdpChecked() ? protocols::UDP : protocols::TCP);
|
||||
oldConfig.insert(config_key::ncp_disable, ! checkBoxProtoOpenvpnAutoEncryptionChecked());
|
||||
oldConfig.insert(config_key::cipher, comboBoxProtoOpenvpnCipherText());
|
||||
oldConfig.insert(config_key::hash, comboBoxProtoOpenvpnHashText());
|
||||
oldConfig.insert(config_key::block_outside_dns, checkBoxProtoOpenvpnBlockDnsChecked());
|
||||
oldConfig.insert(config_key::port, lineEditProtoOpenvpnPortText());
|
||||
oldConfig.insert(config_key::tls_auth, checkBoxProtoOpenvpnTlsAuthChecked());
|
||||
return oldConfig;
|
||||
}
|
||||
|
|
|
@ -9,32 +9,32 @@ class OpenVpnLogic : public PageLogicBase
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
AUTO_PROPERTY(QString, lineEditProtoOpenvpnSubnetText)
|
||||
AUTO_PROPERTY(bool, radioButtonProtoOpenvpnUdpChecked)
|
||||
AUTO_PROPERTY(bool, checkBoxProtoOpenvpnAutoEncryptionChecked)
|
||||
AUTO_PROPERTY(QString, comboBoxProtoOpenvpnCipherText)
|
||||
AUTO_PROPERTY(QString, comboBoxProtoOpenvpnHashText)
|
||||
AUTO_PROPERTY(bool, checkBoxProtoOpenvpnBlockDnsChecked)
|
||||
AUTO_PROPERTY(QString, lineEditProtoOpenvpnPortText)
|
||||
AUTO_PROPERTY(bool, checkBoxProtoOpenvpnTlsAuthChecked)
|
||||
|
||||
AUTO_PROPERTY(bool, widgetProtoOpenvpnEnabled)
|
||||
AUTO_PROPERTY(bool, pushButtonOpenvpnSaveVisible)
|
||||
AUTO_PROPERTY(bool, progressBarProtoOpenvpnResetVisible)
|
||||
AUTO_PROPERTY(bool, radioButtonProtoOpenvpnUdpEnabled)
|
||||
AUTO_PROPERTY(bool, radioButtonProtoOpenvpnTcpEnabled)
|
||||
AUTO_PROPERTY(bool, radioButtonProtoOpenvpnTcpChecked)
|
||||
AUTO_PROPERTY(bool, lineEditProtoOpenvpnPortEnabled)
|
||||
|
||||
AUTO_PROPERTY(bool, comboBoxProtoOpenvpnCipherEnabled)
|
||||
AUTO_PROPERTY(bool, comboBoxProtoOpenvpnHashEnabled)
|
||||
AUTO_PROPERTY(bool, pageProtoOpenvpnEnabled)
|
||||
AUTO_PROPERTY(bool, labelProtoOpenvpnInfoVisible)
|
||||
AUTO_PROPERTY(QString, labelProtoOpenvpnInfoText)
|
||||
AUTO_PROPERTY(int, progressBarProtoOpenvpnResetValue)
|
||||
AUTO_PROPERTY(int, progressBarProtoOpenvpnResetMaximium)
|
||||
|
||||
public:
|
||||
Q_PROPERTY(QString lineEditProtoOpenvpnSubnetText READ getLineEditProtoOpenvpnSubnetText WRITE setLineEditProtoOpenvpnSubnetText NOTIFY lineEditProtoOpenvpnSubnetTextChanged)
|
||||
Q_PROPERTY(bool radioButtonProtoOpenvpnUdpChecked READ getRadioButtonProtoOpenvpnUdpChecked WRITE setRadioButtonProtoOpenvpnUdpChecked NOTIFY radioButtonProtoOpenvpnUdpCheckedChanged)
|
||||
Q_PROPERTY(bool checkBoxProtoOpenvpnAutoEncryptionChecked READ getCheckBoxProtoOpenvpnAutoEncryptionChecked WRITE setCheckBoxProtoOpenvpnAutoEncryptionChecked NOTIFY checkBoxProtoOpenvpnAutoEncryptionCheckedChanged)
|
||||
Q_PROPERTY(QString comboBoxProtoOpenvpnCipherText READ getComboBoxProtoOpenvpnCipherText WRITE setComboBoxProtoOpenvpnCipherText NOTIFY comboBoxProtoOpenvpnCipherTextChanged)
|
||||
Q_PROPERTY(QString comboBoxProtoOpenvpnHashText READ getComboBoxProtoOpenvpnHashText WRITE setComboBoxProtoOpenvpnHashText NOTIFY comboBoxProtoOpenvpnHashTextChanged)
|
||||
Q_PROPERTY(bool checkBoxProtoOpenvpnBlockDnsChecked READ getCheckBoxProtoOpenvpnBlockDnsChecked WRITE setCheckBoxProtoOpenvpnBlockDnsChecked NOTIFY checkBoxProtoOpenvpnBlockDnsCheckedChanged)
|
||||
Q_PROPERTY(QString lineEditProtoOpenvpnPortText READ getLineEditProtoOpenvpnPortText WRITE setLineEditProtoOpenvpnPortText NOTIFY lineEditProtoOpenvpnPortTextChanged)
|
||||
Q_PROPERTY(bool checkBoxProtoOpenvpnTlsAuthChecked READ getCheckBoxProtoOpenvpnTlsAuthChecked WRITE setCheckBoxProtoOpenvpnTlsAuthChecked NOTIFY checkBoxProtoOpenvpnTlsAuthCheckedChanged)
|
||||
|
||||
Q_PROPERTY(bool widgetProtoOpenvpnEnabled READ getWidgetProtoOpenvpnEnabled WRITE setWidgetProtoOpenvpnEnabled NOTIFY widgetProtoOpenvpnEnabledChanged)
|
||||
Q_PROPERTY(bool pushButtonProtoOpenvpnSaveVisible READ getPushButtonProtoOpenvpnSaveVisible WRITE setPushButtonProtoOpenvpnSaveVisible NOTIFY pushButtonProtoOpenvpnSaveVisibleChanged)
|
||||
Q_PROPERTY(bool progressBarProtoOpenvpnResetVisible READ getProgressBarProtoOpenvpnResetVisible WRITE setProgressBarProtoOpenvpnResetVisible NOTIFY progressBarProtoOpenvpnResetVisibleChanged)
|
||||
Q_PROPERTY(bool radioButtonProtoOpenvpnUdpEnabled READ getRadioButtonProtoOpenvpnUdpEnabled WRITE setRadioButtonProtoOpenvpnUdpEnabled NOTIFY radioButtonProtoOpenvpnUdpEnabledChanged)
|
||||
Q_PROPERTY(bool radioButtonProtoOpenvpnTcpEnabled READ getRadioButtonProtoOpenvpnTcpEnabled WRITE setRadioButtonProtoOpenvpnTcpEnabled NOTIFY radioButtonProtoOpenvpnTcpEnabledChanged)
|
||||
Q_PROPERTY(bool radioButtonProtoOpenvpnTcpChecked READ getRadioButtonProtoOpenvpnTcpChecked WRITE setRadioButtonProtoOpenvpnTcpChecked NOTIFY radioButtonProtoOpenvpnTcpCheckedChanged)
|
||||
Q_PROPERTY(bool lineEditProtoOpenvpnPortEnabled READ getLineEditProtoOpenvpnPortEnabled WRITE setLineEditProtoOpenvpnPortEnabled NOTIFY lineEditProtoOpenvpnPortEnabledChanged)
|
||||
|
||||
Q_PROPERTY(bool comboBoxProtoOpenvpnCipherEnabled READ getComboBoxProtoOpenvpnCipherEnabled WRITE setComboBoxProtoOpenvpnCipherEnabled NOTIFY comboBoxProtoOpenvpnCipherEnabledChanged)
|
||||
Q_PROPERTY(bool comboBoxProtoOpenvpnHashEnabled READ getComboBoxProtoOpenvpnHashEnabled WRITE setComboBoxProtoOpenvpnHashEnabled NOTIFY comboBoxProtoOpenvpnHashEnabledChanged)
|
||||
Q_PROPERTY(bool pageProtoOpenvpnEnabled READ getPageProtoOpenvpnEnabled WRITE setPageProtoOpenvpnEnabled NOTIFY pageProtoOpenvpnEnabledChanged)
|
||||
Q_PROPERTY(bool labelProtoOpenvpnInfoVisible READ getLabelProtoOpenvpnInfoVisible WRITE setLabelProtoOpenvpnInfoVisible NOTIFY labelProtoOpenvpnInfoVisibleChanged)
|
||||
Q_PROPERTY(QString labelProtoOpenvpnInfoText READ getLabelProtoOpenvpnInfoText WRITE setLabelProtoOpenvpnInfoText NOTIFY labelProtoOpenvpnInfoTextChanged)
|
||||
Q_PROPERTY(int progressBarProtoOpenvpnResetValue READ getProgressBarProtoOpenvpnResetValue WRITE setProgressBarProtoOpenvpnResetValue NOTIFY progressBarProtoOpenvpnResetValueChanged)
|
||||
Q_PROPERTY(int progressBarProtoOpenvpnResetMaximium READ getProgressBarProtoOpenvpnResetMaximium WRITE setProgressBarProtoOpenvpnResetMaximium NOTIFY progressBarProtoOpenvpnResetMaximiumChanged)
|
||||
|
||||
Q_INVOKABLE void onCheckBoxProtoOpenvpnAutoEncryptionClicked();
|
||||
Q_INVOKABLE void onPushButtonProtoOpenvpnSaveClicked();
|
||||
|
||||
|
@ -45,110 +45,9 @@ public:
|
|||
void updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container, bool haveAuthData);
|
||||
QJsonObject getOpenVpnConfigFromPage(QJsonObject oldConfig);
|
||||
|
||||
QString getLineEditProtoOpenvpnSubnetText() const;
|
||||
void setLineEditProtoOpenvpnSubnetText(const QString &lineEditProtoOpenvpnSubnetText);
|
||||
bool getRadioButtonProtoOpenvpnUdpChecked() const;
|
||||
void setRadioButtonProtoOpenvpnUdpChecked(bool radioButtonProtoOpenvpnUdpChecked);
|
||||
bool getCheckBoxProtoOpenvpnAutoEncryptionChecked() const;
|
||||
void setCheckBoxProtoOpenvpnAutoEncryptionChecked(bool checkBoxProtoOpenvpnAutoEncryptionChecked);
|
||||
QString getComboBoxProtoOpenvpnCipherText() const;
|
||||
void setComboBoxProtoOpenvpnCipherText(const QString &comboBoxProtoOpenvpnCipherText);
|
||||
QString getComboBoxProtoOpenvpnHashText() const;
|
||||
void setComboBoxProtoOpenvpnHashText(const QString &comboBoxProtoOpenvpnHashText);
|
||||
bool getCheckBoxProtoOpenvpnBlockDnsChecked() const;
|
||||
void setCheckBoxProtoOpenvpnBlockDnsChecked(bool checkBoxProtoOpenvpnBlockDnsChecked);
|
||||
QString getLineEditProtoOpenvpnPortText() const;
|
||||
void setLineEditProtoOpenvpnPortText(const QString &lineEditProtoOpenvpnPortText);
|
||||
bool getCheckBoxProtoOpenvpnTlsAuthChecked() const;
|
||||
void setCheckBoxProtoOpenvpnTlsAuthChecked(bool checkBoxProtoOpenvpnTlsAuthChecked);
|
||||
|
||||
|
||||
bool getWidgetProtoOpenvpnEnabled() const;
|
||||
void setWidgetProtoOpenvpnEnabled(bool widgetProtoOpenvpnEnabled);
|
||||
bool getPushButtonProtoOpenvpnSaveVisible() const;
|
||||
void setPushButtonProtoOpenvpnSaveVisible(bool pushButtonProtoOpenvpnSaveVisible);
|
||||
bool getProgressBarProtoOpenvpnResetVisible() const;
|
||||
void setProgressBarProtoOpenvpnResetVisible(bool progressBarProtoOpenvpnResetVisible);
|
||||
bool getRadioButtonProtoOpenvpnUdpEnabled() const;
|
||||
void setRadioButtonProtoOpenvpnUdpEnabled(bool radioButtonProtoOpenvpnUdpEnabled);
|
||||
bool getRadioButtonProtoOpenvpnTcpEnabled() const;
|
||||
void setRadioButtonProtoOpenvpnTcpEnabled(bool radioButtonProtoOpenvpnTcpEnabled);
|
||||
bool getRadioButtonProtoOpenvpnTcpChecked() const;
|
||||
void setRadioButtonProtoOpenvpnTcpChecked(bool radioButtonProtoOpenvpnTcpChecked);
|
||||
bool getLineEditProtoOpenvpnPortEnabled() const;
|
||||
void setLineEditProtoOpenvpnPortEnabled(bool lineEditProtoOpenvpnPortEnabled);
|
||||
|
||||
bool getComboBoxProtoOpenvpnCipherEnabled() const;
|
||||
void setComboBoxProtoOpenvpnCipherEnabled(bool comboBoxProtoOpenvpnCipherEnabled);
|
||||
bool getComboBoxProtoOpenvpnHashEnabled() const;
|
||||
void setComboBoxProtoOpenvpnHashEnabled(bool comboBoxProtoOpenvpnHashEnabled);
|
||||
bool getPageProtoOpenvpnEnabled() const;
|
||||
void setPageProtoOpenvpnEnabled(bool pageProtoOpenvpnEnabled);
|
||||
bool getLabelProtoOpenvpnInfoVisible() const;
|
||||
void setLabelProtoOpenvpnInfoVisible(bool labelProtoOpenvpnInfoVisible);
|
||||
QString getLabelProtoOpenvpnInfoText() const;
|
||||
void setLabelProtoOpenvpnInfoText(const QString &labelProtoOpenvpnInfoText);
|
||||
int getProgressBarProtoOpenvpnResetValue() const;
|
||||
void setProgressBarProtoOpenvpnResetValue(int progressBarProtoOpenvpnResetValue);
|
||||
int getProgressBarProtoOpenvpnResetMaximium() const;
|
||||
void setProgressBarProtoOpenvpnResetMaximium(int progressBarProtoOpenvpnResetMaximium);
|
||||
|
||||
signals:
|
||||
void lineEditProtoOpenvpnSubnetTextChanged();
|
||||
void radioButtonProtoOpenvpnUdpCheckedChanged();
|
||||
void checkBoxProtoOpenvpnAutoEncryptionCheckedChanged();
|
||||
void comboBoxProtoOpenvpnCipherTextChanged();
|
||||
void comboBoxProtoOpenvpnHashTextChanged();
|
||||
void checkBoxProtoOpenvpnBlockDnsCheckedChanged();
|
||||
void lineEditProtoOpenvpnPortTextChanged();
|
||||
void checkBoxProtoOpenvpnTlsAuthCheckedChanged();
|
||||
void widgetProtoOpenvpnEnabledChanged();
|
||||
void pushButtonProtoOpenvpnSaveVisibleChanged();
|
||||
void progressBarProtoOpenvpnResetVisibleChanged();
|
||||
void radioButtonProtoOpenvpnUdpEnabledChanged();
|
||||
void radioButtonProtoOpenvpnTcpEnabledChanged();
|
||||
void radioButtonProtoOpenvpnTcpCheckedChanged();
|
||||
void lineEditProtoOpenvpnPortEnabledChanged();
|
||||
void comboBoxProtoOpenvpnCipherEnabledChanged();
|
||||
void comboBoxProtoOpenvpnHashEnabledChanged();
|
||||
void pageProtoOpenvpnEnabledChanged();
|
||||
void labelProtoOpenvpnInfoVisibleChanged();
|
||||
void labelProtoOpenvpnInfoTextChanged();
|
||||
void progressBarProtoOpenvpnResetValueChanged();
|
||||
void progressBarProtoOpenvpnResetMaximiumChanged();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
|
||||
private:
|
||||
Settings m_settings;
|
||||
UiLogic *m_uiLogic;
|
||||
|
||||
QString m_lineEditProtoOpenvpnSubnetText;
|
||||
bool m_radioButtonProtoOpenvpnUdpChecked;
|
||||
bool m_checkBoxProtoOpenvpnAutoEncryptionChecked;
|
||||
QString m_comboBoxProtoOpenvpnCipherText;
|
||||
QString m_comboBoxProtoOpenvpnHashText;
|
||||
bool m_checkBoxProtoOpenvpnBlockDnsChecked;
|
||||
QString m_lineEditProtoOpenvpnPortText;
|
||||
bool m_checkBoxProtoOpenvpnTlsAuthChecked;
|
||||
bool m_widgetProtoOpenvpnEnabled;
|
||||
bool m_pushButtonProtoOpenvpnSaveVisible;
|
||||
bool m_progressBarProtoOpenvpnResetVisible;
|
||||
bool m_radioButtonProtoOpenvpnUdpEnabled;
|
||||
bool m_radioButtonProtoOpenvpnTcpEnabled;
|
||||
bool m_radioButtonProtoOpenvpnTcpChecked;
|
||||
bool m_lineEditProtoOpenvpnPortEnabled;
|
||||
bool m_comboBoxProtoOpenvpnCipherEnabled;
|
||||
bool m_comboBoxProtoOpenvpnHashEnabled;
|
||||
bool m_pageProtoOpenvpnEnabled;
|
||||
bool m_labelProtoOpenvpnInfoVisible;
|
||||
QString m_labelProtoOpenvpnInfoText;
|
||||
int m_progressBarProtoOpenvpnResetValue;
|
||||
int m_progressBarProtoOpenvpnResetMaximium;
|
||||
};
|
||||
#endif // OPENVPN_LOGIC_H
|
||||
|
|
|
@ -11,7 +11,7 @@ ShadowSocksLogic::ShadowSocksLogic(UiLogic *logic, QObject *parent):
|
|||
m_widgetProtoSsEnabled{false},
|
||||
m_comboBoxProtoShadowsocksCipherText{"chacha20-poly1305"},
|
||||
m_lineEditProtoShadowsocksPortText{},
|
||||
m_pushButtonProtoShadowsocksSaveVisible{false},
|
||||
m_pushButtonShadowsocksSaveVisible{false},
|
||||
m_progressBarProtoShadowsocksResetVisible{false},
|
||||
m_lineEditProtoShadowsocksPortEnabled{false},
|
||||
m_pageProtoShadowsocksEnabled{true},
|
||||
|
@ -25,170 +25,27 @@ ShadowSocksLogic::ShadowSocksLogic(UiLogic *logic, QObject *parent):
|
|||
|
||||
void ShadowSocksLogic::updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData)
|
||||
{
|
||||
setWidgetProtoSsEnabled(haveAuthData);
|
||||
setPushButtonProtoShadowsocksSaveVisible(haveAuthData);
|
||||
setProgressBarProtoShadowsocksResetVisible(haveAuthData);
|
||||
set_widgetProtoSsEnabled(haveAuthData);
|
||||
set_pushButtonShadowsocksSaveVisible(haveAuthData);
|
||||
set_progressBarProtoShadowsocksResetVisible(haveAuthData);
|
||||
|
||||
setComboBoxProtoShadowsocksCipherText(ssConfig.value(config_key::cipher).
|
||||
set_comboBoxProtoShadowsocksCipherText(ssConfig.value(config_key::cipher).
|
||||
toString(protocols::shadowsocks::defaultCipher));
|
||||
|
||||
setLineEditProtoShadowsocksPortText(ssConfig.value(config_key::port).
|
||||
set_lineEditProtoShadowsocksPortText(ssConfig.value(config_key::port).
|
||||
toString(protocols::shadowsocks::defaultPort));
|
||||
|
||||
setLineEditProtoShadowsocksPortEnabled(container == DockerContainer::OpenVpnOverShadowSocks);
|
||||
set_lineEditProtoShadowsocksPortEnabled(container == DockerContainer::OpenVpnOverShadowSocks);
|
||||
}
|
||||
|
||||
QJsonObject ShadowSocksLogic::getShadowSocksConfigFromPage(QJsonObject oldConfig)
|
||||
{
|
||||
oldConfig.insert(config_key::cipher, getComboBoxProtoShadowsocksCipherText());
|
||||
oldConfig.insert(config_key::port, getLineEditProtoShadowsocksPortText());
|
||||
oldConfig.insert(config_key::cipher, comboBoxProtoShadowsocksCipherText());
|
||||
oldConfig.insert(config_key::port, lineEditProtoShadowsocksPortText());
|
||||
|
||||
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(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, Protocol::ShadowSocks);
|
||||
|
@ -199,31 +56,31 @@ void ShadowSocksLogic::onPushButtonProtoShadowsocksSaveClicked()
|
|||
newContainerConfig.insert(config_key::shadowsocks, protocolConfig);
|
||||
UiLogic::PageFunc page_proto_shadowsocks;
|
||||
page_proto_shadowsocks.setEnabledFunc = [this] (bool enabled) -> void {
|
||||
setPageProtoShadowsocksEnabled(enabled);
|
||||
set_pageProtoShadowsocksEnabled(enabled);
|
||||
};
|
||||
UiLogic::ButtonFunc pushButton_proto_shadowsocks_save;
|
||||
pushButton_proto_shadowsocks_save.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setPushButtonProtoShadowsocksSaveVisible(visible);
|
||||
set_pushButtonShadowsocksSaveVisible(visible);
|
||||
};
|
||||
UiLogic::LabelFunc label_proto_shadowsocks_info;
|
||||
label_proto_shadowsocks_info.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setLabelProtoShadowsocksInfoVisible(visible);
|
||||
set_labelProtoShadowsocksInfoVisible(visible);
|
||||
};
|
||||
label_proto_shadowsocks_info.setTextFunc = [this] (const QString& text) ->void {
|
||||
setLabelProtoShadowsocksInfoText(text);
|
||||
set_labelProtoShadowsocksInfoText(text);
|
||||
};
|
||||
UiLogic::ProgressFunc progressBar_proto_shadowsocks_reset;
|
||||
progressBar_proto_shadowsocks_reset.setVisibleFunc = [this] (bool visible) ->void {
|
||||
setProgressBarProtoShadowsocksResetVisible(visible);
|
||||
set_progressBarProtoShadowsocksResetVisible(visible);
|
||||
};
|
||||
progressBar_proto_shadowsocks_reset.setValueFunc = [this] (int value) ->void {
|
||||
setProgressBarProtoShadowsocksResetValue(value);
|
||||
set_progressBarProtoShadowsocksResetValue(value);
|
||||
};
|
||||
progressBar_proto_shadowsocks_reset.getValueFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoShadowsocksResetValue();
|
||||
return progressBarProtoShadowsocksResetValue();
|
||||
};
|
||||
progressBar_proto_shadowsocks_reset.getMaximiumFunc = [this] (void) -> int {
|
||||
return getProgressBarProtoShadowsocksResetMaximium();
|
||||
return progressBarProtoShadowsocksResetMaximium();
|
||||
};
|
||||
|
||||
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, newContainerConfig](){
|
||||
|
|
|
@ -9,19 +9,19 @@ class ShadowSocksLogic : public PageLogicBase
|
|||
{
|
||||
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)
|
||||
AUTO_PROPERTY(bool, widgetProtoSsEnabled)
|
||||
AUTO_PROPERTY(QString, comboBoxProtoShadowsocksCipherText)
|
||||
AUTO_PROPERTY(QString, lineEditProtoShadowsocksPortText)
|
||||
AUTO_PROPERTY(bool, pushButtonShadowsocksSaveVisible)
|
||||
AUTO_PROPERTY(bool, progressBarProtoShadowsocksResetVisible)
|
||||
AUTO_PROPERTY(bool, lineEditProtoShadowsocksPortEnabled)
|
||||
AUTO_PROPERTY(bool, pageProtoShadowsocksEnabled)
|
||||
AUTO_PROPERTY(bool, labelProtoShadowsocksInfoVisible)
|
||||
AUTO_PROPERTY(QString, labelProtoShadowsocksInfoText)
|
||||
AUTO_PROPERTY(int, progressBarProtoShadowsocksResetValue)
|
||||
AUTO_PROPERTY(int, progressBarProtoShadowsocksResetMaximium)
|
||||
|
||||
public:
|
||||
Q_INVOKABLE void onPushButtonProtoShadowsocksSaveClicked();
|
||||
|
||||
public:
|
||||
|
@ -31,66 +31,9 @@ public:
|
|||
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:
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue