Share WireGuard page
Share IKEv2 page
This commit is contained in:
parent
c6efc5b212
commit
25428c9165
28 changed files with 907 additions and 238 deletions
|
|
@ -24,7 +24,7 @@ enum class Page {Start = 0, NewServer, NewServerProtocols, Vpn,
|
|||
Wizard, WizardLow, WizardMedium, WizardHigh, WizardVpnMode, ServerConfiguringProgress,
|
||||
GeneralSettings, AppSettings, NetworkSettings, ServerSettings,
|
||||
ServerContainers, ServersList, ShareConnection, Sites,
|
||||
ProtocolSettings};
|
||||
ProtocolSettings, ProtocolShare};
|
||||
Q_ENUM_NS(Page)
|
||||
|
||||
static void declareQmlPageEnum() {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,6 @@ void GeneralSettingsLogic::onPushButtonGeneralSettingsShareConnectionClicked()
|
|||
qobject_cast<ProtocolsModel *>(uiLogic()->protocolsModel())->setSelectedServerIndex(uiLogic()->selectedServerIndex);
|
||||
qobject_cast<ProtocolsModel *>(uiLogic()->protocolsModel())->setSelectedDockerContainer(uiLogic()->selectedDockerContainer);
|
||||
|
||||
uiLogic()->shareConnectionLogic()->updateSharingPage(uiLogic()->selectedServerIndex, m_settings.serverCredentials(uiLogic()->selectedServerIndex), uiLogic()->selectedDockerContainer);
|
||||
uiLogic()->shareConnectionLogic()->updateSharingPage(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer);
|
||||
emit uiLogic()->goToPage(Page::ShareConnection);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void ServerContainersLogic::onPushButtonDefaultClicked(DockerContainer c)
|
|||
|
||||
void ServerContainersLogic::onPushButtonShareClicked(DockerContainer c)
|
||||
{
|
||||
uiLogic()->shareConnectionLogic()->updateSharingPage(uiLogic()->selectedServerIndex, m_settings.serverCredentials(uiLogic()->selectedServerIndex), c);
|
||||
uiLogic()->shareConnectionLogic()->updateSharingPage(uiLogic()->selectedServerIndex, c);
|
||||
emit uiLogic()->goToPage(Page::ShareConnection);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,6 @@ void ServerSettingsLogic::onLineEditDescriptionEditingFinished()
|
|||
|
||||
void ServerSettingsLogic::onPushButtonShareFullClicked()
|
||||
{
|
||||
uiLogic()->shareConnectionLogic()->updateSharingPage(uiLogic()->selectedServerIndex, m_settings.serverCredentials(uiLogic()->selectedServerIndex), DockerContainer::None);
|
||||
uiLogic()->shareConnectionLogic()->updateSharingPage(uiLogic()->selectedServerIndex, DockerContainer::None);
|
||||
emit uiLogic()->goToShareProtocolPage(Protocol::Any);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
#include "configurators/vpn_configurator.h"
|
||||
#include "configurators/openvpn_configurator.h"
|
||||
#include "configurators/shadowsocks_configurator.h"
|
||||
#include "configurators/wireguard_configurator.h"
|
||||
#include "configurators/ikev2_configurator.h"
|
||||
#include "configurators/ssh_configurator.h"
|
||||
|
||||
#include "defines.h"
|
||||
|
|
@ -25,20 +27,30 @@ ShareConnectionLogic::ShareConnectionLogic(UiLogic *logic, QObject *parent):
|
|||
m_textEditShareOpenVpnCodeText{},
|
||||
m_lineEditShareShadowSocksStringText{},
|
||||
m_shareShadowSocksQrCodeText{},
|
||||
m_labelShareShadowSocksServerText{},
|
||||
m_labelShareShadowSocksPortText{},
|
||||
m_labelShareShadowSocksMethodText{},
|
||||
m_labelShareShadowSocksPasswordText{},
|
||||
m_textEditShareCloakText{},
|
||||
m_textEditShareAmneziaCodeText{},
|
||||
m_pushButtonShareOpenVpnGenerateText{tr("Generate config")}
|
||||
m_textEditShareAmneziaCodeText{}
|
||||
{
|
||||
// TODO consider move to Component.onCompleted
|
||||
//updateSharingPage(uiLogic()->selectedServerIndex, m_settings.serverCredentials(uiLogic()->selectedServerIndex), uiLogic()->selectedDockerContainer);
|
||||
}
|
||||
|
||||
void ShareConnectionLogic::onUpdatePage()
|
||||
{
|
||||
set_textEditShareAmneziaCodeText(tr(""));
|
||||
set_shareAmneziaQrCodeText("");
|
||||
|
||||
set_textEditShareOpenVpnCodeText("");
|
||||
|
||||
set_shareShadowSocksQrCodeText("");
|
||||
set_textEditShareShadowSocksText("");
|
||||
set_lineEditShareShadowSocksStringText("");
|
||||
|
||||
set_textEditShareCloakText("");
|
||||
|
||||
set_textEditShareWireGuardCodeText("");
|
||||
set_shareWireGuardQrCodeText("");
|
||||
|
||||
set_textEditShareIkev2CertText("");
|
||||
set_textEditShareIkev2MobileConfigText("");
|
||||
set_textEditShareIkev2StrongSwanConfigText("");
|
||||
}
|
||||
|
||||
void ShareConnectionLogic::onPushButtonShareAmneziaGenerateClicked()
|
||||
|
|
@ -90,7 +102,7 @@ void ShareConnectionLogic::onPushButtonShareAmneziaGenerateClicked()
|
|||
QString code = QString("vpn://%1").arg(QString(ba.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals)));
|
||||
set_textEditShareAmneziaCodeText(code);
|
||||
|
||||
if (ba.size() < 1024) {
|
||||
if (ba.size() < 2900) {
|
||||
QImage qr = updateQRCodeImage(ba.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals));
|
||||
set_shareAmneziaQrCodeText(imageToBase64(qr));
|
||||
}
|
||||
|
|
@ -98,86 +110,130 @@ void ShareConnectionLogic::onPushButtonShareAmneziaGenerateClicked()
|
|||
|
||||
void ShareConnectionLogic::onPushButtonShareOpenVpnGenerateClicked()
|
||||
{
|
||||
set_pushButtonShareOpenVpnGenerateText(tr("Generating..."));
|
||||
|
||||
ServerCredentials credentials = m_settings.serverCredentials(uiLogic()->selectedServerIndex);
|
||||
const QJsonObject &containerConfig = m_settings.containerConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer);
|
||||
|
||||
ErrorCode e = ErrorCode::NoError;
|
||||
QString cfg = OpenVpnConfigurator::genOpenVpnConfig(credentials, uiLogic()->selectedDockerContainer, containerConfig, &e);
|
||||
cfg = OpenVpnConfigurator::processConfigWithExportSettings(cfg);
|
||||
cfg = VpnConfigurator::processConfigWithExportSettings(uiLogic()->selectedDockerContainer, Protocol::OpenVpn, cfg);
|
||||
|
||||
set_textEditShareOpenVpnCodeText(QJsonDocument::fromJson(cfg.toUtf8()).object()[config_key::config].toString());
|
||||
|
||||
set_pushButtonShareOpenVpnGenerateText(tr("Generate config"));
|
||||
}
|
||||
|
||||
void ShareConnectionLogic::updateSharingPage(int serverIndex, const ServerCredentials &credentials,
|
||||
DockerContainer container)
|
||||
void ShareConnectionLogic::onPushButtonShareShadowSocksGenerateClicked()
|
||||
{
|
||||
int serverIndex = uiLogic()->selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->selectedDockerContainer;
|
||||
ServerCredentials credentials = m_settings.serverCredentials(serverIndex);
|
||||
|
||||
QJsonObject protoConfig = m_settings.protocolConfig(serverIndex, container, Protocol::ShadowSocks);
|
||||
QString cfg = protoConfig.value(config_key::last_config).toString();
|
||||
|
||||
if (cfg.isEmpty()) {
|
||||
const QJsonObject &containerConfig = m_settings.containerConfig(serverIndex, container);
|
||||
|
||||
ErrorCode e = ErrorCode::NoError;
|
||||
cfg = ShadowSocksConfigurator::genShadowSocksConfig(credentials, container, containerConfig, &e);
|
||||
}
|
||||
|
||||
QJsonObject ssConfig = QJsonDocument::fromJson(cfg.toUtf8()).object();
|
||||
|
||||
QString ssString = QString("%1:%2@%3:%4")
|
||||
.arg(ssConfig.value("method").toString())
|
||||
.arg(ssConfig.value("password").toString())
|
||||
.arg(ssConfig.value("server").toString())
|
||||
.arg(ssConfig.value("server_port").toString());
|
||||
|
||||
ssString = "ss://" + ssString.toUtf8().toBase64();
|
||||
set_lineEditShareShadowSocksStringText(ssString);
|
||||
|
||||
QImage qr = updateQRCodeImage(ssString.toUtf8());
|
||||
set_shareShadowSocksQrCodeText(imageToBase64(qr));
|
||||
|
||||
QString humanString = QString("Server: %3\n"
|
||||
"Port: %4\n"
|
||||
"Encryption: %1\n"
|
||||
"Password: %2")
|
||||
.arg(ssConfig.value("method").toString())
|
||||
.arg(ssConfig.value("password").toString())
|
||||
.arg(ssConfig.value("server").toString())
|
||||
.arg(ssConfig.value("server_port").toString());
|
||||
|
||||
set_textEditShareShadowSocksText(humanString);
|
||||
}
|
||||
|
||||
void ShareConnectionLogic::onPushButtonShareCloakGenerateClicked()
|
||||
{
|
||||
int serverIndex = uiLogic()->selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->selectedDockerContainer;
|
||||
ServerCredentials credentials = m_settings.serverCredentials(serverIndex);
|
||||
|
||||
QJsonObject protoConfig = m_settings.protocolConfig(serverIndex, container, Protocol::Cloak);
|
||||
QString cfg = protoConfig.value(config_key::last_config).toString();
|
||||
|
||||
if (cfg.isEmpty()) {
|
||||
const QJsonObject &containerConfig = m_settings.containerConfig(serverIndex, container);
|
||||
|
||||
ErrorCode e = ErrorCode::NoError;
|
||||
cfg = CloakConfigurator::genCloakConfig(credentials, container, containerConfig, &e);
|
||||
}
|
||||
|
||||
QJsonObject cloakConfig = QJsonDocument::fromJson(cfg.toUtf8()).object();
|
||||
cloakConfig.remove(config_key::transport_proto);
|
||||
cloakConfig.insert("ProxyMethod", "shadowsocks");
|
||||
|
||||
set_textEditShareCloakText(QJsonDocument(cloakConfig).toJson());
|
||||
}
|
||||
|
||||
void ShareConnectionLogic::onPushButtonShareWireGuardGenerateClicked()
|
||||
{
|
||||
int serverIndex = uiLogic()->selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->selectedDockerContainer;
|
||||
ServerCredentials credentials = m_settings.serverCredentials(serverIndex);
|
||||
|
||||
const QJsonObject &containerConfig = m_settings.containerConfig(serverIndex, container);
|
||||
|
||||
ErrorCode e = ErrorCode::NoError;
|
||||
QString cfg = WireguardConfigurator::genWireguardConfig(credentials, container, containerConfig, &e);
|
||||
cfg = VpnConfigurator::processConfigWithExportSettings(container, Protocol::WireGuard, cfg);
|
||||
cfg = QJsonDocument::fromJson(cfg.toUtf8()).object()[config_key::config].toString();
|
||||
|
||||
set_textEditShareWireGuardCodeText(cfg);
|
||||
|
||||
QImage qr = updateQRCodeImage(cfg.toUtf8());
|
||||
set_shareWireGuardQrCodeText(imageToBase64(qr));
|
||||
}
|
||||
|
||||
void ShareConnectionLogic::onPushButtonShareIkev2GenerateClicked()
|
||||
{
|
||||
int serverIndex = uiLogic()->selectedServerIndex;
|
||||
DockerContainer container = uiLogic()->selectedDockerContainer;
|
||||
ServerCredentials credentials = m_settings.serverCredentials(serverIndex);
|
||||
|
||||
//const QJsonObject &containerConfig = m_settings.containerConfig(serverIndex, container);
|
||||
|
||||
Ikev2Configurator::ConnectionData connData = Ikev2Configurator::prepareIkev2Config(credentials, container);
|
||||
|
||||
QString cfg = Ikev2Configurator::genIkev2Config(connData);
|
||||
cfg = VpnConfigurator::processConfigWithExportSettings(container, Protocol::Ikev2, cfg);
|
||||
cfg = QJsonDocument::fromJson(cfg.toUtf8()).object()[config_key::cert].toString();
|
||||
|
||||
set_textEditShareIkev2CertText(cfg);
|
||||
|
||||
QString mobileCfg = Ikev2Configurator::genMobileConfig(connData);
|
||||
set_textEditShareIkev2MobileConfigText(mobileCfg);
|
||||
|
||||
QString strongSwanCfg = Ikev2Configurator::genStrongSwanConfig(connData);
|
||||
set_textEditShareIkev2StrongSwanConfigText(strongSwanCfg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ShareConnectionLogic::updateSharingPage(int serverIndex, DockerContainer container)
|
||||
{
|
||||
uiLogic()->selectedDockerContainer = container;
|
||||
uiLogic()->selectedServerIndex = serverIndex;
|
||||
set_shareFullAccess(container == DockerContainer::None);
|
||||
|
||||
if (! shareFullAccess()) {
|
||||
for (Protocol p : ContainerProps::protocolsForContainer(container)) {
|
||||
if (p == Protocol::ShadowSocks) {
|
||||
QJsonObject protoConfig = m_settings.protocolConfig(serverIndex, container, Protocol::ShadowSocks);
|
||||
QString cfg = protoConfig.value(config_key::last_config).toString();
|
||||
|
||||
if (cfg.isEmpty()) {
|
||||
const QJsonObject &containerConfig = m_settings.containerConfig(serverIndex, container);
|
||||
|
||||
ErrorCode e = ErrorCode::NoError;
|
||||
cfg = ShadowSocksConfigurator::genShadowSocksConfig(credentials, container, containerConfig, &e);
|
||||
}
|
||||
|
||||
QJsonObject ssConfig = QJsonDocument::fromJson(cfg.toUtf8()).object();
|
||||
|
||||
QString ssString = QString("%1:%2@%3:%4")
|
||||
.arg(ssConfig.value("method").toString())
|
||||
.arg(ssConfig.value("password").toString())
|
||||
.arg(ssConfig.value("server").toString())
|
||||
.arg(ssConfig.value("server_port").toString());
|
||||
|
||||
ssString = "ss://" + ssString.toUtf8().toBase64();
|
||||
set_lineEditShareShadowSocksStringText(ssString);
|
||||
|
||||
QImage qr = updateQRCodeImage(ssString.toUtf8());
|
||||
set_shareShadowSocksQrCodeText(imageToBase64(qr));
|
||||
|
||||
set_labelShareShadowSocksServerText(ssConfig.value("server").toString());
|
||||
set_labelShareShadowSocksPortText(ssConfig.value("server_port").toString());
|
||||
set_labelShareShadowSocksMethodText(ssConfig.value("method").toString());
|
||||
set_labelShareShadowSocksPasswordText(ssConfig.value("password").toString());
|
||||
|
||||
}
|
||||
else if (p == Protocol::Cloak) {
|
||||
set_textEditShareCloakText(QString(""));
|
||||
|
||||
QJsonObject protoConfig = m_settings.protocolConfig(serverIndex, container, Protocol::Cloak);
|
||||
QString cfg = protoConfig.value(config_key::last_config).toString();
|
||||
|
||||
if (cfg.isEmpty()) {
|
||||
const QJsonObject &containerConfig = m_settings.containerConfig(serverIndex, container);
|
||||
|
||||
ErrorCode e = ErrorCode::NoError;
|
||||
cfg = CloakConfigurator::genCloakConfig(credentials, container, containerConfig, &e);
|
||||
|
||||
//set_pushButtonShareCloakCopyEnabled(true);
|
||||
}
|
||||
|
||||
QJsonObject cloakConfig = QJsonDocument::fromJson(cfg.toUtf8()).object();
|
||||
cloakConfig.remove(config_key::transport_proto);
|
||||
cloakConfig.insert("ProxyMethod", "shadowsocks");
|
||||
|
||||
set_textEditShareCloakText(QJsonDocument(cloakConfig).toJson());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
set_textEditShareAmneziaCodeText(tr(""));
|
||||
}
|
||||
|
||||
QImage ShareConnectionLogic::updateQRCodeImage(const QByteArray &data)
|
||||
|
|
|
|||
|
|
@ -17,20 +17,27 @@ public:
|
|||
AUTO_PROPERTY(QString, shareAmneziaQrCodeText)
|
||||
|
||||
AUTO_PROPERTY(QString, textEditShareOpenVpnCodeText)
|
||||
AUTO_PROPERTY(QString, pushButtonShareOpenVpnGenerateText)
|
||||
|
||||
AUTO_PROPERTY(QString, textEditShareShadowSocksText)
|
||||
AUTO_PROPERTY(QString, lineEditShareShadowSocksStringText)
|
||||
AUTO_PROPERTY(QString, shareShadowSocksQrCodeText)
|
||||
AUTO_PROPERTY(QString, labelShareShadowSocksServerText)
|
||||
AUTO_PROPERTY(QString, labelShareShadowSocksPortText)
|
||||
AUTO_PROPERTY(QString, labelShareShadowSocksMethodText)
|
||||
AUTO_PROPERTY(QString, labelShareShadowSocksPasswordText)
|
||||
|
||||
AUTO_PROPERTY(QString, textEditShareCloakText)
|
||||
|
||||
AUTO_PROPERTY(QString, textEditShareWireGuardCodeText)
|
||||
AUTO_PROPERTY(QString, shareWireGuardQrCodeText)
|
||||
|
||||
AUTO_PROPERTY(QString, textEditShareIkev2CertText)
|
||||
AUTO_PROPERTY(QString, textEditShareIkev2MobileConfigText)
|
||||
AUTO_PROPERTY(QString, textEditShareIkev2StrongSwanConfigText)
|
||||
|
||||
public:
|
||||
Q_INVOKABLE void onPushButtonShareAmneziaGenerateClicked();
|
||||
Q_INVOKABLE void onPushButtonShareOpenVpnGenerateClicked();
|
||||
Q_INVOKABLE void onPushButtonShareShadowSocksGenerateClicked();
|
||||
Q_INVOKABLE void onPushButtonShareCloakGenerateClicked();
|
||||
Q_INVOKABLE void onPushButtonShareWireGuardGenerateClicked();
|
||||
Q_INVOKABLE void onPushButtonShareIkev2GenerateClicked();
|
||||
|
||||
Q_INVOKABLE virtual void onUpdatePage() override;
|
||||
|
||||
|
|
@ -38,8 +45,7 @@ public:
|
|||
explicit ShareConnectionLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
~ShareConnectionLogic() = default;
|
||||
|
||||
void updateSharingPage(int serverIndex, const ServerCredentials &credentials,
|
||||
DockerContainer container);
|
||||
void updateSharingPage(int serverIndex, DockerContainer container);
|
||||
QImage updateQRCodeImage(const QByteArray &data);
|
||||
QString imageToBase64(const QImage &image);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,13 @@ import QtQuick 2.12
|
|||
import QtQuick.Controls 2.12
|
||||
|
||||
ShareConnectionButtonType {
|
||||
readonly property string start_text: qsTr("Copy")
|
||||
readonly property string end_text: qsTr("Copied")
|
||||
property string start_text: qsTr("Copy")
|
||||
property string end_text: qsTr("Copied")
|
||||
|
||||
property string copyText
|
||||
|
||||
enabled: copyText.length > 0
|
||||
visible: copyText.length > 0
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
|
|
@ -16,5 +21,6 @@ ShareConnectionButtonType {
|
|||
onClicked: {
|
||||
text = end_text
|
||||
timer.running = true
|
||||
UiLogic.copyToClipboard(copyText)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import QtQuick 2.12
|
|||
import QtQuick.Controls 2.12
|
||||
import Qt.labs.platform 1.0
|
||||
|
||||
import "../Config"
|
||||
|
||||
Flickable
|
||||
{
|
||||
property alias textArea: root
|
||||
|
|
@ -44,6 +46,18 @@ Flickable
|
|||
return "#A7A7A7"
|
||||
}
|
||||
}
|
||||
|
||||
// MouseArea {
|
||||
// anchors.fill: root
|
||||
// enabled: GC.isDesktop()
|
||||
// acceptedButtons: Qt.RightButton
|
||||
// onClicked: contextMenu.open()
|
||||
// }
|
||||
|
||||
// ContextMenu {
|
||||
// id: contextMenu
|
||||
// textObj: root
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,6 @@ PageBase {
|
|||
height: 40
|
||||
width: tb_c.width - 10
|
||||
onClicked: UiLogic.onGotoShareProtocolPage(proxyProtocolsModel.mapToSource(index))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,6 @@ import "../../Config"
|
|||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.Any
|
||||
logic: ShareConnectionLogic
|
||||
|
||||
readonly property string generateConfigText: qsTr("Generate config")
|
||||
readonly property string generatingConfigText: qsTr("Generating config...")
|
||||
readonly property string showConfigText: qsTr("Show config")
|
||||
property bool genConfigProcess: false
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
|
|
@ -66,7 +60,6 @@ New encryption keys pair will be generated.")
|
|||
}
|
||||
|
||||
ShareConnectionButtonType {
|
||||
id: pb_gen
|
||||
Layout.topMargin: 20
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
|
|
@ -102,15 +95,12 @@ New encryption keys pair will be generated.")
|
|||
|
||||
|
||||
ShareConnectionButtonCopyType {
|
||||
id: pb_copy
|
||||
Layout.bottomMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
enabled: tfShareCode.textArea.length > 0
|
||||
visible: tfShareCode.textArea.length > 0
|
||||
copyText: tfShareCode.textArea.text
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
id: pb_save
|
||||
Layout.bottomMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
|
|
@ -135,7 +125,7 @@ New encryption keys pair will be generated.")
|
|||
|
||||
LabelType {
|
||||
height: 20
|
||||
text: qsTr("Config to long to be displayed as QR code")
|
||||
text: qsTr("Config too long to be displayed as QR code")
|
||||
visible: ShareConnectionLogic.shareAmneziaQrCodeText.length == 0 && tfShareCode.textArea.length > 0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import "../../Config"
|
|||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.Cloak
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
|
|
@ -19,25 +18,93 @@ PageShareProtocolBase {
|
|||
text: qsTr("Share Cloak Settings")
|
||||
}
|
||||
|
||||
|
||||
TextAreaType {
|
||||
Flickable {
|
||||
id: fl
|
||||
width: root.width
|
||||
anchors.top: caption.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.bottom: pb_save.top
|
||||
anchors.bottomMargin: 20
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
|
||||
textArea.readOnly: true
|
||||
textArea.text: ShareConnectionLogic.textEditShareCloakText
|
||||
}
|
||||
|
||||
ShareConnectionButtonCopyType {
|
||||
id: pb_save
|
||||
anchors.bottom: root.bottom
|
||||
anchors.bottomMargin: 10
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
//enabled: ShareConnectionLogic.pushButtonShareCloakCopyEnabled
|
||||
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
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: content.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
|
||||
LabelType {
|
||||
id: lb_desc
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 10
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
wrapMode: Text.Wrap
|
||||
text: qsTr("Note: Cloak protocol using same password for all connections")
|
||||
}
|
||||
|
||||
ShareConnectionButtonType {
|
||||
Layout.topMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
|
||||
text: genConfigProcess ? generatingConfigText : generateConfigText
|
||||
onClicked: {
|
||||
enabled = false
|
||||
genConfigProcess = true
|
||||
ShareConnectionLogic.onPushButtonShareCloakGenerateClicked()
|
||||
enabled = true
|
||||
genConfigProcess = false
|
||||
}
|
||||
}
|
||||
|
||||
TextAreaType {
|
||||
id: tfShareCode
|
||||
|
||||
Layout.topMargin: 20
|
||||
Layout.bottomMargin: 20
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 200
|
||||
|
||||
textArea.readOnly: true
|
||||
textArea.text: ShareConnectionLogic.textEditShareCloakText
|
||||
|
||||
visible: tfShareCode.textArea.length > 0
|
||||
}
|
||||
|
||||
ShareConnectionButtonCopyType {
|
||||
Layout.bottomMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
|
||||
copyText: tfShareCode.textArea.text
|
||||
}
|
||||
|
||||
ShareConnectionButtonType {
|
||||
Layout.bottomMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
|
||||
text: qsTr("Save to file")
|
||||
enabled: tfShareCode.textArea.length > 0
|
||||
visible: tfShareCode.textArea.length > 0
|
||||
|
||||
onClicked: {
|
||||
UiLogic.saveTextFile(qsTr("Save AmneziaVPN config"), "*.json", tfShareCode.textArea.text)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
141
client/ui/qml/Pages/Share/PageShareProtoIkev2.qml
Normal file
141
client/ui/qml/Pages/Share/PageShareProtoIkev2.qml
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.15
|
||||
import ProtocolEnum 1.0
|
||||
import "../"
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.Ikev2
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
}
|
||||
Caption {
|
||||
id: caption
|
||||
text: qsTr("Share IKEv2 Settings")
|
||||
}
|
||||
|
||||
TextAreaType {
|
||||
id: tfCert
|
||||
textArea.readOnly: true
|
||||
textArea.text: ShareConnectionLogic.textEditShareIkev2CertText
|
||||
|
||||
visible: false
|
||||
}
|
||||
|
||||
TextAreaType {
|
||||
id: tfMobileConfig
|
||||
textArea.readOnly: true
|
||||
textArea.text: ShareConnectionLogic.textEditShareIkev2MobileConfigText
|
||||
|
||||
visible: false
|
||||
}
|
||||
|
||||
TextAreaType {
|
||||
id: tfStrongSwanConfig
|
||||
textArea.readOnly: true
|
||||
textArea.text: ShareConnectionLogic.textEditShareIkev2StrongSwanConfigText
|
||||
|
||||
visible: false
|
||||
}
|
||||
|
||||
Flickable {
|
||||
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
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: content.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
// LabelType {
|
||||
// id: lb_desc
|
||||
// Layout.fillWidth: true
|
||||
// Layout.topMargin: 10
|
||||
|
||||
// horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
// wrapMode: Text.Wrap
|
||||
// text: qsTr("Note: ShadowSocks protocol using same password for all connections")
|
||||
// }
|
||||
|
||||
ShareConnectionButtonType {
|
||||
Layout.topMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
|
||||
text: genConfigProcess ? generatingConfigText : generateConfigText
|
||||
onClicked: {
|
||||
enabled = false
|
||||
genConfigProcess = true
|
||||
ShareConnectionLogic.onPushButtonShareIkev2GenerateClicked()
|
||||
enabled = true
|
||||
genConfigProcess = false
|
||||
}
|
||||
}
|
||||
|
||||
ShareConnectionButtonType {
|
||||
Layout.topMargin: 30
|
||||
Layout.bottomMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
width: parent.width - 60
|
||||
|
||||
text: qsTr("Export p12 certificate")
|
||||
enabled: tfCert.textArea.length > 0
|
||||
visible: tfCert.textArea.length > 0
|
||||
|
||||
onClicked: {
|
||||
UiLogic.saveTextFile(qsTr("Export p12 certificate"), "*.p12", tfCert.textArea.text)
|
||||
}
|
||||
}
|
||||
|
||||
ShareConnectionButtonType {
|
||||
Layout.bottomMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
width: parent.width - 60
|
||||
|
||||
text: qsTr("Export config for Apple")
|
||||
enabled: tfMobileConfig.textArea.length > 0
|
||||
visible: tfMobileConfig.textArea.length > 0
|
||||
|
||||
onClicked: {
|
||||
UiLogic.saveTextFile(qsTr("Export config for Apple"), "*.plist", tfMobileConfig.textArea.text)
|
||||
}
|
||||
}
|
||||
|
||||
ShareConnectionButtonType {
|
||||
Layout.bottomMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
width: parent.width - 60
|
||||
|
||||
text: qsTr("Export config for StrongSwan")
|
||||
enabled: tfStrongSwanConfig.textArea.length > 0
|
||||
visible: tfStrongSwanConfig.textArea.length > 0
|
||||
|
||||
onClicked: {
|
||||
UiLogic.saveTextFile(qsTr("Export config for StrongSwan"), "*.profile", tfStrongSwanConfig.textArea.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,6 @@ import "../../Config"
|
|||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.OpenVpn
|
||||
logic: ShareConnectionLogic
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
|
|
@ -19,58 +18,90 @@ PageShareProtocolBase {
|
|||
text: qsTr("Share OpenVPN Settings")
|
||||
}
|
||||
|
||||
TextAreaType {
|
||||
id: tfShareCode
|
||||
Flickable {
|
||||
id: fl
|
||||
width: root.width
|
||||
anchors.top: caption.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.bottom: pb_gen.top
|
||||
anchors.bottomMargin: 20
|
||||
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
|
||||
textArea.readOnly: true
|
||||
|
||||
textArea.verticalAlignment: Text.AlignTop
|
||||
textArea.text: ShareConnectionLogic.textEditShareOpenVpnCodeText
|
||||
}
|
||||
|
||||
|
||||
ShareConnectionButtonType {
|
||||
id: pb_gen
|
||||
anchors.bottom: pb_copy.top
|
||||
anchors.bottomMargin: 10
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
|
||||
text: ShareConnectionLogic.pushButtonShareOpenVpnGenerateText
|
||||
onClicked: {
|
||||
enabled = false
|
||||
ShareConnectionLogic.onPushButtonShareOpenVpnGenerateClicked()
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
ShareConnectionButtonCopyType {
|
||||
id: pb_copy
|
||||
anchors.bottom: pb_save.top
|
||||
anchors.bottomMargin: 10
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
|
||||
enabled: tfShareCode.textArea.length > 0
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
id: pb_save
|
||||
anchors.bottom: root.bottom
|
||||
anchors.bottomMargin: 10
|
||||
anchors.horizontalCenter: root.horizontalCenter
|
||||
width: parent.width - 60
|
||||
anchors.bottomMargin: 20
|
||||
anchors.left: root.left
|
||||
anchors.leftMargin: 30
|
||||
anchors.right: root.right
|
||||
anchors.rightMargin: 30
|
||||
|
||||
text: qsTr("Save to file")
|
||||
enabled: tfShareCode.textArea.length > 0
|
||||
contentHeight: content.height
|
||||
clip: true
|
||||
|
||||
onClicked: {
|
||||
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "*.ovpn", tfShareCode.textArea.text)
|
||||
ColumnLayout {
|
||||
id: content
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: content.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
|
||||
LabelType {
|
||||
id: lb_desc
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 10
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
wrapMode: Text.Wrap
|
||||
text: qsTr("New encryption keys pair will be generated.")
|
||||
}
|
||||
|
||||
ShareConnectionButtonType {
|
||||
Layout.topMargin: 20
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
|
||||
text: genConfigProcess ? generatingConfigText : generateConfigText
|
||||
onClicked: {
|
||||
enabled = false
|
||||
genConfigProcess = true
|
||||
ShareConnectionLogic.onPushButtonShareOpenVpnGenerateClicked()
|
||||
genConfigProcess = false
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
TextAreaType {
|
||||
id: tfShareCode
|
||||
Layout.topMargin: 20
|
||||
Layout.preferredHeight: 200
|
||||
Layout.fillWidth: true
|
||||
|
||||
textArea.readOnly: true
|
||||
|
||||
textArea.verticalAlignment: Text.AlignTop
|
||||
textArea.text: ShareConnectionLogic.textEditShareOpenVpnCodeText
|
||||
|
||||
visible: tfShareCode.textArea.length > 0
|
||||
}
|
||||
|
||||
ShareConnectionButtonCopyType {
|
||||
Layout.preferredHeight: 40
|
||||
Layout.fillWidth: true
|
||||
|
||||
copyText: tfShareCode.textArea.text
|
||||
}
|
||||
ShareConnectionButtonType {
|
||||
Layout.bottomMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
width: parent.width - 60
|
||||
|
||||
text: qsTr("Save to file")
|
||||
enabled: tfShareCode.textArea.length > 0
|
||||
visible: tfShareCode.textArea.length > 0
|
||||
|
||||
onClicked: {
|
||||
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "*.ovpn", tfShareCode.textArea.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import "../../Config"
|
|||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.Sftp
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import "../../Config"
|
|||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.ShadowSocks
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
|
|
@ -31,73 +30,69 @@ PageShareProtocolBase {
|
|||
anchors.right: root.right
|
||||
anchors.rightMargin: 30
|
||||
|
||||
contentHeight: content.height + content2.height + 40
|
||||
contentHeight: content.height
|
||||
clip: true
|
||||
|
||||
GridLayout {
|
||||
id: content
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
columns: 2
|
||||
|
||||
//
|
||||
LabelType {
|
||||
height: 20
|
||||
text: qsTr("Server:")
|
||||
}
|
||||
TextFieldType {
|
||||
height: 20
|
||||
text: ShareConnectionLogic.labelShareShadowSocksServerText
|
||||
readOnly: true
|
||||
}
|
||||
|
||||
//
|
||||
LabelType {
|
||||
height: 20
|
||||
text: qsTr("Port:")
|
||||
}
|
||||
TextFieldType {
|
||||
height: 20
|
||||
text: ShareConnectionLogic.labelShareShadowSocksPortText
|
||||
readOnly: true
|
||||
}
|
||||
|
||||
//
|
||||
LabelType {
|
||||
height: 20
|
||||
text: qsTr("Password")
|
||||
}
|
||||
TextFieldType {
|
||||
height: 20
|
||||
text: ShareConnectionLogic.labelShareShadowSocksPasswordText
|
||||
readOnly: true
|
||||
}
|
||||
|
||||
//
|
||||
LabelType {
|
||||
height: 20
|
||||
text: qsTr("Encryption:")
|
||||
}
|
||||
TextFieldType {
|
||||
height: 20
|
||||
text: ShareConnectionLogic.labelShareShadowSocksMethodText
|
||||
readOnly: true
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: content2
|
||||
id: content
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: content.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
LabelType {
|
||||
id: lb_desc
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 10
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
wrapMode: Text.Wrap
|
||||
text: qsTr("Note: ShadowSocks protocol using same password for all connections")
|
||||
}
|
||||
|
||||
ShareConnectionButtonType {
|
||||
Layout.topMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
|
||||
text: genConfigProcess ? generatingConfigText : generateConfigText
|
||||
onClicked: {
|
||||
enabled = false
|
||||
genConfigProcess = true
|
||||
ShareConnectionLogic.onPushButtonShareShadowSocksGenerateClicked()
|
||||
enabled = true
|
||||
genConfigProcess = false
|
||||
}
|
||||
}
|
||||
|
||||
TextAreaType {
|
||||
id: tfShareCode
|
||||
|
||||
Layout.topMargin: 20
|
||||
Layout.preferredHeight: 200
|
||||
Layout.fillWidth: true
|
||||
|
||||
textArea.readOnly: true
|
||||
textArea.wrapMode: TextEdit.WrapAnywhere
|
||||
textArea.verticalAlignment: Text.AlignTop
|
||||
textArea.text: ShareConnectionLogic.textEditShareShadowSocksText
|
||||
|
||||
visible: tfShareCode.textArea.length > 0
|
||||
}
|
||||
ShareConnectionButtonCopyType {
|
||||
Layout.preferredHeight: 40
|
||||
Layout.fillWidth: true
|
||||
Layout.bottomMargin: 20
|
||||
|
||||
start_text: qsTr("Copy config")
|
||||
copyText: tfShareCode.textArea.text
|
||||
}
|
||||
|
||||
LabelType {
|
||||
height: 20
|
||||
visible: tfConnString.length > 0
|
||||
text: qsTr("Connection string")
|
||||
}
|
||||
TextFieldType {
|
||||
|
|
@ -106,12 +101,15 @@ PageShareProtocolBase {
|
|||
horizontalAlignment: Text.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
text: ShareConnectionLogic.lineEditShareShadowSocksStringText
|
||||
visible: tfConnString.length > 0
|
||||
|
||||
readOnly: true
|
||||
}
|
||||
ShareConnectionButtonCopyType {
|
||||
Layout.preferredHeight: 40
|
||||
Layout.fillWidth: true
|
||||
enabled: tfConnString.length > 0
|
||||
start_text: qsTr("Copy string")
|
||||
copyText: tfConnString.text
|
||||
}
|
||||
|
||||
Image {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import "../../Config"
|
|||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.TorWebSite
|
||||
logic: UiLogic.protocolLogic(protocol)
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
|
|
|
|||
113
client/ui/qml/Pages/Share/PageShareProtoWireGuard.qml
Normal file
113
client/ui/qml/Pages/Share/PageShareProtoWireGuard.qml
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.15
|
||||
import ProtocolEnum 1.0
|
||||
import "../"
|
||||
import "../../Controls"
|
||||
import "../../Config"
|
||||
|
||||
PageShareProtocolBase {
|
||||
id: root
|
||||
protocol: ProtocolEnum.WireGuard
|
||||
|
||||
BackButton {
|
||||
id: back
|
||||
}
|
||||
Caption {
|
||||
id: caption
|
||||
text: qsTr("Share WireGuard Settings")
|
||||
}
|
||||
|
||||
Flickable {
|
||||
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
|
||||
enabled: logic.pageEnabled
|
||||
anchors.top: content.bottom
|
||||
anchors.topMargin: 20
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
LabelType {
|
||||
id: lb_desc
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 10
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
wrapMode: Text.Wrap
|
||||
text: qsTr("New encryption keys pair will be generated.")
|
||||
}
|
||||
|
||||
ShareConnectionButtonType {
|
||||
Layout.topMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
|
||||
text: genConfigProcess ? generatingConfigText : generateConfigText
|
||||
onClicked: {
|
||||
enabled = false
|
||||
genConfigProcess = true
|
||||
ShareConnectionLogic.onPushButtonShareWireGuardGenerateClicked()
|
||||
enabled = true
|
||||
genConfigProcess = false
|
||||
}
|
||||
}
|
||||
|
||||
TextAreaType {
|
||||
id: tfShareCode
|
||||
|
||||
Layout.topMargin: 20
|
||||
Layout.preferredHeight: 200
|
||||
Layout.fillWidth: true
|
||||
|
||||
textArea.readOnly: true
|
||||
textArea.wrapMode: TextEdit.WrapAnywhere
|
||||
textArea.verticalAlignment: Text.AlignTop
|
||||
textArea.text: ShareConnectionLogic.textEditShareWireGuardCodeText
|
||||
|
||||
visible: tfShareCode.textArea.length > 0
|
||||
}
|
||||
ShareConnectionButtonCopyType {
|
||||
Layout.preferredHeight: 40
|
||||
Layout.fillWidth: true
|
||||
|
||||
copyText: tfShareCode.textArea.text
|
||||
}
|
||||
|
||||
ShareConnectionButtonType {
|
||||
Layout.preferredHeight: 40
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: qsTr("Save to file")
|
||||
enabled: tfShareCode.textArea.length > 0
|
||||
visible: tfShareCode.textArea.length > 0
|
||||
|
||||
onClicked: {
|
||||
UiLogic.saveTextFile(qsTr("Save OpenVPN config"), "*.conf", tfShareCode.textArea.text)
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
Layout.topMargin: 20
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: width
|
||||
smooth: false
|
||||
source: ShareConnectionLogic.shareWireGuardQrCodeText
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,5 +9,11 @@ import "../../Config"
|
|||
PageBase {
|
||||
id: root
|
||||
property var protocol: ProtocolEnum.Any
|
||||
page: PageEnum.ProtocolSettings
|
||||
page: PageEnum.ProtocolShare
|
||||
logic: ShareConnectionLogic
|
||||
|
||||
readonly property string generateConfigText: qsTr("Generate config")
|
||||
readonly property string generatingConfigText: qsTr("Generating config...")
|
||||
readonly property string showConfigText: qsTr("Show config")
|
||||
property bool genConfigProcess: false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -705,5 +705,29 @@ bool UiLogic::saveTextFile(const QString& desc, const QString& ext, const QStrin
|
|||
QSaveFile save(fileName);
|
||||
save.open(QIODevice::WriteOnly);
|
||||
save.write(data.toUtf8());
|
||||
|
||||
QFileInfo fi(fileName);
|
||||
QDesktopServices::openUrl(fi.absoluteDir().absolutePath());
|
||||
|
||||
return save.commit();
|
||||
}
|
||||
|
||||
bool UiLogic::saveBinaryFile(const QString &desc, const QString &ext, const QString &data)
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(nullptr, desc,
|
||||
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), ext);
|
||||
|
||||
QSaveFile save(fileName);
|
||||
save.open(QIODevice::WriteOnly);
|
||||
save.write(QByteArray::fromBase64(data.toUtf8()));
|
||||
|
||||
QFileInfo fi(fileName);
|
||||
QDesktopServices::openUrl(fi.absoluteDir().absolutePath());
|
||||
|
||||
return save.commit();
|
||||
}
|
||||
|
||||
void UiLogic::copyToClipboard(const QString &text)
|
||||
{
|
||||
qApp->clipboard()->setText(text);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,8 @@ public:
|
|||
Q_INVOKABLE void keyPressEvent(Qt::Key key);
|
||||
|
||||
Q_INVOKABLE bool saveTextFile(const QString& desc, const QString& ext, const QString& data);
|
||||
Q_INVOKABLE bool saveBinaryFile(const QString& desc, const QString& ext, const QString& data);
|
||||
Q_INVOKABLE void copyToClipboard(const QString& text);
|
||||
|
||||
QString getTrayIconUrl() const;
|
||||
void setTrayIconUrl(const QString &trayIconUrl);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue