qml ui fixws: ss and cloak
This commit is contained in:
parent
d7f672ab0a
commit
9de89e5544
10 changed files with 381 additions and 521 deletions
|
@ -8,17 +8,17 @@ using namespace PageEnumNS;
|
||||||
|
|
||||||
CloakLogic::CloakLogic(UiLogic *logic, QObject *parent):
|
CloakLogic::CloakLogic(UiLogic *logic, QObject *parent):
|
||||||
PageProtocolLogicBase(logic, parent),
|
PageProtocolLogicBase(logic, parent),
|
||||||
m_comboBoxProtoCloakCipherText{"chacha20-poly1305"},
|
m_comboBoxCipherText{"chacha20-poly1305"},
|
||||||
m_lineEditProtoCloakSiteText{"tile.openstreetmap.org"},
|
m_lineEditSiteText{"tile.openstreetmap.org"},
|
||||||
m_lineEditProtoCloakPortText{},
|
m_lineEditPortText{},
|
||||||
m_pushButtonCloakSaveVisible{false},
|
m_pushButtonSaveVisible{false},
|
||||||
m_progressBarProtoCloakResetVisible{false},
|
m_progressBarResetVisible{false},
|
||||||
m_lineEditProtoCloakPortEnabled{false},
|
m_lineEditPortEnabled{false},
|
||||||
m_pageProtoCloakEnabled{true},
|
m_pageEnabled{true},
|
||||||
m_labelProtoCloakInfoVisible{true},
|
m_labelInfoVisible{true},
|
||||||
m_labelProtoCloakInfoText{},
|
m_labelInfoText{},
|
||||||
m_progressBarProtoCloakResetValue{0},
|
m_progressBarResetValue{0},
|
||||||
m_progressBarProtoCloakResetMaximium{100}
|
m_progressBarResetMaximium{100}
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,31 +26,31 @@ CloakLogic::CloakLogic(UiLogic *logic, QObject *parent):
|
||||||
void CloakLogic::updateProtocolPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData)
|
void CloakLogic::updateProtocolPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData)
|
||||||
{
|
{
|
||||||
set_pageEnabled(haveAuthData);
|
set_pageEnabled(haveAuthData);
|
||||||
set_pushButtonCloakSaveVisible(haveAuthData);
|
set_pushButtonSaveVisible(haveAuthData);
|
||||||
set_progressBarProtoCloakResetVisible(haveAuthData);
|
set_progressBarResetVisible(haveAuthData);
|
||||||
|
|
||||||
set_comboBoxProtoCloakCipherText(ckConfig.value(config_key::cipher).
|
set_comboBoxCipherText(ckConfig.value(config_key::cipher).
|
||||||
toString(protocols::cloak::defaultCipher));
|
toString(protocols::cloak::defaultCipher));
|
||||||
|
|
||||||
set_lineEditProtoCloakSiteText(ckConfig.value(config_key::site).
|
set_lineEditSiteText(ckConfig.value(config_key::site).
|
||||||
toString(protocols::cloak::defaultRedirSite));
|
toString(protocols::cloak::defaultRedirSite));
|
||||||
|
|
||||||
set_lineEditProtoCloakPortText(ckConfig.value(config_key::port).
|
set_lineEditPortText(ckConfig.value(config_key::port).
|
||||||
toString(protocols::cloak::defaultPort));
|
toString(protocols::cloak::defaultPort));
|
||||||
|
|
||||||
set_lineEditProtoCloakPortEnabled(container == DockerContainer::Cloak);
|
set_lineEditPortEnabled(container == DockerContainer::Cloak);
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject CloakLogic::getProtocolConfigFromPage(QJsonObject oldConfig)
|
QJsonObject CloakLogic::getProtocolConfigFromPage(QJsonObject oldConfig)
|
||||||
{
|
{
|
||||||
oldConfig.insert(config_key::cipher, comboBoxProtoCloakCipherText());
|
oldConfig.insert(config_key::cipher, comboBoxCipherText());
|
||||||
oldConfig.insert(config_key::site, lineEditProtoCloakSiteText());
|
oldConfig.insert(config_key::site, lineEditSiteText());
|
||||||
oldConfig.insert(config_key::port, lineEditProtoCloakPortText());
|
oldConfig.insert(config_key::port, lineEditPortText());
|
||||||
|
|
||||||
return oldConfig;
|
return oldConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloakLogic::onPushButtonProtoCloakSaveClicked()
|
void CloakLogic::onPushButtonSaveClicked()
|
||||||
{
|
{
|
||||||
QJsonObject protocolConfig = m_settings.protocolConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, Protocol::Cloak);
|
QJsonObject protocolConfig = m_settings.protocolConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, Protocol::Cloak);
|
||||||
protocolConfig = getProtocolConfigFromPage(protocolConfig);
|
protocolConfig = getProtocolConfigFromPage(protocolConfig);
|
||||||
|
@ -59,40 +59,40 @@ void CloakLogic::onPushButtonProtoCloakSaveClicked()
|
||||||
QJsonObject newContainerConfig = containerConfig;
|
QJsonObject newContainerConfig = containerConfig;
|
||||||
newContainerConfig.insert(ProtocolProps::protoToString(Protocol::Cloak), protocolConfig);
|
newContainerConfig.insert(ProtocolProps::protoToString(Protocol::Cloak), protocolConfig);
|
||||||
|
|
||||||
UiLogic::PageFunc page_proto_cloak;
|
UiLogic::PageFunc page_func;
|
||||||
page_proto_cloak.setEnabledFunc = [this] (bool enabled) -> void {
|
page_func.setEnabledFunc = [this] (bool enabled) -> void {
|
||||||
set_pageProtoCloakEnabled(enabled);
|
set_pageEnabled(enabled);
|
||||||
};
|
};
|
||||||
UiLogic::ButtonFunc pushButton_proto_cloak_save;
|
UiLogic::ButtonFunc pushButton_save_func;
|
||||||
pushButton_proto_cloak_save.setVisibleFunc = [this] (bool visible) ->void {
|
pushButton_save_func.setVisibleFunc = [this] (bool visible) ->void {
|
||||||
set_pushButtonCloakSaveVisible(visible);
|
set_pushButtonSaveVisible(visible);
|
||||||
};
|
};
|
||||||
UiLogic::LabelFunc label_proto_cloak_info;
|
UiLogic::LabelFunc label_info_func;
|
||||||
label_proto_cloak_info.setVisibleFunc = [this] (bool visible) ->void {
|
label_info_func.setVisibleFunc = [this] (bool visible) ->void {
|
||||||
set_labelProtoCloakInfoVisible(visible);
|
set_labelInfoVisible(visible);
|
||||||
};
|
};
|
||||||
label_proto_cloak_info.setTextFunc = [this] (const QString& text) ->void {
|
label_info_func.setTextFunc = [this] (const QString& text) ->void {
|
||||||
set_labelProtoCloakInfoText(text);
|
set_labelInfoText(text);
|
||||||
};
|
};
|
||||||
UiLogic::ProgressFunc progressBar_proto_cloak_reset;
|
UiLogic::ProgressFunc progressBar_reset;
|
||||||
progressBar_proto_cloak_reset.setVisibleFunc = [this] (bool visible) ->void {
|
progressBar_reset.setVisibleFunc = [this] (bool visible) ->void {
|
||||||
set_progressBarProtoCloakResetVisible(visible);
|
set_progressBarResetVisible(visible);
|
||||||
};
|
};
|
||||||
progressBar_proto_cloak_reset.setValueFunc = [this] (int value) ->void {
|
progressBar_reset.setValueFunc = [this] (int value) ->void {
|
||||||
set_progressBarProtoCloakResetValue(value);
|
set_progressBarResetValue(value);
|
||||||
};
|
};
|
||||||
progressBar_proto_cloak_reset.getValueFunc = [this] (void) -> int {
|
progressBar_reset.getValueFunc = [this] (void) -> int {
|
||||||
return progressBarProtoCloakResetValue();
|
return progressBarResetValue();
|
||||||
};
|
};
|
||||||
progressBar_proto_cloak_reset.getMaximiumFunc = [this] (void) -> int {
|
progressBar_reset.getMaximiumFunc = [this] (void) -> int {
|
||||||
return progressBarProtoCloakResetMaximium();
|
return progressBarResetMaximium();
|
||||||
};
|
};
|
||||||
|
|
||||||
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, &newContainerConfig](){
|
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, &newContainerConfig](){
|
||||||
return ServerController::updateContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), uiLogic()->selectedDockerContainer, containerConfig, newContainerConfig);
|
return ServerController::updateContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), uiLogic()->selectedDockerContainer, containerConfig, newContainerConfig);
|
||||||
},
|
},
|
||||||
page_proto_cloak, progressBar_proto_cloak_reset,
|
page_func, progressBar_reset,
|
||||||
pushButton_proto_cloak_save, label_proto_cloak_info);
|
pushButton_save_func, label_info_func);
|
||||||
|
|
||||||
if (!e) {
|
if (!e) {
|
||||||
m_settings.setContainerConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, newContainerConfig);
|
m_settings.setContainerConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, newContainerConfig);
|
||||||
|
|
|
@ -9,20 +9,20 @@ class CloakLogic : public PageProtocolLogicBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
AUTO_PROPERTY(QString, comboBoxProtoCloakCipherText)
|
AUTO_PROPERTY(QString, comboBoxCipherText)
|
||||||
AUTO_PROPERTY(QString, lineEditProtoCloakSiteText)
|
AUTO_PROPERTY(QString, lineEditSiteText)
|
||||||
AUTO_PROPERTY(QString, lineEditProtoCloakPortText)
|
AUTO_PROPERTY(QString, lineEditPortText)
|
||||||
AUTO_PROPERTY(bool, pushButtonCloakSaveVisible)
|
AUTO_PROPERTY(bool, pushButtonSaveVisible)
|
||||||
AUTO_PROPERTY(bool, progressBarProtoCloakResetVisible)
|
AUTO_PROPERTY(bool, progressBarResetVisible)
|
||||||
AUTO_PROPERTY(bool, lineEditProtoCloakPortEnabled)
|
AUTO_PROPERTY(bool, lineEditPortEnabled)
|
||||||
AUTO_PROPERTY(bool, pageProtoCloakEnabled)
|
AUTO_PROPERTY(bool, pageEnabled)
|
||||||
AUTO_PROPERTY(bool, labelProtoCloakInfoVisible)
|
AUTO_PROPERTY(bool, labelInfoVisible)
|
||||||
AUTO_PROPERTY(QString, labelProtoCloakInfoText)
|
AUTO_PROPERTY(QString, labelInfoText)
|
||||||
AUTO_PROPERTY(int, progressBarProtoCloakResetValue)
|
AUTO_PROPERTY(int, progressBarResetValue)
|
||||||
AUTO_PROPERTY(int, progressBarProtoCloakResetMaximium)
|
AUTO_PROPERTY(int, progressBarResetMaximium)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE void onPushButtonProtoCloakSaveClicked();
|
Q_INVOKABLE void onPushButtonSaveClicked();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CloakLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
explicit CloakLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||||
|
|
|
@ -8,16 +8,15 @@ using namespace PageEnumNS;
|
||||||
|
|
||||||
ShadowSocksLogic::ShadowSocksLogic(UiLogic *logic, QObject *parent):
|
ShadowSocksLogic::ShadowSocksLogic(UiLogic *logic, QObject *parent):
|
||||||
PageProtocolLogicBase(logic, parent),
|
PageProtocolLogicBase(logic, parent),
|
||||||
m_comboBoxProtoShadowSocksCipherText{"chacha20-poly1305"},
|
m_comboBoxCipherText{"chacha20-poly1305"},
|
||||||
m_lineEditProtoShadowSocksPortText{},
|
m_lineEditPortText{},
|
||||||
m_pushButtonShadowSocksSaveVisible{false},
|
m_pushButtonSaveVisible{false},
|
||||||
m_progressBarProtoShadowSocksResetVisible{false},
|
m_progressBaResetVisible{false},
|
||||||
m_lineEditProtoShadowSocksPortEnabled{false},
|
m_lineEditPortEnabled{false},
|
||||||
m_pageProtoShadowSocksEnabled{true},
|
m_labelInfoVisible{true},
|
||||||
m_labelProtoShadowSocksInfoVisible{true},
|
m_labelInfoText{},
|
||||||
m_labelProtoShadowSocksInfoText{},
|
m_progressBaResetValue{0},
|
||||||
m_progressBarProtoShadowSocksResetValue{0},
|
m_progressBaResetMaximium{100}
|
||||||
m_progressBarProtoShadowSocksResetMaximium{100}
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,27 +24,27 @@ ShadowSocksLogic::ShadowSocksLogic(UiLogic *logic, QObject *parent):
|
||||||
void ShadowSocksLogic::updateProtocolPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData)
|
void ShadowSocksLogic::updateProtocolPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData)
|
||||||
{
|
{
|
||||||
set_pageEnabled(haveAuthData);
|
set_pageEnabled(haveAuthData);
|
||||||
set_pushButtonShadowSocksSaveVisible(haveAuthData);
|
set_pushButtonSaveVisible(haveAuthData);
|
||||||
set_progressBarProtoShadowSocksResetVisible(haveAuthData);
|
set_progressBaResetVisible(haveAuthData);
|
||||||
|
|
||||||
set_comboBoxProtoShadowSocksCipherText(ssConfig.value(config_key::cipher).
|
set_comboBoxCipherText(ssConfig.value(config_key::cipher).
|
||||||
toString(protocols::shadowsocks::defaultCipher));
|
toString(protocols::shadowsocks::defaultCipher));
|
||||||
|
|
||||||
set_lineEditProtoShadowSocksPortText(ssConfig.value(config_key::port).
|
set_lineEditPortText(ssConfig.value(config_key::port).
|
||||||
toString(protocols::shadowsocks::defaultPort));
|
toString(protocols::shadowsocks::defaultPort));
|
||||||
|
|
||||||
set_lineEditProtoShadowSocksPortEnabled(container == DockerContainer::ShadowSocks);
|
set_lineEditPortEnabled(container == DockerContainer::ShadowSocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject ShadowSocksLogic::getProtocolConfigFromPage(QJsonObject oldConfig)
|
QJsonObject ShadowSocksLogic::getProtocolConfigFromPage(QJsonObject oldConfig)
|
||||||
{
|
{
|
||||||
oldConfig.insert(config_key::cipher, comboBoxProtoShadowSocksCipherText());
|
oldConfig.insert(config_key::cipher, comboBoxCipherText());
|
||||||
oldConfig.insert(config_key::port, lineEditProtoShadowSocksPortText());
|
oldConfig.insert(config_key::port, lineEditPortText());
|
||||||
|
|
||||||
return oldConfig;
|
return oldConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShadowSocksLogic::onPushButtonProtoShadowSocksSaveClicked()
|
void ShadowSocksLogic::onPushButtonSaveClicked()
|
||||||
{
|
{
|
||||||
QJsonObject protocolConfig = m_settings.protocolConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, Protocol::ShadowSocks);
|
QJsonObject protocolConfig = m_settings.protocolConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, Protocol::ShadowSocks);
|
||||||
//protocolConfig = getShadowSocksConfigFromPage(protocolConfig);
|
//protocolConfig = getShadowSocksConfigFromPage(protocolConfig);
|
||||||
|
@ -55,37 +54,37 @@ void ShadowSocksLogic::onPushButtonProtoShadowSocksSaveClicked()
|
||||||
newContainerConfig.insert(ProtocolProps::protoToString(Protocol::ShadowSocks), protocolConfig);
|
newContainerConfig.insert(ProtocolProps::protoToString(Protocol::ShadowSocks), protocolConfig);
|
||||||
UiLogic::PageFunc page_proto_shadowsocks;
|
UiLogic::PageFunc page_proto_shadowsocks;
|
||||||
page_proto_shadowsocks.setEnabledFunc = [this] (bool enabled) -> void {
|
page_proto_shadowsocks.setEnabledFunc = [this] (bool enabled) -> void {
|
||||||
set_pageProtoShadowSocksEnabled(enabled);
|
set_pageEnabled(enabled);
|
||||||
};
|
};
|
||||||
UiLogic::ButtonFunc pushButton_proto_shadowsocks_save;
|
UiLogic::ButtonFunc pushButton_proto_shadowsocks_save;
|
||||||
pushButton_proto_shadowsocks_save.setVisibleFunc = [this] (bool visible) ->void {
|
pushButton_proto_shadowsocks_save.setVisibleFunc = [this] (bool visible) ->void {
|
||||||
set_pushButtonShadowSocksSaveVisible(visible);
|
set_pushButtonSaveVisible(visible);
|
||||||
};
|
};
|
||||||
UiLogic::LabelFunc label_proto_shadowsocks_info;
|
UiLogic::LabelFunc label_proto_shadowsocks_info;
|
||||||
label_proto_shadowsocks_info.setVisibleFunc = [this] (bool visible) ->void {
|
label_proto_shadowsocks_info.setVisibleFunc = [this] (bool visible) ->void {
|
||||||
set_labelProtoShadowSocksInfoVisible(visible);
|
set_labelInfoVisible(visible);
|
||||||
};
|
};
|
||||||
label_proto_shadowsocks_info.setTextFunc = [this] (const QString& text) ->void {
|
label_proto_shadowsocks_info.setTextFunc = [this] (const QString& text) ->void {
|
||||||
set_labelProtoShadowSocksInfoText(text);
|
set_labelInfoText(text);
|
||||||
};
|
};
|
||||||
UiLogic::ProgressFunc progressBar_proto_shadowsocks_reset;
|
UiLogic::ProgressFunc progressBar_reset;
|
||||||
progressBar_proto_shadowsocks_reset.setVisibleFunc = [this] (bool visible) ->void {
|
progressBar_reset.setVisibleFunc = [this] (bool visible) ->void {
|
||||||
set_progressBarProtoShadowSocksResetVisible(visible);
|
set_progressBaResetVisible(visible);
|
||||||
};
|
};
|
||||||
progressBar_proto_shadowsocks_reset.setValueFunc = [this] (int value) ->void {
|
progressBar_reset.setValueFunc = [this] (int value) ->void {
|
||||||
set_progressBarProtoShadowSocksResetValue(value);
|
set_progressBaResetValue(value);
|
||||||
};
|
};
|
||||||
progressBar_proto_shadowsocks_reset.getValueFunc = [this] (void) -> int {
|
progressBar_reset.getValueFunc = [this] (void) -> int {
|
||||||
return progressBarProtoShadowSocksResetValue();
|
return progressBaResetValue();
|
||||||
};
|
};
|
||||||
progressBar_proto_shadowsocks_reset.getMaximiumFunc = [this] (void) -> int {
|
progressBar_reset.getMaximiumFunc = [this] (void) -> int {
|
||||||
return progressBarProtoShadowSocksResetMaximium();
|
return progressBaResetMaximium();
|
||||||
};
|
};
|
||||||
|
|
||||||
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, &newContainerConfig](){
|
ErrorCode e = uiLogic()->doInstallAction([this, containerConfig, &newContainerConfig](){
|
||||||
return ServerController::updateContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), uiLogic()->selectedDockerContainer, containerConfig, newContainerConfig);
|
return ServerController::updateContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), uiLogic()->selectedDockerContainer, containerConfig, newContainerConfig);
|
||||||
},
|
},
|
||||||
page_proto_shadowsocks, progressBar_proto_shadowsocks_reset,
|
page_proto_shadowsocks, progressBar_reset,
|
||||||
pushButton_proto_shadowsocks_save, label_proto_shadowsocks_info);
|
pushButton_proto_shadowsocks_save, label_proto_shadowsocks_info);
|
||||||
|
|
||||||
if (!e) {
|
if (!e) {
|
||||||
|
|
|
@ -9,19 +9,18 @@ class ShadowSocksLogic : public PageProtocolLogicBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
AUTO_PROPERTY(QString, comboBoxProtoShadowSocksCipherText)
|
AUTO_PROPERTY(QString, comboBoxCipherText)
|
||||||
AUTO_PROPERTY(QString, lineEditProtoShadowSocksPortText)
|
AUTO_PROPERTY(QString, lineEditPortText)
|
||||||
AUTO_PROPERTY(bool, pushButtonShadowSocksSaveVisible)
|
AUTO_PROPERTY(bool, pushButtonSaveVisible)
|
||||||
AUTO_PROPERTY(bool, progressBarProtoShadowSocksResetVisible)
|
AUTO_PROPERTY(bool, progressBaResetVisible)
|
||||||
AUTO_PROPERTY(bool, lineEditProtoShadowSocksPortEnabled)
|
AUTO_PROPERTY(bool, lineEditPortEnabled)
|
||||||
AUTO_PROPERTY(bool, pageProtoShadowSocksEnabled)
|
AUTO_PROPERTY(bool, labelInfoVisible)
|
||||||
AUTO_PROPERTY(bool, labelProtoShadowSocksInfoVisible)
|
AUTO_PROPERTY(QString, labelInfoText)
|
||||||
AUTO_PROPERTY(QString, labelProtoShadowSocksInfoText)
|
AUTO_PROPERTY(int, progressBaResetValue)
|
||||||
AUTO_PROPERTY(int, progressBarProtoShadowSocksResetValue)
|
AUTO_PROPERTY(int, progressBaResetMaximium)
|
||||||
AUTO_PROPERTY(int, progressBarProtoShadowSocksResetMaximium)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE void onPushButtonProtoShadowSocksSaveClicked();
|
Q_INVOKABLE void onPushButtonSaveClicked();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ShadowSocksLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
explicit ShadowSocksLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||||
|
|
|
@ -147,172 +147,4 @@ PageBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ScrollView {
|
|
||||||
// id: scrollView
|
|
||||||
// width: parent.width - 40
|
|
||||||
// anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
|
|
||||||
// anchors.top: pb_add_container.bottom
|
|
||||||
// anchors.topMargin: 10
|
|
||||||
|
|
||||||
// anchors.bottom: pushButtonConfigure.top
|
|
||||||
// anchors.bottomMargin: 10
|
|
||||||
|
|
||||||
// clip: true
|
|
||||||
// Column {
|
|
||||||
// width: scrollView.width
|
|
||||||
// anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
|
|
||||||
// spacing: 5
|
|
||||||
// InstallSettingsBase {
|
|
||||||
// containerDescription: qsTr("OpenVPN and ShadowSocks\n with masking using Cloak plugin")
|
|
||||||
// onContainerChecked: NewServerProtocolsLogic.checkBoxCloakChecked = checked
|
|
||||||
|
|
||||||
// LabelType {
|
|
||||||
// width: 130
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// text: qsTr("Port (TCP)")
|
|
||||||
// }
|
|
||||||
// TextFieldType {
|
|
||||||
// width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// text: NewServerProtocolsLogic.lineEditCloakPortText
|
|
||||||
// onEditingFinished: {
|
|
||||||
// NewServerProtocolsLogic.lineEditCloakPortText = text
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// LabelType {
|
|
||||||
// width: 130
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// text: qsTr("Fake Web Site")
|
|
||||||
// }
|
|
||||||
// TextFieldType {
|
|
||||||
// width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// text: NewServerProtocolsLogic.lineEditCloakSiteText
|
|
||||||
// onEditingFinished: {
|
|
||||||
// NewServerProtocolsLogic.lineEditCloakSiteText = text
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// InstallSettingsBase {
|
|
||||||
// containerDescription: qsTr("ShadowSocks")
|
|
||||||
// onContainerChecked: NewServerProtocolsLogic.checkBoxSsChecked = checked
|
|
||||||
|
|
||||||
// LabelType {
|
|
||||||
// width: 130
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// text: qsTr("Port (TCP)")
|
|
||||||
// }
|
|
||||||
// TextFieldType {
|
|
||||||
// width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// text: NewServerProtocolsLogic.lineEditSsPortText
|
|
||||||
// onEditingFinished: {
|
|
||||||
// NewServerProtocolsLogic.lineEditSsPortText = text
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// LabelType {
|
|
||||||
// width: 130
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// text: qsTr("Encryption")
|
|
||||||
// }
|
|
||||||
// ComboBoxType {
|
|
||||||
// width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// model: [
|
|
||||||
// qsTr("chacha20-ietf-poly1305"),
|
|
||||||
// qsTr("xchacha20-ietf-poly1305"),
|
|
||||||
// qsTr("aes-256-gcm"),
|
|
||||||
// qsTr("aes-192-gcm"),
|
|
||||||
// qsTr("aes-128-gcm")
|
|
||||||
// ]
|
|
||||||
// currentIndex: {
|
|
||||||
// for (let i = 0; i < model.length; ++i) {
|
|
||||||
// if (NewServerProtocolsLogic.comboBoxSsCipherText === model[i]) {
|
|
||||||
// return i
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return -1
|
|
||||||
// }
|
|
||||||
// onCurrentTextChanged: {
|
|
||||||
// NewServerProtocolsLogic.comboBoxSsCipherText = currentText
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// InstallSettingsBase {
|
|
||||||
// containerDescription: qsTr("OpenVPN")
|
|
||||||
// onContainerChecked: NewServerProtocolsLogic.checkBoxOpenVpnChecked = checked
|
|
||||||
|
|
||||||
// LabelType {
|
|
||||||
// width: 130
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// text: qsTr("Port (TCP/UDP)")
|
|
||||||
// }
|
|
||||||
// TextFieldType {
|
|
||||||
// width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// text: NewServerProtocolsLogic.lineEditOpenvpnPortText
|
|
||||||
// onEditingFinished: {
|
|
||||||
// NewServerProtocolsLogic.lineEditOpenvpnPortText = text
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// LabelType {
|
|
||||||
// width: 130
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// text: qsTr("Protocol")
|
|
||||||
// }
|
|
||||||
// ComboBoxType {
|
|
||||||
// width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2) / 2
|
|
||||||
// model: [
|
|
||||||
// qsTr("udp"),
|
|
||||||
// qsTr("tcp"),
|
|
||||||
// ]
|
|
||||||
// currentIndex: {
|
|
||||||
// for (let i = 0; i < model.length; ++i) {
|
|
||||||
// if (NewServerProtocolsLogic.comboBoxOpenvpnProtoText === model[i]) {
|
|
||||||
// return i
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return -1
|
|
||||||
// }
|
|
||||||
// onCurrentTextChanged: {
|
|
||||||
// NewServerProtocolsLogic.comboBoxOpenvpnProtoText = currentText
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// InstallSettingsBase {
|
|
||||||
// visible: false
|
|
||||||
// containerDescription: qsTr("WireGuard")
|
|
||||||
// onContainerChecked: NewServerProtocolsLogic.checkBoxWireGuardChecked = checked
|
|
||||||
|
|
||||||
// LabelType {
|
|
||||||
// width: 130
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2)
|
|
||||||
// text: qsTr("Port (UDP)")
|
|
||||||
// }
|
|
||||||
// TextFieldType {
|
|
||||||
// width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
|
||||||
// height: (parent.height - parent.spacing - parent.topPadding * 2)
|
|
||||||
// text: "32767"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
|
import QtQuick.Dialogs 1.1
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
import SortFilterProxyModel 0.2
|
import SortFilterProxyModel 0.2
|
||||||
import ContainerProps 1.0
|
import ContainerProps 1.0
|
||||||
|
@ -292,19 +293,30 @@ PageBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButtonType {
|
ImageButtonType {
|
||||||
id: button_default
|
id: button_remove
|
||||||
visible: service_type_role == ProtocolEnum.Vpn
|
visible: index === tb_c.currentIndex
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
checkable: true
|
checkable: true
|
||||||
img.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
|
icon.source: "qrc:/images/delete.png"
|
||||||
implicitWidth: 30
|
implicitWidth: 30
|
||||||
implicitHeight: 30
|
implicitHeight: 30
|
||||||
|
|
||||||
checked: default_role
|
checked: default_role
|
||||||
onClicked: {
|
|
||||||
ServerContainersLogic.onPushButtonDefaultClicked(proxyContainersModel.mapToSource(index))
|
MessageDialog {
|
||||||
|
id: dialogRemove
|
||||||
|
standardButtons: StandardButton.Yes | StandardButton.Cancel
|
||||||
|
title: "AmneziaVPN"
|
||||||
|
text: qsTr("Remove container") + " " + name_role + "?" + "\n" + qsTr("This action will erase all data of this container on the server.")
|
||||||
|
onAccepted: {
|
||||||
|
tb_c.currentIndex = -1
|
||||||
|
ServerContainersLogic.onPushButtonRemoveClicked(proxyContainersModel.mapToSource(index))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClicked: dialogRemove.open()
|
||||||
|
|
||||||
|
VisibleBehavior on visible { }
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButtonType {
|
ImageButtonType {
|
||||||
|
@ -322,23 +334,20 @@ PageBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButtonType {
|
ImageButtonType {
|
||||||
id: button_remove
|
id: button_default
|
||||||
visible: index === tb_c.currentIndex
|
visible: service_type_role == ProtocolEnum.Vpn
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
checkable: true
|
checkable: true
|
||||||
icon.source: "qrc:/images/delete.png"
|
img.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
|
||||||
implicitWidth: 30
|
implicitWidth: 30
|
||||||
implicitHeight: 30
|
implicitHeight: 30
|
||||||
|
|
||||||
checked: default_role
|
checked: default_role
|
||||||
onClicked: {
|
onClicked: {
|
||||||
tb_c.currentIndex = -1
|
ServerContainersLogic.onPushButtonDefaultClicked(proxyContainersModel.mapToSource(index))
|
||||||
ServerContainersLogic.onPushButtonRemoveClicked(proxyContainersModel.mapToSource(index))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VisibleBehavior on visible { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ PageBase {
|
||||||
width: parent.width - 40
|
width: parent.width - 40
|
||||||
height: 1
|
height: 1
|
||||||
anchors.bottom: GC.isMobile() ? root.bottom : conn_type_label.top
|
anchors.bottom: GC.isMobile() ? root.bottom : conn_type_label.top
|
||||||
anchors.bottomMargin: s10
|
anchors.bottomMargin: 10
|
||||||
color: "#DDDDDD"
|
color: "#DDDDDD"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
|
import QtQuick.Layouts 1.15
|
||||||
import ProtocolEnum 1.0
|
import ProtocolEnum 1.0
|
||||||
import "../"
|
import "../"
|
||||||
import "../../Controls"
|
import "../../Controls"
|
||||||
|
@ -10,144 +11,155 @@ PageProtocolBase {
|
||||||
protocol: ProtocolEnum.Cloak
|
protocol: ProtocolEnum.Cloak
|
||||||
logic: UiLogic.protocolLogic(protocol)
|
logic: UiLogic.protocolLogic(protocol)
|
||||||
|
|
||||||
enabled: logic.pageProtoCloakEnabled
|
enabled: logic.pageEnabled
|
||||||
BackButton {
|
BackButton {
|
||||||
id: back
|
id: back
|
||||||
}
|
}
|
||||||
Item {
|
|
||||||
x: 0
|
Caption {
|
||||||
y: 40
|
id: caption
|
||||||
width: 380
|
text: qsTr("Cloak Settings")
|
||||||
height: 600
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: content
|
||||||
enabled: logic.pageEnabled
|
enabled: logic.pageEnabled
|
||||||
ComboBoxType {
|
anchors.top: caption.bottom
|
||||||
x: 190
|
anchors.left: root.left
|
||||||
y: 60
|
anchors.right: root.right
|
||||||
width: 151
|
anchors.bottom: pb_save.top
|
||||||
height: 31
|
anchors.margins: 20
|
||||||
model: [
|
anchors.topMargin: 10
|
||||||
qsTr("chacha20-poly1305"),
|
|
||||||
qsTr("aes-256-gcm"),
|
|
||||||
qsTr("aes-192-gcm"),
|
RowLayout {
|
||||||
qsTr("aes-128-gcm")
|
Layout.fillWidth: true
|
||||||
]
|
|
||||||
currentIndex: {
|
LabelType {
|
||||||
for (let i = 0; i < model.length; ++i) {
|
height: 31
|
||||||
if (logic.comboBoxProtoCloakCipherText === model[i]) {
|
text: qsTr("Cipher")
|
||||||
return i
|
Layout.preferredWidth: 0.3 * root.width - 10
|
||||||
|
}
|
||||||
|
|
||||||
|
ComboBoxType {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 31
|
||||||
|
model: [
|
||||||
|
qsTr("chacha20-poly1305"),
|
||||||
|
qsTr("aes-256-gcm"),
|
||||||
|
qsTr("aes-192-gcm"),
|
||||||
|
qsTr("aes-128-gcm")
|
||||||
|
]
|
||||||
|
currentIndex: {
|
||||||
|
for (let i = 0; i < model.length; ++i) {
|
||||||
|
if (logic.comboBoxCipherText === model[i]) {
|
||||||
|
return i
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return -1
|
||||||
}
|
}
|
||||||
return -1
|
onCurrentTextChanged: {
|
||||||
}
|
logic.comboBoxCipherText = currentText
|
||||||
onCurrentTextChanged: {
|
|
||||||
logic.comboBoxProtoCloakCipherText = currentText
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LabelType {
|
|
||||||
x: 30
|
|
||||||
y: 60
|
|
||||||
width: 151
|
|
||||||
height: 31
|
|
||||||
text: qsTr("Cipher")
|
|
||||||
}
|
|
||||||
LabelType {
|
|
||||||
x: 30
|
|
||||||
y: 160
|
|
||||||
width: 151
|
|
||||||
height: 31
|
|
||||||
text: qsTr("Port")
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
font.family: "Lato"
|
|
||||||
font.styleName: "normal"
|
|
||||||
font.pixelSize: 24
|
|
||||||
color: "#100A44"
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: qsTr("Cloak Settings")
|
|
||||||
x: 20
|
|
||||||
y: 0
|
|
||||||
width: 340
|
|
||||||
height: 30
|
|
||||||
}
|
|
||||||
LabelType {
|
|
||||||
x: 30
|
|
||||||
y: 110
|
|
||||||
width: 151
|
|
||||||
height: 31
|
|
||||||
text: qsTr("Fake Web Site")
|
|
||||||
}
|
|
||||||
|
|
||||||
LabelType {
|
|
||||||
id: label_proto_cloak_info
|
|
||||||
x: 30
|
|
||||||
y: 550
|
|
||||||
width: 321
|
|
||||||
height: 41
|
|
||||||
visible: logic.labelProtoCloakInfoVisible
|
|
||||||
text: logic.labelProtoCloakInfoText
|
|
||||||
}
|
|
||||||
TextFieldType {
|
|
||||||
id: lineEdit_proto_cloak_port
|
|
||||||
x: 190
|
|
||||||
y: 160
|
|
||||||
width: 151
|
|
||||||
height: 31
|
|
||||||
text: logic.lineEditProtoCloakPortText
|
|
||||||
onEditingFinished: {
|
|
||||||
logic.lineEditProtoCloakPortText = text
|
|
||||||
}
|
|
||||||
enabled: logic.lineEditProtoCloakPortEnabled
|
|
||||||
}
|
|
||||||
TextFieldType {
|
|
||||||
id: lineEdit_proto_cloak_site
|
|
||||||
x: 190
|
|
||||||
y: 110
|
|
||||||
width: 151
|
|
||||||
height: 31
|
|
||||||
text: logic.lineEditProtoCloakSiteText
|
|
||||||
onEditingFinished: {
|
|
||||||
logic.lineEditProtoCloakSiteText = text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ProgressBar {
|
|
||||||
id: progressBar_proto_cloak_reset
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
y: 500
|
|
||||||
width: 321
|
|
||||||
height: 40
|
|
||||||
from: 0
|
|
||||||
to: logic.progressBarProtoCloakResetMaximium
|
|
||||||
value: logic.progressBarProtoCloakResetValue
|
|
||||||
background: Rectangle {
|
|
||||||
implicitWidth: parent.width
|
|
||||||
implicitHeight: parent.height
|
|
||||||
color: "#100A44"
|
|
||||||
radius: 4
|
|
||||||
}
|
|
||||||
|
|
||||||
contentItem: Item {
|
|
||||||
implicitWidth: parent.width
|
|
||||||
implicitHeight: parent.height
|
|
||||||
Rectangle {
|
|
||||||
width: progressBar_proto_cloak_reset.visualPosition * parent.width
|
|
||||||
height: parent.height
|
|
||||||
radius: 4
|
|
||||||
color: Qt.rgba(255, 255, 255, 0.15);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visible: logic.progressBarProtoCloakResetVisible
|
|
||||||
}
|
}
|
||||||
BlueButtonType {
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
RowLayout {
|
||||||
y: 500
|
Layout.fillWidth: true
|
||||||
width: 321
|
|
||||||
height: 40
|
LabelType {
|
||||||
text: qsTr("Save and restart VPN")
|
Layout.preferredWidth: 0.3 * root.width - 10
|
||||||
visible: logic.pushButtonCloakSaveVisible
|
height: 31
|
||||||
onClicked: {
|
text: qsTr("Fake Web Site")
|
||||||
logic.onPushButtonProtoCloakSaveClicked()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextFieldType {
|
||||||
|
id: lineEdit_proto_cloak_site
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 31
|
||||||
|
text: logic.lineEditSiteText
|
||||||
|
onEditingFinished: {
|
||||||
|
logic.lineEditSiteText = text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
LabelType {
|
||||||
|
Layout.preferredWidth: 0.3 * root.width - 10
|
||||||
|
height: 31
|
||||||
|
text: qsTr("Port")
|
||||||
|
}
|
||||||
|
|
||||||
|
TextFieldType {
|
||||||
|
id: lineEdit_proto_cloak_port
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 31
|
||||||
|
text: logic.lineEditPortText
|
||||||
|
onEditingFinished: {
|
||||||
|
logic.lineEditPortText = text
|
||||||
|
}
|
||||||
|
enabled: logic.lineEditPortEnabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillHeight: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LabelType {
|
||||||
|
id: label_proto_cloak_info
|
||||||
|
x: 30
|
||||||
|
anchors.bottom: pb_save.top
|
||||||
|
anchors.bottomMargin: 10
|
||||||
|
width: parent.width - 40
|
||||||
|
visible: logic.labelInfoVisible
|
||||||
|
text: logic.labelInfoText
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ProgressBar {
|
||||||
|
id: progressBar_proto_cloak_reset
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.fill: pb_save
|
||||||
|
from: 0
|
||||||
|
to: logic.progressBarResetMaximium
|
||||||
|
value: logic.progressBarResetValue
|
||||||
|
background: Rectangle {
|
||||||
|
implicitWidth: parent.width
|
||||||
|
implicitHeight: parent.height
|
||||||
|
color: "#100A44"
|
||||||
|
radius: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItem: Item {
|
||||||
|
implicitWidth: parent.width
|
||||||
|
implicitHeight: parent.height
|
||||||
|
Rectangle {
|
||||||
|
width: progressBar_proto_cloak_reset.visualPosition * parent.width
|
||||||
|
height: parent.height
|
||||||
|
radius: 4
|
||||||
|
color: Qt.rgba(255, 255, 255, 0.15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
visible: logic.progressBarResetVisible
|
||||||
|
}
|
||||||
|
BlueButtonType {
|
||||||
|
id: pb_save
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
enabled: logic.pageEnabled
|
||||||
|
anchors.bottom: root.bottom
|
||||||
|
anchors.bottomMargin: 20
|
||||||
|
width: root.width - 60
|
||||||
|
height: 40
|
||||||
|
text: qsTr("Save and restart VPN")
|
||||||
|
visible: logic.pushButtonSaveVisible
|
||||||
|
onClicked: {
|
||||||
|
logic.onPushButtonSaveClicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,9 +338,6 @@ PageProtocolBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LabelType {
|
LabelType {
|
||||||
id: label_proto_openvpn_info
|
id: label_proto_openvpn_info
|
||||||
|
|
||||||
|
@ -349,8 +346,6 @@ PageProtocolBase {
|
||||||
text: logic.labelProtoOpenVpnInfoText
|
text: logic.labelProtoOpenVpnInfoText
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: it_save
|
id: it_save
|
||||||
implicitWidth: parent.width
|
implicitWidth: parent.width
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
|
import QtQuick.Layouts 1.15
|
||||||
import ProtocolEnum 1.0
|
import ProtocolEnum 1.0
|
||||||
import "../"
|
import "../"
|
||||||
import "../../Controls"
|
import "../../Controls"
|
||||||
|
@ -10,123 +11,136 @@ PageProtocolBase {
|
||||||
protocol: ProtocolEnum.ShadowSocks
|
protocol: ProtocolEnum.ShadowSocks
|
||||||
logic: UiLogic.protocolLogic(protocol)
|
logic: UiLogic.protocolLogic(protocol)
|
||||||
|
|
||||||
enabled: logic.pageProtoShadowSocksEnabled
|
enabled: logic.pageEnabled
|
||||||
BackButton {
|
BackButton {
|
||||||
id: back
|
id: back
|
||||||
}
|
}
|
||||||
Item {
|
|
||||||
x: 0
|
Caption {
|
||||||
y: 40
|
id: caption
|
||||||
width: 380
|
text: qsTr("ShadowSocks Settings")
|
||||||
height: 600
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: content
|
||||||
enabled: logic.pageEnabled
|
enabled: logic.pageEnabled
|
||||||
ComboBoxType {
|
anchors.top: caption.bottom
|
||||||
x: 190
|
anchors.left: root.left
|
||||||
y: 60
|
anchors.right: root.right
|
||||||
width: 151
|
anchors.bottom: pb_save.top
|
||||||
height: 31
|
anchors.margins: 20
|
||||||
model: [
|
anchors.topMargin: 10
|
||||||
qsTr("chacha20-ietf-poly1305"),
|
|
||||||
qsTr("xchacha20-ietf-poly1305"),
|
|
||||||
qsTr("aes-256-gcm"),
|
|
||||||
qsTr("aes-192-gcm"),
|
RowLayout {
|
||||||
qsTr("aes-128-gcm")
|
Layout.fillWidth: true
|
||||||
]
|
|
||||||
currentIndex: {
|
LabelType {
|
||||||
for (let i = 0; i < model.length; ++i) {
|
height: 31
|
||||||
if (logic.comboBoxProtoShadowSocksCipherText === model[i]) {
|
text: qsTr("Cipher")
|
||||||
return i
|
Layout.preferredWidth: 0.3 * root.width - 10
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LabelType {
|
|
||||||
x: 30
|
|
||||||
y: 60
|
|
||||||
width: 151
|
|
||||||
height: 31
|
|
||||||
text: qsTr("Cipher")
|
|
||||||
}
|
|
||||||
LabelType {
|
|
||||||
x: 30
|
|
||||||
y: 110
|
|
||||||
width: 151
|
|
||||||
height: 31
|
|
||||||
text: qsTr("Port")
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
font.family: "Lato"
|
|
||||||
font.styleName: "normal"
|
|
||||||
font.pixelSize: 24
|
|
||||||
color: "#100A44"
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: qsTr("ShadowSocks Settings")
|
|
||||||
x: 30
|
|
||||||
y: 0
|
|
||||||
width: 340
|
|
||||||
height: 30
|
|
||||||
}
|
|
||||||
LabelType {
|
|
||||||
id: label_proto_shadowsocks_info
|
|
||||||
x: 30
|
|
||||||
y: 550
|
|
||||||
width: 321
|
|
||||||
height: 41
|
|
||||||
visible: logic.labelProtoShadowSocksInfoVisible
|
|
||||||
text: logic.labelProtoShadowSocksInfoText
|
|
||||||
}
|
|
||||||
TextFieldType {
|
|
||||||
id: lineEdit_proto_shadowsocks_port
|
|
||||||
x: 190
|
|
||||||
y: 110
|
|
||||||
width: 151
|
|
||||||
height: 31
|
|
||||||
text: logic.lineEditProtoShadowSocksPortText
|
|
||||||
onEditingFinished: {
|
|
||||||
logic.lineEditProtoShadowSocksPortText = text
|
|
||||||
}
|
|
||||||
enabled: logic.lineEditProtoShadowSocksPortEnabled
|
|
||||||
}
|
|
||||||
ProgressBar {
|
|
||||||
id: progressBar_proto_shadowsocks_reset
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
y: 500
|
|
||||||
width: 321
|
|
||||||
height: 40
|
|
||||||
from: 0
|
|
||||||
to: logic.progressBarProtoShadowSocksResetMaximium
|
|
||||||
value: logic.progressBarProtoShadowSocksResetValue
|
|
||||||
visible: logic.progressBarProtoShadowSocksResetVisible
|
|
||||||
background: Rectangle {
|
|
||||||
implicitWidth: parent.width
|
|
||||||
implicitHeight: parent.height
|
|
||||||
color: "#100A44"
|
|
||||||
radius: 4
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: Item {
|
ComboBoxType {
|
||||||
implicitWidth: parent.width
|
height: 31
|
||||||
implicitHeight: parent.height
|
Layout.fillWidth: true
|
||||||
Rectangle {
|
|
||||||
width: progressBar_proto_shadowsocks_reset.visualPosition * parent.width
|
model: [
|
||||||
height: parent.height
|
qsTr("chacha20-ietf-poly1305"),
|
||||||
radius: 4
|
qsTr("xchacha20-ietf-poly1305"),
|
||||||
color: Qt.rgba(255, 255, 255, 0.15);
|
qsTr("aes-256-gcm"),
|
||||||
|
qsTr("aes-192-gcm"),
|
||||||
|
qsTr("aes-128-gcm")
|
||||||
|
]
|
||||||
|
currentIndex: {
|
||||||
|
for (let i = 0; i < model.length; ++i) {
|
||||||
|
if (logic.comboBoxCipherText === model[i]) {
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BlueButtonType {
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
RowLayout {
|
||||||
y: 500
|
Layout.fillWidth: true
|
||||||
width: 321
|
|
||||||
height: 40
|
LabelType {
|
||||||
text: qsTr("Save and restart VPN")
|
Layout.preferredWidth: 0.3 * root.width - 10
|
||||||
visible: logic.pushButtonShadowSocksSaveVisible
|
height: 31
|
||||||
onClicked: {
|
text: qsTr("Port")
|
||||||
logic.onPushButtonProtoShadowSocksSaveClicked()
|
}
|
||||||
|
|
||||||
|
TextFieldType {
|
||||||
|
id: lineEdit_proto_shadowsocks_port
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 31
|
||||||
|
text: logic.lineEditPortText
|
||||||
|
onEditingFinished: {
|
||||||
|
logic.lineEditPortText = text
|
||||||
|
}
|
||||||
|
enabled: logic.lineEditPortEnabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillHeight: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LabelType {
|
||||||
|
id: label_proto_shadowsocks_info
|
||||||
|
x: 30
|
||||||
|
anchors.bottom: pb_save.top
|
||||||
|
anchors.bottomMargin: 10
|
||||||
|
width: parent.width - 40
|
||||||
|
height: 41
|
||||||
|
visible: logic.labelInfoVisible
|
||||||
|
text: logic.labelInfoText
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgressBar {
|
||||||
|
id: progressBar_reset
|
||||||
|
anchors.fill: pb_save
|
||||||
|
from: 0
|
||||||
|
to: logic.progressBaResetMaximium
|
||||||
|
value: logic.progressBaResetValue
|
||||||
|
visible: logic.progressBaResetVisible
|
||||||
|
background: Rectangle {
|
||||||
|
implicitWidth: parent.width
|
||||||
|
implicitHeight: parent.height
|
||||||
|
color: "#100A44"
|
||||||
|
radius: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItem: Item {
|
||||||
|
implicitWidth: parent.width
|
||||||
|
implicitHeight: parent.height
|
||||||
|
Rectangle {
|
||||||
|
width: progressBar_reset.visualPosition * parent.width
|
||||||
|
height: parent.height
|
||||||
|
radius: 4
|
||||||
|
color: Qt.rgba(255, 255, 255, 0.15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlueButtonType {
|
||||||
|
id: pb_save
|
||||||
|
enabled: logic.pageEnabled
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: root.bottom
|
||||||
|
anchors.bottomMargin: 20
|
||||||
|
width: root.width - 60
|
||||||
|
height: 40
|
||||||
|
text: qsTr("Save and restart VPN")
|
||||||
|
visible: logic.pushButtonSaveVisible
|
||||||
|
onClicked: {
|
||||||
|
logic.onPushButtonSaveClicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue