refact sharing
This commit is contained in:
parent
84ca7e8879
commit
ca3617aa7d
8 changed files with 943 additions and 927 deletions
|
@ -61,6 +61,7 @@ void GeneralSettingsLogic::onPushButtonGeneralSettingsShareConnectionClicked()
|
||||||
m_uiLogic->selectedServerIndex = m_settings.defaultServerIndex();
|
m_uiLogic->selectedServerIndex = m_settings.defaultServerIndex();
|
||||||
m_uiLogic->selectedDockerContainer = m_settings.defaultContainer(m_uiLogic->selectedServerIndex);
|
m_uiLogic->selectedDockerContainer = m_settings.defaultContainer(m_uiLogic->selectedServerIndex);
|
||||||
|
|
||||||
m_uiLogic->updateSharingPage(m_uiLogic->selectedServerIndex, m_settings.serverCredentials(m_uiLogic->selectedServerIndex), m_uiLogic->selectedDockerContainer);
|
// TODO_REFACT
|
||||||
|
//m_uiLogic->updateSharingPage(m_uiLogic->selectedServerIndex, m_settings.serverCredentials(m_uiLogic->selectedServerIndex), m_uiLogic->selectedDockerContainer);
|
||||||
m_uiLogic->goToPage(Page::ShareConnection);
|
m_uiLogic->goToPage(Page::ShareConnection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,6 +299,7 @@ void ServerSettingsLogic::setPushButtonServerSettingsClearClientCacheText(const
|
||||||
|
|
||||||
void ServerSettingsLogic::onPushButtonServerSettingsShareFullClicked()
|
void ServerSettingsLogic::onPushButtonServerSettingsShareFullClicked()
|
||||||
{
|
{
|
||||||
m_uiLogic->updateSharingPage(m_uiLogic->selectedServerIndex, m_settings.serverCredentials(m_uiLogic->selectedServerIndex), DockerContainer::None);
|
// TODO_REFACT
|
||||||
|
// m_uiLogic->updateSharingPage(m_uiLogic->selectedServerIndex, m_settings.serverCredentials(m_uiLogic->selectedServerIndex), DockerContainer::None);
|
||||||
m_uiLogic->goToPage(Page::ShareConnection);
|
m_uiLogic->goToPage(Page::ShareConnection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ class ServerSettingsLogic : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
Q_INVOKABLE void updateServerSettingsPage();
|
Q_INVOKABLE void updateServerSettingsPage();
|
||||||
|
|
||||||
Q_PROPERTY(bool pageServerSettingsEnabled READ getPageServerSettingsEnabled WRITE setPageServerSettingsEnabled NOTIFY pageServerSettingsEnabledChanged)
|
Q_PROPERTY(bool pageServerSettingsEnabled READ getPageServerSettingsEnabled WRITE setPageServerSettingsEnabled NOTIFY pageServerSettingsEnabledChanged)
|
||||||
|
|
|
@ -1,28 +1,29 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QBuffer>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QDebug>
|
//#include <QDesktopServices>
|
||||||
#include <QDesktopServices>
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QHBoxLayout>
|
//#include <QHBoxLayout>
|
||||||
#include <QHostInfo>
|
//#include <QHostInfo>
|
||||||
#include <QItemSelectionModel>
|
//#include <QItemSelectionModel>
|
||||||
#include <QJsonDocument>
|
//#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
//#include <QJsonObject>
|
||||||
#include <QKeyEvent>
|
//#include <QKeyEvent>
|
||||||
#include <QMenu>
|
//#include <QMenu>
|
||||||
#include <QMessageBox>
|
//#include <QMessageBox>
|
||||||
#include <QMetaEnum>
|
//#include <QMetaEnum>
|
||||||
#include <QSysInfo>
|
//#include <QSysInfo>
|
||||||
#include <QThread>
|
//#include <QThread>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QRegularExpression>
|
//#include <QRegularExpression>
|
||||||
#include <QSaveFile>
|
#include <QSaveFile>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
//#include "configurators/cloak_configurator.h"
|
#include "configurators/cloak_configurator.h"
|
||||||
//#include "configurators/vpn_configurator.h"
|
#include "configurators/vpn_configurator.h"
|
||||||
//#include "configurators/openvpn_configurator.h"
|
#include "configurators/openvpn_configurator.h"
|
||||||
//#include "configurators/shadowsocks_configurator.h"
|
#include "configurators/shadowsocks_configurator.h"
|
||||||
//#include "configurators/ssh_configurator.h"
|
#include "configurators/ssh_configurator.h"
|
||||||
|
|
||||||
//#include "core/servercontroller.h"
|
//#include "core/servercontroller.h"
|
||||||
//#include "core/server_defs.h"
|
//#include "core/server_defs.h"
|
||||||
|
@ -31,16 +32,14 @@
|
||||||
//#include "protocols/protocols_defs.h"
|
//#include "protocols/protocols_defs.h"
|
||||||
//#include "protocols/shadowsocksvpnprotocol.h"
|
//#include "protocols/shadowsocksvpnprotocol.h"
|
||||||
|
|
||||||
#include "debug.h"
|
//#include "debug.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "ShareConnectionLogic.h"
|
#include "ShareConnectionLogic.h"
|
||||||
#include "utils.h"
|
//#include "utils.h"
|
||||||
#include "vpnconnection.h"
|
//#include "vpnconnection.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#if defined Q_OS_MAC || defined Q_OS_LINUX
|
#include "../uilogic.h"
|
||||||
#include "ui/macos_util.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace amnezia;
|
using namespace amnezia;
|
||||||
using namespace PageEnumNS;
|
using namespace PageEnumNS;
|
||||||
|
@ -48,7 +47,740 @@ using namespace PageEnumNS;
|
||||||
|
|
||||||
ShareConnectionLogic::ShareConnectionLogic(UiLogic *uiLogic, QObject *parent):
|
ShareConnectionLogic::ShareConnectionLogic(UiLogic *uiLogic, QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_uiLogic(uiLogic)
|
m_uiLogic(uiLogic),
|
||||||
|
m_pageShareAmneziaVisible{true},
|
||||||
|
m_pageShareOpenvpnVisible{true},
|
||||||
|
m_pageShareShadowsocksVisible{true},
|
||||||
|
m_pageShareCloakVisible{true},
|
||||||
|
m_pageShareFullAccessVisible{true},
|
||||||
|
m_textEditShareOpenvpnCodeText{},
|
||||||
|
m_pushButtonShareOpenvpnCopyEnabled{false},
|
||||||
|
m_pushButtonShareOpenvpnSaveEnabled{false},
|
||||||
|
m_toolBoxShareConnectionCurrentIndex{-1},
|
||||||
|
m_pushButtonShareSsCopyEnabled{false},
|
||||||
|
m_lineEditShareSsStringText{},
|
||||||
|
m_labelShareSsQrCodeText{},
|
||||||
|
m_labelShareSsServerText{},
|
||||||
|
m_labelShareSsPortText{},
|
||||||
|
m_labelShareSsMethodText{},
|
||||||
|
m_labelShareSsPasswordText{},
|
||||||
|
m_plainTextEditShareCloakText{},
|
||||||
|
m_pushButtonShareCloakCopyEnabled{false},
|
||||||
|
m_textEditShareFullCodeText{},
|
||||||
|
m_textEditShareAmneziaCodeText{},
|
||||||
|
m_pushButtonShareFullCopyText{tr("Copy")},
|
||||||
|
m_pushButtonShareAmneziaCopyText{tr("Copy")},
|
||||||
|
m_pushButtonShareOpenvpnCopyText{tr("Copy")},
|
||||||
|
m_pushButtonShareSsCopyText{tr("Copy")},
|
||||||
|
m_pushButtonShareCloakCopyText{tr("Copy")},
|
||||||
|
m_pushButtonShareAmneziaGenerateEnabled{true},
|
||||||
|
m_pushButtonShareAmneziaCopyEnabled{true},
|
||||||
|
m_pushButtonShareAmneziaGenerateText{tr("Generate config")},
|
||||||
|
m_pushButtonShareOpenvpnGenerateEnabled{true},
|
||||||
|
m_pushButtonShareOpenvpnGenerateText{tr("Generate config")}
|
||||||
{
|
{
|
||||||
|
// TODO consider move to Component.onCompleted
|
||||||
|
updateSharingPage(m_uiLogic->selectedServerIndex, m_settings.serverCredentials(m_uiLogic->selectedServerIndex), m_uiLogic->selectedDockerContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPageShareAmneziaVisible() const
|
||||||
|
{
|
||||||
|
return m_pageShareAmneziaVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPageShareAmneziaVisible(bool pageShareAmneziaVisible)
|
||||||
|
{
|
||||||
|
if (m_pageShareAmneziaVisible != pageShareAmneziaVisible) {
|
||||||
|
m_pageShareAmneziaVisible = pageShareAmneziaVisible;
|
||||||
|
emit pageShareAmneziaVisibleChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPageShareOpenvpnVisible() const
|
||||||
|
{
|
||||||
|
return m_pageShareOpenvpnVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPageShareOpenvpnVisible(bool pageShareOpenvpnVisible)
|
||||||
|
{
|
||||||
|
if (m_pageShareOpenvpnVisible != pageShareOpenvpnVisible) {
|
||||||
|
m_pageShareOpenvpnVisible = pageShareOpenvpnVisible;
|
||||||
|
emit pageShareOpenvpnVisibleChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPageShareShadowsocksVisible() const
|
||||||
|
{
|
||||||
|
return m_pageShareShadowsocksVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPageShareShadowsocksVisible(bool pageShareShadowsocksVisible)
|
||||||
|
{
|
||||||
|
if (m_pageShareShadowsocksVisible != pageShareShadowsocksVisible) {
|
||||||
|
m_pageShareShadowsocksVisible = pageShareShadowsocksVisible;
|
||||||
|
emit pageShareShadowsocksVisibleChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPageShareCloakVisible() const
|
||||||
|
{
|
||||||
|
return m_pageShareCloakVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPageShareCloakVisible(bool pageShareCloakVisible)
|
||||||
|
{
|
||||||
|
if (m_pageShareCloakVisible != pageShareCloakVisible) {
|
||||||
|
m_pageShareCloakVisible = pageShareCloakVisible;
|
||||||
|
emit pageShareCloakVisibleChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPageShareFullAccessVisible() const
|
||||||
|
{
|
||||||
|
return m_pageShareFullAccessVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPageShareFullAccessVisible(bool pageShareFullAccessVisible)
|
||||||
|
{
|
||||||
|
if (m_pageShareFullAccessVisible != pageShareFullAccessVisible) {
|
||||||
|
m_pageShareFullAccessVisible = pageShareFullAccessVisible;
|
||||||
|
emit pageShareFullAccessVisibleChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getTextEditShareOpenvpnCodeText() const
|
||||||
|
{
|
||||||
|
return m_textEditShareOpenvpnCodeText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setTextEditShareOpenvpnCodeText(const QString &textEditShareOpenvpnCodeText)
|
||||||
|
{
|
||||||
|
if (m_textEditShareOpenvpnCodeText != textEditShareOpenvpnCodeText) {
|
||||||
|
m_textEditShareOpenvpnCodeText = textEditShareOpenvpnCodeText;
|
||||||
|
emit textEditShareOpenvpnCodeTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPushButtonShareOpenvpnCopyEnabled() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareOpenvpnCopyEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareOpenvpnCopyEnabled(bool pushButtonShareOpenvpnCopyEnabled)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareOpenvpnCopyEnabled != pushButtonShareOpenvpnCopyEnabled) {
|
||||||
|
m_pushButtonShareOpenvpnCopyEnabled = pushButtonShareOpenvpnCopyEnabled;
|
||||||
|
emit pushButtonShareOpenvpnCopyEnabledChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPushButtonShareOpenvpnSaveEnabled() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareOpenvpnSaveEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareOpenvpnSaveEnabled(bool pushButtonShareOpenvpnSaveEnabled)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareOpenvpnSaveEnabled != pushButtonShareOpenvpnSaveEnabled) {
|
||||||
|
m_pushButtonShareOpenvpnSaveEnabled = pushButtonShareOpenvpnSaveEnabled;
|
||||||
|
emit pushButtonShareOpenvpnSaveEnabledChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ShareConnectionLogic::getToolBoxShareConnectionCurrentIndex() const
|
||||||
|
{
|
||||||
|
return m_toolBoxShareConnectionCurrentIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setToolBoxShareConnectionCurrentIndex(int toolBoxShareConnectionCurrentIndex)
|
||||||
|
{
|
||||||
|
if (m_toolBoxShareConnectionCurrentIndex != toolBoxShareConnectionCurrentIndex) {
|
||||||
|
m_toolBoxShareConnectionCurrentIndex = toolBoxShareConnectionCurrentIndex;
|
||||||
|
emit toolBoxShareConnectionCurrentIndexChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPushButtonShareSsCopyEnabled() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareSsCopyEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareSsCopyEnabled(bool pushButtonShareSsCopyEnabled)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareSsCopyEnabled != pushButtonShareSsCopyEnabled) {
|
||||||
|
m_pushButtonShareSsCopyEnabled = pushButtonShareSsCopyEnabled;
|
||||||
|
emit pushButtonShareSsCopyEnabledChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getLineEditShareSsStringText() const
|
||||||
|
{
|
||||||
|
return m_lineEditShareSsStringText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setLineEditShareSsStringText(const QString &lineEditShareSsStringText)
|
||||||
|
{
|
||||||
|
if (m_lineEditShareSsStringText != lineEditShareSsStringText) {
|
||||||
|
m_lineEditShareSsStringText = lineEditShareSsStringText;
|
||||||
|
emit lineEditShareSsStringTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getLabelShareSsQrCodeText() const
|
||||||
|
{
|
||||||
|
return m_labelShareSsQrCodeText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setLabelShareSsQrCodeText(const QString &labelShareSsQrCodeText)
|
||||||
|
{
|
||||||
|
if (m_labelShareSsQrCodeText != labelShareSsQrCodeText) {
|
||||||
|
m_labelShareSsQrCodeText = labelShareSsQrCodeText;
|
||||||
|
emit labelShareSsQrCodeTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getLabelShareSsServerText() const
|
||||||
|
{
|
||||||
|
return m_labelShareSsServerText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setLabelShareSsServerText(const QString &labelShareSsServerText)
|
||||||
|
{
|
||||||
|
if (m_labelShareSsServerText != labelShareSsServerText) {
|
||||||
|
m_labelShareSsServerText = labelShareSsServerText;
|
||||||
|
emit labelShareSsServerTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getLabelShareSsPortText() const
|
||||||
|
{
|
||||||
|
return m_labelShareSsPortText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setLabelShareSsPortText(const QString &labelShareSsPortText)
|
||||||
|
{
|
||||||
|
if (m_labelShareSsPortText != labelShareSsPortText) {
|
||||||
|
m_labelShareSsPortText = labelShareSsPortText;
|
||||||
|
emit labelShareSsPortTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getLabelShareSsMethodText() const
|
||||||
|
{
|
||||||
|
return m_labelShareSsMethodText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setLabelShareSsMethodText(const QString &labelShareSsMethodText)
|
||||||
|
{
|
||||||
|
if (m_labelShareSsMethodText != labelShareSsMethodText) {
|
||||||
|
m_labelShareSsMethodText = labelShareSsMethodText;
|
||||||
|
emit labelShareSsMethodTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getLabelShareSsPasswordText() const
|
||||||
|
{
|
||||||
|
return m_labelShareSsPasswordText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setLabelShareSsPasswordText(const QString &labelShareSsPasswordText)
|
||||||
|
{
|
||||||
|
if (m_labelShareSsPasswordText != labelShareSsPasswordText) {
|
||||||
|
m_labelShareSsPasswordText = labelShareSsPasswordText;
|
||||||
|
emit labelShareSsPasswordTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getPlainTextEditShareCloakText() const
|
||||||
|
{
|
||||||
|
return m_plainTextEditShareCloakText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPlainTextEditShareCloakText(const QString &plainTextEditShareCloakText)
|
||||||
|
{
|
||||||
|
if (m_plainTextEditShareCloakText != plainTextEditShareCloakText) {
|
||||||
|
m_plainTextEditShareCloakText = plainTextEditShareCloakText;
|
||||||
|
emit plainTextEditShareCloakTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPushButtonShareCloakCopyEnabled() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareCloakCopyEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareCloakCopyEnabled(bool pushButtonShareCloakCopyEnabled)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareCloakCopyEnabled != pushButtonShareCloakCopyEnabled) {
|
||||||
|
m_pushButtonShareCloakCopyEnabled = pushButtonShareCloakCopyEnabled;
|
||||||
|
emit pushButtonShareCloakCopyEnabledChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getTextEditShareFullCodeText() const
|
||||||
|
{
|
||||||
|
return m_textEditShareFullCodeText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setTextEditShareFullCodeText(const QString &textEditShareFullCodeText)
|
||||||
|
{
|
||||||
|
if (m_textEditShareFullCodeText != textEditShareFullCodeText) {
|
||||||
|
m_textEditShareFullCodeText = textEditShareFullCodeText;
|
||||||
|
emit textEditShareFullCodeTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getTextEditShareAmneziaCodeText() const
|
||||||
|
{
|
||||||
|
return m_textEditShareAmneziaCodeText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setTextEditShareAmneziaCodeText(const QString &textEditShareAmneziaCodeText)
|
||||||
|
{
|
||||||
|
if (m_textEditShareAmneziaCodeText != textEditShareAmneziaCodeText) {
|
||||||
|
m_textEditShareAmneziaCodeText = textEditShareAmneziaCodeText;
|
||||||
|
emit textEditShareAmneziaCodeTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getPushButtonShareFullCopyText() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareFullCopyText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareFullCopyText(const QString &pushButtonShareFullCopyText)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareFullCopyText != pushButtonShareFullCopyText) {
|
||||||
|
m_pushButtonShareFullCopyText = pushButtonShareFullCopyText;
|
||||||
|
emit pushButtonShareFullCopyTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QString ShareConnectionLogic::getPushButtonShareAmneziaCopyText() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareAmneziaCopyText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareAmneziaCopyText(const QString &pushButtonShareAmneziaCopyText)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareAmneziaCopyText != pushButtonShareAmneziaCopyText) {
|
||||||
|
m_pushButtonShareAmneziaCopyText = pushButtonShareAmneziaCopyText;
|
||||||
|
emit pushButtonShareAmneziaCopyTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getPushButtonShareOpenvpnCopyText() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareOpenvpnCopyText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareOpenvpnCopyText(const QString &pushButtonShareOpenvpnCopyText)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareOpenvpnCopyText != pushButtonShareOpenvpnCopyText) {
|
||||||
|
m_pushButtonShareOpenvpnCopyText = pushButtonShareOpenvpnCopyText;
|
||||||
|
emit pushButtonShareOpenvpnCopyTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getPushButtonShareSsCopyText() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareSsCopyText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareSsCopyText(const QString &pushButtonShareSsCopyText)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareSsCopyText != pushButtonShareSsCopyText) {
|
||||||
|
m_pushButtonShareSsCopyText = pushButtonShareSsCopyText;
|
||||||
|
emit pushButtonShareSsCopyTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getPushButtonShareCloakCopyText() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareCloakCopyText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareCloakCopyText(const QString &pushButtonShareCloakCopyText)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareCloakCopyText != pushButtonShareCloakCopyText) {
|
||||||
|
m_pushButtonShareCloakCopyText = pushButtonShareCloakCopyText;
|
||||||
|
emit pushButtonShareCloakCopyTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPushButtonShareAmneziaGenerateEnabled() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareAmneziaGenerateEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareAmneziaGenerateEnabled(bool pushButtonShareAmneziaGenerateEnabled)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareAmneziaGenerateEnabled != pushButtonShareAmneziaGenerateEnabled) {
|
||||||
|
m_pushButtonShareAmneziaGenerateEnabled = pushButtonShareAmneziaGenerateEnabled;
|
||||||
|
emit pushButtonShareAmneziaGenerateEnabledChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPushButtonShareAmneziaCopyEnabled() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareAmneziaCopyEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareAmneziaCopyEnabled(bool pushButtonShareAmneziaCopyEnabled)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareAmneziaCopyEnabled != pushButtonShareAmneziaCopyEnabled) {
|
||||||
|
m_pushButtonShareAmneziaCopyEnabled = pushButtonShareAmneziaCopyEnabled;
|
||||||
|
emit pushButtonShareAmneziaCopyEnabledChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getPushButtonShareAmneziaGenerateText() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareAmneziaGenerateText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareAmneziaGenerateText(const QString &pushButtonShareAmneziaGenerateText)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareAmneziaGenerateText != pushButtonShareAmneziaGenerateText) {
|
||||||
|
m_pushButtonShareAmneziaGenerateText = pushButtonShareAmneziaGenerateText;
|
||||||
|
emit pushButtonShareAmneziaGenerateTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShareConnectionLogic::getPushButtonShareOpenvpnGenerateEnabled() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareOpenvpnGenerateEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareOpenvpnGenerateEnabled(bool pushButtonShareOpenvpnGenerateEnabled)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareOpenvpnGenerateEnabled != pushButtonShareOpenvpnGenerateEnabled) {
|
||||||
|
m_pushButtonShareOpenvpnGenerateEnabled = pushButtonShareOpenvpnGenerateEnabled;
|
||||||
|
emit pushButtonShareOpenvpnGenerateEnabledChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShareConnectionLogic::getPushButtonShareOpenvpnGenerateText() const
|
||||||
|
{
|
||||||
|
return m_pushButtonShareOpenvpnGenerateText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::setPushButtonShareOpenvpnGenerateText(const QString &pushButtonShareOpenvpnGenerateText)
|
||||||
|
{
|
||||||
|
if (m_pushButtonShareOpenvpnGenerateText != pushButtonShareOpenvpnGenerateText) {
|
||||||
|
m_pushButtonShareOpenvpnGenerateText = pushButtonShareOpenvpnGenerateText;
|
||||||
|
emit pushButtonShareOpenvpnGenerateTextChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::onPushButtonShareFullCopyClicked()
|
||||||
|
{
|
||||||
|
QGuiApplication::clipboard()->setText(getTextEditShareFullCodeText());
|
||||||
|
setPushButtonShareFullCopyText(tr("Copied"));
|
||||||
|
|
||||||
|
QTimer::singleShot(3000, this, [this]() {
|
||||||
|
setPushButtonShareFullCopyText(tr("Copy"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::onPushButtonShareFullSaveClicked()
|
||||||
|
{
|
||||||
|
if (getTextEditShareFullCodeText().isEmpty()) return;
|
||||||
|
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save AmneziaVPN config"),
|
||||||
|
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.amnezia");
|
||||||
|
QSaveFile save(fileName);
|
||||||
|
save.open(QIODevice::WriteOnly);
|
||||||
|
save.write(getTextEditShareFullCodeText().toUtf8());
|
||||||
|
save.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::onPushButtonShareAmneziaCopyClicked()
|
||||||
|
{
|
||||||
|
if (getTextEditShareAmneziaCodeText().isEmpty()) return;
|
||||||
|
|
||||||
|
QGuiApplication::clipboard()->setText(getTextEditShareAmneziaCodeText());
|
||||||
|
setPushButtonShareAmneziaCopyText(tr("Copied"));
|
||||||
|
|
||||||
|
QTimer::singleShot(3000, this, [this]() {
|
||||||
|
setPushButtonShareAmneziaCopyText(tr("Copy"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::onPushButtonShareAmneziaSaveClicked()
|
||||||
|
{
|
||||||
|
if (getTextEditShareAmneziaCodeText().isEmpty()) return;
|
||||||
|
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save AmneziaVPN config"),
|
||||||
|
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.amnezia");
|
||||||
|
QSaveFile save(fileName);
|
||||||
|
save.open(QIODevice::WriteOnly);
|
||||||
|
save.write(getTextEditShareAmneziaCodeText().toUtf8());
|
||||||
|
save.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::onPushButtonShareOpenvpnCopyClicked()
|
||||||
|
{
|
||||||
|
QGuiApplication::clipboard()->setText(getTextEditShareOpenvpnCodeText());
|
||||||
|
setPushButtonShareOpenvpnCopyText(tr("Copied"));
|
||||||
|
|
||||||
|
QTimer::singleShot(3000, this, [this]() {
|
||||||
|
setPushButtonShareOpenvpnCopyText(tr("Copy"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::onPushButtonShareSsCopyClicked()
|
||||||
|
{
|
||||||
|
QGuiApplication::clipboard()->setText(getLineEditShareSsStringText());
|
||||||
|
setPushButtonShareSsCopyText(tr("Copied"));
|
||||||
|
|
||||||
|
QTimer::singleShot(3000, this, [this]() {
|
||||||
|
setPushButtonShareSsCopyText(tr("Copy"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::onPushButtonShareCloakCopyClicked()
|
||||||
|
{
|
||||||
|
QGuiApplication::clipboard()->setText(getPlainTextEditShareCloakText());
|
||||||
|
setPushButtonShareCloakCopyText(tr("Copied"));
|
||||||
|
|
||||||
|
QTimer::singleShot(3000, this, [this]() {
|
||||||
|
setPushButtonShareCloakCopyText(tr("Copy"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::onPushButtonShareAmneziaGenerateClicked()
|
||||||
|
{
|
||||||
|
setPushButtonShareAmneziaGenerateEnabled(false);
|
||||||
|
setPushButtonShareAmneziaCopyEnabled(false);
|
||||||
|
setPushButtonShareAmneziaGenerateText(tr("Generating..."));
|
||||||
|
qApp->processEvents();
|
||||||
|
|
||||||
|
ServerCredentials credentials = m_settings.serverCredentials(m_uiLogic->selectedServerIndex);
|
||||||
|
QJsonObject containerConfig = m_settings.containerConfig(m_uiLogic->selectedServerIndex, m_uiLogic->selectedDockerContainer);
|
||||||
|
containerConfig.insert(config_key::container, containerToString(m_uiLogic->selectedDockerContainer));
|
||||||
|
|
||||||
|
ErrorCode e = ErrorCode::NoError;
|
||||||
|
for (Protocol p: amnezia::protocolsForContainer(m_uiLogic->selectedDockerContainer)) {
|
||||||
|
QJsonObject protoConfig = m_settings.protocolConfig(m_uiLogic->selectedServerIndex, m_uiLogic->selectedDockerContainer, p);
|
||||||
|
|
||||||
|
QString cfg = VpnConfigurator::genVpnProtocolConfig(credentials, m_uiLogic->selectedDockerContainer, containerConfig, p, &e);
|
||||||
|
if (e) {
|
||||||
|
cfg = "Error generating config";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
protoConfig.insert(config_key::last_config, cfg);
|
||||||
|
|
||||||
|
containerConfig.insert(protoToString(p), protoConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray ba;
|
||||||
|
if (!e) {
|
||||||
|
QJsonObject serverConfig = m_settings.server(m_uiLogic->selectedServerIndex);
|
||||||
|
serverConfig.remove(config_key::userName);
|
||||||
|
serverConfig.remove(config_key::password);
|
||||||
|
serverConfig.remove(config_key::port);
|
||||||
|
serverConfig.insert(config_key::containers, QJsonArray {containerConfig});
|
||||||
|
serverConfig.insert(config_key::defaultContainer, containerToString(m_uiLogic->selectedDockerContainer));
|
||||||
|
|
||||||
|
|
||||||
|
ba = QJsonDocument(serverConfig).toJson().toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
||||||
|
setTextEditShareAmneziaCodeText(QString("vpn://%1").arg(QString(ba)));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setTextEditShareAmneziaCodeText(tr("Error while generating connection profile"));
|
||||||
|
}
|
||||||
|
|
||||||
|
setPushButtonShareAmneziaGenerateEnabled(true);
|
||||||
|
setPushButtonShareAmneziaCopyEnabled(true);
|
||||||
|
setPushButtonShareAmneziaGenerateText(tr("Generate config"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::onPushButtonShareOpenvpnGenerateClicked()
|
||||||
|
{
|
||||||
|
setPushButtonShareOpenvpnGenerateEnabled(false);
|
||||||
|
setPushButtonShareOpenvpnCopyEnabled(false);
|
||||||
|
setPushButtonShareOpenvpnSaveEnabled(false);
|
||||||
|
setPushButtonShareOpenvpnGenerateText(tr("Generating..."));
|
||||||
|
|
||||||
|
ServerCredentials credentials = m_settings.serverCredentials(m_uiLogic->selectedServerIndex);
|
||||||
|
const QJsonObject &containerConfig = m_settings.containerConfig(m_uiLogic->selectedServerIndex, m_uiLogic->selectedDockerContainer);
|
||||||
|
|
||||||
|
ErrorCode e = ErrorCode::NoError;
|
||||||
|
QString cfg = OpenVpnConfigurator::genOpenVpnConfig(credentials, m_uiLogic->selectedDockerContainer, containerConfig, &e);
|
||||||
|
cfg = OpenVpnConfigurator::processConfigWithExportSettings(cfg);
|
||||||
|
|
||||||
|
setTextEditShareOpenvpnCodeText(cfg);
|
||||||
|
|
||||||
|
setPushButtonShareOpenvpnGenerateEnabled(true);
|
||||||
|
setPushButtonShareOpenvpnCopyEnabled(true);
|
||||||
|
setPushButtonShareOpenvpnSaveEnabled(true);
|
||||||
|
setPushButtonShareOpenvpnGenerateText(tr("Generate config"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareConnectionLogic::onPushButtonShareOpenvpnSaveClicked()
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save OpenVPN config"),
|
||||||
|
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.ovpn");
|
||||||
|
|
||||||
|
QSaveFile save(fileName);
|
||||||
|
save.open(QIODevice::WriteOnly);
|
||||||
|
save.write(getTextEditShareOpenvpnCodeText().toUtf8());
|
||||||
|
save.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ShareConnectionLogic::updateSharingPage(int serverIndex, const ServerCredentials &credentials,
|
||||||
|
DockerContainer container)
|
||||||
|
{
|
||||||
|
m_uiLogic->selectedDockerContainer = container;
|
||||||
|
m_uiLogic->selectedServerIndex = serverIndex;
|
||||||
|
|
||||||
|
//const QJsonObject &containerConfig = m_settings.containerConfig(serverIndex, container);
|
||||||
|
|
||||||
|
setPageShareAmneziaVisible(false);
|
||||||
|
setPageShareOpenvpnVisible(false);
|
||||||
|
setPageShareShadowsocksVisible(false);
|
||||||
|
setPageShareCloakVisible(false);
|
||||||
|
setPageShareFullAccessVisible(false);
|
||||||
|
|
||||||
|
enum currentWidget {
|
||||||
|
full_access = 0,
|
||||||
|
share_amezia,
|
||||||
|
share_openvpn,
|
||||||
|
share_shadowshock,
|
||||||
|
share_cloak
|
||||||
|
};
|
||||||
|
|
||||||
|
if (container == DockerContainer::OpenVpn) {
|
||||||
|
setPageShareAmneziaVisible(true);
|
||||||
|
setPageShareOpenvpnVisible(true);
|
||||||
|
|
||||||
|
QString cfg = tr("Press Generate config");
|
||||||
|
setTextEditShareOpenvpnCodeText(cfg);
|
||||||
|
setPushButtonShareOpenvpnCopyEnabled(false);
|
||||||
|
setPushButtonShareOpenvpnSaveEnabled(false);
|
||||||
|
|
||||||
|
setToolBoxShareConnectionCurrentIndex(share_openvpn);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (container == DockerContainer::OpenVpnOverShadowSocks ||
|
||||||
|
container == DockerContainer::OpenVpnOverCloak) {
|
||||||
|
setPageShareAmneziaVisible(true);
|
||||||
|
setPageShareShadowsocksVisible(true);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
setPushButtonShareSsCopyEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
setLineEditShareSsStringText(ssString);
|
||||||
|
updateQRCodeImage(ssString, [this](const QString& labelText) ->void {
|
||||||
|
setLabelShareSsQrCodeText(labelText);
|
||||||
|
});
|
||||||
|
|
||||||
|
setLabelShareSsServerText(ssConfig.value("server").toString());
|
||||||
|
setLabelShareSsPortText(ssConfig.value("server_port").toString());
|
||||||
|
setLabelShareSsMethodText(ssConfig.value("method").toString());
|
||||||
|
setLabelShareSsPasswordText(ssConfig.value("password").toString());
|
||||||
|
|
||||||
|
setToolBoxShareConnectionCurrentIndex(share_shadowshock);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (container == DockerContainer::OpenVpnOverCloak) {
|
||||||
|
//ui->toolBox_share_connection->addItem(ui->page_share_amnezia, tr(" Share for Amnezia client"));
|
||||||
|
setPageShareCloakVisible(true);
|
||||||
|
setPlainTextEditShareCloakText(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);
|
||||||
|
|
||||||
|
setPushButtonShareCloakCopyEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject cloakConfig = QJsonDocument::fromJson(cfg.toUtf8()).object();
|
||||||
|
cloakConfig.remove(config_key::transport_proto);
|
||||||
|
cloakConfig.insert("ProxyMethod", "shadowsocks");
|
||||||
|
|
||||||
|
setPlainTextEditShareCloakText(QJsonDocument(cloakConfig).toJson());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Full access
|
||||||
|
if (container == DockerContainer::None) {
|
||||||
|
setPageShareFullAccessVisible(true);
|
||||||
|
|
||||||
|
const QJsonObject &server = m_settings.server(m_uiLogic->selectedServerIndex);
|
||||||
|
|
||||||
|
QByteArray ba = QJsonDocument(server).toJson().toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
||||||
|
|
||||||
|
setTextEditShareFullCodeText(QString("vpn://%1").arg(QString(ba)));
|
||||||
|
setToolBoxShareConnectionCurrentIndex(full_access);
|
||||||
|
}
|
||||||
|
|
||||||
|
//ui->toolBox_share_connection->addItem(ui->page_share_amnezia, tr(" Share for Amnezia client"));
|
||||||
|
|
||||||
|
// Amnezia sharing
|
||||||
|
// QJsonObject exportContainer;
|
||||||
|
// for (Protocol p: protocolsForContainer(container)) {
|
||||||
|
// QJsonObject protocolConfig = containerConfig.value(protoToString(p)).toObject();
|
||||||
|
// protocolConfig.remove(config_key::last_config);
|
||||||
|
// exportContainer.insert(protoToString(p), protocolConfig);
|
||||||
|
// }
|
||||||
|
// exportContainer.insert(config_key::container, containerToString(container));
|
||||||
|
|
||||||
|
// ui->textEdit_share_amnezia_code->setPlainText(QJsonDocument(exportContainer).toJson());
|
||||||
|
|
||||||
|
setTextEditShareAmneziaCodeText(tr(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ShareConnectionLogic::updateQRCodeImage(const QString &text, const std::function<void(const QString&)>& setLabelFunc)
|
||||||
|
{
|
||||||
|
int levelIndex = 1;
|
||||||
|
int versionIndex = 0;
|
||||||
|
bool bExtent = true;
|
||||||
|
int maskIndex = -1;
|
||||||
|
|
||||||
|
m_qrEncode.EncodeData( levelIndex, versionIndex, bExtent, maskIndex, text.toUtf8().data() );
|
||||||
|
|
||||||
|
int qrImageSize = m_qrEncode.m_nSymbleSize;
|
||||||
|
|
||||||
|
int encodeImageSize = qrImageSize + ( QR_MARGIN * 2 );
|
||||||
|
QImage encodeImage( encodeImageSize, encodeImageSize, QImage::Format_Mono );
|
||||||
|
|
||||||
|
encodeImage.fill( 1 );
|
||||||
|
|
||||||
|
for ( int i = 0; i < qrImageSize; i++ )
|
||||||
|
for ( int j = 0; j < qrImageSize; j++ )
|
||||||
|
if ( m_qrEncode.m_byModuleData[i][j] )
|
||||||
|
encodeImage.setPixel( i + QR_MARGIN, j + QR_MARGIN, 0 );
|
||||||
|
|
||||||
|
QByteArray byteArray;
|
||||||
|
QBuffer buffer(&byteArray);
|
||||||
|
encodeImage.save(&buffer, "PNG"); // writes the image in PNG format inside the buffer
|
||||||
|
QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data());
|
||||||
|
|
||||||
|
setLabelFunc(iconBase64);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "../pages.h"
|
#include "../pages.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "3rd/QRCodeGenerator/QRCodeGenerator.h"
|
||||||
|
|
||||||
class UiLogic;
|
class UiLogic;
|
||||||
|
|
||||||
|
@ -10,13 +11,150 @@ class ShareConnectionLogic: public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
Q_PROPERTY(bool pageShareAmneziaVisible READ getPageShareAmneziaVisible WRITE setPageShareAmneziaVisible NOTIFY pageShareAmneziaVisibleChanged)
|
||||||
|
Q_PROPERTY(bool pageShareOpenvpnVisible READ getPageShareOpenvpnVisible WRITE setPageShareOpenvpnVisible NOTIFY pageShareOpenvpnVisibleChanged)
|
||||||
|
Q_PROPERTY(bool pageShareShadowsocksVisible READ getPageShareShadowsocksVisible WRITE setPageShareShadowsocksVisible NOTIFY pageShareShadowsocksVisibleChanged)
|
||||||
|
Q_PROPERTY(bool pageShareCloakVisible READ getPageShareCloakVisible WRITE setPageShareCloakVisible NOTIFY pageShareCloakVisibleChanged)
|
||||||
|
Q_PROPERTY(bool pageShareFullAccessVisible READ getPageShareFullAccessVisible WRITE setPageShareFullAccessVisible NOTIFY pageShareFullAccessVisibleChanged)
|
||||||
|
Q_PROPERTY(QString textEditShareOpenvpnCodeText READ getTextEditShareOpenvpnCodeText WRITE setTextEditShareOpenvpnCodeText NOTIFY textEditShareOpenvpnCodeTextChanged)
|
||||||
|
Q_PROPERTY(bool pushButtonShareOpenvpnCopyEnabled READ getPushButtonShareOpenvpnCopyEnabled WRITE setPushButtonShareOpenvpnCopyEnabled NOTIFY pushButtonShareOpenvpnCopyEnabledChanged)
|
||||||
|
Q_PROPERTY(bool pushButtonShareOpenvpnSaveEnabled READ getPushButtonShareOpenvpnSaveEnabled WRITE setPushButtonShareOpenvpnSaveEnabled NOTIFY pushButtonShareOpenvpnSaveEnabledChanged)
|
||||||
|
Q_PROPERTY(int toolBoxShareConnectionCurrentIndex READ getToolBoxShareConnectionCurrentIndex WRITE setToolBoxShareConnectionCurrentIndex NOTIFY toolBoxShareConnectionCurrentIndexChanged)
|
||||||
|
Q_PROPERTY(bool pushButtonShareSsCopyEnabled READ getPushButtonShareSsCopyEnabled WRITE setPushButtonShareSsCopyEnabled NOTIFY pushButtonShareSsCopyEnabledChanged)
|
||||||
|
Q_PROPERTY(QString lineEditShareSsStringText READ getLineEditShareSsStringText WRITE setLineEditShareSsStringText NOTIFY lineEditShareSsStringTextChanged)
|
||||||
|
Q_PROPERTY(QString labelShareSsQrCodeText READ getLabelShareSsQrCodeText WRITE setLabelShareSsQrCodeText NOTIFY labelShareSsQrCodeTextChanged)
|
||||||
|
Q_PROPERTY(QString labelShareSsServerText READ getLabelShareSsServerText WRITE setLabelShareSsServerText NOTIFY labelShareSsServerTextChanged)
|
||||||
|
Q_PROPERTY(QString labelShareSsPortText READ getLabelShareSsPortText WRITE setLabelShareSsPortText NOTIFY labelShareSsPortTextChanged)
|
||||||
|
Q_PROPERTY(QString labelShareSsMethodText READ getLabelShareSsMethodText WRITE setLabelShareSsMethodText NOTIFY labelShareSsMethodTextChanged)
|
||||||
|
Q_PROPERTY(QString labelShareSsPasswordText READ getLabelShareSsPasswordText WRITE setLabelShareSsPasswordText NOTIFY labelShareSsPasswordTextChanged)
|
||||||
|
Q_PROPERTY(QString plainTextEditShareCloakText READ getPlainTextEditShareCloakText WRITE setPlainTextEditShareCloakText NOTIFY plainTextEditShareCloakTextChanged)
|
||||||
|
Q_PROPERTY(bool pushButtonShareCloakCopyEnabled READ getPushButtonShareCloakCopyEnabled WRITE setPushButtonShareCloakCopyEnabled NOTIFY pushButtonShareCloakCopyEnabledChanged)
|
||||||
|
Q_PROPERTY(QString textEditShareFullCodeText READ getTextEditShareFullCodeText WRITE setTextEditShareFullCodeText NOTIFY textEditShareFullCodeTextChanged)
|
||||||
|
Q_PROPERTY(QString textEditShareAmneziaCodeText READ getTextEditShareAmneziaCodeText WRITE setTextEditShareAmneziaCodeText NOTIFY textEditShareAmneziaCodeTextChanged)
|
||||||
|
Q_PROPERTY(QString pushButtonShareFullCopyText READ getPushButtonShareFullCopyText WRITE setPushButtonShareFullCopyText NOTIFY pushButtonShareFullCopyTextChanged)
|
||||||
|
Q_PROPERTY(QString pushButtonShareAmneziaCopyText READ getPushButtonShareAmneziaCopyText WRITE setPushButtonShareAmneziaCopyText NOTIFY pushButtonShareAmneziaCopyTextChanged)
|
||||||
|
Q_PROPERTY(QString pushButtonShareOpenvpnCopyText READ getPushButtonShareOpenvpnCopyText WRITE setPushButtonShareOpenvpnCopyText NOTIFY pushButtonShareOpenvpnCopyTextChanged)
|
||||||
|
Q_PROPERTY(QString pushButtonShareSsCopyText READ getPushButtonShareSsCopyText WRITE setPushButtonShareSsCopyText NOTIFY pushButtonShareSsCopyTextChanged)
|
||||||
|
Q_PROPERTY(QString pushButtonShareCloakCopyText READ getPushButtonShareCloakCopyText WRITE setPushButtonShareCloakCopyText NOTIFY pushButtonShareCloakCopyTextChanged)
|
||||||
|
Q_PROPERTY(bool pushButtonShareAmneziaGenerateEnabled READ getPushButtonShareAmneziaGenerateEnabled WRITE setPushButtonShareAmneziaGenerateEnabled NOTIFY pushButtonShareAmneziaGenerateEnabledChanged)
|
||||||
|
Q_PROPERTY(bool pushButtonShareAmneziaCopyEnabled READ getPushButtonShareAmneziaCopyEnabled WRITE setPushButtonShareAmneziaCopyEnabled NOTIFY pushButtonShareAmneziaCopyEnabledChanged)
|
||||||
|
Q_PROPERTY(QString pushButtonShareAmneziaGenerateText READ getPushButtonShareAmneziaGenerateText WRITE setPushButtonShareAmneziaGenerateText NOTIFY pushButtonShareAmneziaGenerateTextChanged)
|
||||||
|
Q_PROPERTY(bool pushButtonShareOpenvpnGenerateEnabled READ getPushButtonShareOpenvpnGenerateEnabled WRITE setPushButtonShareOpenvpnGenerateEnabled NOTIFY pushButtonShareOpenvpnGenerateEnabledChanged)
|
||||||
|
Q_PROPERTY(QString pushButtonShareOpenvpnGenerateText READ getPushButtonShareOpenvpnGenerateText WRITE setPushButtonShareOpenvpnGenerateText NOTIFY pushButtonShareOpenvpnGenerateTextChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ShareConnectionLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
explicit ShareConnectionLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||||
~ShareConnectionLogic() = default;
|
~ShareConnectionLogic() = default;
|
||||||
|
|
||||||
|
void updateSharingPage(int serverIndex, const ServerCredentials &credentials,
|
||||||
|
DockerContainer container);
|
||||||
|
void updateQRCodeImage(const QString &text, const std::function<void(const QString&)>& setLabelFunc);
|
||||||
|
|
||||||
|
bool getPageShareAmneziaVisible() const;
|
||||||
|
void setPageShareAmneziaVisible(bool pageShareAmneziaVisible);
|
||||||
|
bool getPageShareOpenvpnVisible() const;
|
||||||
|
void setPageShareOpenvpnVisible(bool pageShareOpenvpnVisible);
|
||||||
|
bool getPageShareShadowsocksVisible() const;
|
||||||
|
void setPageShareShadowsocksVisible(bool pageShareShadowsocksVisible);
|
||||||
|
bool getPageShareCloakVisible() const;
|
||||||
|
void setPageShareCloakVisible(bool pageShareCloakVisible);
|
||||||
|
bool getPageShareFullAccessVisible() const;
|
||||||
|
void setPageShareFullAccessVisible(bool pageShareFullAccessVisible);
|
||||||
|
QString getTextEditShareOpenvpnCodeText() const;
|
||||||
|
void setTextEditShareOpenvpnCodeText(const QString &textEditShareOpenvpnCodeText);
|
||||||
|
bool getPushButtonShareOpenvpnCopyEnabled() const;
|
||||||
|
void setPushButtonShareOpenvpnCopyEnabled(bool pushButtonShareOpenvpnCopyEnabled);
|
||||||
|
bool getPushButtonShareOpenvpnSaveEnabled() const;
|
||||||
|
void setPushButtonShareOpenvpnSaveEnabled(bool pushButtonShareOpenvpnSaveEnabled);
|
||||||
|
int getToolBoxShareConnectionCurrentIndex() const;
|
||||||
|
void setToolBoxShareConnectionCurrentIndex(int toolBoxShareConnectionCurrentIndex);
|
||||||
|
bool getPushButtonShareSsCopyEnabled() const;
|
||||||
|
void setPushButtonShareSsCopyEnabled(bool pushButtonShareSsCopyEnabled);
|
||||||
|
QString getLineEditShareSsStringText() const;
|
||||||
|
void setLineEditShareSsStringText(const QString &lineEditShareSsStringText);
|
||||||
|
QString getLabelShareSsQrCodeText() const;
|
||||||
|
void setLabelShareSsQrCodeText(const QString &labelShareSsQrCodeText);
|
||||||
|
QString getLabelShareSsServerText() const;
|
||||||
|
void setLabelShareSsServerText(const QString &labelShareSsServerText);
|
||||||
|
QString getLabelShareSsPortText() const;
|
||||||
|
void setLabelShareSsPortText(const QString &labelShareSsPortText);
|
||||||
|
QString getLabelShareSsMethodText() const;
|
||||||
|
void setLabelShareSsMethodText(const QString &labelShareSsMethodText);
|
||||||
|
QString getLabelShareSsPasswordText() const;
|
||||||
|
void setLabelShareSsPasswordText(const QString &labelShareSsPasswordText);
|
||||||
|
QString getPlainTextEditShareCloakText() const;
|
||||||
|
void setPlainTextEditShareCloakText(const QString &plainTextEditShareCloakText);
|
||||||
|
bool getPushButtonShareCloakCopyEnabled() const;
|
||||||
|
void setPushButtonShareCloakCopyEnabled(bool pushButtonShareCloakCopyEnabled);
|
||||||
|
QString getTextEditShareFullCodeText() const;
|
||||||
|
void setTextEditShareFullCodeText(const QString &textEditShareFullCodeText);
|
||||||
|
QString getTextEditShareAmneziaCodeText() const;
|
||||||
|
void setTextEditShareAmneziaCodeText(const QString &textEditShareAmneziaCodeText);
|
||||||
|
QString getPushButtonShareFullCopyText() const;
|
||||||
|
void setPushButtonShareFullCopyText(const QString &pushButtonShareFullCopyText);
|
||||||
|
QString getPushButtonShareAmneziaCopyText() const;
|
||||||
|
void setPushButtonShareAmneziaCopyText(const QString &pushButtonShareAmneziaCopyText);
|
||||||
|
QString getPushButtonShareOpenvpnCopyText() const;
|
||||||
|
void setPushButtonShareOpenvpnCopyText(const QString &pushButtonShareOpenvpnCopyText);
|
||||||
|
QString getPushButtonShareSsCopyText() const;
|
||||||
|
void setPushButtonShareSsCopyText(const QString &pushButtonShareSsCopyText);
|
||||||
|
QString getPushButtonShareCloakCopyText() const;
|
||||||
|
void setPushButtonShareCloakCopyText(const QString &pushButtonShareCloakCopyText);
|
||||||
|
bool getPushButtonShareAmneziaGenerateEnabled() const;
|
||||||
|
void setPushButtonShareAmneziaGenerateEnabled(bool pushButtonShareAmneziaGenerateEnabled);
|
||||||
|
bool getPushButtonShareAmneziaCopyEnabled() const;
|
||||||
|
void setPushButtonShareAmneziaCopyEnabled(bool pushButtonShareAmneziaCopyEnabled);
|
||||||
|
QString getPushButtonShareAmneziaGenerateText() const;
|
||||||
|
void setPushButtonShareAmneziaGenerateText(const QString &pushButtonShareAmneziaGenerateText);
|
||||||
|
bool getPushButtonShareOpenvpnGenerateEnabled() const;
|
||||||
|
void setPushButtonShareOpenvpnGenerateEnabled(bool pushButtonShareOpenvpnGenerateEnabled);
|
||||||
|
QString getPushButtonShareOpenvpnGenerateText() const;
|
||||||
|
void setPushButtonShareOpenvpnGenerateText(const QString &pushButtonShareOpenvpnGenerateText);
|
||||||
|
|
||||||
|
|
||||||
|
Q_INVOKABLE void onPushButtonShareFullCopyClicked();
|
||||||
|
Q_INVOKABLE void onPushButtonShareFullSaveClicked();
|
||||||
|
Q_INVOKABLE void onPushButtonShareAmneziaCopyClicked();
|
||||||
|
Q_INVOKABLE void onPushButtonShareAmneziaSaveClicked();
|
||||||
|
Q_INVOKABLE void onPushButtonShareOpenvpnCopyClicked();
|
||||||
|
Q_INVOKABLE void onPushButtonShareSsCopyClicked();
|
||||||
|
Q_INVOKABLE void onPushButtonShareCloakCopyClicked();
|
||||||
|
Q_INVOKABLE void onPushButtonShareAmneziaGenerateClicked();
|
||||||
|
Q_INVOKABLE void onPushButtonShareOpenvpnGenerateClicked();
|
||||||
|
Q_INVOKABLE void onPushButtonShareOpenvpnSaveClicked();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void pageShareAmneziaVisibleChanged();
|
||||||
|
void pageShareOpenvpnVisibleChanged();
|
||||||
|
void pageShareShadowsocksVisibleChanged();
|
||||||
|
void pageShareCloakVisibleChanged();
|
||||||
|
void pageShareFullAccessVisibleChanged();
|
||||||
|
void textEditShareOpenvpnCodeTextChanged();
|
||||||
|
void pushButtonShareOpenvpnCopyEnabledChanged();
|
||||||
|
void pushButtonShareOpenvpnSaveEnabledChanged();
|
||||||
|
void toolBoxShareConnectionCurrentIndexChanged();
|
||||||
|
void pushButtonShareSsCopyEnabledChanged();
|
||||||
|
void lineEditShareSsStringTextChanged();
|
||||||
|
void labelShareSsQrCodeTextChanged();
|
||||||
|
void labelShareSsServerTextChanged();
|
||||||
|
void labelShareSsPortTextChanged();
|
||||||
|
void labelShareSsMethodTextChanged();
|
||||||
|
void labelShareSsPasswordTextChanged();
|
||||||
|
void plainTextEditShareCloakTextChanged();
|
||||||
|
void pushButtonShareCloakCopyEnabledChanged();
|
||||||
|
void textEditShareFullCodeTextChanged();
|
||||||
|
void textEditShareAmneziaCodeTextChanged();
|
||||||
|
void pushButtonShareFullCopyTextChanged();
|
||||||
|
void pushButtonShareAmneziaCopyTextChanged();
|
||||||
|
void pushButtonShareOpenvpnCopyTextChanged();
|
||||||
|
void pushButtonShareSsCopyTextChanged();
|
||||||
|
void pushButtonShareCloakCopyTextChanged();
|
||||||
|
void pushButtonShareAmneziaGenerateEnabledChanged();
|
||||||
|
void pushButtonShareAmneziaCopyEnabledChanged();
|
||||||
|
void pushButtonShareAmneziaGenerateTextChanged();
|
||||||
|
void pushButtonShareOpenvpnGenerateEnabledChanged();
|
||||||
|
void pushButtonShareOpenvpnGenerateTextChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -28,8 +166,38 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Settings m_settings;
|
Settings m_settings;
|
||||||
UiLogic *m_uiLogic;
|
UiLogic *m_uiLogic;
|
||||||
|
CQR_Encode m_qrEncode;
|
||||||
|
|
||||||
|
bool m_pageShareAmneziaVisible;
|
||||||
|
bool m_pageShareOpenvpnVisible;
|
||||||
|
bool m_pageShareShadowsocksVisible;
|
||||||
|
bool m_pageShareCloakVisible;
|
||||||
|
bool m_pageShareFullAccessVisible;
|
||||||
|
QString m_textEditShareOpenvpnCodeText;
|
||||||
|
bool m_pushButtonShareOpenvpnCopyEnabled;
|
||||||
|
bool m_pushButtonShareOpenvpnSaveEnabled;
|
||||||
|
int m_toolBoxShareConnectionCurrentIndex;
|
||||||
|
bool m_pushButtonShareSsCopyEnabled;
|
||||||
|
QString m_lineEditShareSsStringText;
|
||||||
|
QString m_labelShareSsQrCodeText;
|
||||||
|
QString m_labelShareSsServerText;
|
||||||
|
QString m_labelShareSsPortText;
|
||||||
|
QString m_labelShareSsMethodText;
|
||||||
|
QString m_labelShareSsPasswordText;
|
||||||
|
QString m_plainTextEditShareCloakText;
|
||||||
|
bool m_pushButtonShareCloakCopyEnabled;
|
||||||
|
QString m_textEditShareFullCodeText;
|
||||||
|
QString m_textEditShareAmneziaCodeText;
|
||||||
|
QString m_pushButtonShareFullCopyText;
|
||||||
|
QString m_pushButtonShareAmneziaCopyText;
|
||||||
|
QString m_pushButtonShareOpenvpnCopyText;
|
||||||
|
QString m_pushButtonShareSsCopyText;
|
||||||
|
QString m_pushButtonShareCloakCopyText;
|
||||||
|
bool m_pushButtonShareAmneziaGenerateEnabled;
|
||||||
|
bool m_pushButtonShareAmneziaCopyEnabled;
|
||||||
|
QString m_pushButtonShareAmneziaGenerateText;
|
||||||
|
bool m_pushButtonShareOpenvpnGenerateEnabled;
|
||||||
|
QString m_pushButtonShareOpenvpnGenerateText;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // SHARE_CONNECTION_LOGIC_H
|
#endif // SHARE_CONNECTION_LOGIC_H
|
||||||
|
|
|
@ -71,7 +71,7 @@ Item {
|
||||||
y: 80
|
y: 80
|
||||||
width: 251
|
width: 251
|
||||||
height: 31
|
height: 31
|
||||||
text: UiLoServerSettingsLogicgic.lineEditServerSettingsDescriptionText
|
text: ServerSettingsLogic.lineEditServerSettingsDescriptionText
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
ServerSettingsLogic.lineEditServerSettingsDescriptionText = text
|
ServerSettingsLogic.lineEditServerSettingsDescriptionText = text
|
||||||
ServerSettingsLogic.onLineEditServerSettingsDescriptionEditingFinished()
|
ServerSettingsLogic.onLineEditServerSettingsDescriptionEditingFinished()
|
||||||
|
@ -116,7 +116,7 @@ Item {
|
||||||
height: 40
|
height: 40
|
||||||
text: qsTr("VPN protocols")
|
text: qsTr("VPN protocols")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
ServerSettingsLogic.goToPage(PageEnum.ServerVpnProtocols)
|
UiLogic.goToPage(PageEnum.ServerVpnProtocols)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BlueButtonType {
|
BlueButtonType {
|
||||||
|
|
|
@ -156,36 +156,6 @@ UiLogic::UiLogic(QObject *parent) :
|
||||||
m_pushButtonNewServerConnectEnabled{},
|
m_pushButtonNewServerConnectEnabled{},
|
||||||
m_pushButtonNewServerConnectText{tr("Connect")},
|
m_pushButtonNewServerConnectText{tr("Connect")},
|
||||||
m_dialogConnectErrorText{},
|
m_dialogConnectErrorText{},
|
||||||
m_pageShareAmneziaVisible{true},
|
|
||||||
m_pageShareOpenvpnVisible{true},
|
|
||||||
m_pageShareShadowsocksVisible{true},
|
|
||||||
m_pageShareCloakVisible{true},
|
|
||||||
m_pageShareFullAccessVisible{true},
|
|
||||||
m_textEditShareOpenvpnCodeText{},
|
|
||||||
m_pushButtonShareOpenvpnCopyEnabled{false},
|
|
||||||
m_pushButtonShareOpenvpnSaveEnabled{false},
|
|
||||||
m_toolBoxShareConnectionCurrentIndex{-1},
|
|
||||||
m_pushButtonShareSsCopyEnabled{false},
|
|
||||||
m_lineEditShareSsStringText{},
|
|
||||||
m_labelShareSsQrCodeText{},
|
|
||||||
m_labelShareSsServerText{},
|
|
||||||
m_labelShareSsPortText{},
|
|
||||||
m_labelShareSsMethodText{},
|
|
||||||
m_labelShareSsPasswordText{},
|
|
||||||
m_plainTextEditShareCloakText{},
|
|
||||||
m_pushButtonShareCloakCopyEnabled{false},
|
|
||||||
m_textEditShareFullCodeText{},
|
|
||||||
m_textEditShareAmneziaCodeText{},
|
|
||||||
m_pushButtonShareFullCopyText{tr("Copy")},
|
|
||||||
m_pushButtonShareAmneziaCopyText{tr("Copy")},
|
|
||||||
m_pushButtonShareOpenvpnCopyText{tr("Copy")},
|
|
||||||
m_pushButtonShareSsCopyText{tr("Copy")},
|
|
||||||
m_pushButtonShareCloakCopyText{tr("Copy")},
|
|
||||||
m_pushButtonShareAmneziaGenerateEnabled{true},
|
|
||||||
m_pushButtonShareAmneziaCopyEnabled{true},
|
|
||||||
m_pushButtonShareAmneziaGenerateText{tr("Generate config")},
|
|
||||||
m_pushButtonShareOpenvpnGenerateEnabled{true},
|
|
||||||
m_pushButtonShareOpenvpnGenerateText{tr("Generate config")},
|
|
||||||
m_pageNewServerConfiguringEnabled{true},
|
m_pageNewServerConfiguringEnabled{true},
|
||||||
m_labelNewServerConfiguringWaitInfoVisible{true},
|
m_labelNewServerConfiguringWaitInfoVisible{true},
|
||||||
m_labelNewServerConfiguringWaitInfoText{tr("Please wait, configuring process may take up to 5 minutes")},
|
m_labelNewServerConfiguringWaitInfoText{tr("Please wait, configuring process may take up to 5 minutes")},
|
||||||
|
@ -257,7 +227,6 @@ void UiLogic::initalizeUiLogic()
|
||||||
}
|
}
|
||||||
|
|
||||||
// //ui->pushButton_general_settings_exit->hide();
|
// //ui->pushButton_general_settings_exit->hide();
|
||||||
updateSharingPage(selectedServerIndex, m_settings.serverCredentials(selectedServerIndex), selectedDockerContainer);
|
|
||||||
|
|
||||||
|
|
||||||
qInfo().noquote() << QString("Started %1 version %2").arg(APPLICATION_NAME).arg(APP_VERSION);
|
qInfo().noquote() << QString("Started %1 version %2").arg(APPLICATION_NAME).arg(APP_VERSION);
|
||||||
|
@ -1660,394 +1629,7 @@ void UiLogic::setDialogConnectErrorText(const QString &dialogConnectErrorText)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool UiLogic::getPageShareAmneziaVisible() const
|
|
||||||
{
|
|
||||||
return m_pageShareAmneziaVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPageShareAmneziaVisible(bool pageShareAmneziaVisible)
|
|
||||||
{
|
|
||||||
if (m_pageShareAmneziaVisible != pageShareAmneziaVisible) {
|
|
||||||
m_pageShareAmneziaVisible = pageShareAmneziaVisible;
|
|
||||||
emit pageShareAmneziaVisibleChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPageShareOpenvpnVisible() const
|
|
||||||
{
|
|
||||||
return m_pageShareOpenvpnVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPageShareOpenvpnVisible(bool pageShareOpenvpnVisible)
|
|
||||||
{
|
|
||||||
if (m_pageShareOpenvpnVisible != pageShareOpenvpnVisible) {
|
|
||||||
m_pageShareOpenvpnVisible = pageShareOpenvpnVisible;
|
|
||||||
emit pageShareOpenvpnVisibleChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPageShareShadowsocksVisible() const
|
|
||||||
{
|
|
||||||
return m_pageShareShadowsocksVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPageShareShadowsocksVisible(bool pageShareShadowsocksVisible)
|
|
||||||
{
|
|
||||||
if (m_pageShareShadowsocksVisible != pageShareShadowsocksVisible) {
|
|
||||||
m_pageShareShadowsocksVisible = pageShareShadowsocksVisible;
|
|
||||||
emit pageShareShadowsocksVisibleChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPageShareCloakVisible() const
|
|
||||||
{
|
|
||||||
return m_pageShareCloakVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPageShareCloakVisible(bool pageShareCloakVisible)
|
|
||||||
{
|
|
||||||
if (m_pageShareCloakVisible != pageShareCloakVisible) {
|
|
||||||
m_pageShareCloakVisible = pageShareCloakVisible;
|
|
||||||
emit pageShareCloakVisibleChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPageShareFullAccessVisible() const
|
|
||||||
{
|
|
||||||
return m_pageShareFullAccessVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPageShareFullAccessVisible(bool pageShareFullAccessVisible)
|
|
||||||
{
|
|
||||||
if (m_pageShareFullAccessVisible != pageShareFullAccessVisible) {
|
|
||||||
m_pageShareFullAccessVisible = pageShareFullAccessVisible;
|
|
||||||
emit pageShareFullAccessVisibleChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getTextEditShareOpenvpnCodeText() const
|
|
||||||
{
|
|
||||||
return m_textEditShareOpenvpnCodeText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setTextEditShareOpenvpnCodeText(const QString &textEditShareOpenvpnCodeText)
|
|
||||||
{
|
|
||||||
if (m_textEditShareOpenvpnCodeText != textEditShareOpenvpnCodeText) {
|
|
||||||
m_textEditShareOpenvpnCodeText = textEditShareOpenvpnCodeText;
|
|
||||||
emit textEditShareOpenvpnCodeTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPushButtonShareOpenvpnCopyEnabled() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareOpenvpnCopyEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareOpenvpnCopyEnabled(bool pushButtonShareOpenvpnCopyEnabled)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareOpenvpnCopyEnabled != pushButtonShareOpenvpnCopyEnabled) {
|
|
||||||
m_pushButtonShareOpenvpnCopyEnabled = pushButtonShareOpenvpnCopyEnabled;
|
|
||||||
emit pushButtonShareOpenvpnCopyEnabledChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPushButtonShareOpenvpnSaveEnabled() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareOpenvpnSaveEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareOpenvpnSaveEnabled(bool pushButtonShareOpenvpnSaveEnabled)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareOpenvpnSaveEnabled != pushButtonShareOpenvpnSaveEnabled) {
|
|
||||||
m_pushButtonShareOpenvpnSaveEnabled = pushButtonShareOpenvpnSaveEnabled;
|
|
||||||
emit pushButtonShareOpenvpnSaveEnabledChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int UiLogic::getToolBoxShareConnectionCurrentIndex() const
|
|
||||||
{
|
|
||||||
return m_toolBoxShareConnectionCurrentIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setToolBoxShareConnectionCurrentIndex(int toolBoxShareConnectionCurrentIndex)
|
|
||||||
{
|
|
||||||
if (m_toolBoxShareConnectionCurrentIndex != toolBoxShareConnectionCurrentIndex) {
|
|
||||||
m_toolBoxShareConnectionCurrentIndex = toolBoxShareConnectionCurrentIndex;
|
|
||||||
emit toolBoxShareConnectionCurrentIndexChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPushButtonShareSsCopyEnabled() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareSsCopyEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareSsCopyEnabled(bool pushButtonShareSsCopyEnabled)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareSsCopyEnabled != pushButtonShareSsCopyEnabled) {
|
|
||||||
m_pushButtonShareSsCopyEnabled = pushButtonShareSsCopyEnabled;
|
|
||||||
emit pushButtonShareSsCopyEnabledChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getLineEditShareSsStringText() const
|
|
||||||
{
|
|
||||||
return m_lineEditShareSsStringText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setLineEditShareSsStringText(const QString &lineEditShareSsStringText)
|
|
||||||
{
|
|
||||||
if (m_lineEditShareSsStringText != lineEditShareSsStringText) {
|
|
||||||
m_lineEditShareSsStringText = lineEditShareSsStringText;
|
|
||||||
emit lineEditShareSsStringTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getLabelShareSsQrCodeText() const
|
|
||||||
{
|
|
||||||
return m_labelShareSsQrCodeText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setLabelShareSsQrCodeText(const QString &labelShareSsQrCodeText)
|
|
||||||
{
|
|
||||||
if (m_labelShareSsQrCodeText != labelShareSsQrCodeText) {
|
|
||||||
m_labelShareSsQrCodeText = labelShareSsQrCodeText;
|
|
||||||
emit labelShareSsQrCodeTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getLabelShareSsServerText() const
|
|
||||||
{
|
|
||||||
return m_labelShareSsServerText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setLabelShareSsServerText(const QString &labelShareSsServerText)
|
|
||||||
{
|
|
||||||
if (m_labelShareSsServerText != labelShareSsServerText) {
|
|
||||||
m_labelShareSsServerText = labelShareSsServerText;
|
|
||||||
emit labelShareSsServerTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getLabelShareSsPortText() const
|
|
||||||
{
|
|
||||||
return m_labelShareSsPortText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setLabelShareSsPortText(const QString &labelShareSsPortText)
|
|
||||||
{
|
|
||||||
if (m_labelShareSsPortText != labelShareSsPortText) {
|
|
||||||
m_labelShareSsPortText = labelShareSsPortText;
|
|
||||||
emit labelShareSsPortTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getLabelShareSsMethodText() const
|
|
||||||
{
|
|
||||||
return m_labelShareSsMethodText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setLabelShareSsMethodText(const QString &labelShareSsMethodText)
|
|
||||||
{
|
|
||||||
if (m_labelShareSsMethodText != labelShareSsMethodText) {
|
|
||||||
m_labelShareSsMethodText = labelShareSsMethodText;
|
|
||||||
emit labelShareSsMethodTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getLabelShareSsPasswordText() const
|
|
||||||
{
|
|
||||||
return m_labelShareSsPasswordText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setLabelShareSsPasswordText(const QString &labelShareSsPasswordText)
|
|
||||||
{
|
|
||||||
if (m_labelShareSsPasswordText != labelShareSsPasswordText) {
|
|
||||||
m_labelShareSsPasswordText = labelShareSsPasswordText;
|
|
||||||
emit labelShareSsPasswordTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getPlainTextEditShareCloakText() const
|
|
||||||
{
|
|
||||||
return m_plainTextEditShareCloakText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPlainTextEditShareCloakText(const QString &plainTextEditShareCloakText)
|
|
||||||
{
|
|
||||||
if (m_plainTextEditShareCloakText != plainTextEditShareCloakText) {
|
|
||||||
m_plainTextEditShareCloakText = plainTextEditShareCloakText;
|
|
||||||
emit plainTextEditShareCloakTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPushButtonShareCloakCopyEnabled() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareCloakCopyEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareCloakCopyEnabled(bool pushButtonShareCloakCopyEnabled)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareCloakCopyEnabled != pushButtonShareCloakCopyEnabled) {
|
|
||||||
m_pushButtonShareCloakCopyEnabled = pushButtonShareCloakCopyEnabled;
|
|
||||||
emit pushButtonShareCloakCopyEnabledChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getTextEditShareFullCodeText() const
|
|
||||||
{
|
|
||||||
return m_textEditShareFullCodeText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setTextEditShareFullCodeText(const QString &textEditShareFullCodeText)
|
|
||||||
{
|
|
||||||
if (m_textEditShareFullCodeText != textEditShareFullCodeText) {
|
|
||||||
m_textEditShareFullCodeText = textEditShareFullCodeText;
|
|
||||||
emit textEditShareFullCodeTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getTextEditShareAmneziaCodeText() const
|
|
||||||
{
|
|
||||||
return m_textEditShareAmneziaCodeText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setTextEditShareAmneziaCodeText(const QString &textEditShareAmneziaCodeText)
|
|
||||||
{
|
|
||||||
if (m_textEditShareAmneziaCodeText != textEditShareAmneziaCodeText) {
|
|
||||||
m_textEditShareAmneziaCodeText = textEditShareAmneziaCodeText;
|
|
||||||
emit textEditShareAmneziaCodeTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getPushButtonShareFullCopyText() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareFullCopyText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareFullCopyText(const QString &pushButtonShareFullCopyText)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareFullCopyText != pushButtonShareFullCopyText) {
|
|
||||||
m_pushButtonShareFullCopyText = pushButtonShareFullCopyText;
|
|
||||||
emit pushButtonShareFullCopyTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QString UiLogic::getPushButtonShareAmneziaCopyText() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareAmneziaCopyText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareAmneziaCopyText(const QString &pushButtonShareAmneziaCopyText)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareAmneziaCopyText != pushButtonShareAmneziaCopyText) {
|
|
||||||
m_pushButtonShareAmneziaCopyText = pushButtonShareAmneziaCopyText;
|
|
||||||
emit pushButtonShareAmneziaCopyTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getPushButtonShareOpenvpnCopyText() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareOpenvpnCopyText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareOpenvpnCopyText(const QString &pushButtonShareOpenvpnCopyText)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareOpenvpnCopyText != pushButtonShareOpenvpnCopyText) {
|
|
||||||
m_pushButtonShareOpenvpnCopyText = pushButtonShareOpenvpnCopyText;
|
|
||||||
emit pushButtonShareOpenvpnCopyTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getPushButtonShareSsCopyText() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareSsCopyText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareSsCopyText(const QString &pushButtonShareSsCopyText)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareSsCopyText != pushButtonShareSsCopyText) {
|
|
||||||
m_pushButtonShareSsCopyText = pushButtonShareSsCopyText;
|
|
||||||
emit pushButtonShareSsCopyTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getPushButtonShareCloakCopyText() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareCloakCopyText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareCloakCopyText(const QString &pushButtonShareCloakCopyText)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareCloakCopyText != pushButtonShareCloakCopyText) {
|
|
||||||
m_pushButtonShareCloakCopyText = pushButtonShareCloakCopyText;
|
|
||||||
emit pushButtonShareCloakCopyTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPushButtonShareAmneziaGenerateEnabled() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareAmneziaGenerateEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareAmneziaGenerateEnabled(bool pushButtonShareAmneziaGenerateEnabled)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareAmneziaGenerateEnabled != pushButtonShareAmneziaGenerateEnabled) {
|
|
||||||
m_pushButtonShareAmneziaGenerateEnabled = pushButtonShareAmneziaGenerateEnabled;
|
|
||||||
emit pushButtonShareAmneziaGenerateEnabledChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPushButtonShareAmneziaCopyEnabled() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareAmneziaCopyEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareAmneziaCopyEnabled(bool pushButtonShareAmneziaCopyEnabled)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareAmneziaCopyEnabled != pushButtonShareAmneziaCopyEnabled) {
|
|
||||||
m_pushButtonShareAmneziaCopyEnabled = pushButtonShareAmneziaCopyEnabled;
|
|
||||||
emit pushButtonShareAmneziaCopyEnabledChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getPushButtonShareAmneziaGenerateText() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareAmneziaGenerateText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareAmneziaGenerateText(const QString &pushButtonShareAmneziaGenerateText)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareAmneziaGenerateText != pushButtonShareAmneziaGenerateText) {
|
|
||||||
m_pushButtonShareAmneziaGenerateText = pushButtonShareAmneziaGenerateText;
|
|
||||||
emit pushButtonShareAmneziaGenerateTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPushButtonShareOpenvpnGenerateEnabled() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareOpenvpnGenerateEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareOpenvpnGenerateEnabled(bool pushButtonShareOpenvpnGenerateEnabled)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareOpenvpnGenerateEnabled != pushButtonShareOpenvpnGenerateEnabled) {
|
|
||||||
m_pushButtonShareOpenvpnGenerateEnabled = pushButtonShareOpenvpnGenerateEnabled;
|
|
||||||
emit pushButtonShareOpenvpnGenerateEnabledChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString UiLogic::getPushButtonShareOpenvpnGenerateText() const
|
|
||||||
{
|
|
||||||
return m_pushButtonShareOpenvpnGenerateText;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::setPushButtonShareOpenvpnGenerateText(const QString &pushButtonShareOpenvpnGenerateText)
|
|
||||||
{
|
|
||||||
if (m_pushButtonShareOpenvpnGenerateText != pushButtonShareOpenvpnGenerateText) {
|
|
||||||
m_pushButtonShareOpenvpnGenerateText = pushButtonShareOpenvpnGenerateText;
|
|
||||||
emit pushButtonShareOpenvpnGenerateTextChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UiLogic::getPageNewServerConfiguringEnabled() const
|
bool UiLogic::getPageNewServerConfiguringEnabled() const
|
||||||
{
|
{
|
||||||
|
@ -3190,7 +2772,8 @@ void UiLogic::setupProtocolsPageConnections()
|
||||||
DockerContainer container = containers.at(i);
|
DockerContainer container = containers.at(i);
|
||||||
|
|
||||||
connect(this, buttonClickedFunc, [this, container](bool){
|
connect(this, buttonClickedFunc, [this, container](bool){
|
||||||
updateSharingPage(selectedServerIndex, m_settings.serverCredentials(selectedServerIndex), container);
|
// TODO_REFACT
|
||||||
|
//updateSharingPage(selectedServerIndex, m_settings.serverCredentials(selectedServerIndex), container);
|
||||||
goToPage(Page::ShareConnection);
|
goToPage(Page::ShareConnection);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -3292,161 +2875,7 @@ void UiLogic::onDisconnect()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonShareFullCopyClicked()
|
|
||||||
{
|
|
||||||
QGuiApplication::clipboard()->setText(getTextEditShareFullCodeText());
|
|
||||||
setPushButtonShareFullCopyText(tr("Copied"));
|
|
||||||
|
|
||||||
QTimer::singleShot(3000, this, [this]() {
|
|
||||||
setPushButtonShareFullCopyText(tr("Copy"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonShareFullSaveClicked()
|
|
||||||
{
|
|
||||||
if (getTextEditShareFullCodeText().isEmpty()) return;
|
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save AmneziaVPN config"),
|
|
||||||
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.amnezia");
|
|
||||||
QSaveFile save(fileName);
|
|
||||||
save.open(QIODevice::WriteOnly);
|
|
||||||
save.write(getTextEditShareFullCodeText().toUtf8());
|
|
||||||
save.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonShareAmneziaCopyClicked()
|
|
||||||
{
|
|
||||||
if (getTextEditShareAmneziaCodeText().isEmpty()) return;
|
|
||||||
|
|
||||||
QGuiApplication::clipboard()->setText(getTextEditShareAmneziaCodeText());
|
|
||||||
setPushButtonShareAmneziaCopyText(tr("Copied"));
|
|
||||||
|
|
||||||
QTimer::singleShot(3000, this, [this]() {
|
|
||||||
setPushButtonShareAmneziaCopyText(tr("Copy"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonShareAmneziaSaveClicked()
|
|
||||||
{
|
|
||||||
if (getTextEditShareAmneziaCodeText().isEmpty()) return;
|
|
||||||
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save AmneziaVPN config"),
|
|
||||||
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.amnezia");
|
|
||||||
QSaveFile save(fileName);
|
|
||||||
save.open(QIODevice::WriteOnly);
|
|
||||||
save.write(getTextEditShareAmneziaCodeText().toUtf8());
|
|
||||||
save.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonShareOpenvpnCopyClicked()
|
|
||||||
{
|
|
||||||
QGuiApplication::clipboard()->setText(getTextEditShareOpenvpnCodeText());
|
|
||||||
setPushButtonShareOpenvpnCopyText(tr("Copied"));
|
|
||||||
|
|
||||||
QTimer::singleShot(3000, this, [this]() {
|
|
||||||
setPushButtonShareOpenvpnCopyText(tr("Copy"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonShareSsCopyClicked()
|
|
||||||
{
|
|
||||||
QGuiApplication::clipboard()->setText(getLineEditShareSsStringText());
|
|
||||||
setPushButtonShareSsCopyText(tr("Copied"));
|
|
||||||
|
|
||||||
QTimer::singleShot(3000, this, [this]() {
|
|
||||||
setPushButtonShareSsCopyText(tr("Copy"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonShareCloakCopyClicked()
|
|
||||||
{
|
|
||||||
QGuiApplication::clipboard()->setText(getPlainTextEditShareCloakText());
|
|
||||||
setPushButtonShareCloakCopyText(tr("Copied"));
|
|
||||||
|
|
||||||
QTimer::singleShot(3000, this, [this]() {
|
|
||||||
setPushButtonShareCloakCopyText(tr("Copy"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonShareAmneziaGenerateClicked()
|
|
||||||
{
|
|
||||||
setPushButtonShareAmneziaGenerateEnabled(false);
|
|
||||||
setPushButtonShareAmneziaCopyEnabled(false);
|
|
||||||
setPushButtonShareAmneziaGenerateText(tr("Generating..."));
|
|
||||||
qApp->processEvents();
|
|
||||||
|
|
||||||
ServerCredentials credentials = m_settings.serverCredentials(selectedServerIndex);
|
|
||||||
QJsonObject containerConfig = m_settings.containerConfig(selectedServerIndex, selectedDockerContainer);
|
|
||||||
containerConfig.insert(config_key::container, containerToString(selectedDockerContainer));
|
|
||||||
|
|
||||||
ErrorCode e = ErrorCode::NoError;
|
|
||||||
for (Protocol p: amnezia::protocolsForContainer(selectedDockerContainer)) {
|
|
||||||
QJsonObject protoConfig = m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, p);
|
|
||||||
|
|
||||||
QString cfg = VpnConfigurator::genVpnProtocolConfig(credentials, selectedDockerContainer, containerConfig, p, &e);
|
|
||||||
if (e) {
|
|
||||||
cfg = "Error generating config";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
protoConfig.insert(config_key::last_config, cfg);
|
|
||||||
|
|
||||||
containerConfig.insert(protoToString(p), protoConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray ba;
|
|
||||||
if (!e) {
|
|
||||||
QJsonObject serverConfig = m_settings.server(selectedServerIndex);
|
|
||||||
serverConfig.remove(config_key::userName);
|
|
||||||
serverConfig.remove(config_key::password);
|
|
||||||
serverConfig.remove(config_key::port);
|
|
||||||
serverConfig.insert(config_key::containers, QJsonArray {containerConfig});
|
|
||||||
serverConfig.insert(config_key::defaultContainer, containerToString(selectedDockerContainer));
|
|
||||||
|
|
||||||
|
|
||||||
ba = QJsonDocument(serverConfig).toJson().toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
|
||||||
setTextEditShareAmneziaCodeText(QString("vpn://%1").arg(QString(ba)));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setTextEditShareAmneziaCodeText(tr("Error while generating connection profile"));
|
|
||||||
}
|
|
||||||
|
|
||||||
setPushButtonShareAmneziaGenerateEnabled(true);
|
|
||||||
setPushButtonShareAmneziaCopyEnabled(true);
|
|
||||||
setPushButtonShareAmneziaGenerateText(tr("Generate config"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonShareOpenvpnGenerateClicked()
|
|
||||||
{
|
|
||||||
setPushButtonShareOpenvpnGenerateEnabled(false);
|
|
||||||
setPushButtonShareOpenvpnCopyEnabled(false);
|
|
||||||
setPushButtonShareOpenvpnSaveEnabled(false);
|
|
||||||
setPushButtonShareOpenvpnGenerateText(tr("Generating..."));
|
|
||||||
|
|
||||||
ServerCredentials credentials = m_settings.serverCredentials(selectedServerIndex);
|
|
||||||
const QJsonObject &containerConfig = m_settings.containerConfig(selectedServerIndex, selectedDockerContainer);
|
|
||||||
|
|
||||||
ErrorCode e = ErrorCode::NoError;
|
|
||||||
QString cfg = OpenVpnConfigurator::genOpenVpnConfig(credentials, selectedDockerContainer, containerConfig, &e);
|
|
||||||
cfg = OpenVpnConfigurator::processConfigWithExportSettings(cfg);
|
|
||||||
|
|
||||||
setTextEditShareOpenvpnCodeText(cfg);
|
|
||||||
|
|
||||||
setPushButtonShareOpenvpnGenerateEnabled(true);
|
|
||||||
setPushButtonShareOpenvpnCopyEnabled(true);
|
|
||||||
setPushButtonShareOpenvpnSaveEnabled(true);
|
|
||||||
setPushButtonShareOpenvpnGenerateText(tr("Generate config"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void UiLogic::onPushButtonShareOpenvpnSaveClicked()
|
|
||||||
{
|
|
||||||
QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save OpenVPN config"),
|
|
||||||
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.ovpn");
|
|
||||||
|
|
||||||
QSaveFile save(fileName);
|
|
||||||
save.open(QIODevice::WriteOnly);
|
|
||||||
save.write(getTextEditShareOpenvpnCodeText().toUtf8());
|
|
||||||
save.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3876,161 +3305,6 @@ void UiLogic::updateCloakPage(const QJsonObject &ckConfig, DockerContainer conta
|
||||||
setLineEditProtoCloakPortEnabled(container == DockerContainer::OpenVpnOverCloak);
|
setLineEditProtoCloakPortEnabled(container == DockerContainer::OpenVpnOverCloak);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UiLogic::updateSharingPage(int serverIndex, const ServerCredentials &credentials,
|
|
||||||
DockerContainer container)
|
|
||||||
{
|
|
||||||
selectedDockerContainer = container;
|
|
||||||
selectedServerIndex = serverIndex;
|
|
||||||
|
|
||||||
//const QJsonObject &containerConfig = m_settings.containerConfig(serverIndex, container);
|
|
||||||
|
|
||||||
setPageShareAmneziaVisible(false);
|
|
||||||
setPageShareOpenvpnVisible(false);
|
|
||||||
setPageShareShadowsocksVisible(false);
|
|
||||||
setPageShareCloakVisible(false);
|
|
||||||
setPageShareFullAccessVisible(false);
|
|
||||||
|
|
||||||
enum currentWidget {
|
|
||||||
full_access = 0,
|
|
||||||
share_amezia,
|
|
||||||
share_openvpn,
|
|
||||||
share_shadowshock,
|
|
||||||
share_cloak
|
|
||||||
};
|
|
||||||
|
|
||||||
if (container == DockerContainer::OpenVpn) {
|
|
||||||
setPageShareAmneziaVisible(true);
|
|
||||||
setPageShareOpenvpnVisible(true);
|
|
||||||
|
|
||||||
QString cfg = tr("Press Generate config");
|
|
||||||
setTextEditShareOpenvpnCodeText(cfg);
|
|
||||||
setPushButtonShareOpenvpnCopyEnabled(false);
|
|
||||||
setPushButtonShareOpenvpnSaveEnabled(false);
|
|
||||||
|
|
||||||
setToolBoxShareConnectionCurrentIndex(share_openvpn);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (container == DockerContainer::OpenVpnOverShadowSocks ||
|
|
||||||
container == DockerContainer::OpenVpnOverCloak) {
|
|
||||||
setPageShareAmneziaVisible(true);
|
|
||||||
setPageShareShadowsocksVisible(true);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
setPushButtonShareSsCopyEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
setLineEditShareSsStringText(ssString);
|
|
||||||
updateQRCodeImage(ssString, [this](const QString& labelText) ->void {
|
|
||||||
setLabelShareSsQrCodeText(labelText);
|
|
||||||
});
|
|
||||||
|
|
||||||
setLabelShareSsServerText(ssConfig.value("server").toString());
|
|
||||||
setLabelShareSsPortText(ssConfig.value("server_port").toString());
|
|
||||||
setLabelShareSsMethodText(ssConfig.value("method").toString());
|
|
||||||
setLabelShareSsPasswordText(ssConfig.value("password").toString());
|
|
||||||
|
|
||||||
setToolBoxShareConnectionCurrentIndex(share_shadowshock);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (container == DockerContainer::OpenVpnOverCloak) {
|
|
||||||
//ui->toolBox_share_connection->addItem(ui->page_share_amnezia, tr(" Share for Amnezia client"));
|
|
||||||
setPageShareCloakVisible(true);
|
|
||||||
setPlainTextEditShareCloakText(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);
|
|
||||||
|
|
||||||
setPushButtonShareCloakCopyEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonObject cloakConfig = QJsonDocument::fromJson(cfg.toUtf8()).object();
|
|
||||||
cloakConfig.remove(config_key::transport_proto);
|
|
||||||
cloakConfig.insert("ProxyMethod", "shadowsocks");
|
|
||||||
|
|
||||||
setPlainTextEditShareCloakText(QJsonDocument(cloakConfig).toJson());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Full access
|
|
||||||
if (container == DockerContainer::None) {
|
|
||||||
setPageShareFullAccessVisible(true);
|
|
||||||
|
|
||||||
const QJsonObject &server = m_settings.server(selectedServerIndex);
|
|
||||||
|
|
||||||
QByteArray ba = QJsonDocument(server).toJson().toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
|
||||||
|
|
||||||
setTextEditShareFullCodeText(QString("vpn://%1").arg(QString(ba)));
|
|
||||||
setToolBoxShareConnectionCurrentIndex(full_access);
|
|
||||||
}
|
|
||||||
|
|
||||||
//ui->toolBox_share_connection->addItem(ui->page_share_amnezia, tr(" Share for Amnezia client"));
|
|
||||||
|
|
||||||
// Amnezia sharing
|
|
||||||
// QJsonObject exportContainer;
|
|
||||||
// for (Protocol p: protocolsForContainer(container)) {
|
|
||||||
// QJsonObject protocolConfig = containerConfig.value(protoToString(p)).toObject();
|
|
||||||
// protocolConfig.remove(config_key::last_config);
|
|
||||||
// exportContainer.insert(protoToString(p), protocolConfig);
|
|
||||||
// }
|
|
||||||
// exportContainer.insert(config_key::container, containerToString(container));
|
|
||||||
|
|
||||||
// ui->textEdit_share_amnezia_code->setPlainText(QJsonDocument(exportContainer).toJson());
|
|
||||||
|
|
||||||
setTextEditShareAmneziaCodeText(tr(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UiLogic::updateQRCodeImage(const QString &text, const std::function<void(const QString&)>& setLabelFunc)
|
|
||||||
{
|
|
||||||
int levelIndex = 1;
|
|
||||||
int versionIndex = 0;
|
|
||||||
bool bExtent = true;
|
|
||||||
int maskIndex = -1;
|
|
||||||
|
|
||||||
m_qrEncode.EncodeData( levelIndex, versionIndex, bExtent, maskIndex, text.toUtf8().data() );
|
|
||||||
|
|
||||||
int qrImageSize = m_qrEncode.m_nSymbleSize;
|
|
||||||
|
|
||||||
int encodeImageSize = qrImageSize + ( QR_MARGIN * 2 );
|
|
||||||
QImage encodeImage( encodeImageSize, encodeImageSize, QImage::Format_Mono );
|
|
||||||
|
|
||||||
encodeImage.fill( 1 );
|
|
||||||
|
|
||||||
for ( int i = 0; i < qrImageSize; i++ )
|
|
||||||
for ( int j = 0; j < qrImageSize; j++ )
|
|
||||||
if ( m_qrEncode.m_byModuleData[i][j] )
|
|
||||||
encodeImage.setPixel( i + QR_MARGIN, j + QR_MARGIN, 0 );
|
|
||||||
|
|
||||||
QByteArray byteArray;
|
|
||||||
QBuffer buffer(&byteArray);
|
|
||||||
encodeImage.save(&buffer, "PNG"); // writes the image in PNG format inside the buffer
|
|
||||||
QString iconBase64 = QString::fromLatin1(byteArray.toBase64().data());
|
|
||||||
|
|
||||||
setLabelFunc(iconBase64);
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonObject UiLogic::getOpenVpnConfigFromPage(QJsonObject oldConfig)
|
QJsonObject UiLogic::getOpenVpnConfigFromPage(QJsonObject oldConfig)
|
||||||
{
|
{
|
||||||
oldConfig.insert(config_key::subnet_address, getLineEditProtoOpenvpnSubnetText());
|
oldConfig.insert(config_key::subnet_address, getLineEditProtoOpenvpnSubnetText());
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <QRegExpValidator>
|
#include <QRegExpValidator>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "3rd/QRCodeGenerator/QRCodeGenerator.h"
|
|
||||||
|
|
||||||
#include "pages.h"
|
#include "pages.h"
|
||||||
#include "protocols/vpnprotocol.h"
|
#include "protocols/vpnprotocol.h"
|
||||||
|
@ -132,36 +131,6 @@ class UiLogic : public QObject
|
||||||
Q_PROPERTY(bool pushButtonNewServerConnectEnabled READ getPushButtonNewServerConnectEnabled WRITE setPushButtonNewServerConnectEnabled NOTIFY pushButtonNewServerConnectEnabledChanged)
|
Q_PROPERTY(bool pushButtonNewServerConnectEnabled READ getPushButtonNewServerConnectEnabled WRITE setPushButtonNewServerConnectEnabled NOTIFY pushButtonNewServerConnectEnabledChanged)
|
||||||
Q_PROPERTY(QString pushButtonNewServerConnectText READ getPushButtonNewServerConnectText WRITE setPushButtonNewServerConnectText NOTIFY pushButtonNewServerConnectTextChanged)
|
Q_PROPERTY(QString pushButtonNewServerConnectText READ getPushButtonNewServerConnectText WRITE setPushButtonNewServerConnectText NOTIFY pushButtonNewServerConnectTextChanged)
|
||||||
Q_PROPERTY(QString dialogConnectErrorText READ getDialogConnectErrorText WRITE setDialogConnectErrorText NOTIFY dialogConnectErrorTextChanged)
|
Q_PROPERTY(QString dialogConnectErrorText READ getDialogConnectErrorText WRITE setDialogConnectErrorText NOTIFY dialogConnectErrorTextChanged)
|
||||||
Q_PROPERTY(bool pageShareAmneziaVisible READ getPageShareAmneziaVisible WRITE setPageShareAmneziaVisible NOTIFY pageShareAmneziaVisibleChanged)
|
|
||||||
Q_PROPERTY(bool pageShareOpenvpnVisible READ getPageShareOpenvpnVisible WRITE setPageShareOpenvpnVisible NOTIFY pageShareOpenvpnVisibleChanged)
|
|
||||||
Q_PROPERTY(bool pageShareShadowsocksVisible READ getPageShareShadowsocksVisible WRITE setPageShareShadowsocksVisible NOTIFY pageShareShadowsocksVisibleChanged)
|
|
||||||
Q_PROPERTY(bool pageShareCloakVisible READ getPageShareCloakVisible WRITE setPageShareCloakVisible NOTIFY pageShareCloakVisibleChanged)
|
|
||||||
Q_PROPERTY(bool pageShareFullAccessVisible READ getPageShareFullAccessVisible WRITE setPageShareFullAccessVisible NOTIFY pageShareFullAccessVisibleChanged)
|
|
||||||
Q_PROPERTY(QString textEditShareOpenvpnCodeText READ getTextEditShareOpenvpnCodeText WRITE setTextEditShareOpenvpnCodeText NOTIFY textEditShareOpenvpnCodeTextChanged)
|
|
||||||
Q_PROPERTY(bool pushButtonShareOpenvpnCopyEnabled READ getPushButtonShareOpenvpnCopyEnabled WRITE setPushButtonShareOpenvpnCopyEnabled NOTIFY pushButtonShareOpenvpnCopyEnabledChanged)
|
|
||||||
Q_PROPERTY(bool pushButtonShareOpenvpnSaveEnabled READ getPushButtonShareOpenvpnSaveEnabled WRITE setPushButtonShareOpenvpnSaveEnabled NOTIFY pushButtonShareOpenvpnSaveEnabledChanged)
|
|
||||||
Q_PROPERTY(int toolBoxShareConnectionCurrentIndex READ getToolBoxShareConnectionCurrentIndex WRITE setToolBoxShareConnectionCurrentIndex NOTIFY toolBoxShareConnectionCurrentIndexChanged)
|
|
||||||
Q_PROPERTY(bool pushButtonShareSsCopyEnabled READ getPushButtonShareSsCopyEnabled WRITE setPushButtonShareSsCopyEnabled NOTIFY pushButtonShareSsCopyEnabledChanged)
|
|
||||||
Q_PROPERTY(QString lineEditShareSsStringText READ getLineEditShareSsStringText WRITE setLineEditShareSsStringText NOTIFY lineEditShareSsStringTextChanged)
|
|
||||||
Q_PROPERTY(QString labelShareSsQrCodeText READ getLabelShareSsQrCodeText WRITE setLabelShareSsQrCodeText NOTIFY labelShareSsQrCodeTextChanged)
|
|
||||||
Q_PROPERTY(QString labelShareSsServerText READ getLabelShareSsServerText WRITE setLabelShareSsServerText NOTIFY labelShareSsServerTextChanged)
|
|
||||||
Q_PROPERTY(QString labelShareSsPortText READ getLabelShareSsPortText WRITE setLabelShareSsPortText NOTIFY labelShareSsPortTextChanged)
|
|
||||||
Q_PROPERTY(QString labelShareSsMethodText READ getLabelShareSsMethodText WRITE setLabelShareSsMethodText NOTIFY labelShareSsMethodTextChanged)
|
|
||||||
Q_PROPERTY(QString labelShareSsPasswordText READ getLabelShareSsPasswordText WRITE setLabelShareSsPasswordText NOTIFY labelShareSsPasswordTextChanged)
|
|
||||||
Q_PROPERTY(QString plainTextEditShareCloakText READ getPlainTextEditShareCloakText WRITE setPlainTextEditShareCloakText NOTIFY plainTextEditShareCloakTextChanged)
|
|
||||||
Q_PROPERTY(bool pushButtonShareCloakCopyEnabled READ getPushButtonShareCloakCopyEnabled WRITE setPushButtonShareCloakCopyEnabled NOTIFY pushButtonShareCloakCopyEnabledChanged)
|
|
||||||
Q_PROPERTY(QString textEditShareFullCodeText READ getTextEditShareFullCodeText WRITE setTextEditShareFullCodeText NOTIFY textEditShareFullCodeTextChanged)
|
|
||||||
Q_PROPERTY(QString textEditShareAmneziaCodeText READ getTextEditShareAmneziaCodeText WRITE setTextEditShareAmneziaCodeText NOTIFY textEditShareAmneziaCodeTextChanged)
|
|
||||||
Q_PROPERTY(QString pushButtonShareFullCopyText READ getPushButtonShareFullCopyText WRITE setPushButtonShareFullCopyText NOTIFY pushButtonShareFullCopyTextChanged)
|
|
||||||
Q_PROPERTY(QString pushButtonShareAmneziaCopyText READ getPushButtonShareAmneziaCopyText WRITE setPushButtonShareAmneziaCopyText NOTIFY pushButtonShareAmneziaCopyTextChanged)
|
|
||||||
Q_PROPERTY(QString pushButtonShareOpenvpnCopyText READ getPushButtonShareOpenvpnCopyText WRITE setPushButtonShareOpenvpnCopyText NOTIFY pushButtonShareOpenvpnCopyTextChanged)
|
|
||||||
Q_PROPERTY(QString pushButtonShareSsCopyText READ getPushButtonShareSsCopyText WRITE setPushButtonShareSsCopyText NOTIFY pushButtonShareSsCopyTextChanged)
|
|
||||||
Q_PROPERTY(QString pushButtonShareCloakCopyText READ getPushButtonShareCloakCopyText WRITE setPushButtonShareCloakCopyText NOTIFY pushButtonShareCloakCopyTextChanged)
|
|
||||||
Q_PROPERTY(bool pushButtonShareAmneziaGenerateEnabled READ getPushButtonShareAmneziaGenerateEnabled WRITE setPushButtonShareAmneziaGenerateEnabled NOTIFY pushButtonShareAmneziaGenerateEnabledChanged)
|
|
||||||
Q_PROPERTY(bool pushButtonShareAmneziaCopyEnabled READ getPushButtonShareAmneziaCopyEnabled WRITE setPushButtonShareAmneziaCopyEnabled NOTIFY pushButtonShareAmneziaCopyEnabledChanged)
|
|
||||||
Q_PROPERTY(QString pushButtonShareAmneziaGenerateText READ getPushButtonShareAmneziaGenerateText WRITE setPushButtonShareAmneziaGenerateText NOTIFY pushButtonShareAmneziaGenerateTextChanged)
|
|
||||||
Q_PROPERTY(bool pushButtonShareOpenvpnGenerateEnabled READ getPushButtonShareOpenvpnGenerateEnabled WRITE setPushButtonShareOpenvpnGenerateEnabled NOTIFY pushButtonShareOpenvpnGenerateEnabledChanged)
|
|
||||||
Q_PROPERTY(QString pushButtonShareOpenvpnGenerateText READ getPushButtonShareOpenvpnGenerateText WRITE setPushButtonShareOpenvpnGenerateText NOTIFY pushButtonShareOpenvpnGenerateTextChanged)
|
|
||||||
Q_PROPERTY(bool pageNewServerConfiguringEnabled READ getPageNewServerConfiguringEnabled WRITE setPageNewServerConfiguringEnabled NOTIFY pageNewServerConfiguringEnabledChanged)
|
Q_PROPERTY(bool pageNewServerConfiguringEnabled READ getPageNewServerConfiguringEnabled WRITE setPageNewServerConfiguringEnabled NOTIFY pageNewServerConfiguringEnabledChanged)
|
||||||
Q_PROPERTY(bool labelNewServerConfiguringWaitInfoVisible READ getLabelNewServerConfiguringWaitInfoVisible WRITE setLabelNewServerConfiguringWaitInfoVisible NOTIFY labelNewServerConfiguringWaitInfoVisibleChanged)
|
Q_PROPERTY(bool labelNewServerConfiguringWaitInfoVisible READ getLabelNewServerConfiguringWaitInfoVisible WRITE setLabelNewServerConfiguringWaitInfoVisible NOTIFY labelNewServerConfiguringWaitInfoVisibleChanged)
|
||||||
Q_PROPERTY(QString labelNewServerConfiguringWaitInfoText READ getLabelNewServerConfiguringWaitInfoText WRITE setLabelNewServerConfiguringWaitInfoText NOTIFY labelNewServerConfiguringWaitInfoTextChanged)
|
Q_PROPERTY(QString labelNewServerConfiguringWaitInfoText READ getLabelNewServerConfiguringWaitInfoText WRITE setLabelNewServerConfiguringWaitInfoText NOTIFY labelNewServerConfiguringWaitInfoTextChanged)
|
||||||
|
@ -425,66 +394,7 @@ public:
|
||||||
void setDialogConnectErrorText(const QString &dialogConnectErrorText);
|
void setDialogConnectErrorText(const QString &dialogConnectErrorText);
|
||||||
|
|
||||||
|
|
||||||
bool getPageShareAmneziaVisible() const;
|
|
||||||
void setPageShareAmneziaVisible(bool pageShareAmneziaVisible);
|
|
||||||
bool getPageShareOpenvpnVisible() const;
|
|
||||||
void setPageShareOpenvpnVisible(bool pageShareOpenvpnVisible);
|
|
||||||
bool getPageShareShadowsocksVisible() const;
|
|
||||||
void setPageShareShadowsocksVisible(bool pageShareShadowsocksVisible);
|
|
||||||
bool getPageShareCloakVisible() const;
|
|
||||||
void setPageShareCloakVisible(bool pageShareCloakVisible);
|
|
||||||
bool getPageShareFullAccessVisible() const;
|
|
||||||
void setPageShareFullAccessVisible(bool pageShareFullAccessVisible);
|
|
||||||
QString getTextEditShareOpenvpnCodeText() const;
|
|
||||||
void setTextEditShareOpenvpnCodeText(const QString &textEditShareOpenvpnCodeText);
|
|
||||||
bool getPushButtonShareOpenvpnCopyEnabled() const;
|
|
||||||
void setPushButtonShareOpenvpnCopyEnabled(bool pushButtonShareOpenvpnCopyEnabled);
|
|
||||||
bool getPushButtonShareOpenvpnSaveEnabled() const;
|
|
||||||
void setPushButtonShareOpenvpnSaveEnabled(bool pushButtonShareOpenvpnSaveEnabled);
|
|
||||||
int getToolBoxShareConnectionCurrentIndex() const;
|
|
||||||
void setToolBoxShareConnectionCurrentIndex(int toolBoxShareConnectionCurrentIndex);
|
|
||||||
bool getPushButtonShareSsCopyEnabled() const;
|
|
||||||
void setPushButtonShareSsCopyEnabled(bool pushButtonShareSsCopyEnabled);
|
|
||||||
QString getLineEditShareSsStringText() const;
|
|
||||||
void setLineEditShareSsStringText(const QString &lineEditShareSsStringText);
|
|
||||||
QString getLabelShareSsQrCodeText() const;
|
|
||||||
void setLabelShareSsQrCodeText(const QString &labelShareSsQrCodeText);
|
|
||||||
QString getLabelShareSsServerText() const;
|
|
||||||
void setLabelShareSsServerText(const QString &labelShareSsServerText);
|
|
||||||
QString getLabelShareSsPortText() const;
|
|
||||||
void setLabelShareSsPortText(const QString &labelShareSsPortText);
|
|
||||||
QString getLabelShareSsMethodText() const;
|
|
||||||
void setLabelShareSsMethodText(const QString &labelShareSsMethodText);
|
|
||||||
QString getLabelShareSsPasswordText() const;
|
|
||||||
void setLabelShareSsPasswordText(const QString &labelShareSsPasswordText);
|
|
||||||
QString getPlainTextEditShareCloakText() const;
|
|
||||||
void setPlainTextEditShareCloakText(const QString &plainTextEditShareCloakText);
|
|
||||||
bool getPushButtonShareCloakCopyEnabled() const;
|
|
||||||
void setPushButtonShareCloakCopyEnabled(bool pushButtonShareCloakCopyEnabled);
|
|
||||||
QString getTextEditShareFullCodeText() const;
|
|
||||||
void setTextEditShareFullCodeText(const QString &textEditShareFullCodeText);
|
|
||||||
QString getTextEditShareAmneziaCodeText() const;
|
|
||||||
void setTextEditShareAmneziaCodeText(const QString &textEditShareAmneziaCodeText);
|
|
||||||
QString getPushButtonShareFullCopyText() const;
|
|
||||||
void setPushButtonShareFullCopyText(const QString &pushButtonShareFullCopyText);
|
|
||||||
QString getPushButtonShareAmneziaCopyText() const;
|
|
||||||
void setPushButtonShareAmneziaCopyText(const QString &pushButtonShareAmneziaCopyText);
|
|
||||||
QString getPushButtonShareOpenvpnCopyText() const;
|
|
||||||
void setPushButtonShareOpenvpnCopyText(const QString &pushButtonShareOpenvpnCopyText);
|
|
||||||
QString getPushButtonShareSsCopyText() const;
|
|
||||||
void setPushButtonShareSsCopyText(const QString &pushButtonShareSsCopyText);
|
|
||||||
QString getPushButtonShareCloakCopyText() const;
|
|
||||||
void setPushButtonShareCloakCopyText(const QString &pushButtonShareCloakCopyText);
|
|
||||||
bool getPushButtonShareAmneziaGenerateEnabled() const;
|
|
||||||
void setPushButtonShareAmneziaGenerateEnabled(bool pushButtonShareAmneziaGenerateEnabled);
|
|
||||||
bool getPushButtonShareAmneziaCopyEnabled() const;
|
|
||||||
void setPushButtonShareAmneziaCopyEnabled(bool pushButtonShareAmneziaCopyEnabled);
|
|
||||||
QString getPushButtonShareAmneziaGenerateText() const;
|
|
||||||
void setPushButtonShareAmneziaGenerateText(const QString &pushButtonShareAmneziaGenerateText);
|
|
||||||
bool getPushButtonShareOpenvpnGenerateEnabled() const;
|
|
||||||
void setPushButtonShareOpenvpnGenerateEnabled(bool pushButtonShareOpenvpnGenerateEnabled);
|
|
||||||
QString getPushButtonShareOpenvpnGenerateText() const;
|
|
||||||
void setPushButtonShareOpenvpnGenerateText(const QString &pushButtonShareOpenvpnGenerateText);
|
|
||||||
bool getPageNewServerConfiguringEnabled() const;
|
bool getPageNewServerConfiguringEnabled() const;
|
||||||
void setPageNewServerConfiguringEnabled(bool pageNewServerConfiguringEnabled);
|
void setPageNewServerConfiguringEnabled(bool pageNewServerConfiguringEnabled);
|
||||||
bool getLabelNewServerConfiguringWaitInfoVisible() const;
|
bool getLabelNewServerConfiguringWaitInfoVisible() const;
|
||||||
|
@ -566,16 +476,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Q_INVOKABLE void onPushButtonShareFullCopyClicked();
|
|
||||||
Q_INVOKABLE void onPushButtonShareFullSaveClicked();
|
|
||||||
Q_INVOKABLE void onPushButtonShareAmneziaCopyClicked();
|
|
||||||
Q_INVOKABLE void onPushButtonShareAmneziaSaveClicked();
|
|
||||||
Q_INVOKABLE void onPushButtonShareOpenvpnCopyClicked();
|
|
||||||
Q_INVOKABLE void onPushButtonShareSsCopyClicked();
|
|
||||||
Q_INVOKABLE void onPushButtonShareCloakCopyClicked();
|
|
||||||
Q_INVOKABLE void onPushButtonShareAmneziaGenerateClicked();
|
|
||||||
Q_INVOKABLE void onPushButtonShareOpenvpnGenerateClicked();
|
|
||||||
Q_INVOKABLE void onPushButtonShareOpenvpnSaveClicked();
|
|
||||||
|
|
||||||
Q_INVOKABLE void onPushButtonProtoOpenvpnContOpenvpnConfigClicked();
|
Q_INVOKABLE void onPushButtonProtoOpenvpnContOpenvpnConfigClicked();
|
||||||
Q_INVOKABLE void onPushButtonProtoSsOpenvpnContOpenvpnConfigClicked();
|
Q_INVOKABLE void onPushButtonProtoSsOpenvpnContOpenvpnConfigClicked();
|
||||||
|
@ -703,36 +604,7 @@ signals:
|
||||||
void pushButtonNewServerConnectEnabledChanged();
|
void pushButtonNewServerConnectEnabledChanged();
|
||||||
void pushButtonNewServerConnectTextChanged();
|
void pushButtonNewServerConnectTextChanged();
|
||||||
void dialogConnectErrorTextChanged();
|
void dialogConnectErrorTextChanged();
|
||||||
void pageShareAmneziaVisibleChanged();
|
|
||||||
void pageShareOpenvpnVisibleChanged();
|
|
||||||
void pageShareShadowsocksVisibleChanged();
|
|
||||||
void pageShareCloakVisibleChanged();
|
|
||||||
void pageShareFullAccessVisibleChanged();
|
|
||||||
void textEditShareOpenvpnCodeTextChanged();
|
|
||||||
void pushButtonShareOpenvpnCopyEnabledChanged();
|
|
||||||
void pushButtonShareOpenvpnSaveEnabledChanged();
|
|
||||||
void toolBoxShareConnectionCurrentIndexChanged();
|
|
||||||
void pushButtonShareSsCopyEnabledChanged();
|
|
||||||
void lineEditShareSsStringTextChanged();
|
|
||||||
void labelShareSsQrCodeTextChanged();
|
|
||||||
void labelShareSsServerTextChanged();
|
|
||||||
void labelShareSsPortTextChanged();
|
|
||||||
void labelShareSsMethodTextChanged();
|
|
||||||
void labelShareSsPasswordTextChanged();
|
|
||||||
void plainTextEditShareCloakTextChanged();
|
|
||||||
void pushButtonShareCloakCopyEnabledChanged();
|
|
||||||
void textEditShareFullCodeTextChanged();
|
|
||||||
void textEditShareAmneziaCodeTextChanged();
|
|
||||||
void pushButtonShareFullCopyTextChanged();
|
|
||||||
void pushButtonShareAmneziaCopyTextChanged();
|
|
||||||
void pushButtonShareOpenvpnCopyTextChanged();
|
|
||||||
void pushButtonShareSsCopyTextChanged();
|
|
||||||
void pushButtonShareCloakCopyTextChanged();
|
|
||||||
void pushButtonShareAmneziaGenerateEnabledChanged();
|
|
||||||
void pushButtonShareAmneziaCopyEnabledChanged();
|
|
||||||
void pushButtonShareAmneziaGenerateTextChanged();
|
|
||||||
void pushButtonShareOpenvpnGenerateEnabledChanged();
|
|
||||||
void pushButtonShareOpenvpnGenerateTextChanged();
|
|
||||||
void pageNewServerConfiguringEnabledChanged();
|
void pageNewServerConfiguringEnabledChanged();
|
||||||
void labelNewServerConfiguringWaitInfoVisibleChanged();
|
void labelNewServerConfiguringWaitInfoVisibleChanged();
|
||||||
void labelNewServerConfiguringWaitInfoTextChanged();
|
void labelNewServerConfiguringWaitInfoTextChanged();
|
||||||
|
@ -891,36 +763,7 @@ private:
|
||||||
bool m_pushButtonNewServerConnectEnabled;
|
bool m_pushButtonNewServerConnectEnabled;
|
||||||
QString m_pushButtonNewServerConnectText;
|
QString m_pushButtonNewServerConnectText;
|
||||||
QString m_dialogConnectErrorText;
|
QString m_dialogConnectErrorText;
|
||||||
bool m_pageShareAmneziaVisible;
|
|
||||||
bool m_pageShareOpenvpnVisible;
|
|
||||||
bool m_pageShareShadowsocksVisible;
|
|
||||||
bool m_pageShareCloakVisible;
|
|
||||||
bool m_pageShareFullAccessVisible;
|
|
||||||
QString m_textEditShareOpenvpnCodeText;
|
|
||||||
bool m_pushButtonShareOpenvpnCopyEnabled;
|
|
||||||
bool m_pushButtonShareOpenvpnSaveEnabled;
|
|
||||||
int m_toolBoxShareConnectionCurrentIndex;
|
|
||||||
bool m_pushButtonShareSsCopyEnabled;
|
|
||||||
QString m_lineEditShareSsStringText;
|
|
||||||
QString m_labelShareSsQrCodeText;
|
|
||||||
QString m_labelShareSsServerText;
|
|
||||||
QString m_labelShareSsPortText;
|
|
||||||
QString m_labelShareSsMethodText;
|
|
||||||
QString m_labelShareSsPasswordText;
|
|
||||||
QString m_plainTextEditShareCloakText;
|
|
||||||
bool m_pushButtonShareCloakCopyEnabled;
|
|
||||||
QString m_textEditShareFullCodeText;
|
|
||||||
QString m_textEditShareAmneziaCodeText;
|
|
||||||
QString m_pushButtonShareFullCopyText;
|
|
||||||
QString m_pushButtonShareAmneziaCopyText;
|
|
||||||
QString m_pushButtonShareOpenvpnCopyText;
|
|
||||||
QString m_pushButtonShareSsCopyText;
|
|
||||||
QString m_pushButtonShareCloakCopyText;
|
|
||||||
bool m_pushButtonShareAmneziaGenerateEnabled;
|
|
||||||
bool m_pushButtonShareAmneziaCopyEnabled;
|
|
||||||
QString m_pushButtonShareAmneziaGenerateText;
|
|
||||||
bool m_pushButtonShareOpenvpnGenerateEnabled;
|
|
||||||
QString m_pushButtonShareOpenvpnGenerateText;
|
|
||||||
bool m_pageNewServerConfiguringEnabled;
|
bool m_pageNewServerConfiguringEnabled;
|
||||||
bool m_labelNewServerConfiguringWaitInfoVisible;
|
bool m_labelNewServerConfiguringWaitInfoVisible;
|
||||||
QString m_labelNewServerConfiguringWaitInfoText;
|
QString m_labelNewServerConfiguringWaitInfoText;
|
||||||
|
@ -1006,9 +849,7 @@ private:
|
||||||
void updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData);
|
void updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData);
|
||||||
void updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData);
|
void updateCloakPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData);
|
||||||
|
|
||||||
void updateSharingPage(int serverIndex, const ServerCredentials &credentials,
|
|
||||||
DockerContainer container);
|
|
||||||
void updateQRCodeImage(const QString &text, const std::function<void(const QString&)>& setLabelFunc);
|
|
||||||
|
|
||||||
QJsonObject getOpenVpnConfigFromPage(QJsonObject oldConfig);
|
QJsonObject getOpenVpnConfigFromPage(QJsonObject oldConfig);
|
||||||
QJsonObject getShadowSocksConfigFromPage(QJsonObject oldConfig);
|
QJsonObject getShadowSocksConfigFromPage(QJsonObject oldConfig);
|
||||||
|
@ -1027,8 +868,6 @@ private:
|
||||||
// QRegExpValidator m_ipNetwok24Validator;
|
// QRegExpValidator m_ipNetwok24Validator;
|
||||||
// QRegExpValidator m_ipPortValidator;
|
// QRegExpValidator m_ipPortValidator;
|
||||||
|
|
||||||
CQR_Encode m_qrEncode;
|
|
||||||
|
|
||||||
// QPoint offset;
|
// QPoint offset;
|
||||||
// bool needToHideCustomTitlebar = false;
|
// bool needToHideCustomTitlebar = false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue