Config export
This commit is contained in:
parent
de67f244da
commit
e3fb239de9
28 changed files with 1247 additions and 349 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include <QClipboard>
|
||||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
#include <QHBoxLayout>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
|
@ -13,13 +14,19 @@
|
|||
#include <QThread>
|
||||
#include <QTimer>
|
||||
|
||||
#include <protocols/shadowsocksvpnprotocol.h>
|
||||
|
||||
#include "core/errorstrings.h"
|
||||
#include "configurators/vpn_configurator.h"
|
||||
#include "configurators/openvpn_configurator.h"
|
||||
#include "configurators/shadowsocks_configurator.h"
|
||||
#include "configurators/cloak_configurator.h"
|
||||
|
||||
#include "core/servercontroller.h"
|
||||
#include "core/server_defs.h"
|
||||
#include "core/errorstrings.h"
|
||||
|
||||
#include "protocols/protocols_defs.h"
|
||||
#include "protocols/shadowsocksvpnprotocol.h"
|
||||
|
||||
#include "ui/qautostart.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
|
@ -52,6 +59,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
setupUiConnections();
|
||||
setupProtocolsPageConnections();
|
||||
setupNewServerPageConnections();
|
||||
setupSharePageConnections();
|
||||
setupServerSettingsPageConnections();
|
||||
|
||||
ui->label_error_text->clear();
|
||||
installEventFilter(this);
|
||||
|
|
@ -117,6 +126,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
m_ipAddressValidator.setRegExp(Utils::ipAddressRegExp());
|
||||
m_ipAddressPortValidator.setRegExp(Utils::ipAddressPortRegExp());
|
||||
m_ipNetwok24Validator.setRegExp(Utils::ipNetwork24RegExp());
|
||||
m_ipPortValidator.setRegExp(Utils::ipPortRegExp());
|
||||
|
||||
ui->lineEdit_new_server_ip->setValidator(&m_ipAddressPortValidator);
|
||||
ui->lineEdit_network_settings_dns1->setValidator(&m_ipAddressValidator);
|
||||
|
|
@ -124,8 +134,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
|
||||
ui->lineEdit_proto_openvpn_subnet->setValidator(&m_ipNetwok24Validator);
|
||||
|
||||
ui->toolBox_share_connection->removeItem(ui->toolBox_share_connection->indexOf(ui->page_share_shadowsocks));
|
||||
ui->page_share_shadowsocks->setVisible(false);
|
||||
ui->lineEdit_proto_openvpn_port->setValidator(&m_ipPortValidator);
|
||||
ui->lineEdit_proto_shadowsocks_port->setValidator(&m_ipPortValidator);
|
||||
ui->lineEdit_proto_cloak_port->setValidator(&m_ipPortValidator);
|
||||
|
||||
//ui->toolBox_share_connection->removeItem(ui->toolBox_share_connection->indexOf(ui->page_share_shadowsocks));
|
||||
//ui->page_share_shadowsocks->setVisible(false);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
|
@ -155,22 +169,7 @@ void MainWindow::goToPage(Page page, bool reset, bool slide)
|
|||
updateServerPage();
|
||||
}
|
||||
if (page == Page::ShareConnection) {
|
||||
// QJsonObject ssConfig = ShadowSocksVpnProtocol::genShadowSocksConfig(m_settings.defaultServerCredentials());
|
||||
|
||||
// QString ssString = QString("%1:%2@%3:%4")
|
||||
// .arg(ssConfig.value("method").toString())
|
||||
// .arg(ssConfig.value("password").toString())
|
||||
// .arg(ssConfig.value("server").toString())
|
||||
// .arg(QString::number(ssConfig.value("server_port").toInt()));
|
||||
|
||||
// ssString = "ss://" + ssString.toUtf8().toBase64();
|
||||
// ui->lineEdit_share_ss_string->setText(ssString);
|
||||
// updateQRCodeImage(ssString, ui->label_share_ss_qr_code);
|
||||
|
||||
// ui->label_share_ss_server->setText(ssConfig.value("server").toString());
|
||||
// ui->label_share_ss_port->setText(QString::number(ssConfig.value("server_port").toInt()));
|
||||
// ui->label_share_ss_method->setText(ssConfig.value("method").toString());
|
||||
// ui->label_share_ss_password->setText(ssConfig.value("password").toString());
|
||||
}
|
||||
if (page == Page::ServersList) {
|
||||
updateServersListPage();
|
||||
|
|
@ -281,14 +280,6 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if (keyEvent->key() == Qt::Key_Escape && ! ui->stackedWidget_main->isAnimationRunning() ) {
|
||||
if (currentPage() != Page::Vpn && currentPage() != Page::Start) {
|
||||
closePage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QMainWindow::eventFilter(obj, event);
|
||||
}
|
||||
|
|
@ -304,16 +295,30 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
|
|||
#ifdef QT_DEBUG
|
||||
case Qt::Key_Q:
|
||||
qApp->quit();
|
||||
break;
|
||||
case Qt::Key_C:
|
||||
qDebug().noquote() << QJsonDocument(m_settings.serversArray()).toJson();
|
||||
qDebug().noquote() << QJsonDocument(m_settings.containerConfig(m_settings.defaultServerIndex(), m_settings.defaultContainer(m_settings.defaultServerIndex()))).toJson();
|
||||
//qDebug().noquote() << QJsonDocument(m_settings.serversArray()).toJson();
|
||||
break;
|
||||
#endif
|
||||
case Qt::Key_A:
|
||||
goToPage(Page::Start);
|
||||
break;
|
||||
case Qt::Key_S:
|
||||
selectedServerIndex = m_settings.defaultServerIndex();
|
||||
goToPage(Page::ServerSettings);
|
||||
break;
|
||||
case Qt::Key_P:
|
||||
selectedServerIndex = m_settings.defaultServerIndex();
|
||||
selectedDockerContainer = m_settings.defaultContainer(selectedServerIndex);
|
||||
goToPage(Page::ServerVpnProtocols);
|
||||
break;
|
||||
case Qt::Key_Escape:
|
||||
if (! ui->stackedWidget_main->isAnimationRunning() && ui->stackedWidget_main->currentWidget()->isEnabled()) {
|
||||
if (currentPage() != Page::Vpn && currentPage() != Page::Start) {
|
||||
closePage();
|
||||
}
|
||||
}
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
|
@ -654,16 +659,6 @@ ErrorCode MainWindow::doInstallAction(const std::function<ErrorCode()> &action,
|
|||
return ErrorCode::NoError;
|
||||
}
|
||||
|
||||
void MainWindow::onPushButtonReinstallServer(bool)
|
||||
{
|
||||
// onDisconnect();
|
||||
// installServer(m_settings.defaultServerCredentials(),
|
||||
// ui->page_server_settings,
|
||||
// ui->progressBar_server_settings_reinstall,
|
||||
// ui->pushButton_server_settings_reinstall,
|
||||
// ui->label_server_settings_wait_info);
|
||||
}
|
||||
|
||||
void MainWindow::onPushButtonClearServer(bool)
|
||||
{
|
||||
ui->page_server_settings->setEnabled(false);
|
||||
|
|
@ -697,8 +692,15 @@ void MainWindow::onPushButtonForgetServer(bool)
|
|||
onDisconnect();
|
||||
}
|
||||
m_settings.removeServer(selectedServerIndex);
|
||||
m_settings.setDefaultServer(0);
|
||||
|
||||
if (m_settings.defaultServerIndex() == selectedServerIndex) {
|
||||
m_settings.setDefaultServer(0);
|
||||
}
|
||||
else if (m_settings.defaultServerIndex() > selectedServerIndex) {
|
||||
m_settings.setDefaultServer(m_settings.defaultServerIndex() - 1);
|
||||
}
|
||||
|
||||
selectedServerIndex = -1;
|
||||
closePage();
|
||||
updateServersListPage();
|
||||
}
|
||||
|
|
@ -849,9 +851,6 @@ void MainWindow::setupUiConnections()
|
|||
connect(ui->pushButton_new_server_connect_configure, SIGNAL(clicked(bool)), this, SLOT(onPushButtonNewServerConnectConfigure(bool)));
|
||||
connect(ui->pushButton_new_server_import, SIGNAL(clicked(bool)), this, SLOT(onPushButtonNewServerImport(bool)));
|
||||
|
||||
connect(ui->pushButton_server_settings_reinstall, SIGNAL(clicked(bool)), this, SLOT(onPushButtonReinstallServer(bool)));
|
||||
connect(ui->pushButton_server_settings_clear, SIGNAL(clicked(bool)), this, SLOT(onPushButtonClearServer(bool)));
|
||||
connect(ui->pushButton_server_settings_forget, SIGNAL(clicked(bool)), this, SLOT(onPushButtonForgetServer(bool)));
|
||||
|
||||
connect(ui->pushButton_vpn_add_site, &QPushButton::clicked, this, [this](){ goToPage(Page::Sites); });
|
||||
connect(ui->pushButton_settings, &QPushButton::clicked, this, [this](){ goToPage(Page::GeneralSettings); });
|
||||
|
|
@ -861,21 +860,12 @@ void MainWindow::setupUiConnections()
|
|||
selectedServerIndex = m_settings.defaultServerIndex();
|
||||
goToPage(Page::ServerSettings);
|
||||
});
|
||||
connect(ui->pushButton_server_settings_protocols, &QPushButton::clicked, this, [this](){ goToPage(Page::ServerVpnProtocols); });
|
||||
connect(ui->pushButton_servers_list, &QPushButton::clicked, this, [this](){ goToPage(Page::ServersList); });
|
||||
connect(ui->pushButton_share_connection, &QPushButton::clicked, this, [this](){
|
||||
goToPage(Page::ShareConnection);
|
||||
updateShareCodePage();
|
||||
});
|
||||
|
||||
connect(ui->pushButton_copy_sharing_code, &QPushButton::clicked, this, [this](){
|
||||
QGuiApplication::clipboard()->setText(ui->textEdit_sharing_code->toPlainText());
|
||||
ui->pushButton_copy_sharing_code->setText(tr("Copied"));
|
||||
|
||||
QTimer::singleShot(3000, this, [this]() {
|
||||
ui->pushButton_copy_sharing_code->setText(tr("Copy"));
|
||||
});
|
||||
});
|
||||
|
||||
connect(ui->pushButton_back_from_sites, &QPushButton::clicked, this, [this](){ closePage(); });
|
||||
connect(ui->pushButton_back_from_settings, &QPushButton::clicked, this, [this](){ closePage(); });
|
||||
|
|
@ -1014,43 +1004,64 @@ void MainWindow::setupProtocolsPageConnections()
|
|||
});
|
||||
}
|
||||
|
||||
// share buttons
|
||||
QList<QPushButton *> shareButtons {
|
||||
ui->pushButton_proto_openvpn_cont_share,
|
||||
ui->pushButton_proto_ss_openvpn_cont_share,
|
||||
ui->pushButton_proto_cloak_openvpn_cont_share
|
||||
};
|
||||
|
||||
for (int i = 0; i < containers.size(); ++i) {
|
||||
QPushButton *button = shareButtons.at(i);
|
||||
DockerContainer container = containers.at(i);
|
||||
|
||||
connect(button, &QPushButton::clicked, this, [this, button, container](){
|
||||
updateSharingPage(selectedServerIndex, m_settings.serverCredentials(selectedServerIndex), container);
|
||||
goToPage(Page::ShareConnection);
|
||||
});
|
||||
}
|
||||
|
||||
// settings buttons
|
||||
|
||||
// settings openvpn container
|
||||
connect(ui->pushButton_proto_openvpn_cont_openvpn_config, &QPushButton::clicked, this, [this](){
|
||||
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, DockerContainer::OpenVpn, Protocol::OpenVpn));
|
||||
selectedDockerContainer = DockerContainer::OpenVpn;
|
||||
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn),
|
||||
selectedDockerContainer);
|
||||
goToPage(Page::OpenVpnSettings);
|
||||
});
|
||||
|
||||
// settings shadowsocks container
|
||||
connect(ui->pushButton_proto_ss_openvpn_cont_openvpn_config, &QPushButton::clicked, this, [this](){
|
||||
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, DockerContainer::OpenVpnOverShadowSocks, Protocol::OpenVpn),
|
||||
DockerContainer::OpenVpnOverShadowSocks);
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverShadowSocks;
|
||||
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn),
|
||||
selectedDockerContainer);
|
||||
goToPage(Page::OpenVpnSettings);
|
||||
});
|
||||
connect(ui->pushButton_proto_ss_openvpn_cont_ss_config, &QPushButton::clicked, this, [this](){
|
||||
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, DockerContainer::OpenVpnOverShadowSocks, Protocol::ShadowSocks));
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverShadowSocks;
|
||||
updateShadowSocksPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::ShadowSocks),
|
||||
selectedDockerContainer);
|
||||
goToPage(Page::ShadowSocksSettings);
|
||||
});
|
||||
|
||||
// settings cloak container
|
||||
connect(ui->pushButton_proto_cloak_openvpn_cont_openvpn_config, &QPushButton::clicked, this, [this](){
|
||||
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, DockerContainer::OpenVpnOverCloak, Protocol::OpenVpn));
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverCloak;
|
||||
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::OpenVpn),
|
||||
selectedDockerContainer);
|
||||
goToPage(Page::OpenVpnSettings);
|
||||
});
|
||||
connect(ui->pushButton_proto_cloak_openvpn_cont_ss_config, &QPushButton::clicked, this, [this](){
|
||||
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, DockerContainer::OpenVpnOverCloak, Protocol::ShadowSocks));
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverCloak;
|
||||
updateShadowSocksPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::ShadowSocks),
|
||||
selectedDockerContainer);
|
||||
goToPage(Page::ShadowSocksSettings);
|
||||
});
|
||||
connect(ui->pushButton_proto_cloak_openvpn_cont_cloak_config, &QPushButton::clicked, this, [this](){
|
||||
updateOpenVpnPage(m_settings.protocolConfig(selectedServerIndex, DockerContainer::OpenVpnOverCloak, Protocol::Cloak));
|
||||
selectedDockerContainer = DockerContainer::OpenVpnOverCloak;
|
||||
updateCloakPage(m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::Cloak),
|
||||
selectedDockerContainer);
|
||||
goToPage(Page::CloakSettings);
|
||||
});
|
||||
|
||||
|
|
@ -1079,6 +1090,50 @@ void MainWindow::setupProtocolsPageConnections()
|
|||
m_settings.setContainerConfig(selectedServerIndex, selectedDockerContainer, newContainerConfig);
|
||||
m_settings.clearLastConnectionConfig(selectedServerIndex, selectedDockerContainer);
|
||||
}
|
||||
qDebug() << "Protocol saved with code:" << e << "for" << selectedServerIndex << selectedDockerContainer;
|
||||
});
|
||||
|
||||
connect(ui->pushButton_proto_shadowsocks_save, &QPushButton::clicked, this, [this](){
|
||||
QJsonObject protocolConfig = m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::ShadowSocks);
|
||||
protocolConfig = getShadowSocksConfigFromPage(protocolConfig);
|
||||
|
||||
QJsonObject containerConfig = m_settings.containerConfig(selectedServerIndex, selectedDockerContainer);
|
||||
QJsonObject newContainerConfig = containerConfig;
|
||||
newContainerConfig.insert(config_key::shadowsocks, protocolConfig);
|
||||
|
||||
ErrorCode e = doInstallAction([this, containerConfig, newContainerConfig](){
|
||||
return ServerController::updateContainer(m_settings.serverCredentials(selectedServerIndex), selectedDockerContainer, containerConfig, newContainerConfig);
|
||||
},
|
||||
ui->page_proto_shadowsocks, ui->progressBar_proto_shadowsocks_reset,
|
||||
ui->pushButton_proto_shadowsocks_save, ui->label_proto_shadowsocks_info);
|
||||
|
||||
if (!e) {
|
||||
m_settings.setContainerConfig(selectedServerIndex, selectedDockerContainer, newContainerConfig);
|
||||
m_settings.clearLastConnectionConfig(selectedServerIndex, selectedDockerContainer);
|
||||
}
|
||||
qDebug() << "Protocol saved with code:" << e << "for" << selectedServerIndex << selectedDockerContainer;
|
||||
});
|
||||
|
||||
connect(ui->pushButton_proto_cloak_save, &QPushButton::clicked, this, [this](){
|
||||
QJsonObject protocolConfig = m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, Protocol::Cloak);
|
||||
protocolConfig = getCloakConfigFromPage(protocolConfig);
|
||||
|
||||
QJsonObject containerConfig = m_settings.containerConfig(selectedServerIndex, selectedDockerContainer);
|
||||
QJsonObject newContainerConfig = containerConfig;
|
||||
newContainerConfig.insert(config_key::cloak, protocolConfig);
|
||||
|
||||
ErrorCode e = doInstallAction([this, containerConfig, newContainerConfig](){
|
||||
return ServerController::updateContainer(m_settings.serverCredentials(selectedServerIndex), selectedDockerContainer, containerConfig, newContainerConfig);
|
||||
},
|
||||
ui->page_proto_cloak, ui->progressBar_proto_cloak_reset,
|
||||
ui->pushButton_proto_cloak_save, ui->label_proto_cloak_info);
|
||||
|
||||
if (!e) {
|
||||
m_settings.setContainerConfig(selectedServerIndex, selectedDockerContainer, newContainerConfig);
|
||||
m_settings.clearLastConnectionConfig(selectedServerIndex, selectedDockerContainer);
|
||||
}
|
||||
|
||||
qDebug() << "Protocol saved with code:" << e << "for" << selectedServerIndex << selectedDockerContainer;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1127,6 +1182,137 @@ void MainWindow::setupNewServerPageConnections()
|
|||
});
|
||||
}
|
||||
|
||||
void MainWindow::setupServerSettingsPageConnections()
|
||||
{
|
||||
connect(ui->pushButton_server_settings_protocols, &QPushButton::clicked, this, [this](){ goToPage(Page::ServerVpnProtocols); });
|
||||
|
||||
connect(ui->pushButton_server_settings_clear, SIGNAL(clicked(bool)), this, SLOT(onPushButtonClearServer(bool)));
|
||||
connect(ui->pushButton_server_settings_forget, SIGNAL(clicked(bool)), this, SLOT(onPushButtonForgetServer(bool)));
|
||||
|
||||
connect(ui->pushButton_server_settings_clear_client_cache, &QPushButton::clicked, this, [this](){
|
||||
ui->pushButton_server_settings_clear_client_cache->setText(tr("Cache cleared"));
|
||||
|
||||
const auto &containers = m_settings.containers(selectedServerIndex);
|
||||
for (DockerContainer container: containers.keys()) {
|
||||
m_settings.clearLastConnectionConfig(selectedServerIndex, container);
|
||||
}
|
||||
|
||||
QTimer::singleShot(3000, this, [this]() {
|
||||
ui->pushButton_server_settings_clear_client_cache->setText(tr("Clear client cached profile"));
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::setupSharePageConnections()
|
||||
{
|
||||
connect(ui->pushButton_share_full_copy, &QPushButton::clicked, this, [this](){
|
||||
QGuiApplication::clipboard()->setText(ui->textEdit_share_full_code->toPlainText());
|
||||
ui->pushButton_share_full_copy->setText(tr("Copied"));
|
||||
|
||||
QTimer::singleShot(3000, this, [this]() {
|
||||
ui->pushButton_share_full_copy->setText(tr("Copy"));
|
||||
});
|
||||
});
|
||||
|
||||
connect(ui->pushButton_share_amnezia_copy, &QPushButton::clicked, this, [this](){
|
||||
QGuiApplication::clipboard()->setText(ui->textEdit_share_amnezia_code->toPlainText());
|
||||
ui->pushButton_share_amnezia_copy->setText(tr("Copied"));
|
||||
|
||||
QTimer::singleShot(3000, this, [this]() {
|
||||
ui->pushButton_share_amnezia_copy->setText(tr("Copy"));
|
||||
});
|
||||
});
|
||||
|
||||
connect(ui->pushButton_share_openvpn_copy, &QPushButton::clicked, this, [this](){
|
||||
QGuiApplication::clipboard()->setText(ui->textEdit_share_openvpn_code->toPlainText());
|
||||
ui->pushButton_share_openvpn_copy->setText(tr("Copied"));
|
||||
|
||||
QTimer::singleShot(3000, this, [this]() {
|
||||
ui->pushButton_share_openvpn_copy->setText(tr("Copy"));
|
||||
});
|
||||
});
|
||||
|
||||
connect(ui->pushButton_share_ss_copy, &QPushButton::clicked, this, [this](){
|
||||
QGuiApplication::clipboard()->setText(ui->lineEdit_share_ss_string->text());
|
||||
ui->pushButton_share_ss_copy->setText(tr("Copied"));
|
||||
|
||||
QTimer::singleShot(3000, this, [this]() {
|
||||
ui->pushButton_share_ss_copy->setText(tr("Copy"));
|
||||
});
|
||||
});
|
||||
|
||||
// connect(ui->pushButton_share_cloak_copy, &QPushButton::clicked, this, [this](){
|
||||
// QGuiApplication::clipboard()->setText(ui->textEdit_share_openvpn_code->toPlainText());
|
||||
// ui->pushButton_share_cloak_copy->setText(tr("Copied"));
|
||||
|
||||
// QTimer::singleShot(3000, this, [this]() {
|
||||
// ui->pushButton_share_cloak_copy->setText(tr("Copy"));
|
||||
// });
|
||||
// });
|
||||
|
||||
connect(ui->pushButton_share_amnezia_generate, &QPushButton::clicked, this, [this](){
|
||||
ui->pushButton_share_amnezia_generate->setEnabled(false);
|
||||
ui->pushButton_share_amnezia_copy->setEnabled(false);
|
||||
ui->pushButton_share_amnezia_generate->setText(tr("Generating..."));
|
||||
qApp->processEvents();
|
||||
|
||||
ServerCredentials credentials = m_settings.serverCredentials(selectedServerIndex);
|
||||
QJsonObject containerConfig; // = m_settings.containerConfig(selectedServerIndex, selectedDockerContainer);
|
||||
containerConfig.insert(config_key::container, containerToString(selectedDockerContainer));
|
||||
|
||||
for (Protocol p: amnezia::protocolsForContainer(selectedDockerContainer)) {
|
||||
QJsonObject protoConfig = m_settings.protocolConfig(selectedServerIndex, selectedDockerContainer, p);
|
||||
|
||||
ErrorCode e = ErrorCode::NoError;
|
||||
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);
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
|
||||
ui->textEdit_share_amnezia_code->setPlainText(QJsonDocument(serverConfig).toJson());
|
||||
|
||||
ui->pushButton_share_amnezia_generate->setEnabled(true);
|
||||
ui->pushButton_share_amnezia_copy->setEnabled(true);
|
||||
ui->pushButton_share_amnezia_generate->setText(tr("Generate config"));
|
||||
});
|
||||
|
||||
connect(ui->pushButton_share_openvpn_generate, &QPushButton::clicked, this, [this](){
|
||||
ServerCredentials credentials = m_settings.serverCredentials(selectedServerIndex);
|
||||
const QJsonObject &containerConfig = m_settings.containerConfig(selectedServerIndex, selectedDockerContainer);
|
||||
ui->pushButton_share_openvpn_copy->setEnabled(false);
|
||||
ui->pushButton_share_openvpn_save->setEnabled(false);
|
||||
|
||||
ErrorCode e = ErrorCode::NoError;
|
||||
QString cfg = OpenVpnConfigurator::genOpenVpnConfig(credentials, selectedDockerContainer, containerConfig, &e);
|
||||
|
||||
ui->textEdit_share_openvpn_code->setPlainText(cfg);
|
||||
ui->pushButton_share_openvpn_copy->setEnabled(true);
|
||||
ui->pushButton_share_openvpn_save->setEnabled(true);
|
||||
});
|
||||
|
||||
connect(ui->pushButton_share_openvpn_save, &QPushButton::clicked, this, [this](){
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save OpenVPN config"), QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.ovpn");
|
||||
QSaveFile save(fileName);
|
||||
save.open(QIODevice::WriteOnly);
|
||||
save.write(ui->textEdit_share_openvpn_code->toPlainText().toUtf8());
|
||||
save.commit();
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::setTrayState(VpnProtocol::ConnectionState state)
|
||||
{
|
||||
QString resourcesPath = ":/images/tray/%1";
|
||||
|
|
@ -1224,7 +1410,6 @@ void MainWindow::onTrayActionConnect()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::onPushButtonAddCustomSitesClicked()
|
||||
{
|
||||
QString newSite = ui->lineEdit_sites_add_custom->text();
|
||||
|
|
@ -1428,6 +1613,115 @@ void MainWindow::updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerConta
|
|||
ui->radioButton_proto_openvpn_tcp->setEnabled(false);
|
||||
ui->radioButton_proto_openvpn_tcp->setChecked(true);
|
||||
}
|
||||
|
||||
ui->lineEdit_proto_openvpn_port->setText(openvpnConfig.value(config_key::port).
|
||||
toString(protocols::openvpn::defaultPort));
|
||||
|
||||
ui->lineEdit_proto_openvpn_port->setEnabled(container == DockerContainer::OpenVpn);
|
||||
}
|
||||
|
||||
void MainWindow::updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container)
|
||||
{
|
||||
ui->comboBox_proto_shadowsocks_cipher->setCurrentText(ssConfig.value(config_key::cipher).
|
||||
toString(protocols::shadowsocks::defaultCipher));
|
||||
|
||||
ui->lineEdit_proto_shadowsocks_port->setText(ssConfig.value(config_key::port).
|
||||
toString(protocols::shadowsocks::defaultPort));
|
||||
|
||||
ui->lineEdit_proto_shadowsocks_port->setEnabled(container == DockerContainer::OpenVpnOverShadowSocks);
|
||||
}
|
||||
|
||||
void MainWindow::updateCloakPage(const QJsonObject &ckConfig, DockerContainer container)
|
||||
{
|
||||
ui->comboBox_proto_cloak_cipher->setCurrentText(ckConfig.value(config_key::cipher).
|
||||
toString(protocols::cloak::defaultCipher));
|
||||
|
||||
ui->lineEdit_proto_cloak_site->setText(ckConfig.value(config_key::site).
|
||||
toString(protocols::cloak::defaultRedirSite));
|
||||
|
||||
ui->lineEdit_proto_cloak_port->setText(ckConfig.value(config_key::port).
|
||||
toString(protocols::cloak::defaultPort));
|
||||
|
||||
ui->lineEdit_proto_cloak_port->setEnabled(container == DockerContainer::OpenVpnOverCloak);
|
||||
}
|
||||
|
||||
void MainWindow::updateSharingPage(int serverIndex, const ServerCredentials &credentials,
|
||||
DockerContainer container)
|
||||
{
|
||||
selectedDockerContainer = container;
|
||||
selectedServerIndex = serverIndex;
|
||||
|
||||
const QJsonObject &containerConfig = m_settings.containerConfig(serverIndex, container);
|
||||
|
||||
for (QWidget *page : { ui->page_share_openvpn,
|
||||
ui->page_share_shadowsocks,
|
||||
ui->page_share_cloak,
|
||||
ui->page_share_full_access }) {
|
||||
|
||||
ui->toolBox_share_connection->removeItem(ui->toolBox_share_connection->indexOf(page));
|
||||
page->hide();
|
||||
}
|
||||
|
||||
if (container == DockerContainer::OpenVpn) {
|
||||
ui->toolBox_share_connection->addItem(ui->page_share_openvpn, tr(" Share for OpenVPN client"));
|
||||
|
||||
QJsonObject protoConfig = m_settings.protocolConfig(serverIndex, container, Protocol::OpenVpn);
|
||||
QString cfg = protoConfig.value(config_key::last_config).toString();
|
||||
if (!cfg.isEmpty()) {
|
||||
// TODO add redirect-gateway def1 bypass-dhcp here and on click Generate config
|
||||
ui->textEdit_share_openvpn_code->setPlainText(cfg);
|
||||
}
|
||||
else {
|
||||
cfg = tr("Press Generate config");
|
||||
ui->textEdit_share_openvpn_code->setPlainText(cfg);
|
||||
ui->pushButton_share_openvpn_copy->setEnabled(false);
|
||||
ui->pushButton_share_openvpn_save->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (container == DockerContainer::OpenVpnOverShadowSocks) {
|
||||
ui->toolBox_share_connection->addItem(ui->page_share_shadowsocks, tr(" Share for ShadowSocks client"));
|
||||
|
||||
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);
|
||||
|
||||
ui->pushButton_share_ss_copy->setEnabled(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();
|
||||
ui->lineEdit_share_ss_string->setText(ssString);
|
||||
updateQRCodeImage(ssString, ui->label_share_ss_qr_code);
|
||||
|
||||
ui->label_share_ss_server->setText(ssConfig.value("server").toString());
|
||||
ui->label_share_ss_port->setText(ssConfig.value("server_port").toString());
|
||||
ui->label_share_ss_method->setText(ssConfig.value("method").toString());
|
||||
ui->label_share_ss_password->setText(ssConfig.value("password").toString());
|
||||
}
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
||||
void MainWindow::makeSitesListItem(QListWidget *listWidget, const QString &address)
|
||||
|
|
@ -1472,10 +1766,10 @@ void MainWindow::makeServersListItem(QListWidget *listWidget, const QJsonObject
|
|||
updateServersListPage();
|
||||
});
|
||||
|
||||
connect(widget->ui->pushButton_share, &QPushButton::clicked, this, [this, index](){
|
||||
goToPage(Page::ShareConnection);
|
||||
// update share page
|
||||
});
|
||||
// connect(widget->ui->pushButton_share, &QPushButton::clicked, this, [this, index](){
|
||||
// goToPage(Page::ShareConnection);
|
||||
// // update share page
|
||||
// });
|
||||
|
||||
connect(widget->ui->pushButton_settings, &QPushButton::clicked, this, [this, index](){
|
||||
selectedServerIndex = index;
|
||||
|
|
@ -1521,6 +1815,24 @@ QJsonObject MainWindow::getOpenVpnConfigFromPage(QJsonObject oldConfig)
|
|||
oldConfig.insert(config_key::cipher, ui->comboBox_proto_openvpn_cipher->currentText());
|
||||
oldConfig.insert(config_key::hash, ui->comboBox_proto_openvpn_hash->currentText());
|
||||
oldConfig.insert(config_key::block_outside_dns, ui->checkBox_proto_openvpn_block_dns->isChecked());
|
||||
oldConfig.insert(config_key::port, ui->lineEdit_proto_openvpn_port->text());
|
||||
|
||||
return oldConfig;
|
||||
}
|
||||
|
||||
QJsonObject MainWindow::getShadowSocksConfigFromPage(QJsonObject oldConfig)
|
||||
{
|
||||
oldConfig.insert(config_key::cipher, ui->comboBox_proto_shadowsocks_cipher->currentText());
|
||||
oldConfig.insert(config_key::port, ui->lineEdit_proto_shadowsocks_port->text());
|
||||
|
||||
return oldConfig;
|
||||
}
|
||||
|
||||
QJsonObject MainWindow::getCloakConfigFromPage(QJsonObject oldConfig)
|
||||
{
|
||||
oldConfig.insert(config_key::cipher, ui->comboBox_proto_cloak_cipher->currentText());
|
||||
oldConfig.insert(config_key::site, ui->lineEdit_proto_cloak_site->text());
|
||||
oldConfig.insert(config_key::port, ui->lineEdit_proto_cloak_port->text());
|
||||
|
||||
return oldConfig;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ private slots:
|
|||
void onPushButtonNewServerConnectConfigure(bool);
|
||||
void onPushButtonNewServerImport(bool);
|
||||
|
||||
void onPushButtonReinstallServer(bool);
|
||||
void onPushButtonClearServer(bool);
|
||||
void onPushButtonForgetServer(bool);
|
||||
|
||||
|
|
@ -90,6 +89,8 @@ private:
|
|||
void setupUiConnections();
|
||||
void setupProtocolsPageConnections();
|
||||
void setupNewServerPageConnections();
|
||||
void setupServerSettingsPageConnections();
|
||||
void setupSharePageConnections();
|
||||
|
||||
void updateSettings();
|
||||
|
||||
|
|
@ -100,7 +101,12 @@ private:
|
|||
void updateServersListPage();
|
||||
void updateProtocolsPage();
|
||||
void updateShareCodePage();
|
||||
void updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container = DockerContainer::None);
|
||||
void updateOpenVpnPage(const QJsonObject &openvpnConfig, DockerContainer container);
|
||||
void updateShadowSocksPage(const QJsonObject &ssConfig, DockerContainer container);
|
||||
void updateCloakPage(const QJsonObject &ckConfig, DockerContainer container);
|
||||
|
||||
void updateSharingPage(int serverIndex, const ServerCredentials &credentials,
|
||||
DockerContainer container);
|
||||
|
||||
void makeSitesListItem(QListWidget* listWidget, const QString &address);
|
||||
void makeServersListItem(QListWidget* listWidget, const QJsonObject &server, bool isDefault, int index);
|
||||
|
|
@ -108,6 +114,8 @@ private:
|
|||
void updateQRCodeImage(const QString &text, QLabel *label);
|
||||
|
||||
QJsonObject getOpenVpnConfigFromPage(QJsonObject oldConfig);
|
||||
QJsonObject getShadowSocksConfigFromPage(QJsonObject oldConfig);
|
||||
QJsonObject getCloakConfigFromPage(QJsonObject oldConfig);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
|
@ -123,6 +131,7 @@ private:
|
|||
QRegExpValidator m_ipAddressValidator;
|
||||
QRegExpValidator m_ipAddressPortValidator;
|
||||
QRegExpValidator m_ipNetwok24Validator;
|
||||
QRegExpValidator m_ipPortValidator;
|
||||
|
||||
CQR_Encode m_qrEncode;
|
||||
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ QPushButton:hover {
|
|||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>14</number>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_start">
|
||||
<widget class="QLabel" name="label_25">
|
||||
|
|
@ -1206,6 +1206,16 @@ border: none;
|
|||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_new_server_ss_cipher">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>chacha20-ietf-poly1305</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>xchacha20-ietf-poly1305</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>aes-256-gcm</string>
|
||||
|
|
@ -1221,16 +1231,6 @@ border: none;
|
|||
<string>aes-128-gcm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>chacha20-ietf-poly1305</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>xchacha20-ietf-poly1305</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
@ -2984,7 +2984,7 @@ padding:0px;
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_server_settings_reinstall">
|
||||
<widget class="QPushButton" name="pushButton_server_settings_clear_client_cache">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
|
|
@ -3015,7 +3015,7 @@ background: #211966;
|
|||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reinstall Amnezia server</string>
|
||||
<string>Clear client cached profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_back_from_server_settings">
|
||||
|
|
@ -3078,50 +3078,6 @@ color: #100A44;
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_server_settings_reinstall">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>350</y>
|
||||
<width>300</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QProgressBar{
|
||||
color:rgb(212, 212, 212);
|
||||
border-radius: 4px;
|
||||
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 21px;
|
||||
|
||||
background: #100A44;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
QProgressBar::chunk {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
border-radius: 4px 0px 0px 4px;
|
||||
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="textVisible">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>Configuring...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
|
|
@ -3322,9 +3278,8 @@ font-size: 20px;
|
|||
</widget>
|
||||
<zorder>label_server_settings_wait_info</zorder>
|
||||
<zorder>label_16</zorder>
|
||||
<zorder>progressBar_server_settings_reinstall</zorder>
|
||||
<zorder>label_17</zorder>
|
||||
<zorder>pushButton_server_settings_reinstall</zorder>
|
||||
<zorder>pushButton_server_settings_clear_client_cache</zorder>
|
||||
<zorder>pushButton_server_settings_clear</zorder>
|
||||
<zorder>pushButton_server_settings_forget</zorder>
|
||||
<zorder>label_server_settings_server</zorder>
|
||||
|
|
@ -4144,8 +4099,7 @@ background: transparent;
|
|||
}
|
||||
|
||||
QToolBox > QWidget {
|
||||
font: 25px "Lato";
|
||||
|
||||
font: 25px "Lato";
|
||||
background: transparent;
|
||||
border-radius: 5px;
|
||||
|
||||
|
|
@ -4163,7 +4117,7 @@ border-radius: 2px;
|
|||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 23px;
|
||||
font-size: 18px;
|
||||
color: #100A44;
|
||||
image: url(:/images/share.png);
|
||||
image-position: left;
|
||||
|
|
@ -4188,15 +4142,15 @@ QToolBox::tab:hover {
|
|||
<number>1</number>
|
||||
</property>
|
||||
<property name="tabSpacing">
|
||||
<number>2</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_share_main">
|
||||
<widget class="QWidget" name="page_share_full_access">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>500</height>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
|
@ -4205,12 +4159,12 @@ QToolBox::tab:hover {
|
|||
<attribute name="label">
|
||||
<string> Full access</string>
|
||||
</attribute>
|
||||
<widget class="QTextEdit" name="textEdit_sharing_code">
|
||||
<widget class="QTextEdit" name="textEdit_share_full_code">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>330</width>
|
||||
<width>341</width>
|
||||
<height>100</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -4255,7 +4209,7 @@ p, li { white-space: pre-wrap; }
|
|||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<width>321</width>
|
||||
<width>341</width>
|
||||
<height>111</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -4275,18 +4229,18 @@ This code includes your server credentials!
|
|||
Provide this code only to TRUSTED users.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignJustify|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_copy_sharing_code">
|
||||
<widget class="QPushButton" name="pushButton_share_full_copy">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>130</y>
|
||||
<width>331</width>
|
||||
<width>341</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -4318,20 +4272,346 @@ background: #282932;
|
|||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_share_amnezia">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string> Share for Amnezia client</string>
|
||||
</attribute>
|
||||
<widget class="QTextEdit" name="textEdit_share_amnezia_code">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>341</width>
|
||||
<height>100</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QTextEdit {
|
||||
|
||||
background: #F5F5F5;
|
||||
border-radius: 10px;
|
||||
|
||||
|
||||
font-family: Consolas;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
|
||||
text-align: center;
|
||||
|
||||
color: #15CDCB;
|
||||
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
<enum>QTextEdit::FixedColumnWidth</enum>
|
||||
</property>
|
||||
<property name="lineWrapColumnOrWidth">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Consolas'; font-size:20px; font-weight:600; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt;">vpn:\\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_41">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>230</y>
|
||||
<width>341</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 150%;
|
||||
|
||||
color: #181922;
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Anyone who logs in with this code will be able to connect to this VPN server.
|
||||
This code does not include server credentials.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignJustify|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_share_amnezia_copy">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<width>341</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
font-size: 13pt;
|
||||
font: "Open Sans Semibold";
|
||||
color:rgb(212, 212, 212);
|
||||
|
||||
background: #181922;
|
||||
border-radius: 4px;
|
||||
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 21px;
|
||||
|
||||
}
|
||||
QPushButton:hover {
|
||||
background: #282932;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_share_amnezia_generate">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>130</y>
|
||||
<width>341</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
font-size: 13pt;
|
||||
font: "Open Sans Semibold";
|
||||
color:rgb(212, 212, 212);
|
||||
|
||||
background: #181922;
|
||||
border-radius: 4px;
|
||||
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 21px;
|
||||
|
||||
}
|
||||
QPushButton:hover {
|
||||
background: #282932;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Generate config</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_share_openvpn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string> Share for OpenVPN client</string>
|
||||
</attribute>
|
||||
<widget class="QTextEdit" name="textEdit_share_openvpn_code">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>341</width>
|
||||
<height>100</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QTextEdit {
|
||||
|
||||
background: #F5F5F5;
|
||||
border-radius: 10px;
|
||||
|
||||
|
||||
font-family: Consolas;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 20px;
|
||||
|
||||
text-align: center;
|
||||
|
||||
color: #15CDCB;
|
||||
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
<enum>QTextEdit::FixedColumnWidth</enum>
|
||||
</property>
|
||||
<property name="lineWrapColumnOrWidth">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Consolas'; font-size:20px; font-weight:600; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt;">vpn:\\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_share_openvpn_copy">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<width>341</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
font-size: 13pt;
|
||||
font: "Open Sans Semibold";
|
||||
color:rgb(212, 212, 212);
|
||||
|
||||
background: #181922;
|
||||
border-radius: 4px;
|
||||
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 21px;
|
||||
|
||||
}
|
||||
QPushButton:hover {
|
||||
background: #282932;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_share_openvpn_save">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>230</y>
|
||||
<width>341</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
font-size: 13pt;
|
||||
font: "Open Sans Semibold";
|
||||
color:rgb(212, 212, 212);
|
||||
|
||||
background: #181922;
|
||||
border-radius: 4px;
|
||||
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 21px;
|
||||
|
||||
}
|
||||
QPushButton:hover {
|
||||
background: #282932;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save file</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_share_openvpn_generate">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>130</y>
|
||||
<width>341</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>PointingHandCursor</cursorShape>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
font-size: 13pt;
|
||||
font: "Open Sans Semibold";
|
||||
color:rgb(212, 212, 212);
|
||||
|
||||
background: #181922;
|
||||
border-radius: 4px;
|
||||
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 21px;
|
||||
|
||||
}
|
||||
QPushButton:hover {
|
||||
background: #282932;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Generate config</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_share_shadowsocks">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>500</height>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string> ShadowSocks</string>
|
||||
<string> Share for ShadowSocks client</string>
|
||||
</attribute>
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="geometry">
|
||||
|
|
@ -4462,7 +4742,7 @@ background: #282932;
|
|||
<string>Connection string</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_share_ss_code">
|
||||
<widget class="QPushButton" name="pushButton_share_ss_copy">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
|
|
@ -4542,6 +4822,19 @@ color: #15CDCB;
|
|||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_share_cloak">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string> Share for Cloak client</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_proto_openvpn">
|
||||
|
|
@ -4644,7 +4937,7 @@ QPushButton:hover {
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>330</y>
|
||||
<y>380</y>
|
||||
<width>151</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
|
|
@ -4694,6 +4987,11 @@ QPushButton:hover {
|
|||
<string>CAMELLIA-256-CBC</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>none</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_99">
|
||||
<property name="enabled">
|
||||
|
|
@ -4702,7 +5000,7 @@ QPushButton:hover {
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>300</y>
|
||||
<y>350</y>
|
||||
<width>151</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
|
@ -4718,7 +5016,7 @@ QPushButton:hover {
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>330</y>
|
||||
<y>380</y>
|
||||
<width>151</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
|
|
@ -4776,7 +5074,7 @@ QPushButton:hover {
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>300</y>
|
||||
<y>350</y>
|
||||
<width>151</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
|
@ -4792,7 +5090,7 @@ QPushButton:hover {
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>390</y>
|
||||
<y>440</y>
|
||||
<width>321</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
|
@ -4807,9 +5105,9 @@ QPushButton:hover {
|
|||
<widget class="QPushButton" name="pushButton_proto_openvpn_save">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<x>30</x>
|
||||
<y>530</y>
|
||||
<width>300</width>
|
||||
<width>311</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -4911,7 +5209,7 @@ background: #211966;
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>270</y>
|
||||
<y>320</y>
|
||||
<width>321</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
|
|
@ -4926,9 +5224,9 @@ background: #211966;
|
|||
<widget class="QProgressBar" name="progressBar_proto_openvpn_reset">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<x>30</x>
|
||||
<y>530</y>
|
||||
<width>301</width>
|
||||
<width>311</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -4989,6 +5287,41 @@ border-radius: 4px 0px 0px 4px;
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_proto_openvpn_port">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>260</y>
|
||||
<width>151</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_103">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>260</y>
|
||||
<width>151</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>progressBar_proto_openvpn_reset</zorder>
|
||||
<zorder>label_38</zorder>
|
||||
<zorder>pushButton_back_from_openvpn_settings</zorder>
|
||||
|
|
@ -5004,6 +5337,8 @@ border-radius: 4px 0px 0px 4px;
|
|||
<zorder>frame_3</zorder>
|
||||
<zorder>checkBox_proto_openvpn_auto_encryption</zorder>
|
||||
<zorder>label_proto_openvpn_info</zorder>
|
||||
<zorder>lineEdit_proto_openvpn_port</zorder>
|
||||
<zorder>label_103</zorder>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_proto_shadowsocks">
|
||||
<widget class="QLabel" name="label_43">
|
||||
|
|
@ -5090,33 +5425,13 @@ QPushButton:hover {
|
|||
<string>aes-128-gcm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>aes-256-cfb</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>aes-128-cfb</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>chacha20</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>chacha20-ietf</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar_proto_shadowsocks_reset">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<x>30</x>
|
||||
<y>530</y>
|
||||
<width>301</width>
|
||||
<width>311</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -5158,9 +5473,9 @@ border-radius: 4px 0px 0px 4px;
|
|||
<widget class="QPushButton" name="pushButton_proto_shadowsocks_save">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<x>30</x>
|
||||
<y>530</y>
|
||||
<width>300</width>
|
||||
<width>311</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -5230,6 +5545,41 @@ background: #211966;
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_proto_shadowsocks_port">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>130</y>
|
||||
<width>151</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_104">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>130</y>
|
||||
<width>151</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_proto_cloak">
|
||||
<widget class="QLabel" name="label_44">
|
||||
|
|
@ -5251,7 +5601,7 @@ color: #100A44;
|
|||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OpenVPN Settings</string>
|
||||
<string>Cloak Settings</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
|
|
@ -5311,6 +5661,11 @@ QPushButton:hover {
|
|||
<string>aes-256-gcm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>aes-192-gcm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>aes-128-gcm</string>
|
||||
|
|
@ -5344,9 +5699,9 @@ QPushButton:hover {
|
|||
<widget class="QProgressBar" name="progressBar_proto_cloak_reset">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<x>30</x>
|
||||
<y>530</y>
|
||||
<width>301</width>
|
||||
<width>311</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -5410,9 +5765,9 @@ border-radius: 4px 0px 0px 4px;
|
|||
<widget class="QPushButton" name="pushButton_proto_cloak_save">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<x>30</x>
|
||||
<y>530</y>
|
||||
<width>300</width>
|
||||
<width>311</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -5441,6 +5796,82 @@ background: #211966;
|
|||
<string>Save and restart VPN</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_47">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>130</y>
|
||||
<width>130</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>130</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>130</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fake Web Site</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_proto_cloak_port">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>180</y>
|
||||
<width>151</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_105">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>180</y>
|
||||
<width>151</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_proto_cloak_site">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>130</y>
|
||||
<width>151</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>mail.ru</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,19 @@ ServerWidget::ServerWidget(const QJsonObject &server, bool isDefault, QWidget *p
|
|||
ui(new Ui::ServerWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->pushButton_connect->hide();
|
||||
ui->pushButton_share->hide();
|
||||
|
||||
//ui->pushButton_settings->hide();\\
|
||||
|
||||
ui->pushButton_settings->setGraphicsEffect(&eff);
|
||||
animation.setTargetObject(&eff);
|
||||
animation.setPropertyName("opacity");
|
||||
animation.setDuration(150);
|
||||
animation.setEasingCurve(QEasingCurve::InOutQuad);
|
||||
|
||||
eff.setOpacity(0);
|
||||
|
||||
QString desc = server.value(config_key::description).toString();
|
||||
QString address = server.value(config_key::hostName).toString();
|
||||
|
||||
|
|
@ -29,3 +42,20 @@ ServerWidget::~ServerWidget()
|
|||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ServerWidget::enterEvent(QEvent *e)
|
||||
{
|
||||
animation.setStartValue(0);
|
||||
animation.setEndValue(1);
|
||||
|
||||
animation.start();
|
||||
}
|
||||
|
||||
void ServerWidget::leaveEvent(QEvent *e)
|
||||
{
|
||||
animation.setStartValue(1);
|
||||
animation.setEndValue(0);
|
||||
|
||||
animation.start();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
#include <QJsonObject>
|
||||
#include <QWidget>
|
||||
|
||||
#include <QGraphicsOpacityEffect>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
namespace Ui {
|
||||
class ServerWidget;
|
||||
}
|
||||
|
|
@ -16,7 +19,12 @@ public:
|
|||
explicit ServerWidget(const QJsonObject &server, bool isDefault, QWidget *parent = nullptr);
|
||||
~ServerWidget();
|
||||
Ui::ServerWidget *ui;
|
||||
private:
|
||||
void enterEvent(QEvent *e) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
|
||||
QPropertyAnimation animation;
|
||||
QGraphicsOpacityEffect eff;
|
||||
};
|
||||
|
||||
#endif // SERVER_WIDGET_H
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ QPushButton:!checked {
|
|||
<widget class="QPushButton" name="pushButton_share">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<x>170</x>
|
||||
<y>25</y>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
|
|
@ -139,7 +139,7 @@ QPushButton:!checked {
|
|||
<widget class="QPushButton" name="pushButton_settings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>174</x>
|
||||
<x>260</x>
|
||||
<y>25</y>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue