Merge branch 'qt_migration' of github.com:amnezia-vpn/desktop-client into feature/qt6-server-busy-notification

This commit is contained in:
vladimir.kuznetsov 2023-01-13 16:59:03 +03:00
commit 221ea5ebb0
51 changed files with 1175 additions and 1017 deletions

View file

@ -42,6 +42,13 @@ jobs:
export QIF_BIN_DIR=${{ runner.temp }}/Qt/Tools/QtInstallerFramework/${{ env.QIF_VERSION }}/bin
bash deploy/build_linux.sh
- name: 'Upload artifact'
uses: actions/upload-artifact@v3
with:
name: AmneziaVPN_Linux
path: deploy/AmneziaVPN_Linux_Installer
retention-days: 3
# ------------------------------------------------------
Build-Windows:
@ -90,6 +97,13 @@ jobs:
set QIF_BIN_DIR="${{ runner.temp }}\\Qt\\Tools\\QtInstallerFramework\\${{ env.QIF_VERSION }}\\bin"
call deploy\\build_windows.bat
- name: 'Upload artifact'
uses: actions/upload-artifact@v3
with:
name: AmneziaVPN_Windows
path: AmneziaVPN_x${{ env.BUILD_ARCH }}.exe
retention-days: 3
# ------------------------------------------------------
Build-IOS:
@ -166,14 +180,6 @@ jobs:
team-id: 'X7UJ388FXK'
configuration: Release
# ------------------------------------------------------
Build-MacOS:
@ -219,6 +225,13 @@ jobs:
export QIF_BIN_DIR="${{ runner.temp }}/Qt/Tools/QtInstallerFramework/${{ env.QIF_VERSION }}/bin"
bash deploy/build_macos.sh
- name: 'Upload artifact'
uses: actions/upload-artifact@v3
with:
name: AmneziaVPN_MacOS
path: AmneziaVPN.dmg
retention-days: 3
# ------------------------------------------------------
Build-Android:

View file

@ -292,8 +292,6 @@ endif()
if(IOS)
message("Client iOS build")
find_package(Qt6 REQUIRED COMPONENTS ShaderTools)
set(LIBS ${LIBS} Qt6::ShaderTools)
@ -346,7 +344,11 @@ qt_add_executable(${PROJECT} ${SOURCES} ${HEADERS} ${RESOURCES} ${QRC})
qt_add_translations(${PROJECT} TS_FILES
${CMAKE_CURRENT_LIST_DIR}/translations/amneziavpn_ru.ts)
# NETWORKEXTENSION=1
if(APPLE AND NOT IOS)
set_target_properties(AmneziaVPN PROPERTIES
MACOSX_BUNDLE TRUE
)
endif()
if(IOS)
enable_language(OBJC)

View file

@ -76,6 +76,7 @@ HEADERS += \
ui/pages_logic/protocols/OtherProtocolsLogic.h \
ui/pages_logic/protocols/PageProtocolLogicBase.h \
ui/pages_logic/protocols/ShadowSocksLogic.h \
ui/pages_logic/protocols/WireGuardLogic.h \
ui/property_helper.h \
ui/models/servers_model.h \
ui/uilogic.h \
@ -138,6 +139,7 @@ SOURCES += \
ui/pages_logic/protocols/PageProtocolLogicBase.cpp \
ui/pages_logic/protocols/ShadowSocksLogic.cpp \
ui/models/servers_model.cpp \
ui/pages_logic/protocols/WireGuardLogic.cpp \
ui/uilogic.cpp \
ui/qautostart.cpp \
ui/models/sites_model.cpp \

View file

@ -58,6 +58,12 @@ constexpr char additional_server_config[] = "additional_server_config";
// proto config keys
constexpr char last_config[] = "last_config";
constexpr char isThirdPartyConfig[] = "isThirdPartyConfig";
constexpr char openvpn[] = "openvpn";
constexpr char wireguard[] = "wireguard";
}
namespace protocols {

View file

@ -63,6 +63,7 @@
<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/PageBase.qml</file>
<file>ui/qml/Pages/PageAppSetting.qml</file>
<file>ui/qml/Pages/PageGeneralSettings.qml</file>
<file>ui/qml/Pages/PageNetworkSetting.qml</file>
@ -81,6 +82,28 @@
<file>ui/qml/Pages/PageSites.qml</file>
<file>ui/qml/Pages/PageStart.qml</file>
<file>ui/qml/Pages/PageVPN.qml</file>
<file>ui/qml/Pages/PageQrDecoder.qml</file>
<file>ui/qml/Pages/PageAbout.qml</file>
<file>ui/qml/Pages/PageQrDecoderIos.qml</file>
<file>ui/qml/Pages/PageViewConfig.qml</file>
<file>ui/qml/Pages/Protocols/PageProtoCloak.qml</file>
<file>ui/qml/Pages/Protocols/PageProtoOpenVPN.qml</file>
<file>ui/qml/Pages/Protocols/PageProtoShadowSocks.qml</file>
<file>ui/qml/Pages/Protocols/PageProtoSftp.qml</file>
<file>ui/qml/Pages/Protocols/PageProtoTorWebSite.qml</file>
<file>ui/qml/Pages/Protocols/PageProtocolBase.qml</file>
<file>ui/qml/Pages/Protocols/PageProtoWireGuard.qml</file>
<file>ui/qml/Pages/InstallSettings/InstallSettingsBase.qml</file>
<file>ui/qml/Pages/InstallSettings/SelectContainer.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoCloak.qml</file>
<file>ui/qml/Pages/Share/PageShareProtocolBase.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoOpenVPN.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoSftp.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoShadowSocks.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoTorWebSite.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoAmnezia.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoWireGuard.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoIkev2.qml</file>
<file>ui/qml/Controls/BasicButtonType.qml</file>
<file>ui/qml/Controls/BlueButtonType.qml</file>
<file>ui/qml/Controls/CheckBoxType.qml</file>
@ -92,57 +115,41 @@
<file>ui/qml/Controls/ShareConnectionButtonType.qml</file>
<file>ui/qml/Controls/ShareConnectionContent.qml</file>
<file>ui/qml/Controls/TextFieldType.qml</file>
<file>ui/qml/Pages/PageBase.qml</file>
<file>ui/qml/Config/GlobalConfig.qml</file>
<file>ui/qml/Config/qmldir</file>
<file>images/background_connected.png</file>
<file>images/background_connected@2x.png</file>
<file>ui/qml/Pages/Protocols/PageProtoCloak.qml</file>
<file>ui/qml/Pages/Protocols/PageProtoOpenVPN.qml</file>
<file>ui/qml/Pages/Protocols/PageProtoShadowSocks.qml</file>
<file>ui/qml/Controls/BackButton.qml</file>
<file>ui/qml/Pages/InstallSettings/InstallSettingsBase.qml</file>
<file>ui/qml/Controls/Caption.qml</file>
<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/RichLabelType.qml</file>
<file>ui/qml/Controls/SvgImageType.qml</file>
<file>ui/qml/Controls/FlickableType.qml</file>
<file>ui/qml/Controls/UrlButtonType.qml</file>
<file>ui/qml/Controls/TextAreaType.qml</file>
<file>ui/qml/Controls/ContextMenu.qml</file>
<file>ui/qml/Controls/FadeBehavior.qml</file>
<file>ui/qml/Controls/VisibleBehavior.qml</file>
<file>ui/qml/Controls/Caption.qml</file>
<file>ui/qml/Controls/Logo.qml</file>
<file>ui/qml/Controls/BackButton.qml</file>
<file>ui/qml/Controls/ShareConnectionButtonCopyType.qml</file>
<file>ui/qml/Controls/SvgButtonType.qml</file>
<file>ui/qml/Config/GlobalConfig.qml</file>
<file>ui/qml/Config/qmldir</file>
<file>server_scripts/check_server_is_busy.sh</file>
<file>server_scripts/dns/configure_container.sh</file>
<file>server_scripts/dns/Dockerfile</file>
<file>server_scripts/dns/run_container.sh</file>
<file>server_scripts/sftp/configure_container.sh</file>
<file>server_scripts/sftp/Dockerfile</file>
<file>server_scripts/sftp/run_container.sh</file>
<file>ui/qml/Pages/Protocols/PageProtoSftp.qml</file>
<file>ui/qml/Pages/Protocols/PageProtoTorWebSite.qml</file>
<file>server_scripts/ipsec/configure_container.sh</file>
<file>server_scripts/ipsec/Dockerfile</file>
<file>server_scripts/ipsec/run_container.sh</file>
<file>server_scripts/ipsec/start.sh</file>
<file>ui/qml/Pages/Share/PageShareProtoCloak.qml</file>
<file>ui/qml/Pages/Share/PageShareProtocolBase.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoOpenVPN.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoSftp.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoShadowSocks.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoTorWebSite.qml</file>
<file>ui/qml/Controls/TextAreaType.qml</file>
<file>ui/qml/Controls/ContextMenu.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoAmnezia.qml</file>
<file>ui/qml/Controls/ShareConnectionButtonCopyType.qml</file>
<file>ui/qml/Pages/Share/PageShareProtoWireGuard.qml</file>
<file>server_scripts/ipsec/mobileconfig.plist</file>
<file>ui/qml/Pages/Share/PageShareProtoIkev2.qml</file>
<file>server_scripts/ipsec/strongswan.profile</file>
<file>images/background_connected.png</file>
<file>images/background_connected@2x.png</file>
<file>images/delete.png</file>
<file>images/animation.gif</file>
<file>images/connected.png</file>
<file>images/disconnected.png</file>
<file>ui/qml/Pages/PageQrDecoder.qml</file>
<file>ui/qml/Pages/PageAbout.qml</file>
<file>ui/qml/Controls/RichLabelType.qml</file>
<file>images/svg/gpp_good_black_24dp.svg</file>
<file>ui/qml/Controls/SvgImageType.qml</file>
<file>images/svg/gpp_maybe_black_24dp.svg</file>
<file>images/svg/close_black_24dp.svg</file>
<file>images/svg/delete_black_24dp.svg</file>
@ -156,10 +163,6 @@
<file>images/svg/vpn_key_black_24dp.svg</file>
<file>images/svg/control_point_black_24dp.svg</file>
<file>images/svg/settings_suggest_black_24dp.svg</file>
<file>ui/qml/Controls/SvgButtonType.qml</file>
<file>ui/qml/Pages/PageQrDecoderIos.qml</file>
<file>server_scripts/website_tor/Dockerfile</file>
<file>ui/qml/Pages/PageViewConfig.qml</file>
<file>server_scripts/check_server_is_busy.sh</file>
</qresource>
</RCC>

View file

@ -29,6 +29,7 @@ void ServerContainersLogic::onUpdatePage()
ProtocolsModel *p_model = qobject_cast<ProtocolsModel *>(uiLogic()->protocolsModel());
p_model->setSelectedServerIndex(uiLogic()->selectedServerIndex);
set_isManagedServer(m_settings->haveAuthData(uiLogic()->selectedServerIndex));
emit updatePage();
}

View file

@ -19,6 +19,8 @@ public:
Q_INVOKABLE void onPushButtonRemoveClicked(DockerContainer c);
Q_INVOKABLE void onPushButtonContinueClicked(DockerContainer c, int port, TransportProto tp);
AUTO_PROPERTY(bool, isManagedServer)
public:
explicit ServerContainersLogic(UiLogic *uiLogic, QObject *parent = nullptr);
~ServerContainersLogic() = default;

View file

@ -37,11 +37,17 @@ void ServerSettingsLogic::onUpdatePage()
set_pushButtonShareFullVisible(m_settings->haveAuthData(uiLogic()->selectedServerIndex));
const QJsonObject &server = m_settings->server(uiLogic()->selectedServerIndex);
const QString &port = server.value(config_key::port).toString();
set_labelServerText(QString("%1@%2%3%4")
.arg(server.value(config_key::userName).toString())
.arg(server.value(config_key::hostName).toString())
.arg(port.isEmpty() ? "" : ":")
.arg(port));
const QString &userName = server.value(config_key::userName).toString();
const QString &hostName = server.value(config_key::hostName).toString();
QString name = QString("%1%2%3%4%5")
.arg(userName)
.arg(userName.isEmpty() ? "" : "@")
.arg(hostName)
.arg(port.isEmpty() ? "" : ":")
.arg(port);
set_labelServerText(name);
set_lineEditDescriptionText(server.value(config_key::description).toString());
DockerContainer selectedContainer = m_settings->defaultContainer(uiLogic()->selectedServerIndex);

View file

@ -15,6 +15,36 @@
#include "platforms/android/android_controller.h"
#endif
namespace {
enum class ConfigTypes {
Amnezia,
OpenVpn,
WireGuard
};
ConfigTypes checkConfigFormat(const QString &config)
{
const QString openVpnConfigPatternCli = "client";
const QString openVpnConfigPatternProto1 = "proto tcp";
const QString openVpnConfigPatternProto2 = "proto udp";
const QString openVpnConfigPatternDriver1 = "dev tun";
const QString openVpnConfigPatternDriver2 = "dev tap";
const QString wireguardConfigPatternSectionInterface = "[Interface]";
const QString wireguardConfigPatternSectionPeer = "[Peer]";
if (config.contains(openVpnConfigPatternCli) &&
(config.contains(openVpnConfigPatternProto1) || config.contains(openVpnConfigPatternProto2)) &&
(config.contains(openVpnConfigPatternDriver1) || config.contains(openVpnConfigPatternDriver2))) {
return ConfigTypes::OpenVpn;
} else if (config.contains(wireguardConfigPatternSectionInterface) &&
config.contains(wireguardConfigPatternSectionPeer))
return ConfigTypes::WireGuard;
return ConfigTypes::Amnezia;
}
}
StartPageLogic::StartPageLogic(UiLogic *logic, QObject *parent):
PageLogicBase(logic, parent),
m_pushButtonConnectEnabled{true},
@ -135,15 +165,22 @@ void StartPageLogic::onPushButtonImport()
void StartPageLogic::onPushButtonImportOpenFile()
{
QString fileName = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Open profile"),
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), tr("*.vpn"));
QString fileName = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Open config file"),
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.vpn *.ovpn *.conf");
if (fileName.isEmpty()) return;
QFile file(fileName);
file.open(QIODevice::ReadOnly);
QByteArray data = file.readAll();
importConnectionFromCode(QString(data));
auto configFormat = checkConfigFormat(QString(data));
if (configFormat == ConfigTypes::OpenVpn) {
importConnectionFromOpenVpnConfig(QString(data));
} else if (configFormat == ConfigTypes::WireGuard) {
importConnectionFromWireguardConfig(QString(data));
} else {
importConnectionFromCode(QString(data));
}
}
bool StartPageLogic::importConnection(const QJsonObject &profile)
@ -201,3 +238,90 @@ bool StartPageLogic::importConnectionFromQr(const QByteArray &data)
return false;
}
bool StartPageLogic::importConnectionFromOpenVpnConfig(const QString &config)
{
QJsonObject openVpnConfig;
openVpnConfig[config_key::config] = config;
QJsonObject lastConfig;
lastConfig[config_key::last_config] = QString(QJsonDocument(openVpnConfig).toJson());
lastConfig[config_key::isThirdPartyConfig] = true;
QJsonObject containers;
containers.insert(config_key::container, QJsonValue("amnezia-openvpn"));
containers.insert(config_key::openvpn, QJsonValue(lastConfig));
QJsonArray arr;
arr.push_back(containers);
QString hostName;
const static QRegularExpression hostNameRegExp("remote (.*) [0-9]*");
QRegularExpressionMatch hostNameMatch = hostNameRegExp.match(config);
if (hostNameMatch.hasMatch()) {
hostName = hostNameMatch.captured(1);
}
QJsonObject o;
o[config_key::containers] = arr;
o[config_key::defaultContainer] = "amnezia-openvpn";
o[config_key::description] = m_settings->nextAvailableServerName();
const static QRegularExpression dnsRegExp("dhcp-option DNS (\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b)");
QRegularExpressionMatchIterator dnsMatch = dnsRegExp.globalMatch(config);
if (dnsMatch.hasNext()) {
o[config_key::dns1] = dnsMatch.next().captured(1);
}
if (dnsMatch.hasNext()) {
o[config_key::dns2] = dnsMatch.next().captured(1);
}
o[config_key::hostName] = hostName;
return importConnection(o);
}
bool StartPageLogic::importConnectionFromWireguardConfig(const QString &config)
{
QJsonObject lastConfig;
lastConfig[config_key::config] = config;
const static QRegularExpression hostNameAndPortRegExp("Endpoint = (.*):([0-9]*)");
QRegularExpressionMatch hostNameAndPortMatch = hostNameAndPortRegExp.match(config);
QString hostName;
QString port;
if (hostNameAndPortMatch.hasMatch()) {
hostName = hostNameAndPortMatch.captured(1);
port = hostNameAndPortMatch.captured(2);
}
QJsonObject wireguardConfig;
wireguardConfig[config_key::last_config] = QString(QJsonDocument(lastConfig).toJson());
wireguardConfig[config_key::isThirdPartyConfig] = true;
wireguardConfig[config_key::port] = port;
wireguardConfig[config_key::transport_proto] = "udp";
QJsonObject containers;
containers.insert(config_key::container, QJsonValue("amnezia-wireguard"));
containers.insert(config_key::wireguard, QJsonValue(wireguardConfig));
QJsonArray arr;
arr.push_back(containers);
QJsonObject o;
o[config_key::containers] = arr;
o[config_key::defaultContainer] = "amnezia-wireguard";
o[config_key::description] = m_settings->nextAvailableServerName();
const static QRegularExpression dnsRegExp("DNS = (\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b).*(\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b)");
QRegularExpressionMatch dnsMatch = dnsRegExp.match(config);
if (dnsMatch.hasMatch()) {
o[config_key::dns1] = dnsMatch.captured(1);
o[config_key::dns2] = dnsMatch.captured(2);
}
o[config_key::hostName] = hostName;
return importConnection(o);
}

View file

@ -34,6 +34,8 @@ public:
bool importConnection(const QJsonObject &profile);
bool importConnectionFromCode(QString code);
bool importConnectionFromQr(const QByteArray &data);
bool importConnectionFromOpenVpnConfig(const QString &config);
bool importConnectionFromWireguardConfig(const QString &config);
public:
explicit StartPageLogic(UiLogic *uiLogic, QObject *parent = nullptr);

View file

@ -13,6 +13,8 @@ void ViewConfigLogic::onUpdatePage()
{
set_configText(QJsonDocument(configJson()).toJson());
auto s = configJson()[config_key::isThirdPartyConfig].toBool();
m_openVpnLastConfigs = m_openVpnMalStrings =
"<style> \
div { line-height: 0.5; } \
@ -24,28 +26,42 @@ void ViewConfigLogic::onUpdatePage()
const QJsonArray &containers = configJson()[config_key::containers].toArray();
int i = 0;
for (const QJsonValue &v: containers) {
QString cfg_json = v.toObject()[ProtocolProps::protoToString(Proto::OpenVpn)]
.toObject()[config_key::last_config].toString();
QString openvpn_cfg = QJsonDocument::fromJson(cfg_json.toUtf8()).object()[config_key::config]
.toString();
openvpn_cfg.replace("\r", "");
QStringList lines = openvpn_cfg.split("\n");
for (const QString &l: lines) {
i++;
QRegularExpressionMatch match = m_re.match(l);
if (dangerousTags.contains(match.captured(0))) {
QString t = QString("<p><font color=\"red\">%1</font>").arg(l);
m_openVpnLastConfigs.append(t + "\n");
m_openVpnMalStrings.append(t);
if (m_warningStringNumber == 3) m_warningStringNumber = i - 3;
m_warningActive = true;
qDebug() << "ViewConfigLogic : malicious scripts warning:" << l;
auto containerName = v.toObject()[config_key::container].toString();
QJsonObject containerConfig = v.toObject()[containerName.replace("amnezia-", "")].toObject();
if (containerConfig[config_key::isThirdPartyConfig].toBool()) {
auto lastConfig = containerConfig.value(config_key::last_config).toString();
auto lastConfigJson = QJsonDocument::fromJson(lastConfig.toUtf8()).object();
QStringList lines = lastConfigJson.value(config_key::config).toString().replace("\r", "").split("\n");
QString lastConfigText;
for (const QString &l: lines) {
lastConfigText.append(l + "\n");
}
else {
m_openVpnLastConfigs.append("<p>" + l + "&nbsp;\n");
set_configText(lastConfigText);
}
if (v.toObject()[config_key::container].toString() == "amnezia-openvpn") {
QString lastConfig = v.toObject()[ProtocolProps::protoToString(Proto::OpenVpn)]
.toObject()[config_key::last_config].toString();
QString lastConfigJson = QJsonDocument::fromJson(lastConfig.toUtf8()).object()[config_key::config]
.toString();
QStringList lines = lastConfigJson.replace("\r", "").split("\n");
for (const QString &l: lines) {
i++;
QRegularExpressionMatch match = m_re.match(l);
if (dangerousTags.contains(match.captured(0))) {
QString t = QString("<p><font color=\"red\">%1</font>").arg(l);
m_openVpnLastConfigs.append(t + "\n");
m_openVpnMalStrings.append(t);
if (m_warningStringNumber == 3) m_warningStringNumber = i - 3;
m_warningActive = true;
qDebug() << "ViewConfigLogic : malicious scripts warning:" << l;
}
else {
m_openVpnLastConfigs.append("<p>" + l + "&nbsp;\n");
}
}
}
}

View file

@ -36,7 +36,7 @@ public:
explicit CloakLogic(UiLogic *uiLogic, QObject *parent = nullptr);
~CloakLogic() = default;
void updateProtocolPage (const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData) override;
void updateProtocolPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData) override;
QJsonObject getProtocolConfigFromPage(QJsonObject oldConfig) override;
private:

View file

@ -90,6 +90,17 @@ void OpenVpnLogic::updateProtocolPage(const QJsonObject &openvpnConfig, DockerCo
toString(protocols::openvpn::defaultPort));
set_lineEditPortEnabled(container == DockerContainer::OpenVpn);
auto lastConfig = openvpnConfig.value(config_key::last_config).toString();
auto lastConfigJson = QJsonDocument::fromJson(lastConfig.toUtf8()).object();
QStringList lines = lastConfigJson.value(config_key::config).toString().replace("\r", "").split("\n");
QString openVpnLastConfigText;
for (const QString &l: lines) {
openVpnLastConfigText.append(l + "\n");
}
set_openVpnLastConfigText(openVpnLastConfigText);
set_isThirdPartyConfig(openvpnConfig.value(config_key::isThirdPartyConfig).isBool());
}
void OpenVpnLogic::onPushButtonSaveClicked()

View file

@ -42,6 +42,9 @@ class OpenVpnLogic : public PageProtocolLogicBase
AUTO_PROPERTY(bool, pushButtonCancelVisible)
AUTO_PROPERTY(QString, openVpnLastConfigText)
AUTO_PROPERTY(bool, isThirdPartyConfig)
public:
Q_INVOKABLE void onPushButtonSaveClicked();
Q_INVOKABLE void onPushButtonCancelClicked();

View file

@ -0,0 +1,30 @@
#include "WireGuardLogic.h"
#include "core/servercontroller.h"
#include <functional>
#include "../../uilogic.h"
using namespace amnezia;
using namespace PageEnumNS;
WireGuardLogic::WireGuardLogic(UiLogic *logic, QObject *parent):
PageProtocolLogicBase(logic, parent)
{
}
void WireGuardLogic::updateProtocolPage(const QJsonObject &wireGuardConfig, DockerContainer container, bool haveAuthData)
{
qDebug() << "WireGuardLogic::updateProtocolPage";
auto lastConfigJsonDoc = QJsonDocument::fromJson(wireGuardConfig.value(config_key::last_config).toString().toUtf8());
auto lastConfigJson = lastConfigJsonDoc.object();
QString wireGuardLastConfigText;
QStringList lines = lastConfigJson.value(config_key::config).toString().replace("\r", "").split("\n");
for (const QString &l: lines) {
wireGuardLastConfigText.append(l + "\n");
}
set_wireGuardLastConfigText(wireGuardLastConfigText);
set_isThirdPartyConfig(wireGuardConfig.value(config_key::isThirdPartyConfig).toBool());
}

View file

@ -0,0 +1,26 @@
#ifndef WIREGUARDLOGIC_H
#define WIREGUARDLOGIC_H
#include "PageProtocolLogicBase.h"
class UiLogic;
class WireGuardLogic : public PageProtocolLogicBase
{
Q_OBJECT
AUTO_PROPERTY(QString, wireGuardLastConfigText)
AUTO_PROPERTY(bool, isThirdPartyConfig)
public:
explicit WireGuardLogic(UiLogic *uiLogic, QObject *parent = nullptr);
~WireGuardLogic() = default;
void updateProtocolPage(const QJsonObject &wireGuardConfig, DockerContainer container, bool haveAuthData) override;
private:
UiLogic *m_uiLogic;
};
#endif // WIREGUARDLOGIC_H

View file

@ -6,7 +6,9 @@ Item {
readonly property string screenHomeIntroGifEx1: "qrc:/ScreenHomeIntroGifEx1.qml"
readonly property int screenWidth: 380
readonly property int screenHeight: 640
readonly property int screenHeight: 680
readonly property int defaultMargin: 20
function isMobile() {
if (Qt.platform.os == "android" ||
@ -24,20 +26,4 @@ Item {
}
return false
}
function trX(x) {
return x
}
function trY(y) {
return y
}
function trW(w) {
return w
}
function trH(h) {
return h
}
}

View file

@ -1,11 +1,12 @@
import QtQuick
import QtQuick.Controls
import "../Config"
BasicButtonType {
id: root
width: parent.width - 80
height: 40
width: parent.width - 2 * GC.defaultMargin
implicitHeight: 40
background: Rectangle {
anchors.fill: parent

View file

@ -0,0 +1,26 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import "../Config"
Flickable {
id: fl
clip: true
width: parent.width
anchors.topMargin: GC.defaultMargin
anchors.bottom: parent.bottom
anchors.bottomMargin: GC.defaultMargin
anchors.left: root.left
anchors.leftMargin: GC.defaultMargin
anchors.right: root.right
anchors.rightMargin: 1
Keys.onUpPressed: scrollBar.decrease()
Keys.onDownPressed: scrollBar.increase()
ScrollBar.vertical: ScrollBar {
id: scrollBar
policy: fl.height >= fl.contentHeight ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
}
}

View file

@ -1,9 +1,9 @@
import QtQuick
import "../Config"
Text {
id: root
x: 40
width: parent.width
width: parent.width - 2 * GC.defaultMargin
anchors.topMargin: 10
font.family: "Lato"

View file

@ -1,19 +1,20 @@
import QtQuick
import QtQuick.Controls
import Qt.labs.platform
import "../Config"
TextField {
id: root
property bool error: false
width: parent.width - 80
width: parent.width - 2 * GC.defaultMargin
height: 40
anchors.topMargin: 5
selectByMouse: true
selectionColor: "darkgray"
font.pixelSize: 16
color: "#333333"
background: Rectangle {
implicitWidth: 200
implicitHeight: 40

View file

@ -0,0 +1,25 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
BasicButtonType {
property alias label: lbl
id: root
antialiasing: true
height: 21
background: Item {}
contentItem: Text {
id: lbl
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 18
font.underline: true
text: root.text
color: "#3045ee"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}

View file

@ -48,8 +48,7 @@ Drawer {
}
Flickable {
clip: true
FlickableType {
anchors.fill: parent
contentHeight: col.height

View file

@ -19,20 +19,10 @@ PageBase {
text: qsTr("Application Settings")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: logo.top
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -40,6 +30,7 @@ PageBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
CheckBoxType {
visible: !GC.isMobile()
@ -79,7 +70,6 @@ PageBase {
BlueButtonType {
visible: !GC.isMobile()
Layout.fillWidth: true
Layout.preferredHeight: 41
text: qsTr("Check for updates")
onClicked: {
Qt.openUrlExternally("https://github.com/amnezia-vpn/desktop-client/releases/latest")
@ -98,7 +88,6 @@ PageBase {
}
BlueButtonType {
Layout.fillWidth: true
Layout.preferredHeight: 41
text: qsTr("Open logs folder")
onClicked: {
AppSettingsLogic.onPushButtonOpenLogsClicked()
@ -108,7 +97,6 @@ PageBase {
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 10
Layout.preferredHeight: 41
text: qsTr("Export logs")
onClicked: {
AppSettingsLogic.onPushButtonExportLogsClicked()
@ -118,7 +106,6 @@ PageBase {
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 10
Layout.preferredHeight: 41
property string start_text: qsTr("Clear logs")
property string end_text: qsTr("Cleared")
@ -162,9 +149,4 @@ PageBase {
}
}
}
Logo {
id: logo
anchors.bottom: parent.bottom
}
}

View file

@ -17,8 +17,4 @@ Item {
onActivated: pageActive = true
onDeactivated: pageActive = false
// width: GC.screenWidth
// height: GC.screenHeight
}

View file

@ -16,20 +16,12 @@ PageBase {
z: -1
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: back.bottom
anchors.topMargin: 0
anchors.bottom: root.bottom
anchors.bottomMargin: 10
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -38,6 +30,7 @@ PageBase {
anchors.topMargin: 10
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: GC.defaultMargin
spacing: 15

View file

@ -1,5 +1,6 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import PageEnum 1.0
import "./"
import "../Controls"
@ -18,108 +19,95 @@ PageBase {
text: qsTr("DNS Servers")
}
CheckBoxType {
id: cb_amnezia_dns
FlickableType {
id: fl
anchors.top: caption.bottom
x: 30
width: parent.width - 60
text: qsTr("Use AmneziaDNS service (recommended)")
checked: NetworkSettingsLogic.checkBoxUseAmneziaDnsChecked
onCheckedChanged: {
NetworkSettingsLogic.checkBoxUseAmneziaDnsChecked = checked
NetworkSettingsLogic.onCheckBoxUseAmneziaDnsToggled(checked)
UiLogic.onUpdateAllPages()
}
}
contentHeight: content.height
LabelType {
id: lb_amnezia_dns
x: 30
anchors.top: cb_amnezia_dns.bottom
width: parent.width - 60
text: qsTr("Use AmneziaDNS container on your server, when it installed.\n
ColumnLayout {
id: content
enabled: logic.pageEnabled
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
CheckBoxType {
Layout.preferredWidth: parent.width
text: qsTr("Use AmneziaDNS service (recommended)")
checked: NetworkSettingsLogic.checkBoxUseAmneziaDnsChecked
onCheckedChanged: {
NetworkSettingsLogic.checkBoxUseAmneziaDnsChecked = checked
NetworkSettingsLogic.onCheckBoxUseAmneziaDnsToggled(checked)
UiLogic.onUpdateAllPages()
}
}
LabelType {
Layout.preferredWidth: parent.width
text: qsTr("Use AmneziaDNS container on your server, when it installed.\n
Your AmneziaDNS server available only when it installed and VPN connected, it has internal IP address 172.29.172.254\n
If AmneziaDNS service is not installed on the same server, or this option is unchecked, the following DNS servers will be used:")
}
}
LabelType {
id: l1
x: 30
anchors.top: lb_amnezia_dns.bottom
width: parent.width - 30
height: 21
text: qsTr("Primary DNS server")
}
TextFieldType {
id: dns1
x: 30
anchors.top: l1.bottom
width: parent.width - 90
height: 40
text: NetworkSettingsLogic.lineEditDns1Text
onEditingFinished: {
NetworkSettingsLogic.lineEditDns1Text = text
NetworkSettingsLogic.onLineEditDns1EditFinished(text)
UiLogic.onUpdateAllPages()
}
validator: RegularExpressionValidator {
regularExpression: NetworkSettingsLogic.ipAddressRegex
}
}
SvgButtonType {
id: resetDNS1
anchors. left: dns1.right
anchors.leftMargin: 10
anchors.verticalCenter: dns1.verticalCenter
width: 24
height: 24
icon.source: "qrc:/images/svg/refresh_black_24dp.svg"
onClicked: {
NetworkSettingsLogic.onPushButtonResetDns1Clicked()
UiLogic.onUpdateAllPages()
}
}
LabelType {
Layout.topMargin: 15
text: qsTr("Primary DNS server")
}
TextFieldType {
height: 40
implicitWidth: parent.width
text: NetworkSettingsLogic.lineEditDns1Text
onEditingFinished: {
NetworkSettingsLogic.lineEditDns1Text = text
NetworkSettingsLogic.onLineEditDns1EditFinished(text)
UiLogic.onUpdateAllPages()
}
validator: RegularExpressionValidator {
regularExpression: NetworkSettingsLogic.ipAddressRegex
}
}
LabelType {
id: l2
x: 30
anchors.top: dns1.bottom
anchors.topMargin: 20
width: parent.width - 60
height: 21
text: qsTr("Secondary DNS server")
}
TextFieldType {
id: dns2
x: 30
anchors.top: l2.bottom
width: parent.width - 90
height: 40
text: NetworkSettingsLogic.lineEditDns2Text
onEditingFinished: {
NetworkSettingsLogic.lineEditDns2Text = text
NetworkSettingsLogic.onLineEditDns2EditFinished(text)
UiLogic.onUpdateAllPages()
}
validator: RegularExpressionValidator {
regularExpression: NetworkSettingsLogic.ipAddressRegex
}
}
SvgButtonType {
id: resetDNS2
anchors. left: dns2.right
anchors.leftMargin: 10
anchors.verticalCenter: dns2.verticalCenter
width: 24
height: 24
icon.source: "qrc:/images/svg/refresh_black_24dp.svg"
onClicked: {
NetworkSettingsLogic.onPushButtonResetDns2Clicked()
UiLogic.onUpdateAllPages()
}
}
UrlButtonType {
text: qsTr("Reset to default")
label.horizontalAlignment: Text.AlignLeft
label.verticalAlignment: Text.AlignTop
label.font.pixelSize: 14
icon.source: "qrc:/images/svg/refresh_black_24dp.svg"
onClicked: {
NetworkSettingsLogic.onPushButtonResetDns1Clicked()
UiLogic.onUpdateAllPages()
}
}
Logo {
anchors.bottom: parent.bottom
LabelType {
text: qsTr("Secondary DNS server")
}
TextFieldType {
height: 40
implicitWidth: parent.width
text: NetworkSettingsLogic.lineEditDns2Text
onEditingFinished: {
NetworkSettingsLogic.lineEditDns2Text = text
NetworkSettingsLogic.onLineEditDns2EditFinished(text)
UiLogic.onUpdateAllPages()
}
validator: RegularExpressionValidator {
regularExpression: NetworkSettingsLogic.ipAddressRegex
}
}
UrlButtonType {
text: qsTr("Reset to default")
label.horizontalAlignment: Text.AlignLeft
label.verticalAlignment: Text.AlignTop
label.font.pixelSize: 14
icon.source: "qrc:/images/svg/refresh_black_24dp.svg"
onClicked: {
NetworkSettingsLogic.onPushButtonResetDns2Clicked()
UiLogic.onUpdateAllPages()
}
}
}
}
}

View file

@ -8,7 +8,6 @@ import "../Config"
PageBase {
id: root
page: PageEnum.NewServer
//logic: {}
BackButton {
id: back_from_new_server
@ -22,15 +21,15 @@ PageBase {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("If you want easily configure your server just run Wizard")
width: parent.width - 80
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: caption.bottom
anchors.topMargin: 30
}
BlueButtonType {
id: pushButtonWizard
text: qsTr("Run Setup Wizard")
anchors.top: labelWizard.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: labelWizard.bottom
anchors.topMargin: 10
onClicked: {
UiLogic.goToPage(PageEnum.Wizard);
@ -41,14 +40,13 @@ PageBase {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Press configure manually to choose VPN protocols you want to install")
width: parent.width - 80
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: pushButtonWizard.bottom
anchors.topMargin: 40
}
BlueButtonType {
text: qsTr("Configure VPN protocols manually")
text: qsTr("Configure")
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: labelManual.bottom
anchors.topMargin: 10

View file

@ -32,6 +32,7 @@ PageBase {
BackButton {
id: back
onClicked: tb_c.currentIndex = -1
}
Caption {
id: caption
@ -174,11 +175,7 @@ PageBase {
}
}
Flickable {
FlickableType {
visible: container_selector.selectedIndex <= 0
clip: true
width: parent.width
@ -224,7 +221,6 @@ PageBase {
ListView {
id: tb_c
x: 10
width: parent.width - 10
height: tb_c.contentItem.height
currentIndex: -1
@ -293,7 +289,7 @@ PageBase {
ImageButtonType {
id: button_remove
visible: index === tb_c.currentIndex
visible: (index === tb_c.currentIndex) && ServerContainersLogic.isManagedServer
Layout.alignment: Qt.AlignRight
checkable: true
icon.source: "qrc:/images/delete.png"
@ -320,7 +316,7 @@ PageBase {
ImageButtonType {
id: button_share
visible: index === tb_c.currentIndex
visible: (index === tb_c.currentIndex) && ServerContainersLogic.isManagedServer
Layout.alignment: Qt.AlignRight
icon.source: "qrc:/images/share.png"
implicitWidth: 30
@ -431,7 +427,7 @@ PageBase {
width: parent.width - 40
height: 40
text: qsTr("Install new protocols container")
text: qsTr("Install new service")
font.pixelSize: 16
onClicked: container_selector.visible ? container_selector.close() : container_selector.open()

View file

@ -35,10 +35,10 @@ PageBase {
ListView {
id: listWidget_servers
x: 20
x: GC.defaultMargin
anchors.top: caption.bottom
anchors.topMargin: 15
width: parent.width
width: parent.width - GC.defaultMargin - 1
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
model: ServerListLogic.serverListModel
@ -49,7 +49,7 @@ PageBase {
clip: true
delegate: Item {
height: 60
width: root.width - 40
width: listWidget_servers.width - 15
MouseArea {
id: ms
anchors.fill: parent
@ -96,14 +96,14 @@ PageBase {
id: label_address
x: 20
y: 40
width: 141
width: listWidget_servers.width - 100
height: 16
text: address
}
Text {
x: 10
y: 10
width: 181
width: listWidget_servers.width - 100
height: 21
font.family: "Lato"
font.styleName: "normal"
@ -177,5 +177,9 @@ PageBase {
}
}
}
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AsNeeded
}
}
}

View file

@ -1,5 +1,6 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import PageEnum 1.0
import "./"
import "../Controls"
@ -16,113 +17,106 @@ PageBase {
id: back
}
Caption {
id: caption
text: qsTr("Server settings")
anchors.horizontalCenter: parent.horizontalCenter
}
LabelType {
anchors.horizontalCenter: parent.horizontalCenter
y: 150
width: 341
height: 31
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
text: ServerSettingsLogic.labelCurrentVpnProtocolText
}
// LabelType {
// anchors.horizontalCenter: parent.horizontalCenter
// y: 120
// width: 341
// height: 31
// font.pixelSize: 20
// horizontalAlignment: Text.AlignHCenter
// text: ServerSettingsLogic.labelServerText
// }
TextFieldType {
anchors.horizontalCenter: parent.horizontalCenter
y: 120
width: 341
height: 31
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
text: ServerSettingsLogic.labelServerText
readOnly: true
background: Item {}
FlickableType {
id: fl
anchors.top: caption.bottom
anchors.bottom: logo.top
contentHeight: content.height
ColumnLayout {
id: content
enabled: logic.pageEnabled
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
LabelType {
Layout.fillWidth: true
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
text: ServerSettingsLogic.labelCurrentVpnProtocolText
}
TextFieldType {
Layout.fillWidth: true
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
text: ServerSettingsLogic.labelServerText
readOnly: true
background: Item {}
}
LabelType {
Layout.fillWidth: true
text: ServerSettingsLogic.labelWaitInfoText
visible: ServerSettingsLogic.labelWaitInfoVisible
}
TextFieldType {
Layout.fillWidth: true
text: ServerSettingsLogic.lineEditDescriptionText
onEditingFinished: {
ServerSettingsLogic.lineEditDescriptionText = text
ServerSettingsLogic.onLineEditDescriptionEditingFinished()
}
}
BlueButtonType {
text: qsTr("Protocols and Services")
Layout.topMargin: 20
Layout.fillWidth: true
onClicked: {
UiLogic.goToPage(PageEnum.ServerContainers)
}
}
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 10
text: qsTr("Share Server (FULL ACCESS)")
visible: ServerSettingsLogic.pushButtonShareFullVisible
onClicked: {
ServerSettingsLogic.onPushButtonShareFullClicked()
}
}
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 60
text: ServerSettingsLogic.pushButtonClearText
visible: ServerSettingsLogic.pushButtonClearVisible
onClicked: {
ServerSettingsLogic.onPushButtonClearServer()
}
}
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 10
text: ServerSettingsLogic.pushButtonClearClientCacheText
visible: ServerSettingsLogic.pushButtonClearClientCacheVisible
onClicked: {
ServerSettingsLogic.onPushButtonClearClientCacheClicked()
}
}
BlueButtonType {
Layout.fillWidth: true
Layout.topMargin: 10
text: qsTr("Forget this server")
onClicked: {
ServerSettingsLogic.onPushButtonForgetServer()
}
}
}
}
LabelType {
anchors.horizontalCenter: parent.horizontalCenter
y: 530
width: 301
height: 41
text: ServerSettingsLogic.labelWaitInfoText
visible: ServerSettingsLogic.labelWaitInfoVisible
}
TextFieldType {
anchors.horizontalCenter: parent.horizontalCenter
y: 80
width: 251
height: 31
text: ServerSettingsLogic.lineEditDescriptionText
onEditingFinished: {
ServerSettingsLogic.lineEditDescriptionText = text
ServerSettingsLogic.onLineEditDescriptionEditingFinished()
}
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 410
width: parent.width - 40
height: 40
text: ServerSettingsLogic.pushButtonClearText
visible: ServerSettingsLogic.pushButtonClearVisible
onClicked: {
ServerSettingsLogic.onPushButtonClearServer()
}
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 350
width: parent.width - 40
height: 40
text: ServerSettingsLogic.pushButtonClearClientCacheText
visible: ServerSettingsLogic.pushButtonClearClientCacheVisible
onClicked: {
ServerSettingsLogic.onPushButtonClearClientCacheClicked()
}
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 470
width: parent.width - 40
height: 40
text: qsTr("Forget this server")
onClicked: {
ServerSettingsLogic.onPushButtonForgetServer()
}
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 210
width: parent.width - 40
height: 40
text: qsTr("Protocols and Services")
onClicked: {
UiLogic.goToPage(PageEnum.ServerContainers)
}
}
BlueButtonType {
anchors.horizontalCenter: parent.horizontalCenter
y: 260
width: parent.width - 40
height: 40
text: qsTr("Share Server (FULL ACCESS)")
visible: ServerSettingsLogic.pushButtonShareFullVisible
onClicked: {
ServerSettingsLogic.onPushButtonShareFullClicked()
}
}
Logo {
id : logo
anchors.bottom: parent.bottom
}
}

View file

@ -19,20 +19,11 @@ PageBase {
text: qsTr("Setup your server to use VPN")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
anchors.bottom: next_button.top
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -40,6 +31,7 @@ PageBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
RadioButtonType {
id: radioButton_setup_wizard_high
@ -93,21 +85,23 @@ OpenVPN over ShadowSocks profile will be installed.\n")
text: qsTr("I want to improve my privacy on the internet.
OpenVPN profile will be installed.\n")
}
}
}
BlueButtonType {
Layout.fillWidth: true
Layout.preferredHeight: 41
text: qsTr("Next")
onClicked: {
if (radioButton_setup_wizard_high.checked) {
UiLogic.goToPage(PageEnum.WizardHigh, false);
} else if (radioButton_setup_wizard_medium.checked) {
UiLogic.goToPage(PageEnum.WizardMedium, false);
} else if (radioButton_setup_wizard_low.checked) {
UiLogic.goToPage(PageEnum.WizardLow, false);
}
}
BlueButtonType {
id: next_button
anchors.bottom: parent.bottom
anchors.bottomMargin: GC.defaultMargin
x: GC.defaultMargin
width: parent.width - 2 * GC.defaultMargin
text: qsTr("Next")
onClicked: {
if (radioButton_setup_wizard_high.checked) {
UiLogic.goToPage(PageEnum.WizardHigh, false);
} else if (radioButton_setup_wizard_medium.checked) {
UiLogic.goToPage(PageEnum.WizardMedium, false);
} else if (radioButton_setup_wizard_low.checked) {
UiLogic.goToPage(PageEnum.WizardLow, false);
}
}
}

View file

@ -19,20 +19,11 @@ PageBase {
text: qsTr("Setup Wizard")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
anchors.bottom: next_button.top
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -40,6 +31,7 @@ PageBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
LabelType {
Layout.fillWidth: true
@ -83,22 +75,22 @@ You SHOULD set this website address to some foreign website which is not blocked
This protocol support exporting connection profiles to mobile devices by exporting ShadowSocks and Cloak configs (you should launch the 3rd party open source VPN client - ShadowSocks VPN and install Cloak plugin).")
}
BlueButtonType {
id: next_button
Layout.fillWidth: true
Layout.topMargin: 15
Layout.preferredHeight: 41
text: qsTr("Next")
onClicked: {
let domain = website_masking.text;
if (!domain || !domain.includes(".")) {
return
}
UiLogic.goToPage(PageEnum.WizardVpnMode, false)
}
}
}
}
BlueButtonType {
id: next_button
anchors.bottom: parent.bottom
anchors.bottomMargin: GC.defaultMargin
x: GC.defaultMargin
width: parent.width - 2 * GC.defaultMargin
text: qsTr("Next")
onClicked: {
let domain = website_masking.text;
if (!domain || !domain.includes(".")) {
return
}
UiLogic.goToPage(PageEnum.WizardVpnMode, false)
}
}
}

View file

@ -19,20 +19,11 @@ PageBase {
text: qsTr("Setup Wizard")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
anchors.bottom: next_button.top
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -40,6 +31,7 @@ PageBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
LabelType {
Layout.fillWidth: true
@ -56,16 +48,18 @@ We recommend not to use messaging applications for sending the connection profil
text: qsTr('OpenVPN profile will be installed')
verticalAlignment: Text.AlignBottom
}
BlueButtonType {
id: next_button
Layout.fillWidth: true
Layout.topMargin: 15
Layout.preferredHeight: 41
text: qsTr("Start configuring")
onClicked: {
WizardLogic.onPushButtonLowFinishClicked()
}
}
}
}
BlueButtonType {
id: next_button
anchors.bottom: parent.bottom
anchors.bottomMargin: GC.defaultMargin
x: GC.defaultMargin
width: parent.width - 2 * GC.defaultMargin
text: qsTr("Start configuring")
onClicked: {
WizardLogic.onPushButtonLowFinishClicked()
}
}
}

View file

@ -19,20 +19,11 @@ PageBase {
text: qsTr("Setup Wizard")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
anchors.bottom: next_button.top
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -40,6 +31,7 @@ PageBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
LabelType {
Layout.fillWidth: true
@ -51,16 +43,18 @@ PageBase {
Layout.topMargin: 15
text: qsTr('OpenVPN over ShadowSocks profile will be installed')
}
BlueButtonType {
id: next_button
Layout.fillWidth: true
Layout.topMargin: 15
Layout.preferredHeight: 41
text: qsTr("Next")
onClicked: {
UiLogic.goToPage(PageEnum.WizardVpnMode, false)
}
}
}
}
BlueButtonType {
id: next_button
anchors.bottom: parent.bottom
anchors.bottomMargin: GC.defaultMargin
x: GC.defaultMargin
width: parent.width - 2 * GC.defaultMargin
text: qsTr("Next")
onClicked: {
UiLogic.goToPage(PageEnum.WizardVpnMode, false)
}
}
}

View file

@ -19,20 +19,11 @@ PageBase {
text: qsTr("Setup Wizard")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
anchors.bottom: vpn_mode_finish.top
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -40,6 +31,7 @@ PageBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
LabelType {
Layout.fillWidth: true
@ -56,17 +48,18 @@ You can enable VPN mode "For selected sites" and add blocked sites you need to v
WizardLogic.checkBoxVpnModeChecked = checked
}
}
}
}
BlueButtonType {
id: vpn_mode_finish
Layout.fillWidth: true
Layout.topMargin: 15
Layout.preferredHeight: 41
text: qsTr("Start configuring")
onClicked: {
WizardLogic.onPushButtonVpnModeFinishClicked()
}
}
BlueButtonType {
id: vpn_mode_finish
anchors.bottom: parent.bottom
anchors.bottomMargin: GC.defaultMargin
x: GC.defaultMargin
width: parent.width - 2 * GC.defaultMargin
text: qsTr("Start configuring")
onClicked: {
WizardLogic.onPushButtonVpnModeFinishClicked()
}
}
}

View file

@ -27,12 +27,11 @@ PageBase {
}
Flickable {
FlickableType {
clip: true
width: parent.width
anchors.top: caption.bottom
anchors.bottom: root.bottom
contentHeight: col.height
boundsBehavior: Flickable.StopAtBounds
Column {
id: col
@ -54,7 +53,6 @@ PageBase {
ShareConnectionContent {
x: 10
text: qsTr("Share for Amnezia")
height: 40
width: tb_c.width - 10
@ -63,7 +61,6 @@ PageBase {
ListView {
id: tb_c
x: 10
width: parent.width - 10
height: tb_c.contentItem.height
currentIndex: -1

View file

@ -46,12 +46,12 @@ PageBase {
BasicButtonType {
id: start_switch_page
width: parent.width - 2 * GC.defaultMargin
implicitHeight: 40
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: logo.top
anchors.bottomMargin: 10
width: parent.width - 80
height: 40
anchors.topMargin: 20
text: qsTr("Set up your own server")
@ -88,7 +88,6 @@ PageBase {
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
}
Item {
@ -104,6 +103,7 @@ PageBase {
id: label_connection_code
anchors.top: parent.top
anchors.topMargin: 20
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Connection code")
}
TextFieldType {
@ -303,7 +303,8 @@ PageBase {
}
enabled: StartPageLogic.pushButtonConnectEnabled
}
BasicButtonType {
UrlButtonType {
id: new_sever_connect_key
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: new_sever_connect.bottom
@ -311,21 +312,8 @@ PageBase {
width: 281
height: 21
text: qsTr("Connect using SSH key")
background: Item {
anchors.fill: parent
}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#15CDCB";
text: new_sever_connect_key.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
label.font.pixelSize: 16
checkable: true
checked: StartPageLogic.pushButtonConnectKeyChecked
onCheckedChanged: {

View file

@ -30,27 +30,12 @@ PageBase {
font.pixelSize: 12
}
BasicButtonType {
UrlButtonType {
y: 10
anchors.horizontalCenter: parent.horizontalCenter
height: 21
background: Item {}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 18
font.underline: true
text: qsTr("Donate")
color: "#D4D4D4"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
label.color: "#D4D4D4"
label.text: qsTr("Donate")
onClicked: {
UiLogic.goToPage(PageEnum.About)

View file

@ -20,20 +20,10 @@ PageBase {
text: qsTr("Check config")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -41,6 +31,7 @@ PageBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
TextAreaType {
id: ta_config
@ -124,7 +115,7 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull
BasicButtonType {
Layout.preferredWidth: (content.width - parent.spacing) /2
Layout.preferredHeight: 41
Layout.preferredHeight: 40
font.pixelSize: btn_import.font.pixelSize
text: qsTr("Cancel")
onClicked: {
@ -135,7 +126,6 @@ AmneziaVPN detected this profile may contain malicious scripts. Please, carefull
BlueButtonType {
id: btn_import
Layout.preferredWidth: (content.width - parent.spacing) /2
Layout.preferredHeight: 41
text: qsTr("Import config")
onClicked: {
logic.importConfig()

View file

@ -15,424 +15,442 @@ PageProtocolBase {
id: back
enabled: logic.pageEnabled
}
Caption {
id: caption
text: qsTr("OpenVPN Settings")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: GC.defaultMargin - 1
ColumnLayout {
visible: !logic.isThirdPartyConfig
LabelType {
id: lb_subnet
enabled: logic.pageEnabled
height: 21
text: qsTr("VPN Addresses Subnet")
}
TextFieldType {
id: tf_subnet
enabled: logic.pageEnabled
implicitWidth: parent.width
height: 31
text: logic.lineEditSubnetText
onEditingFinished: {
logic.lineEditSubnetText = text
}
}
LabelType {
id: lb_proto
enabled: logic.pageEnabled
Layout.topMargin: 20
height: 21
text: qsTr("Network protocol")
}
Rectangle {
id: rect_proto
enabled: logic.pageEnabled
implicitWidth: root.width - 60
height: 71
border.width: 1
border.color: "lightgray"
radius: 2
RadioButtonType {
x: 10
y: 40
width: 171
height: 19
text: qsTr("TCP")
enabled: logic.radioButtonTcpEnabled
checked: logic.radioButtonTcpChecked
onCheckedChanged: {
UiLogic.radioButtonTcpChecked = checked
}
}
RadioButtonType {
x: 10
y: 10
width: 171
height: 19
text: qsTr("UDP")
checked: logic.radioButtonUdpChecked
onCheckedChanged: {
logic.radioButtonUdpChecked = checked
}
enabled: logic.radioButtonUdpEnabled
}
}
RowLayout {
enabled: logic.pageEnabled
Layout.topMargin: 10
Layout.fillWidth: true
LabelType {
id: lb_port
height: 31
text: qsTr("Port")
Layout.preferredWidth: root.width / 2 - 10
id: lb_subnet
enabled: logic.pageEnabled
height: 21
text: qsTr("VPN Addresses Subnet")
}
TextFieldType {
id: tf_port
id: tf_subnet
enabled: logic.pageEnabled
implicitWidth: parent.width
height: 31
text: logic.lineEditSubnetText
onEditingFinished: {
logic.lineEditSubnetText = text
}
}
LabelType {
id: lb_proto
enabled: logic.pageEnabled
Layout.topMargin: 20
height: 21
text: qsTr("Network protocol")
}
Rectangle {
id: rect_proto
enabled: logic.pageEnabled
implicitWidth: parent.width
height: 71
border.width: 1
border.color: "lightgray"
radius: 2
RadioButtonType {
x: 10
y: 40
width: 171
height: 19
text: qsTr("TCP")
enabled: logic.radioButtonTcpEnabled
checked: logic.radioButtonTcpChecked
onCheckedChanged: {
logic.radioButtonTcpChecked = checked
}
}
RadioButtonType {
x: 10
y: 10
width: 171
height: 19
text: qsTr("UDP")
checked: logic.radioButtonUdpChecked
onCheckedChanged: {
logic.radioButtonUdpChecked = checked
}
enabled: logic.radioButtonUdpEnabled
}
}
RowLayout {
enabled: logic.pageEnabled
Layout.topMargin: 10
Layout.fillWidth: true
LabelType {
id: lb_port
height: 31
text: qsTr("Port")
Layout.preferredWidth: root.width / 2 - 10
}
TextFieldType {
id: tf_port
Layout.fillWidth: true
height: 31
text: logic.lineEditPortText
onEditingFinished: {
logic.lineEditPortText = text
}
enabled: logic.lineEditPortEnabled
}
}
CheckBoxType {
id: check_auto_enc
enabled: logic.pageEnabled
implicitWidth: parent.width
height: 21
text: qsTr("Auto-negotiate encryption")
checked: logic.checkBoxAutoEncryptionChecked
onCheckedChanged: {
logic.checkBoxAutoEncryptionChecked = checked
}
onClicked: {
logic.checkBoxAutoEncryptionClicked()
}
}
LabelType {
id: lb_cipher
enabled: logic.pageEnabled
height: 21
text: qsTr("Cipher")
}
ComboBoxType {
id: cb_cipher
enabled: logic.pageEnabled && !check_auto_enc.checked
implicitWidth: parent.width
height: 31
text: logic.lineEditPortText
onEditingFinished: {
logic.lineEditPortText = text
}
enabled: logic.lineEditPortEnabled
}
}
CheckBoxType {
id: check_auto_enc
enabled: logic.pageEnabled
implicitWidth: parent.width
height: 21
text: qsTr("Auto-negotiate encryption")
checked: logic.checkBoxAutoEncryptionChecked
onCheckedChanged: {
logic.checkBoxAutoEncryptionChecked = checked
}
onClicked: {
logic.checkBoxAutoEncryptionClicked()
}
}
LabelType {
id: lb_cipher
enabled: logic.pageEnabled
height: 21
text: qsTr("Cipher")
}
ComboBoxType {
id: cb_cipher
enabled: logic.pageEnabled && !check_auto_enc.checked
implicitWidth: parent.width
height: 31
model: [
qsTr("AES-256-GCM"),
qsTr("AES-192-GCM"),
qsTr("AES-128-GCM"),
qsTr("AES-256-CBC"),
qsTr("AES-192-CBC"),
qsTr("AES-128-CBC"),
qsTr("ChaCha20-Poly1305"),
qsTr("ARIA-256-CBC"),
qsTr("CAMELLIA-256-CBC"),
qsTr("none")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (logic.comboBoxVpnCipherText === model[i]) {
return i
model: [
qsTr("AES-256-GCM"),
qsTr("AES-192-GCM"),
qsTr("AES-128-GCM"),
qsTr("AES-256-CBC"),
qsTr("AES-192-CBC"),
qsTr("AES-128-CBC"),
qsTr("ChaCha20-Poly1305"),
qsTr("ARIA-256-CBC"),
qsTr("CAMELLIA-256-CBC"),
qsTr("none")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (logic.comboBoxVpnCipherText === model[i]) {
return i
}
}
return -1
}
return -1
}
onCurrentTextChanged: {
logic.comboBoxVpnCipherText = currentText
}
}
LabelType {
id: lb_hash
enabled: logic.pageEnabled
height: 21
Layout.topMargin: 20
text: qsTr("Hash")
}
ComboBoxType {
id: cb_hash
enabled: logic.pageEnabled && !check_auto_enc.checked
height: 31
implicitWidth: parent.width
model: [
qsTr("SHA512"),
qsTr("SHA384"),
qsTr("SHA256"),
qsTr("SHA3-512"),
qsTr("SHA3-384"),
qsTr("SHA3-256"),
qsTr("whirlpool"),
qsTr("BLAKE2b512"),
qsTr("BLAKE2s256"),
qsTr("SHA1")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (logic.comboBoxVpnHashText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
logic.comboBoxVpnHashText = currentText
}
}
CheckBoxType {
id: check_tls
enabled: logic.pageEnabled
implicitWidth: parent.width
Layout.topMargin: 20
height: 21
text: qsTr("Enable TLS auth")
checked: logic.checkBoxTlsAuthChecked
onCheckedChanged: {
logic.checkBoxTlsAuthChecked = checked
}
}
CheckBoxType {
id: check_block_dns
enabled: logic.pageEnabled
implicitWidth: parent.width
height: 21
text: qsTr("Block DNS requests outside of VPN")
checked: logic.checkBoxBlockDnsChecked
onCheckedChanged: {
logic.checkBoxBlockDnsChecked = checked
}
}
BasicButtonType {
id: pb_client_config
enabled: logic.pageEnabled
implicitWidth: parent.width
height: 21
text: qsTr("Additional client config commands →")
background: Item {
anchors.fill: parent
}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#15CDCB";
text: pb_client_config.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
checkable: true
checked: StartPageLogic.pushButtonConnectKeyChecked
}
Rectangle {
id: rect_client_conf
enabled: logic.pageEnabled
implicitWidth: root.width - 60
height: 101
border.width: 1
border.color: "lightgray"
radius: 2
visible: pb_client_config.checked
ScrollView {
anchors.fill: parent
TextArea {
id: te_client_config
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
text: logic.textAreaAdditionalClientConfig
onEditingFinished: {
logic.textAreaAdditionalClientConfig = text
}
}
}
}
BasicButtonType {
id: pb_server_config
enabled: logic.pageEnabled
implicitWidth: parent.width
height: 21
text: qsTr("Additional server config commands →")
background: Item {
anchors.fill: parent
}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#15CDCB";
text: pb_server_config.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
checkable: true
checked: StartPageLogic.pushButtonConnectKeyChecked
}
Rectangle {
id: rect_server_conf
enabled: logic.pageEnabled
implicitWidth: root.width - 60
height: 101
border.width: 1
border.color: "lightgray"
radius: 2
visible: pb_server_config.checked
ScrollView {
anchors.fill: parent
TextArea {
id: te_server_config
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
text: logic.textAreaAdditionalServerConfig
onEditingFinished: {
logic.textAreaAdditionalServerConfig = text
}
onCurrentTextChanged: {
logic.comboBoxVpnCipherText = currentText
}
}
}
LabelType {
id: label_server_busy
enabled: logic.pageEnabled
horizontalAlignment: Text.AlignHCenter
Layout.maximumWidth: parent.width
Layout.fillWidth: true
visible: logic.labelServerBusyVisible
text: logic.labelServerBusyText
}
LabelType {
id: label_proto_openvpn_info
enabled: logic.pageEnabled
horizontalAlignment: Text.AlignHCenter
Layout.maximumWidth: parent.width
Layout.fillWidth: true
visible: logic.labelProtoOpenVpnInfoVisible
text: logic.labelProtoOpenVpnInfoText
}
Rectangle {
id: it_save
implicitWidth: parent.width
Layout.topMargin: 20
height: 40
BlueButtonType {
id: pb_save
enabled: logic.pageEnabled
z: 1
height: 40
text: qsTr("Save and restart VPN")
width: parent.width
visible: logic.pushButtonSaveVisible
onClicked: {
logic.onPushButtonSaveClicked()
}
}
BlueButtonType {
z: 1
anchors.fill: pb_save
text: qsTr("Cancel")
visible: logic.pushButtonCancelVisible
enabled: logic.pushButtonCancelVisible
onClicked: {
logic.onPushButtonCancelClicked()
}
}
ProgressBar {
id: progress_save
enabled: logic.pageEnabled
anchors.fill: pb_save
from: 0
to: logic.progressBarResetMaximium
value: logic.progressBarResetValue
visible: logic.progressBarResetVisible
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: progress_save.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
}
LabelType {
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
text: logic.progressBarText
id: lb_hash
enabled: logic.pageEnabled
height: 21
Layout.topMargin: 20
text: qsTr("Hash")
}
ComboBoxType {
id: cb_hash
enabled: logic.pageEnabled && !check_auto_enc.checked
height: 31
implicitWidth: parent.width
model: [
qsTr("SHA512"),
qsTr("SHA384"),
qsTr("SHA256"),
qsTr("SHA3-512"),
qsTr("SHA3-384"),
qsTr("SHA3-256"),
qsTr("whirlpool"),
qsTr("BLAKE2b512"),
qsTr("BLAKE2s256"),
qsTr("SHA1")
]
currentIndex: {
for (let i = 0; i < model.length; ++i) {
if (logic.comboBoxVpnHashText === model[i]) {
return i
}
}
return -1
}
onCurrentTextChanged: {
logic.comboBoxVpnHashText = currentText
}
}
CheckBoxType {
id: check_tls
enabled: logic.pageEnabled
implicitWidth: parent.width
Layout.topMargin: 20
height: 21
text: qsTr("Enable TLS auth")
checked: logic.checkBoxTlsAuthChecked
onCheckedChanged: {
logic.checkBoxTlsAuthChecked = checked
}
}
CheckBoxType {
id: check_block_dns
enabled: logic.pageEnabled
implicitWidth: parent.width
height: 21
text: qsTr("Block DNS requests outside of VPN")
checked: logic.checkBoxBlockDnsChecked
onCheckedChanged: {
logic.checkBoxBlockDnsChecked = checked
}
}
BasicButtonType {
id: pb_client_config
enabled: logic.pageEnabled
implicitWidth: parent.width
height: 21
text: qsTr("Additional client config commands →")
background: Item {
anchors.fill: parent
}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#15CDCB";
text: pb_client_config.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
checkable: true
checked: StartPageLogic.pushButtonConnectKeyChecked
}
Rectangle {
id: rect_client_conf
enabled: logic.pageEnabled
implicitWidth: root.width - 60
height: 101
border.width: 1
border.color: "lightgray"
radius: 2
visible: pb_client_config.checked
ScrollView {
anchors.fill: parent
TextArea {
id: te_client_config
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
text: logic.textAreaAdditionalClientConfig
onEditingFinished: {
logic.textAreaAdditionalClientConfig = text
}
}
}
}
BasicButtonType {
id: pb_server_config
enabled: logic.pageEnabled
implicitWidth: parent.width
height: 21
text: qsTr("Additional server config commands →")
background: Item {
anchors.fill: parent
}
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#15CDCB";
text: pb_server_config.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
checkable: true
checked: StartPageLogic.pushButtonConnectKeyChecked
}
Rectangle {
id: rect_server_conf
enabled: logic.pageEnabled
implicitWidth: root.width - 60
height: 101
border.width: 1
border.color: "lightgray"
radius: 2
visible: pb_server_config.checked
ScrollView {
anchors.fill: parent
TextArea {
id: te_server_config
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
text: logic.textAreaAdditionalServerConfig
onEditingFinished: {
logic.textAreaAdditionalServerConfig = text
}
}
}
}
LabelType {
id: label_server_busy
enabled: logic.pageEnabled
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#D4D4D4"
visible: logic.progressBarTextVisible
Layout.maximumWidth: parent.width
Layout.fillWidth: true
visible: logic.labelServerBusyVisible
text: logic.labelServerBusyText
}
LabelType {
id: label_proto_openvpn_info
enabled: logic.pageEnabled
horizontalAlignment: Text.AlignHCenter
Layout.maximumWidth: parent.width
Layout.fillWidth: true
height: 41
visible: logic.labelProtoOpenVpnInfoVisible
text: logic.labelProtoOpenVpnInfoText
}
Rectangle {
id: it_save
implicitWidth: parent.width
Layout.topMargin: 20
height: 40
BlueButtonType {
id: pb_save
enabled: logic.pageEnabled
z: 1
height: 40
text: qsTr("Save and restart VPN")
width: parent.width
visible: logic.pushButtonSaveVisible
onClicked: {
logic.onPushButtonSaveClicked()
}
}
BlueButtonType {
z: 1
anchors.fill: pb_save
text: qsTr("Cancel")
visible: logic.pushButtonCancelVisible
enabled: logic.pushButtonCancelVisible
onClicked: {
logic.onPushButtonCancelClicked()
}
}
ProgressBar {
id: progress_save
anchors.fill: pb_save
from: 0
to: logic.progressBarResetMaximium
value: logic.progressBarResetValue
visible: logic.progressBarResetVisible
background: Rectangle {
implicitWidth: parent.width
implicitHeight: parent.height
color: "#100A44"
radius: 4
}
contentItem: Item {
implicitWidth: parent.width
implicitHeight: parent.height
Rectangle {
width: progress_save.visualPosition * parent.width
height: parent.height
radius: 4
color: Qt.rgba(255, 255, 255, 0.15);
}
}
}
LabelType {
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
text: logic.progressBarText
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#D4D4D4"
visible: logic.progressBarTextVisible
}
}
}
ColumnLayout {
visible: logic.isThirdPartyConfig
TextAreaType {
id: ta_config
Layout.topMargin: 5
Layout.bottomMargin: 20
Layout.fillWidth: true
Layout.leftMargin: 1
Layout.rightMargin: 1
Layout.preferredHeight: fl.height - 70
flickableDirection: Flickable.AutoFlickIfNeeded
textArea.readOnly: true
textArea.text: logic.openVpnLastConfigText
}
}
}

View file

@ -0,0 +1,60 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.15
import ProtocolEnum 1.0
import "../"
import "../../Controls"
import "../../Config"
PageProtocolBase {
id: root
protocol: ProtocolEnum.WireGuard
logic: UiLogic.protocolLogic(protocol)
BackButton {
id: back
}
Caption {
id: caption
text: qsTr("WireGuard Settings")
}
Flickable {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: parent.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
TextAreaType {
id: ta_config
Layout.topMargin: 5
Layout.bottomMargin: 20
Layout.fillWidth: true
Layout.leftMargin: 1
Layout.rightMargin: 1
Layout.preferredHeight: fl.height - 70
flickableDirection: Flickable.AutoFlickIfNeeded
textArea.readOnly: true
textArea.text: logic.wireGuardLastConfigText
}
}
}
}

View file

@ -18,20 +18,10 @@ PageShareProtocolBase {
text: qsTr("Share for Amnezia")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height + 20
clip: true
Behavior on contentY{
NumberAnimation {
@ -46,6 +36,7 @@ PageShareProtocolBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
Text {
id: lb_desc

View file

@ -18,20 +18,10 @@ PageShareProtocolBase {
text: qsTr("Share Cloak Settings")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -39,7 +29,7 @@ PageShareProtocolBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
LabelType {
id: lb_desc

View file

@ -42,20 +42,10 @@ PageShareProtocolBase {
visible: false
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -63,6 +53,7 @@ PageShareProtocolBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
// LabelType {
// id: lb_desc

View file

@ -18,20 +18,10 @@ PageShareProtocolBase {
text: qsTr("Share OpenVPN Settings")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -39,7 +29,7 @@ PageShareProtocolBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
LabelType {
id: lb_desc

View file

@ -18,20 +18,10 @@ PageShareProtocolBase {
text: qsTr("Share ShadowSocks Settings")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -39,6 +29,7 @@ PageShareProtocolBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
LabelType {
id: lb_desc

View file

@ -18,20 +18,10 @@ PageShareProtocolBase {
text: qsTr("Share WireGuard Settings")
}
Flickable {
FlickableType {
id: fl
width: root.width
anchors.top: caption.bottom
anchors.topMargin: 20
anchors.bottom: root.bottom
anchors.bottomMargin: 20
anchors.left: root.left
anchors.leftMargin: 30
anchors.right: root.right
anchors.rightMargin: 30
contentHeight: content.height
clip: true
ColumnLayout {
id: content
@ -39,6 +29,7 @@ PageShareProtocolBase {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 15
LabelType {
id: lb_desc

View file

@ -8,7 +8,6 @@ import Qt.labs.platform
import Qt.labs.folderlistmodel
import QtQuick.Dialogs
import QtQuick.Controls.Basic
import "./"
import "Controls"
import "Pages"
import "Pages/Protocols"
@ -23,10 +22,10 @@ Window {
id: root
visible: true
width: GC.screenWidth
height: GC.isDesktop() ? GC.screenHeight + titleBar.height : GC.screenHeight
minimumWidth: 360
height: GC.screenHeight
minimumWidth: GC.isDesktop() ? 360 : 0
minimumHeight: GC.isDesktop() ? 640 : 0
onClosing: {
onClosing: function() {
console.debug("QML onClosing signal")
UiLogic.onCloseWindow()
}
@ -85,29 +84,6 @@ Window {
}
}
TitleBar {
id: titleBar
anchors.top: root.top
visible: GC.isDesktop()
DragHandler {
grabPermissions: TapHandler.CanTakeOverFromAnything
onActiveChanged: {
if (active) {
root.startSystemMove();
}
}
target: null
}
onCloseButtonClicked: {
if (UiLogic.currentPageValue === PageEnum.Start ||
UiLogic.currentPageValue === PageEnum.NewServer) {
Qt.quit()
} else {
root.hide()
}
}
}
Rectangle {
y: GC.isDesktop() ? titleBar.height : 0
anchors.fill: parent
@ -120,16 +96,15 @@ Window {
anchors.fill: parent
focus: true
onCurrentItemChanged: {
//console.debug("QML onCurrentItemChanged " + pageLoader.currentItem)
onCurrentItemChanged: function() {
UiLogic.currentPageValue = currentItem.page
}
onDepthChanged: {
onDepthChanged: function() {
UiLogic.pagesStackDepth = depth
}
Keys.onPressed: {
Keys.onPressed: function(event) {
UiLogic.keyPressEvent(event.key)
event.accepted = true
}

View file

@ -72,7 +72,7 @@
#include "pages_logic/protocols/OpenVpnLogic.h"
#include "pages_logic/protocols/ShadowSocksLogic.h"
#include "pages_logic/protocols/OtherProtocolsLogic.h"
#include "pages_logic/protocols/WireGuardLogic.h"
using namespace amnezia;
using namespace PageEnumNS;
@ -95,7 +95,7 @@ UiLogic::UiLogic(std::shared_ptr<Settings> settings, std::shared_ptr<VpnConfigur
m_protocolLogicMap.insert(Proto::OpenVpn, new OpenVpnLogic(this));
m_protocolLogicMap.insert(Proto::ShadowSocks, new ShadowSocksLogic(this));
m_protocolLogicMap.insert(Proto::Cloak, new CloakLogic(this));
//m_protocolLogicMap->insert(Proto::WireGuard, new WireguardLogic(this));
m_protocolLogicMap.insert(Proto::WireGuard, new WireGuardLogic(this));
m_protocolLogicMap.insert(Proto::Dns, new OtherProtocolsLogic(this));
m_protocolLogicMap.insert(Proto::Sftp, new OtherProtocolsLogic(this));

View file

@ -38,9 +38,9 @@ DMG_FILENAME=$PROJECT_DIR/${APP_NAME}.dmg
# Seacrh Qt
if [ -z "${QT_VERSION+x}" ]; then
QT_VERSION=5.15.2;
QT_VERSION=6.4.1;
QIF_VERSION=4.1
QT_BIN_DIR=$HOME/Qt/$QT_VERSION/clang_64/bin
QT_BIN_DIR=$HOME/Qt/$QT_VERSION/macos/bin
QIF_BIN_DIR=$QT_BIN_DIR/../../../Tools/QtInstallerFramework/$QIF_VERSION/bin
fi
@ -58,9 +58,7 @@ echo "Building App..."
cd $BUILD_DIR
$QT_BIN_DIR/qt-cmake -S $PROJECT_DIR -B $BUILD_DIR
cmake --build . --config release
# $QT_BIN_DIR/qmake $PROJECT_DIR/AmneziaVPN.pro 'CONFIG+=release CONFIG+=x86_64'
# make -j `sysctl -n hw.ncpu`
cmake --build . --config release --target all
# Build and run tests here
@ -74,7 +72,7 @@ echo "Packaging ..."
#cd $DEPLOY_DIR
$QT_BIN_DIR/macdeployqt $OUT_APP_DIR/$APP_FILENAME -always-overwrite -qmldir=$PROJECT_DIR
cp -av $BUILD_DIR/service/server/$APP_NAME-service.app/Contents/macOS/$APP_NAME-service $BUNDLE_DIR/Contents/macOS
cp -av $BUILD_DIR/service/server/$APP_NAME-service $BUNDLE_DIR/Contents/macOS
cp -Rv $PROJECT_DIR/deploy/data/macos/* $BUNDLE_DIR/Contents/macOS
rm -f $BUNDLE_DIR/Contents/macOS/post_install.sh $BUNDLE_DIR/Contents/macOS/post_uninstall.sh