Merge branch 'tor_site_container' into teplitsa_tz
Containers page refactoring
This commit is contained in:
commit
6ee203a21d
22 changed files with 10641 additions and 748 deletions
|
@ -60,7 +60,7 @@ QMap<DockerContainer, QString> ContainerProps::containerHumanNames()
|
|||
{DockerContainer::ShadowSocks, "OpenVpn over ShadowSocks"},
|
||||
{DockerContainer::Cloak, "OpenVpn over Cloak"},
|
||||
{DockerContainer::WireGuard, "WireGuard"},
|
||||
{DockerContainer::TorSite, QObject::tr("Web site under TOR")},
|
||||
{DockerContainer::TorWebSite, QObject::tr("Web site in TOR network")},
|
||||
{DockerContainer::Dns, QObject::tr("DNS Service")},
|
||||
{DockerContainer::FileShare, QObject::tr("File Sharing Service")}
|
||||
};
|
||||
|
@ -74,10 +74,9 @@ QMap<DockerContainer, QString> ContainerProps::containerDescriptions()
|
|||
{DockerContainer::Cloak, QObject::tr("Container with OpenVpn and ShadowSocks protocols "
|
||||
"configured with traffic masking by Cloak plugin")},
|
||||
{DockerContainer::WireGuard, QObject::tr("WireGuard container")},
|
||||
{DockerContainer::TorSite, QObject::tr("Web site under TOR")},
|
||||
{DockerContainer::TorWebSite, QObject::tr("Web site in TOR network")},
|
||||
{DockerContainer::Dns, QObject::tr("DNS Service")},
|
||||
{DockerContainer::FileShare, QObject::tr("File Sharing Service")}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -89,7 +88,7 @@ amnezia::ServiceType ContainerProps::containerService(DockerContainer c)
|
|||
case DockerContainer::Cloak : return ServiceType::Vpn;
|
||||
case DockerContainer::ShadowSocks : return ServiceType::Vpn;
|
||||
case DockerContainer::WireGuard : return ServiceType::Vpn;
|
||||
case DockerContainer::TorSite : return ServiceType::Other;
|
||||
case DockerContainer::TorWebSite : return ServiceType::Other;
|
||||
case DockerContainer::Dns : return ServiceType::Other;
|
||||
case DockerContainer::FileShare : return ServiceType::Other;
|
||||
default: return ServiceType::Other;
|
||||
|
|
|
@ -20,7 +20,7 @@ enum DockerContainer {
|
|||
WireGuard,
|
||||
|
||||
//non-vpn
|
||||
TorSite,
|
||||
TorWebSite,
|
||||
Dns,
|
||||
FileShare
|
||||
};
|
||||
|
|
|
@ -11,6 +11,7 @@ QString amnezia::scriptFolder(amnezia::DockerContainer container)
|
|||
case DockerContainer::Cloak: return QLatin1String("openvpn_cloak");
|
||||
case DockerContainer::ShadowSocks: return QLatin1String("openvpn_shadowsocks");
|
||||
case DockerContainer::WireGuard: return QLatin1String("wireguard");
|
||||
case DockerContainer::TorWebSite: return QLatin1String("website_tor");
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
|
BIN
client/images/delete.png
Normal file
BIN
client/images/delete.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 437 B |
|
@ -68,7 +68,7 @@ QMap<amnezia::Protocol, QString> ProtocolProps::protocolHumanNames()
|
|||
{Protocol::ShadowSocks, "ShadowSocks"},
|
||||
{Protocol::Cloak, "Cloak"},
|
||||
{Protocol::WireGuard, "WireGuard"},
|
||||
{Protocol::TorSite, "Web site under TOR"},
|
||||
{Protocol::TorWebSite, "Web site in TOR network"},
|
||||
{Protocol::Dns, "DNS Service"},
|
||||
{Protocol::FileShare, "File Sharing Service"}
|
||||
};
|
||||
|
@ -87,7 +87,7 @@ amnezia::ServiceType ProtocolProps::protocolService(Protocol p)
|
|||
case Protocol::Cloak : return ServiceType::Vpn;
|
||||
case Protocol::ShadowSocks : return ServiceType::Vpn;
|
||||
case Protocol::WireGuard : return ServiceType::Vpn;
|
||||
case Protocol::TorSite : return ServiceType::Other;
|
||||
case Protocol::TorWebSite : return ServiceType::Other;
|
||||
case Protocol::Dns : return ServiceType::Other;
|
||||
case Protocol::FileShare : return ServiceType::Other;
|
||||
default: return ServiceType::Other;
|
||||
|
@ -102,7 +102,7 @@ int ProtocolProps::defaultPort(Protocol p)
|
|||
case Protocol::Cloak : return 443;
|
||||
case Protocol::ShadowSocks : return 6789;
|
||||
case Protocol::WireGuard : return 51820;
|
||||
case Protocol::TorSite : return 443;
|
||||
case Protocol::TorWebSite : return 443;
|
||||
case Protocol::Dns : return 53;
|
||||
case Protocol::FileShare : return 139;
|
||||
default: return -1;
|
||||
|
@ -117,7 +117,7 @@ bool ProtocolProps::defaultPortChangeable(Protocol p)
|
|||
case Protocol::Cloak : return true;
|
||||
case Protocol::ShadowSocks : return true;
|
||||
case Protocol::WireGuard : return true;
|
||||
case Protocol::TorSite : return true;
|
||||
case Protocol::TorWebSite : return true;
|
||||
case Protocol::Dns : return false;
|
||||
case Protocol::FileShare : return false;
|
||||
default: return -1;
|
||||
|
@ -132,7 +132,7 @@ TransportProto ProtocolProps::defaultTransportProto(Protocol p)
|
|||
case Protocol::Cloak : return TransportProto::Tcp;
|
||||
case Protocol::ShadowSocks : return TransportProto::Tcp;
|
||||
case Protocol::WireGuard : return TransportProto::Udp;
|
||||
case Protocol::TorSite : return TransportProto::Tcp;
|
||||
case Protocol::TorWebSite : return TransportProto::Tcp;
|
||||
case Protocol::Dns : return TransportProto::Udp;
|
||||
case Protocol::FileShare : return TransportProto::Tcp;
|
||||
default: return TransportProto::Udp;
|
||||
|
@ -147,7 +147,7 @@ bool ProtocolProps::defaultTransportProtoChangeable(Protocol p)
|
|||
case Protocol::Cloak : return false;
|
||||
case Protocol::ShadowSocks : return false;
|
||||
case Protocol::WireGuard : return false;
|
||||
case Protocol::TorSite : return false;
|
||||
case Protocol::TorWebSite : return false;
|
||||
case Protocol::Dns : return false;
|
||||
case Protocol::FileShare : return false;
|
||||
default: return -1;
|
||||
|
|
|
@ -118,7 +118,7 @@ enum Protocol {
|
|||
ShadowSocks,
|
||||
Cloak,
|
||||
WireGuard,
|
||||
TorSite,
|
||||
TorWebSite,
|
||||
Dns,
|
||||
FileShare
|
||||
};
|
||||
|
|
|
@ -64,6 +64,8 @@
|
|||
<file>server_scripts/wireguard/run_container.sh</file>
|
||||
<file>server_scripts/wireguard/start.sh</file>
|
||||
<file>server_scripts/wireguard/template.conf</file>
|
||||
<file>server_scripts/website_tor/configure_container.sh</file>
|
||||
<file>server_scripts/website_tor/run_container.sh</file>
|
||||
<file>ui/qml/main.qml</file>
|
||||
<file>ui/qml/TitleBar.qml</file>
|
||||
<file>ui/qml/Pages/PageAppSetting.qml</file>
|
||||
|
@ -109,5 +111,8 @@
|
|||
<file>ui/qml/Controls/Logo.qml</file>
|
||||
<file>ui/qml/Pages/InstallSettings/SelectContainer.qml</file>
|
||||
<file>ui/qml/Pages/Protocols/PageProtocolBase.qml</file>
|
||||
<file>images/delete.png</file>
|
||||
<file>ui/qml/Controls/FadeBehavior.qml</file>
|
||||
<file>ui/qml/Controls/VisibleBehavior.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
13
client/server_scripts/website_tor/configure_container.sh
Normal file
13
client/server_scripts/website_tor/configure_container.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Wireguard config
|
||||
sudo docker exec -i $CONTAINER_NAME bash -c '\
|
||||
mkdir -p /opt/amnezia/wireguard; \
|
||||
cd /opt/amnezia/wireguard || exit 1; \
|
||||
WIREGUARD_SERVER_PRIVATE_KEY=$(wg genkey) && echo $WIREGUARD_SERVER_PRIVATE_KEY > /opt/amnezia/wireguard/wireguard_server_private_key.key; \
|
||||
WIREGUARD_SERVER_PUBLIC_KEY=$(echo $WIREGUARD_SERVER_PRIVATE_KEY | wg pubkey) && echo $WIREGUARD_SERVER_PUBLIC_KEY > /opt/amnezia/wireguard/wireguard_server_public_key.key; \
|
||||
WIREGUARD_PSK=$(wg genpsk) && echo $WIREGUARD_PSK > /opt/amnezia/wireguard/wireguard_psk.key; \
|
||||
echo -e "\
|
||||
[Interface]\\n\
|
||||
PrivateKey = $WIREGUARD_SERVER_PRIVATE_KEY \\n\
|
||||
Address = $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR \\n\
|
||||
ListenPort = $WIREGUARD_SERVER_PORT \\n\
|
||||
" >/opt/amnezia/wireguard/wg0.conf'
|
3
client/server_scripts/website_tor/run_container.sh
Normal file
3
client/server_scripts/website_tor/run_container.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Run container
|
||||
sudo docker run -d -p 80:80 --restart always --name amnezia-wp-tor tutum/wordpress
|
||||
sudo docker run -d --link amnezia-wp-tor --name amnezia-tor goldy/tor-hidden-service
|
2383
client/ui/mainwindow.cpp
Normal file
2383
client/ui/mainwindow.cpp
Normal file
File diff suppressed because it is too large
Load diff
7838
client/ui/mainwindow.ui
Normal file
7838
client/ui/mainwindow.ui
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,9 @@
|
|||
#include "ServerConfiguringProgressLogic.h"
|
||||
#include "defines.h"
|
||||
#include "core/errorstrings.h"
|
||||
#include <QTimer>
|
||||
#include <QEventLoop>
|
||||
#include <QMessageBox>
|
||||
|
||||
ServerConfiguringProgressLogic::ServerConfiguringProgressLogic(UiLogic *logic, QObject *parent):
|
||||
PageLogicBase(logic, parent),
|
||||
|
@ -13,3 +18,105 @@ ServerConfiguringProgressLogic::ServerConfiguringProgressLogic(UiLogic *logic, Q
|
|||
|
||||
}
|
||||
|
||||
|
||||
ErrorCode ServerConfiguringProgressLogic::doInstallAction(const std::function<ErrorCode()> &action)
|
||||
{
|
||||
PageFunc page;
|
||||
page.setEnabledFunc = [this] (bool enabled) -> void {
|
||||
set_pageEnabled(enabled);
|
||||
};
|
||||
ButtonFunc button;
|
||||
LabelFunc info;
|
||||
ProgressFunc progress;
|
||||
progress.setVisibleFunc = [this] (bool visible) ->void {
|
||||
set_progressBarVisible(visible);
|
||||
};
|
||||
|
||||
progress.setValueFunc = [this] (int value) ->void {
|
||||
set_progressBarValue(value);
|
||||
};
|
||||
progress.getValueFunc = [this] (void) -> int {
|
||||
return progressBarValue();
|
||||
};
|
||||
progress.getMaximiumFunc = [this] (void) -> int {
|
||||
return progressBarMaximium();
|
||||
};
|
||||
|
||||
|
||||
|
||||
progress.setVisibleFunc(true);
|
||||
if (page.setEnabledFunc) {
|
||||
page.setEnabledFunc(false);
|
||||
}
|
||||
if (button.setVisibleFunc) {
|
||||
button.setVisibleFunc(false);
|
||||
}
|
||||
if (info.setVisibleFunc) {
|
||||
info.setVisibleFunc(true);
|
||||
}
|
||||
if (info.setTextFunc) {
|
||||
info.setTextFunc(tr("Please wait, configuring process may take up to 5 minutes"));
|
||||
}
|
||||
|
||||
QTimer timer;
|
||||
connect(&timer, &QTimer::timeout, [progress](){
|
||||
progress.setValueFunc(progress.getValueFunc() + 1);
|
||||
});
|
||||
|
||||
progress.setValueFunc(0);
|
||||
timer.start(1000);
|
||||
|
||||
ErrorCode e = action();
|
||||
qDebug() << "doInstallAction finished with code" << e;
|
||||
|
||||
if (e) {
|
||||
if (page.setEnabledFunc) {
|
||||
page.setEnabledFunc(true);
|
||||
}
|
||||
if (button.setVisibleFunc) {
|
||||
button.setVisibleFunc(true);
|
||||
}
|
||||
if (info.setVisibleFunc) {
|
||||
info.setVisibleFunc(false);
|
||||
}
|
||||
QMessageBox::warning(nullptr, APPLICATION_NAME,
|
||||
tr("Error occurred while configuring server.") + "\n" +
|
||||
errorString(e));
|
||||
|
||||
progress.setVisibleFunc(false);
|
||||
return e;
|
||||
}
|
||||
|
||||
// just ui progressbar tweak
|
||||
timer.stop();
|
||||
|
||||
int remaining_val = progress.getMaximiumFunc() - progress.getValueFunc();
|
||||
|
||||
if (remaining_val > 0) {
|
||||
QTimer timer1;
|
||||
QEventLoop loop1;
|
||||
|
||||
connect(&timer1, &QTimer::timeout, [&](){
|
||||
progress.setValueFunc(progress.getValueFunc() + 1);
|
||||
if (progress.getValueFunc() >= progress.getMaximiumFunc()) {
|
||||
loop1.quit();
|
||||
}
|
||||
});
|
||||
|
||||
timer1.start(5);
|
||||
loop1.exec();
|
||||
}
|
||||
|
||||
|
||||
progress.setVisibleFunc(false);
|
||||
if (button.setVisibleFunc) {
|
||||
button.setVisibleFunc(true);
|
||||
}
|
||||
if (page.setEnabledFunc) {
|
||||
page.setEnabledFunc(true);
|
||||
}
|
||||
if (info.setTextFunc) {
|
||||
info.setTextFunc(tr("Operation finished"));
|
||||
}
|
||||
return ErrorCode::NoError;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef SERVER_CONFIGURING_PROGRESS_LOGIC_H
|
||||
#define SERVER_CONFIGURING_PROGRESS_LOGIC_H
|
||||
|
||||
#include <functional>
|
||||
#include "PageLogicBase.h"
|
||||
|
||||
class UiLogic;
|
||||
|
@ -21,5 +22,27 @@ public:
|
|||
explicit ServerConfiguringProgressLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~ServerConfiguringProgressLogic() = default;
|
||||
|
||||
ErrorCode doInstallAction(const std::function<ErrorCode()> &action);
|
||||
|
||||
private:
|
||||
struct ProgressFunc {
|
||||
std::function<void(bool)> setVisibleFunc;
|
||||
std::function<void(int)> setValueFunc;
|
||||
std::function<int(void)> getValueFunc;
|
||||
std::function<int(void)> getMaximiumFunc;
|
||||
std::function<void(bool)> setTextVisibleFunc;
|
||||
std::function<void(const QString&)> setTextFunc;
|
||||
};
|
||||
struct PageFunc {
|
||||
std::function<void(bool)> setEnabledFunc;
|
||||
};
|
||||
struct ButtonFunc {
|
||||
std::function<void(bool)> setVisibleFunc;
|
||||
};
|
||||
struct LabelFunc {
|
||||
std::function<void(bool)> setVisibleFunc;
|
||||
std::function<void(const QString&)> setTextFunc;
|
||||
};
|
||||
|
||||
};
|
||||
#endif // SERVER_CONFIGURING_PROGRESS_LOGIC_H
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
#include "ServerContainersLogic.h"
|
||||
#include "ShareConnectionLogic.h"
|
||||
#include "ServerConfiguringProgressLogic.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include "protocols/CloakLogic.h"
|
||||
#include "protocols/OpenVpnLogic.h"
|
||||
#include "protocols/ShadowSocksLogic.h"
|
||||
|
@ -10,105 +14,17 @@
|
|||
#include "../uilogic.h"
|
||||
|
||||
ServerContainersLogic::ServerContainersLogic(UiLogic *logic, QObject *parent):
|
||||
PageLogicBase(logic, parent),
|
||||
m_progressBarProtocolsContainerReinstallValue{0},
|
||||
m_progressBarProtocolsContainerReinstallMaximium{100},
|
||||
m_pushButtonOpenVpnContInstallEnabled{false},
|
||||
m_pushButtonSsOpenVpnContInstallEnabled{false},
|
||||
m_pushButtonCloakOpenVpnContInstallEnabled{false},
|
||||
m_pushButtonWireguardContInstallEnabled{false},
|
||||
m_pushButtonOpenVpnContDefaultChecked{false},
|
||||
m_pushButtonSsOpenVpnContDefaultChecked{false},
|
||||
m_pushButtonCloakOpenVpnContDefaultChecked{false},
|
||||
m_pushButtonWireguardContDefaultChecked{false},
|
||||
m_pushButtonOpenVpnContDefaultVisible{true},
|
||||
m_pushButtonSsOpenVpnContDefaultVisible{false},
|
||||
m_pushButtonCloakOpenVpnContDefaultVisible{false},
|
||||
m_pushButtonWireguardContDefaultVisible{false},
|
||||
m_pushButtonOpenVpnContShareVisible{false},
|
||||
m_pushButtonSsOpenVpnContShareVisible{false},
|
||||
m_pushButtonCloakOpenVpnContShareVisible{false},
|
||||
m_pushButtonWireguardContShareVisible{false},
|
||||
m_frameOpenvpnSettingsVisible{true},
|
||||
m_frameOpenvpnSsSettingsVisible{true},
|
||||
m_frameOpenvpnSsCloakSettingsVisible{true},
|
||||
m_progressBarProtocolsContainerReinstallVisible{false},
|
||||
m_frameWireguardSettingsVisible{false},
|
||||
m_frameWireguardVisible{false}
|
||||
PageLogicBase(logic, parent)
|
||||
{
|
||||
setupProtocolsPageConnections();
|
||||
|
||||
set_frameWireguardSettingsVisible(false);
|
||||
set_frameWireguardVisible(false);
|
||||
}
|
||||
|
||||
void ServerContainersLogic::updateServerContainersPage()
|
||||
{
|
||||
set_progressBarProtocolsContainerReinstallVisible(false);
|
||||
|
||||
ContainersModel *c_model = qobject_cast<ContainersModel *>(uiLogic()->containersModel());
|
||||
c_model->setSelectedServerIndex(uiLogic()->selectedServerIndex);
|
||||
|
||||
ProtocolsModel *p_model = qobject_cast<ProtocolsModel *>(uiLogic()->protocolsModel());
|
||||
p_model->setSelectedServerIndex(uiLogic()->selectedServerIndex);
|
||||
|
||||
auto containers = m_settings.containers(uiLogic()->selectedServerIndex);
|
||||
DockerContainer defaultContainer = m_settings.defaultContainer(uiLogic()->selectedServerIndex);
|
||||
bool haveAuthData = m_settings.haveAuthData(uiLogic()->selectedServerIndex);
|
||||
|
||||
// all containers
|
||||
QList<DockerContainer> allContainers {
|
||||
DockerContainer::OpenVpn,
|
||||
DockerContainer::ShadowSocks,
|
||||
DockerContainer::Cloak,
|
||||
DockerContainer::WireGuard
|
||||
};
|
||||
|
||||
using SetVisibleFunc = std::function<void(bool)>;
|
||||
using SetCheckedFunc = std::function<void(bool)>;
|
||||
using SetEnabledFunc = std::function<void(bool)>;
|
||||
|
||||
QList<SetEnabledFunc> installButtonsEnabledFunc {
|
||||
[this](bool enabled) ->void {set_pushButtonOpenVpnContInstallEnabled(enabled);},
|
||||
[this](bool enabled) ->void {set_pushButtonSsOpenVpnContInstallEnabled(enabled);},
|
||||
[this](bool enabled) ->void {set_pushButtonCloakOpenVpnContInstallEnabled(enabled);},
|
||||
[this](bool enabled) ->void {set_pushButtonWireguardContInstallEnabled(enabled);},
|
||||
};
|
||||
|
||||
QList<SetCheckedFunc> defaultButtonsCheckedFunc {
|
||||
[this](bool checked) ->void {set_pushButtonOpenVpnContDefaultChecked(checked);},
|
||||
[this](bool checked) ->void {set_pushButtonSsOpenVpnContDefaultChecked(checked);},
|
||||
[this](bool checked) ->void {set_pushButtonCloakOpenVpnContDefaultChecked(checked);},
|
||||
[this](bool checked) ->void {set_pushButtonWireguardContDefaultChecked(checked);},
|
||||
};
|
||||
QList<SetVisibleFunc> defaultButtonsVisibleFunc {
|
||||
[this](bool visible) ->void {set_pushButtonOpenVpnContDefaultVisible(visible);},
|
||||
[this](bool visible) ->void {set_pushButtonSsOpenVpnContDefaultVisible(visible);},
|
||||
[this](bool visible) ->void {set_pushButtonCloakOpenVpnContDefaultVisible(visible);},
|
||||
[this](bool visible) ->void {set_pushButtonWireguardContDefaultVisible(visible);},
|
||||
};
|
||||
|
||||
QList<SetVisibleFunc> shareButtonsVisibleFunc {
|
||||
[this](bool visible) ->void {set_pushButtonOpenVpnContShareVisible(visible);},
|
||||
[this](bool visible) ->void {set_pushButtonSsOpenVpnContShareVisible(visible);},
|
||||
[this](bool visible) ->void {set_pushButtonCloakOpenVpnContShareVisible(visible);},
|
||||
[this](bool visible) ->void {set_pushButtonWireguardContShareVisible(visible);},
|
||||
};
|
||||
|
||||
QList<SetVisibleFunc> framesVisibleFunc {
|
||||
[this](bool visible) ->void {set_frameOpenvpnSettingsVisible(visible);},
|
||||
[this](bool visible) ->void {set_frameOpenvpnSsSettingsVisible(visible);},
|
||||
[this](bool visible) ->void {set_frameOpenvpnSsCloakSettingsVisible(visible);},
|
||||
[this](bool visible) ->void {set_frameWireguardSettingsVisible(visible);},
|
||||
};
|
||||
|
||||
for (int i = 0; i < allContainers.size(); ++i) {
|
||||
defaultButtonsCheckedFunc.at(i)(defaultContainer == allContainers.at(i));
|
||||
defaultButtonsVisibleFunc.at(i)(haveAuthData && containers.contains(allContainers.at(i)));
|
||||
shareButtonsVisibleFunc.at(i)(haveAuthData && containers.contains(allContainers.at(i)));
|
||||
installButtonsEnabledFunc.at(i)(haveAuthData);
|
||||
framesVisibleFunc.at(i)(containers.contains(allContainers.at(i)));
|
||||
}
|
||||
}
|
||||
|
||||
void ServerContainersLogic::onPushButtonProtoSettingsClicked(DockerContainer c, Protocol p)
|
||||
|
@ -134,114 +50,48 @@ void ServerContainersLogic::onPushButtonShareClicked(DockerContainer c)
|
|||
emit uiLogic()->goToPage(Page::ShareConnection);
|
||||
}
|
||||
|
||||
void ServerContainersLogic::setupProtocolsPageConnections()
|
||||
void ServerContainersLogic::onPushButtonRemoveClicked(DockerContainer container)
|
||||
{
|
||||
QJsonObject openvpnConfig;
|
||||
|
||||
// all containers
|
||||
QList<DockerContainer> containers {
|
||||
DockerContainer::OpenVpn,
|
||||
DockerContainer::ShadowSocks,
|
||||
DockerContainer::Cloak,
|
||||
DockerContainer::WireGuard
|
||||
};
|
||||
using ButtonClickedFunc = void (ServerContainersLogic::*)(bool);
|
||||
using ButtonSetEnabledFunc = std::function<void(bool)>;
|
||||
|
||||
|
||||
// install buttons
|
||||
QList<ButtonClickedFunc> installButtonsClickedSig {
|
||||
&ServerContainersLogic::pushButtonOpenVpnContInstallClicked,
|
||||
&ServerContainersLogic::pushButtonSsOpenVpnContInstallClicked,
|
||||
&ServerContainersLogic::pushButtonCloakOpenVpnContInstallClicked,
|
||||
&ServerContainersLogic::pushButtonWireguardContInstallClicked,
|
||||
};
|
||||
QList<ButtonSetEnabledFunc> installButtonsSetEnabledFunc {
|
||||
[this] (bool enabled) -> void {
|
||||
set_pushButtonOpenVpnContInstallEnabled(enabled);
|
||||
},
|
||||
[this] (bool enabled) -> void {
|
||||
set_pushButtonSsOpenVpnContInstallEnabled(enabled);
|
||||
},
|
||||
[this] (bool enabled) -> void {
|
||||
set_pushButtonCloakOpenVpnContInstallEnabled(enabled);
|
||||
},
|
||||
[this] (bool enabled) -> void {
|
||||
set_pushButtonWireguardContInstallEnabled(enabled);
|
||||
},
|
||||
};
|
||||
|
||||
for (int i = 0; i < containers.size(); ++i) {
|
||||
ButtonClickedFunc buttonClickedFunc = installButtonsClickedSig.at(i);
|
||||
ButtonSetEnabledFunc buttonSetEnabledFunc = installButtonsSetEnabledFunc.at(i);
|
||||
DockerContainer container = containers.at(i);
|
||||
|
||||
connect(this, buttonClickedFunc, [this, container, buttonSetEnabledFunc](bool checked){
|
||||
if (checked) {
|
||||
UiLogic::PageFunc page_server_containers;
|
||||
page_server_containers.setEnabledFunc = [this] (bool enabled) -> void {
|
||||
set_pageEnabled(enabled);
|
||||
};
|
||||
UiLogic::ButtonFunc no_button;
|
||||
UiLogic::LabelFunc no_label;
|
||||
UiLogic::ProgressFunc progressBar_protocols_container_reinstall;
|
||||
progressBar_protocols_container_reinstall.setVisibleFunc = [this] (bool visible) ->void {
|
||||
set_progressBarProtocolsContainerReinstallVisible(visible);
|
||||
};
|
||||
progressBar_protocols_container_reinstall.setValueFunc = [this] (int value) ->void {
|
||||
set_progressBarProtocolsContainerReinstallValue(value);
|
||||
};
|
||||
progressBar_protocols_container_reinstall.getValueFunc = [this] (void) -> int {
|
||||
return progressBarProtocolsContainerReinstallValue();
|
||||
};
|
||||
progressBar_protocols_container_reinstall.getMaximiumFunc = [this] (void) -> int {
|
||||
return progressBarProtocolsContainerReinstallMaximium();
|
||||
};
|
||||
|
||||
ErrorCode e = uiLogic()->doInstallAction([this, container](){
|
||||
return ServerController::setupContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), container);
|
||||
},
|
||||
page_server_containers, progressBar_protocols_container_reinstall,
|
||||
no_button, no_label);
|
||||
|
||||
if (!e) {
|
||||
m_settings.setContainerConfig(uiLogic()->selectedServerIndex, container, QJsonObject());
|
||||
m_settings.setDefaultContainer(uiLogic()->selectedServerIndex, container);
|
||||
}
|
||||
}
|
||||
else {
|
||||
buttonSetEnabledFunc(false);
|
||||
//buttonSetEnabledFunc(false);
|
||||
ErrorCode e = ServerController::removeContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), container);
|
||||
m_settings.removeContainerConfig(uiLogic()->selectedServerIndex, container);
|
||||
buttonSetEnabledFunc(true);
|
||||
//buttonSetEnabledFunc(true);
|
||||
|
||||
if (m_settings.defaultContainer(uiLogic()->selectedServerIndex) == container) {
|
||||
const auto &c = m_settings.containers(uiLogic()->selectedServerIndex);
|
||||
if (c.isEmpty()) m_settings.setDefaultContainer(uiLogic()->selectedServerIndex, DockerContainer::None);
|
||||
else m_settings.setDefaultContainer(uiLogic()->selectedServerIndex, c.keys().first());
|
||||
}
|
||||
updateServerContainersPage();
|
||||
}
|
||||
|
||||
void ServerContainersLogic::onPushButtonContinueClicked(DockerContainer c, int port, TransportProto tp)
|
||||
{
|
||||
QMap<DockerContainer, QJsonObject> containers;
|
||||
Protocol mainProto = ContainerProps::defaultProtocol(c);
|
||||
|
||||
QJsonObject config {
|
||||
{ config_key::container, ContainerProps::containerToString(c) },
|
||||
{ ProtocolProps::protoToString(mainProto), QJsonObject {
|
||||
{ config_key::port, QString::number(port) },
|
||||
{ config_key::transport_proto, ProtocolProps::transportProtoToString(tp, mainProto) }}
|
||||
}
|
||||
};
|
||||
|
||||
containers.insert(c, config);
|
||||
|
||||
emit uiLogic()->goToPage(Page::ServerConfiguringProgress);
|
||||
qApp->processEvents();
|
||||
|
||||
ErrorCode e = uiLogic()->serverConfiguringProgressLogic()->doInstallAction([this, c](){
|
||||
return ServerController::setupContainer(m_settings.serverCredentials(uiLogic()->selectedServerIndex), c);
|
||||
});
|
||||
|
||||
if (!e) {
|
||||
m_settings.setContainerConfig(uiLogic()->selectedServerIndex, c, QJsonObject());
|
||||
m_settings.setDefaultContainer(uiLogic()->selectedServerIndex, c);
|
||||
}
|
||||
|
||||
updateServerContainersPage();
|
||||
});
|
||||
emit uiLogic()->closePage();
|
||||
}
|
||||
|
||||
// share buttons
|
||||
QList<ButtonClickedFunc> shareButtonsClickedSig {
|
||||
&ServerContainersLogic::pushButtonOpenVpnContShareClicked,
|
||||
&ServerContainersLogic::pushButtonSsOpenVpnContShareClicked,
|
||||
&ServerContainersLogic::pushButtonCloakOpenVpnContShareClicked,
|
||||
&ServerContainersLogic::pushButtonWireguardContShareClicked,
|
||||
};
|
||||
|
||||
for (int i = 0; i < containers.size(); ++i) {
|
||||
ButtonClickedFunc buttonClickedFunc = shareButtonsClickedSig.at(i);
|
||||
DockerContainer container = containers.at(i);
|
||||
|
||||
connect(this, buttonClickedFunc, [this, container](bool){
|
||||
uiLogic()->shareConnectionLogic()->updateSharingPage(uiLogic()->selectedServerIndex, m_settings.serverCredentials(uiLogic()->selectedServerIndex), container);
|
||||
emit uiLogic()->goToPage(Page::ShareConnection);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,67 +9,18 @@ class ServerContainersLogic : public PageLogicBase
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
AUTO_PROPERTY(int, progressBarProtocolsContainerReinstallValue)
|
||||
AUTO_PROPERTY(int, progressBarProtocolsContainerReinstallMaximium)
|
||||
|
||||
// AUTO_PROPERTY(bool, pushButtonOpenVpnContInstallChecked)
|
||||
// AUTO_PROPERTY(bool, pushButtonSsOpenVpnContInstallChecked)
|
||||
// AUTO_PROPERTY(bool, pushButtonCloakOpenVpnContInstallChecked)
|
||||
// AUTO_PROPERTY(bool, pushButtonWireguardContInstallChecked)
|
||||
|
||||
AUTO_PROPERTY(bool, pushButtonOpenVpnContInstallEnabled)
|
||||
AUTO_PROPERTY(bool, pushButtonSsOpenVpnContInstallEnabled)
|
||||
AUTO_PROPERTY(bool, pushButtonCloakOpenVpnContInstallEnabled)
|
||||
AUTO_PROPERTY(bool, pushButtonWireguardContInstallEnabled)
|
||||
|
||||
AUTO_PROPERTY(bool, pushButtonOpenVpnContDefaultChecked)
|
||||
AUTO_PROPERTY(bool, pushButtonSsOpenVpnContDefaultChecked)
|
||||
AUTO_PROPERTY(bool, pushButtonCloakOpenVpnContDefaultChecked)
|
||||
AUTO_PROPERTY(bool, pushButtonWireguardContDefaultChecked)
|
||||
|
||||
AUTO_PROPERTY(bool, pushButtonOpenVpnContDefaultVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonSsOpenVpnContDefaultVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonCloakOpenVpnContDefaultVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonWireguardContDefaultVisible)
|
||||
|
||||
AUTO_PROPERTY(bool, pushButtonOpenVpnContShareVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonSsOpenVpnContShareVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonCloakOpenVpnContShareVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonWireguardContShareVisible)
|
||||
|
||||
AUTO_PROPERTY(bool, frameOpenvpnSettingsVisible)
|
||||
AUTO_PROPERTY(bool, frameOpenvpnSsSettingsVisible)
|
||||
AUTO_PROPERTY(bool, frameOpenvpnSsCloakSettingsVisible)
|
||||
AUTO_PROPERTY(bool, progressBarProtocolsContainerReinstallVisible)
|
||||
|
||||
AUTO_PROPERTY(bool, frameWireguardSettingsVisible)
|
||||
AUTO_PROPERTY(bool, frameWireguardVisible)
|
||||
|
||||
public:
|
||||
Q_INVOKABLE void updateServerContainersPage();
|
||||
|
||||
Q_INVOKABLE void onPushButtonProtoSettingsClicked(DockerContainer c, Protocol p);
|
||||
Q_INVOKABLE void onPushButtonDefaultClicked(DockerContainer c);
|
||||
Q_INVOKABLE void onPushButtonShareClicked(DockerContainer c);
|
||||
Q_INVOKABLE void onPushButtonRemoveClicked(DockerContainer c);
|
||||
Q_INVOKABLE void onPushButtonContinueClicked(DockerContainer c, int port, TransportProto tp);
|
||||
|
||||
public:
|
||||
explicit ServerContainersLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~ServerContainersLogic() = default;
|
||||
|
||||
void setupProtocolsPageConnections();
|
||||
|
||||
signals:
|
||||
void pushButtonOpenVpnContDefaultClicked(bool checked);
|
||||
void pushButtonSsOpenVpnContDefaultClicked(bool checked);
|
||||
void pushButtonCloakOpenVpnContDefaultClicked(bool checked);
|
||||
void pushButtonWireguardContDefaultClicked(bool checked);
|
||||
void pushButtonOpenVpnContInstallClicked(bool checked);
|
||||
void pushButtonSsOpenVpnContInstallClicked(bool checked);
|
||||
void pushButtonCloakOpenVpnContInstallClicked(bool checked);
|
||||
void pushButtonWireguardContInstallClicked(bool checked);
|
||||
void pushButtonOpenVpnContShareClicked(bool checked);
|
||||
void pushButtonSsOpenVpnContShareClicked(bool checked);
|
||||
void pushButtonCloakOpenVpnContShareClicked(bool checked);
|
||||
void pushButtonWireguardContShareClicked(bool checked);
|
||||
|
||||
};
|
||||
#endif // SERVER_CONTAINERS_LOGIC_H
|
||||
|
|
35
client/ui/qml/Controls/FadeBehavior.qml
Normal file
35
client/ui/qml/Controls/FadeBehavior.qml
Normal file
|
@ -0,0 +1,35 @@
|
|||
import QtQuick 2.15
|
||||
import QtQml 2.15
|
||||
|
||||
Behavior {
|
||||
id: root
|
||||
|
||||
property QtObject fadeTarget: targetProperty.object
|
||||
property string fadeProperty: "scale"
|
||||
property int fadeDuration: 150
|
||||
property string easingType: "Quad"
|
||||
|
||||
property alias outAnimation: outAnimation
|
||||
property alias inAnimation: inAnimation
|
||||
|
||||
SequentialAnimation {
|
||||
NumberAnimation {
|
||||
id: outAnimation
|
||||
target: root.fadeTarget
|
||||
property: root.fadeProperty
|
||||
duration: root.fadeDuration
|
||||
to: 0
|
||||
easing.type: Easing["In"+root.easingType]
|
||||
}
|
||||
PropertyAction { }
|
||||
NumberAnimation {
|
||||
id: inAnimation
|
||||
target: root.fadeTarget
|
||||
property: root.fadeProperty
|
||||
duration: root.fadeDuration
|
||||
to: target[property]
|
||||
easing.type: Easing["Out"+root.easingType]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
6
client/ui/qml/Controls/VisibleBehavior.qml
Normal file
6
client/ui/qml/Controls/VisibleBehavior.qml
Normal file
|
@ -0,0 +1,6 @@
|
|||
FadeBehavior {
|
||||
fadeProperty: "opacity"
|
||||
fadeDuration: 200
|
||||
outAnimation.duration: targetValue ? 0 : fadeDuration
|
||||
inAnimation.duration: targetValue ? fadeDuration : 0
|
||||
}
|
|
@ -10,7 +10,6 @@ Drawer {
|
|||
id: root
|
||||
signal containerSelected(int c_index)
|
||||
property int selectedIndex: -1
|
||||
property alias modelFilters: proxyModel.filters
|
||||
|
||||
z: -3
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ import QtQuick 2.12
|
|||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.15
|
||||
import SortFilterProxyModel 0.2
|
||||
import ContainerProps 1.0
|
||||
import ProtocolProps 1.0
|
||||
import PageEnum 1.0
|
||||
import "./"
|
||||
import "../Controls"
|
||||
|
@ -19,33 +21,149 @@ PageBase {
|
|||
}
|
||||
Caption {
|
||||
id: caption
|
||||
text: qsTr("Protocols")
|
||||
text: container_selector.selectedIndex > 0 ? qsTr("Install new service") : qsTr("Installed services")
|
||||
}
|
||||
BlueButtonType {
|
||||
id: pb_add_container
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
SelectContainer {
|
||||
id: container_selector
|
||||
|
||||
onContainerSelected: {
|
||||
var containerProto = ContainerProps.defaultProtocol(c_index)
|
||||
|
||||
tf_port_num.text = ProtocolProps.defaultPort(containerProto)
|
||||
cb_port_proto.currentIndex = ProtocolProps.defaultTransportProto(containerProto)
|
||||
|
||||
tf_port_num.enabled = ProtocolProps.defaultPortChangeable(containerProto)
|
||||
cb_port_proto.enabled = ProtocolProps.defaultTransportProtoChangeable(containerProto)
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: c1
|
||||
visible: container_selector.selectedIndex > 0
|
||||
width: parent.width
|
||||
anchors.top: caption.bottom
|
||||
anchors.topMargin: 10
|
||||
|
||||
Caption {
|
||||
font.pixelSize: 22
|
||||
text: UiLogic.containerName(container_selector.selectedIndex)
|
||||
}
|
||||
|
||||
Text {
|
||||
width: parent.width
|
||||
anchors.topMargin: 10
|
||||
padding: 10
|
||||
|
||||
font.family: "Lato"
|
||||
font.styleName: "normal"
|
||||
font.pixelSize: 16
|
||||
color: "#181922"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
text: UiLogic.containerDesc(container_selector.selectedIndex)
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: frame_settings
|
||||
visible: container_selector.selectedIndex > 0
|
||||
width: parent.width
|
||||
anchors.top: c1.bottom
|
||||
anchors.topMargin: 10
|
||||
|
||||
border.width: 1
|
||||
border.color: "lightgray"
|
||||
anchors.bottomMargin: 5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
radius: 2
|
||||
Grid {
|
||||
id: grid
|
||||
visible: container_selector.selectedIndex > 0
|
||||
anchors.fill: parent
|
||||
columns: 2
|
||||
horizontalItemAlignment: Grid.AlignHCenter
|
||||
verticalItemAlignment: Grid.AlignVCenter
|
||||
topPadding: 5
|
||||
leftPadding: 10
|
||||
spacing: 5
|
||||
|
||||
|
||||
LabelType {
|
||||
width: 130
|
||||
text: qsTr("Port")
|
||||
}
|
||||
TextFieldType {
|
||||
id: tf_port_num
|
||||
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
||||
}
|
||||
LabelType {
|
||||
width: 130
|
||||
text: qsTr("Network Protocol")
|
||||
}
|
||||
ComboBoxType {
|
||||
id: cb_port_proto
|
||||
width: parent.width - 130 - parent.spacing - parent.leftPadding * 2
|
||||
model: [
|
||||
qsTr("udp"),
|
||||
qsTr("tcp"),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BlueButtonType {
|
||||
id: pb_cancel_add
|
||||
visible: container_selector.selectedIndex > 0
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: pb_continue_add.top
|
||||
anchors.bottomMargin: 20
|
||||
|
||||
width: parent.width - 40
|
||||
height: 40
|
||||
text: qsTr("Add protocols container")
|
||||
text: qsTr("Cancel")
|
||||
font.pixelSize: 16
|
||||
onClicked: container_selector.visible ? container_selector.close() : container_selector.open()
|
||||
onClicked: container_selector.selectedIndex = -1
|
||||
|
||||
}
|
||||
SelectContainer {
|
||||
id: container_selector
|
||||
|
||||
BlueButtonType {
|
||||
id: pb_continue_add
|
||||
visible: container_selector.selectedIndex > 0
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 20
|
||||
|
||||
width: parent.width - 40
|
||||
height: 40
|
||||
text: qsTr("Continue")
|
||||
font.pixelSize: 16
|
||||
onClicked: {
|
||||
let cont = container_selector.selectedIndex
|
||||
let tp = ProtocolProps.transportProtoFromString(cb_port_proto.currentText)
|
||||
let port = tf_port_num.text
|
||||
ServerContainersLogic.onPushButtonContinueClicked(cont, port, tp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Flickable {
|
||||
visible: container_selector.selectedIndex <= 0
|
||||
clip: true
|
||||
width: parent.width
|
||||
anchors.top: pb_add_container.bottom
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: caption.bottom
|
||||
anchors.bottom: pb_add_container.top
|
||||
contentHeight: col.height
|
||||
|
||||
Column {
|
||||
visible: container_selector.selectedIndex <= 0
|
||||
id: col
|
||||
anchors {
|
||||
left: parent.left;
|
||||
|
@ -116,23 +234,6 @@ PageBase {
|
|||
visible: index === tb_c.currentIndex
|
||||
}
|
||||
|
||||
// ImageButtonType {
|
||||
// id: button_default1
|
||||
// z:10
|
||||
|
||||
// Layout.alignment: Qt.AlignRight
|
||||
// checkable: true
|
||||
// img.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
|
||||
// width: 20
|
||||
// img.width: 20
|
||||
// height: 20
|
||||
|
||||
// checked: default_role
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonDefaultClicked(proxyContainersModel.mapToSource(index))
|
||||
// }
|
||||
// }
|
||||
|
||||
RowLayout {
|
||||
id: row_container
|
||||
//width: parent.width
|
||||
|
@ -156,6 +257,7 @@ PageBase {
|
|||
Layout.fillWidth: true
|
||||
|
||||
MouseArea {
|
||||
enabled: col.visible
|
||||
anchors.top: lb_container_name.top
|
||||
anchors.bottom: lb_container_name.bottom
|
||||
anchors.left: parent.left
|
||||
|
@ -191,6 +293,7 @@ PageBase {
|
|||
|
||||
ImageButtonType {
|
||||
id: button_share
|
||||
visible: index === tb_c.currentIndex
|
||||
Layout.alignment: Qt.AlignRight
|
||||
icon.source: "qrc:/images/share.png"
|
||||
implicitWidth: 30
|
||||
|
@ -198,6 +301,25 @@ PageBase {
|
|||
onClicked: {
|
||||
ServerContainersLogic.onPushButtonShareClicked(proxyContainersModel.mapToSource(index))
|
||||
}
|
||||
|
||||
VisibleBehavior on visible { }
|
||||
}
|
||||
|
||||
ImageButtonType {
|
||||
id: button_remove
|
||||
visible: index === tb_c.currentIndex
|
||||
Layout.alignment: Qt.AlignRight
|
||||
checkable: true
|
||||
icon.source: "qrc:/images/delete.png"
|
||||
implicitWidth: 30
|
||||
implicitHeight: 30
|
||||
|
||||
checked: default_role
|
||||
onClicked: {
|
||||
ServerContainersLogic.onPushButtonRemoveClicked(proxyContainersModel.mapToSource(index))
|
||||
}
|
||||
|
||||
VisibleBehavior on visible { }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -218,6 +340,9 @@ PageBase {
|
|||
interactive: false
|
||||
model: proxyProtocolsModel
|
||||
|
||||
VisibleBehavior on visible { }
|
||||
|
||||
|
||||
delegate: Item {
|
||||
id: dp_item
|
||||
|
||||
|
@ -279,13 +404,7 @@ PageBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MouseArea {
|
||||
// anchors.fill: parent
|
||||
// onClicked: {
|
||||
// tb_p.currentIndex = index
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -294,456 +413,20 @@ PageBase {
|
|||
}
|
||||
|
||||
|
||||
BlueButtonType {
|
||||
id: pb_add_container
|
||||
visible: container_selector.selectedIndex < 0
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.topMargin: 10
|
||||
anchors.bottomMargin: 20
|
||||
|
||||
width: parent.width - 40
|
||||
height: 40
|
||||
text: qsTr("Install new protocols container")
|
||||
font.pixelSize: 16
|
||||
onClicked: container_selector.visible ? container_selector.close() : container_selector.open()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ProgressBar {
|
||||
// id: progress_bar
|
||||
// anchors.horizontalCenter: parent.horizontalCenter
|
||||
// y: 570
|
||||
// width: 301
|
||||
// height: 40
|
||||
// from: 0
|
||||
// to: ServerContainersLogic.progressBarProtocolsContainerReinstallMaximium
|
||||
// value: ServerContainersLogic.progressBarProtocolsContainerReinstallValue
|
||||
// visible: ServerContainersLogic.progressBarProtocolsContainerReinstallVisible
|
||||
// background: Rectangle {
|
||||
// implicitWidth: parent.width
|
||||
// implicitHeight: parent.height
|
||||
// color: "#100A44"
|
||||
// radius: 4
|
||||
// }
|
||||
|
||||
// contentItem: Item {
|
||||
// implicitWidth: parent.width
|
||||
// implicitHeight: parent.height
|
||||
// Rectangle {
|
||||
// width: progress_bar.visualPosition * parent.width
|
||||
// height: parent.height
|
||||
// radius: 4
|
||||
// color: Qt.rgba(255, 255, 255, 0.15);
|
||||
// }
|
||||
// }
|
||||
|
||||
// LabelType {
|
||||
// anchors.fill: parent
|
||||
// text: qsTr("Configuring...")
|
||||
// horizontalAlignment: Text.AlignHCenter
|
||||
// font.family: "Lato"
|
||||
// font.styleName: "normal"
|
||||
// font.pixelSize: 16
|
||||
// color: "#D4D4D4"
|
||||
// }
|
||||
// }
|
||||
// ScrollView {
|
||||
// x: 0
|
||||
// y: 190
|
||||
// width: 380
|
||||
// height: 471
|
||||
// clip: true
|
||||
// Column {
|
||||
// spacing: 5
|
||||
// Rectangle {
|
||||
// id: frame_openvpn_ss_cloak
|
||||
// x: 9
|
||||
// height: 135
|
||||
// width: 363
|
||||
// border.width: 1
|
||||
// border.color: "lightgray"
|
||||
// radius: 2
|
||||
// visible: ServerContainersLogic.frameOpenvpnSsCloakSettingsVisible
|
||||
// Item {
|
||||
// x: 5
|
||||
// y: 5
|
||||
// width: parent.width - 10
|
||||
// height: parent.height - 10
|
||||
// LabelType {
|
||||
// anchors.left: parent.left
|
||||
// width: 239
|
||||
// height: 24
|
||||
// text: qsTr("Cloak container")
|
||||
// leftPadding: 5
|
||||
// }
|
||||
// ImageButtonType {
|
||||
// anchors.right: sr1.left
|
||||
// anchors.rightMargin: 5
|
||||
// checkable: true
|
||||
// icon.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
|
||||
// width: 24
|
||||
// height: 24
|
||||
// checked: ServerContainersLogic.pushButtonCloakOpenVpnContDefaultChecked
|
||||
// onCheckedChanged: {
|
||||
// ServerContainersLogic.pushButtonCloakOpenVpnContDefaultChecked = checked
|
||||
// }
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoCloakOpenVpnContDefaultClicked(checked)
|
||||
// }
|
||||
|
||||
// visible: ServerContainersLogic.pushButtonCloakOpenVpnContDefaultVisible
|
||||
// }
|
||||
|
||||
// ImageButtonType {
|
||||
// id: sr1
|
||||
// anchors.right: cn1.left
|
||||
// anchors.rightMargin: 5
|
||||
// icon.source: "qrc:/images/share.png"
|
||||
// width: 24
|
||||
// height: 24
|
||||
// visible: ServerContainersLogic.pushButtonCloakOpenVpnContShareVisible
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoCloakOpenVpnContShareClicked(false)
|
||||
// }
|
||||
// }
|
||||
// ImageButtonType {
|
||||
// id: cn1
|
||||
// anchors.right: parent.right
|
||||
// checkable: true
|
||||
// icon.source: checked ? "qrc:/images/connect_button_connected.png"
|
||||
// : "qrc:/images/connect_button_disconnected.png"
|
||||
// width: 36
|
||||
// height: 24
|
||||
// checked: ServerContainersLogic.pushButtonCloakOpenVpnContInstallChecked
|
||||
// onCheckedChanged: {
|
||||
// ServerContainersLogic.pushButtonCloakOpenVpnContInstallChecked = checked
|
||||
// }
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoCloakOpenVpnContInstallClicked(checked)
|
||||
// }
|
||||
// enabled: ServerContainersLogic.pushButtonCloakOpenVpnContInstallEnabled
|
||||
// }
|
||||
// }
|
||||
// Rectangle {
|
||||
// x: 10
|
||||
// y: 42
|
||||
// height: 83
|
||||
// width: 343
|
||||
// border.width: 1
|
||||
// border.color: "lightgray"
|
||||
// radius: 2
|
||||
// SettingButtonType {
|
||||
// x: 10
|
||||
// y: 10
|
||||
// width: 323
|
||||
// height: 24
|
||||
// text: qsTr("OpenVPN settings")
|
||||
// icon.source: "qrc:/images/settings.png"
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoCloakOpenVpnContOpenvpnConfigClicked()
|
||||
// }
|
||||
// }
|
||||
// SettingButtonType {
|
||||
// x: 10
|
||||
// y: 33
|
||||
// width: 323
|
||||
// height: 24
|
||||
// text: qsTr("ShadowSocks settings")
|
||||
// icon.source: "qrc:/images/settings.png"
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoCloakOpenVpnContSsConfigClicked()
|
||||
// }
|
||||
// }
|
||||
// SettingButtonType {
|
||||
// x: 10
|
||||
// y: 56
|
||||
// width: 323
|
||||
// height: 24
|
||||
// text: qsTr("Cloak settings")
|
||||
// icon.source: "qrc:/images/settings.png"
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoCloakOpenVpnContCloakConfigClicked()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Rectangle {
|
||||
// id: frame_openvpn_ss
|
||||
// x: 9
|
||||
// height: 105
|
||||
// width: 363
|
||||
// border.width: 1
|
||||
// border.color: "lightgray"
|
||||
// radius: 2
|
||||
// visible: ServerContainersLogic.frameOpenvpnSsSettingsVisible
|
||||
// Item {
|
||||
// x: 5
|
||||
// y: 5
|
||||
// width: parent.width - 10
|
||||
// height: parent.height - 10
|
||||
// LabelType {
|
||||
// anchors.left: parent.left
|
||||
// width: 239
|
||||
// height: 24
|
||||
// text: qsTr("ShadowSocks container")
|
||||
// leftPadding: 5
|
||||
// }
|
||||
// ImageButtonType {
|
||||
// anchors.right: sr2.left
|
||||
// anchors.rightMargin: 5
|
||||
// checkable: true
|
||||
// icon.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
|
||||
// width: 24
|
||||
// height: 24
|
||||
// checked: ServerContainersLogic.pushButtonSsOpenVpnContDefaultChecked
|
||||
// onCheckedChanged: {
|
||||
// ServerContainersLogic.pushButtonSsOpenVpnContDefaultChecked = checked
|
||||
// }
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoSsOpenVpnContDefaultClicked(checked)
|
||||
// }
|
||||
|
||||
// visible: ServerContainersLogic.pushButtonSsOpenVpnContDefaultVisible
|
||||
// }
|
||||
|
||||
// ImageButtonType {
|
||||
// id: sr2
|
||||
// anchors.right: cn2.left
|
||||
// anchors.rightMargin: 5
|
||||
// icon.source: "qrc:/images/share.png"
|
||||
// width: 24
|
||||
// height: 24
|
||||
// visible: ServerContainersLogic.pushButtonSsOpenVpnContShareVisible
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoSsOpenVpnContShareClicked(false)
|
||||
// }
|
||||
// }
|
||||
// ImageButtonType {
|
||||
// id: cn2
|
||||
// anchors.right: parent.right
|
||||
// checkable: true
|
||||
// icon.source: checked ? "qrc:/images/connect_button_connected.png"
|
||||
// : "qrc:/images/connect_button_disconnected.png"
|
||||
// width: 36
|
||||
// height: 24
|
||||
// checked: ServerContainersLogic.pushButtonSsOpenVpnContInstallChecked
|
||||
// onCheckedChanged: {
|
||||
// ServerContainersLogic.pushButtonSsOpenVpnContInstallChecked = checked
|
||||
// }
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoSsOpenVpnContInstallClicked(checked)
|
||||
// }
|
||||
// enabled: ServerContainersLogic.pushButtonSsOpenVpnContInstallEnabled
|
||||
// }
|
||||
// }
|
||||
// Rectangle {
|
||||
// x: 10
|
||||
// y: 42
|
||||
// height: 53
|
||||
// width: 343
|
||||
// border.width: 1
|
||||
// border.color: "lightgray"
|
||||
// radius: 2
|
||||
// SettingButtonType {
|
||||
// x: 10
|
||||
// y: 5
|
||||
// width: 323
|
||||
// height: 24
|
||||
// text: qsTr("OpenVPN settings")
|
||||
// icon.source: "qrc:/images/settings.png"
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoSsOpenVpnContOpenvpnConfigClicked()
|
||||
// }
|
||||
// }
|
||||
// SettingButtonType {
|
||||
// x: 10
|
||||
// y: 27
|
||||
// width: 323
|
||||
// height: 24
|
||||
// text: qsTr("ShadowSocks settings")
|
||||
// icon.source: "qrc:/images/settings.png"
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoSsOpenVpnContSsConfigClicked()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Rectangle {
|
||||
// id: frame_openvpn
|
||||
// x: 9
|
||||
// height: 100
|
||||
// width: 363
|
||||
// border.width: 1
|
||||
// border.color: "lightgray"
|
||||
// radius: 2
|
||||
// visible: ServerContainersLogic.frameOpenvpnSettingsVisible
|
||||
// Item {
|
||||
// x: 5
|
||||
// y: 5
|
||||
// width: parent.width - 10
|
||||
// height: parent.height - 10
|
||||
// LabelType {
|
||||
// anchors.left: parent.left
|
||||
// width: 239
|
||||
// height: 24
|
||||
// text: qsTr("OpenVPN container")
|
||||
// leftPadding: 5
|
||||
// }
|
||||
// ImageButtonType {
|
||||
// anchors.right: sr3.left
|
||||
// anchors.rightMargin: 5
|
||||
// checkable: true
|
||||
// icon.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
|
||||
// width: 24
|
||||
// height: 24
|
||||
// checked: ServerContainersLogic.pushButtonOpenVpnContDefaultChecked
|
||||
// onCheckedChanged: {
|
||||
// ServerContainersLogic.pushButtonOpenVpnContDefaultChecked = checked
|
||||
// }
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoOpenVpnContDefaultClicked(checked)
|
||||
// }
|
||||
|
||||
// visible: ServerContainersLogic.pushButtonOpenVpnContDefaultVisible
|
||||
// }
|
||||
|
||||
// ImageButtonType {
|
||||
// id: sr3
|
||||
// anchors.right: cn3.left
|
||||
// anchors.rightMargin: 5
|
||||
// icon.source: "qrc:/images/share.png"
|
||||
// width: 24
|
||||
// height: 24
|
||||
// visible: ServerContainersLogic.pushButtonOpenVpnContShareVisible
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoOpenVpnContShareClicked(false)
|
||||
// }
|
||||
// }
|
||||
// ImageButtonType {
|
||||
// id: cn3
|
||||
// anchors.right: parent.right
|
||||
// checkable: true
|
||||
// icon.source: checked ? "qrc:/images/connect_button_connected.png"
|
||||
// : "qrc:/images/connect_button_disconnected.png"
|
||||
// width: 36
|
||||
// height: 24
|
||||
// checked: ServerContainersLogic.pushButtonOpenVpnContInstallChecked
|
||||
// onCheckedChanged: {
|
||||
// ServerContainersLogic.pushButtonOpenVpnContInstallChecked = checked
|
||||
// }
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoOpenVpnContInstallClicked(checked)
|
||||
// }
|
||||
// enabled: ServerContainersLogic.pushButtonOpenVpnContInstallEnabled
|
||||
// }
|
||||
// }
|
||||
// Rectangle {
|
||||
// x: 10
|
||||
// y: 42
|
||||
// height: 44
|
||||
// width: 343
|
||||
// border.width: 1
|
||||
// border.color: "lightgray"
|
||||
// radius: 2
|
||||
// SettingButtonType {
|
||||
// x: 10
|
||||
// y: 10
|
||||
// width: 323
|
||||
// height: 24
|
||||
// text: qsTr("OpenVPN settings")
|
||||
// icon.source: "qrc:/images/settings.png"
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoOpenVpnContOpenvpnConfigClicked()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Rectangle {
|
||||
// id: frame_wireguard
|
||||
// x: 9
|
||||
// height: 100
|
||||
// width: 363
|
||||
// border.width: 1
|
||||
// border.color: "lightgray"
|
||||
// radius: 2
|
||||
// visible: ServerContainersLogic.frameWireguardVisible
|
||||
// Item {
|
||||
// x: 5
|
||||
// y: 5
|
||||
// width: parent.width - 10
|
||||
// height: parent.height - 10
|
||||
// LabelType {
|
||||
// anchors.left: parent.left
|
||||
// width: 239
|
||||
// height: 24
|
||||
// text: qsTr("WireGuard container")
|
||||
// leftPadding: 5
|
||||
// }
|
||||
// ImageButtonType {
|
||||
// anchors.right: sr4.left
|
||||
// anchors.rightMargin: 5
|
||||
// checkable: true
|
||||
// icon.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
|
||||
// width: 24
|
||||
// height: 24
|
||||
// checked: ServerContainersLogic.pushButtonWireguardContDefaultChecked
|
||||
// onCheckedChanged: {
|
||||
// ServerContainersLogic.pushButtonWireguardContDefaultChecked = checked
|
||||
// }
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoWireguardContDefaultClicked(checked)
|
||||
// }
|
||||
|
||||
// visible: ServerContainersLogic.pushButtonWireguardContDefaultVisible
|
||||
// }
|
||||
|
||||
// ImageButtonType {
|
||||
// id: sr4
|
||||
// anchors.right: cn4.left
|
||||
// anchors.rightMargin: 5
|
||||
// icon.source: "qrc:/images/share.png"
|
||||
// width: 24
|
||||
// height: 24
|
||||
// visible: ServerContainersLogic.pushButtonWireguardContShareVisible
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoWireguardContShareClicked(false)
|
||||
// }
|
||||
// }
|
||||
// ImageButtonType {
|
||||
// id: cn4
|
||||
// anchors.right: parent.right
|
||||
// checkable: true
|
||||
// icon.source: checked ? "qrc:/images/connect_button_connected.png"
|
||||
// : "qrc:/images/connect_button_disconnected.png"
|
||||
// width: 36
|
||||
// height: 24
|
||||
// checked: ServerContainersLogic.pushButtonWireguardContInstallChecked
|
||||
// onCheckedChanged: {
|
||||
// ServerContainersLogic.pushButtonWireguardContInstallChecked = checked
|
||||
// }
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonProtoWireguardContInstallClicked(checked)
|
||||
// }
|
||||
// enabled: ServerContainersLogic.pushButtonWireguardContInstallEnabled
|
||||
// }
|
||||
// }
|
||||
// Rectangle {
|
||||
// id: frame_wireguard_settings
|
||||
// visible: ServerContainersLogic.frameWireguardSettingsVisible
|
||||
// x: 10
|
||||
// y: 42
|
||||
// height: 44
|
||||
// width: 343
|
||||
// border.width: 1
|
||||
// border.color: "lightgray"
|
||||
// radius: 2
|
||||
// SettingButtonType {
|
||||
// x: 10
|
||||
// y: 10
|
||||
// width: 323
|
||||
// height: 24
|
||||
// text: qsTr("WireGuard settings")
|
||||
// icon.source: "qrc:/images/settings.png"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ PageBase {
|
|||
y: 210
|
||||
width: 300
|
||||
height: 40
|
||||
text: qsTr("VPN protocols")
|
||||
text: qsTr("Protocols and services")
|
||||
onClicked: {
|
||||
UiLogic.goToPage(PageEnum.ServerContainers)
|
||||
}
|
||||
|
|
|
@ -33,18 +33,13 @@ PageProtocolBase {
|
|||
qsTr("aes-128-gcm")
|
||||
]
|
||||
currentIndex: {
|
||||
console.debug("logic.comboBoxProtoShadowSocksCipherText " + logic.comboBoxProtoShadowSocksCipherText)
|
||||
for (let i = 0; i < model.length; ++i) {
|
||||
console.debug("check " + model[i])
|
||||
if (logic.comboBoxProtoShadowSocksCipherText === model[i]) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
// onCurrentTextChanged: {
|
||||
// logic.comboBoxProtoShadowSocksCipherText = currentText
|
||||
// }
|
||||
}
|
||||
LabelType {
|
||||
x: 30
|
||||
|
|
|
@ -83,6 +83,8 @@ public:
|
|||
Q_INVOKABLE QString containerName(int container);
|
||||
Q_INVOKABLE QString containerDesc(int container);
|
||||
|
||||
Q_INVOKABLE void onGotoPage(PageEnumNS::Page p, bool reset = true, bool slide = true) { emit goToPage(p, reset, slide); }
|
||||
Q_INVOKABLE void onGotoProtocolPage(Protocol p, bool reset = true, bool slide = true) { emit goToProtocolPage(p, reset, slide); }
|
||||
|
||||
|
||||
int getCurrentPageValue() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue