moved vpnConnection to separate thread
- added tabbar blocking when installing/removing containers
This commit is contained in:
parent
e0d93eaa9f
commit
591d98d8b6
14 changed files with 128 additions and 95 deletions
|
@ -57,6 +57,27 @@ AmneziaApplication::AmneziaApplication(int &argc, char *argv[], bool allowSecond
|
|||
|
||||
AmneziaApplication::~AmneziaApplication()
|
||||
{
|
||||
// emit hide();
|
||||
|
||||
// #ifdef AMNEZIA_DESKTOP
|
||||
// if (m_vpnConnection->connectionState() != Vpn::ConnectionState::Disconnected) {
|
||||
// m_vpnConnection->disconnectFromVpn();
|
||||
// for (int i = 0; i < 50; i++) {
|
||||
// qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
// QThread::msleep(100);
|
||||
// if (m_vpnConnection->isDisconnected()) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
|
||||
// m_vpnConnection->deleteLater();
|
||||
// m_vpnConnectionThread.quit();
|
||||
// m_vpnConnectionThread.wait(3000);
|
||||
|
||||
// qDebug() << "Application closed";
|
||||
|
||||
if (m_engine) {
|
||||
QObject::disconnect(m_engine, 0, 0, 0);
|
||||
delete m_engine;
|
||||
|
@ -87,6 +108,8 @@ void AmneziaApplication::init()
|
|||
|
||||
m_configurator = std::shared_ptr<VpnConfigurator>(new VpnConfigurator(m_settings, this));
|
||||
m_vpnConnection.reset(new VpnConnection(m_settings, m_configurator));
|
||||
m_vpnConnection->moveToThread(&m_vpnConnectionThread);
|
||||
m_vpnConnectionThread.start();
|
||||
|
||||
initModels();
|
||||
initControllers();
|
||||
|
|
|
@ -101,6 +101,7 @@ private:
|
|||
QScopedPointer<SftpConfigModel> m_sftpConfigModel;
|
||||
|
||||
QSharedPointer<VpnConnection> m_vpnConnection;
|
||||
QThread m_vpnConnectionThread;
|
||||
QScopedPointer<NotificationHandler> m_notificationHandler;
|
||||
|
||||
QScopedPointer<ConnectionController> m_connectionController;
|
||||
|
|
|
@ -2,20 +2,19 @@
|
|||
#include <QTimer>
|
||||
|
||||
#include "amnezia_application.h"
|
||||
#include "version.h"
|
||||
#include "migrations.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include "Windows.h"
|
||||
#include "Windows.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_IOS)
|
||||
#include "platforms/ios/QtAppDelegate-C-Interface.h"
|
||||
#include "platforms/ios/QtAppDelegate-C-Interface.h"
|
||||
#endif
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Migrations migrationsManager;
|
||||
|
@ -27,16 +26,14 @@ int main(int argc, char *argv[])
|
|||
AllowSetForegroundWindow(ASFW_ANY);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||
AmneziaApplication app(argc, argv);
|
||||
#else
|
||||
AmneziaApplication app(argc, argv, true, SingleApplication::Mode::User | SingleApplication::Mode::SecondaryNotification);
|
||||
AmneziaApplication app(argc, argv, true,
|
||||
SingleApplication::Mode::User | SingleApplication::Mode::SecondaryNotification);
|
||||
|
||||
if (!app.isPrimary()) {
|
||||
QTimer::singleShot(1000, &app, [&](){
|
||||
app.quit();
|
||||
});
|
||||
QTimer::singleShot(1000, &app, [&]() { app.quit(); });
|
||||
return app.exec();
|
||||
}
|
||||
#endif
|
||||
|
@ -63,6 +60,10 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (doExec) {
|
||||
app.init();
|
||||
|
||||
qInfo().noquote() << QString("Started %1 version %2").arg(APPLICATION_NAME, APP_VERSION);
|
||||
qInfo().noquote() << QString("%1 (%2)").arg(QSysInfo::prettyProductName(), QSysInfo::currentCpuArchitecture());
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
#include <QCoreApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QProcess>
|
||||
#include <QTcpSocket>
|
||||
#include <QTcpServer>
|
||||
#include <QRandomGenerator>
|
||||
#include <QTcpServer>
|
||||
#include <QTcpSocket>
|
||||
|
||||
#include "logger.h"
|
||||
#include "version.h"
|
||||
#include "utilities.h"
|
||||
#include "openvpnprotocol.h"
|
||||
#include "utilities.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
OpenVpnProtocol::OpenVpnProtocol(const QJsonObject &configuration, QObject* parent) :
|
||||
VpnProtocol(configuration, parent)
|
||||
OpenVpnProtocol::OpenVpnProtocol(const QJsonObject &configuration, QObject *parent) : VpnProtocol(configuration, parent)
|
||||
{
|
||||
readOpenVpnConfiguration(configuration);
|
||||
connect(&m_managementServer, &ManagementServer::readyRead, this, &OpenVpnProtocol::onReadyReadDataFromManagementServer);
|
||||
connect(&m_managementServer, &ManagementServer::readyRead, this,
|
||||
&OpenVpnProtocol::onReadyReadDataFromManagementServer);
|
||||
}
|
||||
|
||||
OpenVpnProtocol::~OpenVpnProtocol()
|
||||
|
@ -27,7 +26,7 @@ OpenVpnProtocol::~OpenVpnProtocol()
|
|||
|
||||
QString OpenVpnProtocol::defaultConfigFileName()
|
||||
{
|
||||
//qDebug() << "OpenVpnProtocol::defaultConfigFileName" << defaultConfigPath() + QString("/%1.ovpn").arg(APPLICATION_NAME);
|
||||
// qDebug() << "OpenVpnProtocol::defaultConfigFileName" << defaultConfigPath() + QString("/%1.ovpn").arg(APPLICATION_NAME);
|
||||
return defaultConfigPath() + QString("/%1.ovpn").arg(APPLICATION_NAME);
|
||||
}
|
||||
|
||||
|
@ -42,21 +41,20 @@ QString OpenVpnProtocol::defaultConfigPath()
|
|||
void OpenVpnProtocol::stop()
|
||||
{
|
||||
qDebug() << "OpenVpnProtocol::stop()";
|
||||
setConnectionState(VpnProtocol::Disconnecting);
|
||||
setConnectionState(Vpn::ConnectionState::Disconnecting);
|
||||
|
||||
// TODO: need refactoring
|
||||
// sendTermSignal() will even return true while server connected ???
|
||||
if ((m_connectionState == Vpn::ConnectionState::Preparing) ||
|
||||
(m_connectionState == Vpn::ConnectionState::Connecting) ||
|
||||
(m_connectionState == Vpn::ConnectionState::Connected) ||
|
||||
(m_connectionState == Vpn::ConnectionState::Reconnecting)) {
|
||||
if ((m_connectionState == Vpn::ConnectionState::Preparing) || (m_connectionState == Vpn::ConnectionState::Connecting)
|
||||
|| (m_connectionState == Vpn::ConnectionState::Connected)
|
||||
|| (m_connectionState == Vpn::ConnectionState::Reconnecting)) {
|
||||
if (!sendTermSignal()) {
|
||||
killOpenVpnProcess();
|
||||
}
|
||||
QThread::msleep(10);
|
||||
m_managementServer.stop();
|
||||
}
|
||||
setConnectionState(VpnProtocol::Disconnected);
|
||||
setConnectionState(Vpn::ConnectionState::Disconnected);
|
||||
}
|
||||
|
||||
ErrorCode OpenVpnProtocol::prepare()
|
||||
|
@ -68,18 +66,19 @@ ErrorCode OpenVpnProtocol::prepare()
|
|||
QRemoteObjectPendingReply<QStringList> resultCheck = IpcClient::Interface()->getTapList();
|
||||
resultCheck.waitForFinished();
|
||||
|
||||
if (resultCheck.returnValue().isEmpty()){
|
||||
if (resultCheck.returnValue().isEmpty()) {
|
||||
QRemoteObjectPendingReply<bool> resultInstall = IpcClient::Interface()->checkAndInstallDriver();
|
||||
resultInstall.waitForFinished();
|
||||
|
||||
if (!resultInstall.returnValue()) return ErrorCode::OpenVpnTapAdapterError;
|
||||
if (!resultInstall.returnValue())
|
||||
return ErrorCode::OpenVpnTapAdapterError;
|
||||
}
|
||||
return ErrorCode::NoError;
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::killOpenVpnProcess()
|
||||
{
|
||||
if (m_openVpnProcess){
|
||||
if (m_openVpnProcess) {
|
||||
m_openVpnProcess->close();
|
||||
}
|
||||
}
|
||||
|
@ -113,9 +112,9 @@ QString OpenVpnProtocol::configPath() const
|
|||
return m_configFileName;
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::sendManagementCommand(const QString& command)
|
||||
void OpenVpnProtocol::sendManagementCommand(const QString &command)
|
||||
{
|
||||
QIODevice *device = dynamic_cast<QIODevice*>(m_managementServer.socket().data());
|
||||
QIODevice *device = dynamic_cast<QIODevice *>(m_managementServer.socket().data());
|
||||
if (device) {
|
||||
QTextStream stream(device);
|
||||
stream << command << Qt::endl;
|
||||
|
@ -127,11 +126,12 @@ uint OpenVpnProtocol::selectMgmtPort()
|
|||
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
quint32 port = QRandomGenerator::global()->generate();
|
||||
port = (double)(65000-15001) * port / UINT32_MAX + 15001;
|
||||
port = (double)(65000 - 15001) * port / UINT32_MAX + 15001;
|
||||
|
||||
QTcpServer s;
|
||||
bool ok = s.listen(QHostAddress::LocalHost, port);
|
||||
if (ok) return port;
|
||||
if (ok)
|
||||
return port;
|
||||
}
|
||||
|
||||
return m_managementPort;
|
||||
|
@ -141,7 +141,8 @@ void OpenVpnProtocol::updateRouteGateway(QString line)
|
|||
{
|
||||
// TODO: fix for macos
|
||||
line = line.split("ROUTE_GATEWAY", Qt::SkipEmptyParts).at(1);
|
||||
if (!line.contains("/")) return;
|
||||
if (!line.contains("/"))
|
||||
return;
|
||||
m_routeGateway = line.split("/", Qt::SkipEmptyParts).first();
|
||||
m_routeGateway.replace(" ", "");
|
||||
qDebug() << "Set VPN route gateway" << m_routeGateway;
|
||||
|
@ -149,7 +150,7 @@ void OpenVpnProtocol::updateRouteGateway(QString line)
|
|||
|
||||
ErrorCode OpenVpnProtocol::start()
|
||||
{
|
||||
//qDebug() << "Start OpenVPN connection";
|
||||
// qDebug() << "Start OpenVPN connection";
|
||||
OpenVpnProtocol::stop();
|
||||
|
||||
if (!QFileInfo::exists(Utils::openVpnExecPath())) {
|
||||
|
@ -167,24 +168,25 @@ ErrorCode OpenVpnProtocol::start()
|
|||
QProcess p;
|
||||
p.setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
||||
p.start("route", QStringList() << "-n" << "get" << "default");
|
||||
p.start("route",
|
||||
QStringList() << "-n"
|
||||
<< "get"
|
||||
<< "default");
|
||||
p.waitForFinished();
|
||||
QString s = p.readAll();
|
||||
QString s = p.readAll();
|
||||
|
||||
QRegularExpression rx(R"(gateway:\s*(\d+\.\d+\.\d+\.\d+))");
|
||||
QRegularExpressionMatch match = rx.match(s);
|
||||
if (match.hasMatch()) {
|
||||
m_routeGateway = match.captured(1);
|
||||
qDebug() << "Set VPN route gateway" << m_routeGateway;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
qWarning() << "Unable to set VPN route gateway, output:\n" << s;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// QString vpnLogFileNamePath = Utils::systemLogPath() + "/openvpn.log";
|
||||
// Utils::createEmptyFile(vpnLogFileNamePath);
|
||||
// QString vpnLogFileNamePath = Utils::systemLogPath() + "/openvpn.log";
|
||||
// Utils::createEmptyFile(vpnLogFileNamePath);
|
||||
|
||||
uint mgmtPort = selectMgmtPort();
|
||||
qDebug() << "OpenVpnProtocol::start mgmt port selected:" << mgmtPort;
|
||||
|
@ -199,7 +201,7 @@ ErrorCode OpenVpnProtocol::start()
|
|||
m_openVpnProcess = IpcClient::CreatePrivilegedProcess();
|
||||
|
||||
if (!m_openVpnProcess) {
|
||||
//qWarning() << "IpcProcess replica is not created!";
|
||||
// qWarning() << "IpcProcess replica is not created!";
|
||||
setLastError(ErrorCode::AmneziaServiceConnectionFailed);
|
||||
return ErrorCode::AmneziaServiceConnectionFailed;
|
||||
}
|
||||
|
@ -211,28 +213,25 @@ ErrorCode OpenVpnProtocol::start()
|
|||
return ErrorCode::AmneziaServiceConnectionFailed;
|
||||
}
|
||||
m_openVpnProcess->setProgram(PermittedProcess::OpenVPN);
|
||||
QStringList arguments({"--config" , configPath(),
|
||||
"--management", m_managementHost, QString::number(mgmtPort),
|
||||
"--management-client"/*, "--log", vpnLogFileNamePath */
|
||||
});
|
||||
QStringList arguments({
|
||||
"--config", configPath(), "--management", m_managementHost, QString::number(mgmtPort),
|
||||
"--management-client" /*, "--log", vpnLogFileNamePath */
|
||||
});
|
||||
m_openVpnProcess->setArguments(arguments);
|
||||
|
||||
qDebug() << arguments.join(" ");
|
||||
connect(m_openVpnProcess.data(), &PrivilegedProcess::errorOccurred, [&](QProcess::ProcessError error) {
|
||||
qDebug() << "PrivilegedProcess errorOccurred" << error;
|
||||
});
|
||||
connect(m_openVpnProcess.data(), &PrivilegedProcess::errorOccurred,
|
||||
[&](QProcess::ProcessError error) { qDebug() << "PrivilegedProcess errorOccurred" << error; });
|
||||
|
||||
connect(m_openVpnProcess.data(), &PrivilegedProcess::stateChanged, [&](QProcess::ProcessState newState) {
|
||||
qDebug() << "PrivilegedProcess stateChanged" << newState;
|
||||
});
|
||||
connect(m_openVpnProcess.data(), &PrivilegedProcess::stateChanged,
|
||||
[&](QProcess::ProcessState newState) { qDebug() << "PrivilegedProcess stateChanged" << newState; });
|
||||
|
||||
connect(m_openVpnProcess.data(), &PrivilegedProcess::finished, this, [&]() {
|
||||
setConnectionState(Vpn::ConnectionState::Disconnected);
|
||||
});
|
||||
connect(m_openVpnProcess.data(), &PrivilegedProcess::finished, this,
|
||||
[&]() { setConnectionState(Vpn::ConnectionState::Disconnected); });
|
||||
|
||||
m_openVpnProcess->start();
|
||||
|
||||
//startTimeoutTimer();
|
||||
// startTimeoutTimer();
|
||||
|
||||
return ErrorCode::NoError;
|
||||
}
|
||||
|
@ -255,7 +254,7 @@ void OpenVpnProtocol::sendInitialData()
|
|||
|
||||
void OpenVpnProtocol::onReadyReadDataFromManagementServer()
|
||||
{
|
||||
for (;;) {
|
||||
for (;;) {
|
||||
QString line = m_managementServer.readLine().simplified();
|
||||
|
||||
if (line.isEmpty()) {
|
||||
|
@ -268,14 +267,14 @@ void OpenVpnProtocol::onReadyReadDataFromManagementServer()
|
|||
|
||||
if (line.contains(">INFO:OpenVPN Management Interface")) {
|
||||
sendInitialData();
|
||||
} else if (line.startsWith(">STATE")) {
|
||||
} else if (line.startsWith(">STATE")) {
|
||||
if (line.contains("CONNECTED,SUCCESS")) {
|
||||
sendByteCount();
|
||||
stopTimeoutTimer();
|
||||
setConnectionState(Vpn::ConnectionState::Connected);
|
||||
continue;
|
||||
} else if (line.contains("EXITING,SIGTER")) {
|
||||
//openVpnStateSigTermHandler();
|
||||
// openVpnStateSigTermHandler();
|
||||
setConnectionState(Vpn::ConnectionState::Disconnecting);
|
||||
continue;
|
||||
} else if (line.contains("RECONNECTING")) {
|
||||
|
@ -295,8 +294,7 @@ void OpenVpnProtocol::onReadyReadDataFromManagementServer()
|
|||
if (line.contains("FATAL")) {
|
||||
if (line.contains("tap-windows6 adapters on this system are currently in use or disabled")) {
|
||||
emit protocolError(ErrorCode::OpenVpnAdaptersInUseError);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
emit protocolError(ErrorCode::OpenVpnUnknownError);
|
||||
}
|
||||
return;
|
||||
|
@ -321,7 +319,8 @@ void OpenVpnProtocol::onReadyReadDataFromManagementServer()
|
|||
void OpenVpnProtocol::updateVpnGateway(const QString &line)
|
||||
{
|
||||
// line looks like
|
||||
// PUSH: Received control message: 'PUSH_REPLY,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5,peer-id 0,cipher AES-256-GCM'
|
||||
// PUSH: Received control message: 'PUSH_REPLY,route 10.8.0.1,topology net30,ping 10,ping-restart
|
||||
// 120,ifconfig 10.8.0.6 10.8.0.5,peer-id 0,cipher AES-256-GCM'
|
||||
|
||||
QStringList params = line.split(",");
|
||||
for (const QString &l : params) {
|
||||
|
|
|
@ -88,6 +88,7 @@ signals:
|
|||
void showNotificationMessage(const QString &message);
|
||||
|
||||
void showBusyIndicator(bool visible);
|
||||
void enableTabBar(bool enabled);
|
||||
|
||||
void hideMainWindow();
|
||||
void raiseMainWindow();
|
||||
|
|
|
@ -36,12 +36,13 @@ void SitesController::addSite(QString hostname)
|
|||
m_sitesModel->addSite(hostname, ip);
|
||||
|
||||
if (!ip.isEmpty()) {
|
||||
m_vpnConnection->addRoutes(QStringList() << ip);
|
||||
m_vpnConnection->flushDns();
|
||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "addRoutes", Qt::QueuedConnection,
|
||||
Q_ARG(QStringList, QStringList() << ip));
|
||||
} else if (Utils::ipAddressWithSubnetRegExp().exactMatch(hostname)) {
|
||||
m_vpnConnection->addRoutes(QStringList() << hostname);
|
||||
m_vpnConnection->flushDns();
|
||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "addRoutes", Qt::QueuedConnection,
|
||||
Q_ARG(QStringList, QStringList() << hostname));
|
||||
}
|
||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "flushDns", Qt::QueuedConnection);
|
||||
};
|
||||
|
||||
const auto &resolveCallback = [this, processSite](const QHostInfo &hostInfo) {
|
||||
|
@ -70,6 +71,10 @@ void SitesController::removeSite(int index)
|
|||
auto hostname = m_sitesModel->data(modelIndex, SitesModel::Roles::UrlRole).toString();
|
||||
m_sitesModel->removeSite(modelIndex);
|
||||
|
||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "deleteRoutes", Qt::QueuedConnection,
|
||||
Q_ARG(QStringList, QStringList() << hostname));
|
||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "flushDns", Qt::QueuedConnection);
|
||||
|
||||
emit finished(tr("Site removed: ") + hostname);
|
||||
}
|
||||
|
||||
|
@ -124,8 +129,8 @@ void SitesController::importSites(bool replaceExisting)
|
|||
|
||||
m_sitesModel->addSites(sites, replaceExisting);
|
||||
|
||||
m_vpnConnection->addRoutes(QStringList() << ips);
|
||||
m_vpnConnection->flushDns();
|
||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "addRoutes", Qt::QueuedConnection, Q_ARG(QStringList, ips));
|
||||
QMetaObject::invokeMethod(m_vpnConnection.get(), "flushDns", Qt::QueuedConnection);
|
||||
|
||||
emit finished(tr("Import completed"));
|
||||
}
|
||||
|
|
|
@ -66,18 +66,14 @@ void SitesLogic::onPushButtonAddCustomSitesClicked()
|
|||
m_settings->addVpnSite(mode, newSite, ip);
|
||||
|
||||
if (!ip.isEmpty()) {
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "addRoutes",
|
||||
Qt::QueuedConnection,
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "addRoutes", Qt::QueuedConnection,
|
||||
Q_ARG(QStringList, QStringList() << ip));
|
||||
}
|
||||
else if (Utils::ipAddressWithSubnetRegExp().exactMatch(newSite)) {
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "addRoutes",
|
||||
Qt::QueuedConnection,
|
||||
} else if (Utils::ipAddressWithSubnetRegExp().exactMatch(newSite)) {
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "addRoutes", Qt::QueuedConnection,
|
||||
Q_ARG(QStringList, QStringList() << newSite));
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "flushDns",
|
||||
Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "flushDns", Qt::QueuedConnection);
|
||||
|
||||
onUpdatePage();
|
||||
};
|
||||
|
@ -124,19 +120,16 @@ void SitesLogic::onPushButtonSitesDeleteClicked(QStringList items)
|
|||
return;
|
||||
// sites.append(siteModel->data(row, 0).toString());
|
||||
|
||||
if (uiLogic()->m_vpnConnection && uiLogic()->m_vpnConnection->connectionState() == VpnProtocol::Connected) {
|
||||
ips.append(siteModel->data(row, 1).toString());
|
||||
}
|
||||
// if (uiLogic()->m_vpnConnection && uiLogic()->m_vpnConnection->connectionState() == VpnProtocol::Connected) {
|
||||
// ips.append(siteModel->data(row, 1).toString());
|
||||
// }
|
||||
}
|
||||
|
||||
m_settings->removeVpnSites(mode, sites);
|
||||
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "deleteRoutes",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(QStringList, ips));
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "deleteRoutes", Qt::QueuedConnection, Q_ARG(QStringList, ips));
|
||||
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "flushDns",
|
||||
Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "flushDns", Qt::QueuedConnection);
|
||||
|
||||
onUpdatePage();
|
||||
}
|
||||
|
@ -197,12 +190,9 @@ void SitesLogic::onPushButtonSitesImportClicked(const QString &fileName)
|
|||
m_settings->addVpnIps(mode, ips);
|
||||
m_settings->addVpnSites(mode, sites);
|
||||
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "addRoutes",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(QStringList, ips));
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "addRoutes", Qt::QueuedConnection, Q_ARG(QStringList, ips));
|
||||
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "flushDns",
|
||||
Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(uiLogic()->m_vpnConnection, "flushDns", Qt::QueuedConnection);
|
||||
|
||||
onUpdatePage();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ import "../Config"
|
|||
PageType {
|
||||
id: root
|
||||
|
||||
Component.onCompleted: PageController.enableTabBar(false)
|
||||
Component.onDestruction: PageController.enableTabBar(true)
|
||||
|
||||
SortFilterProxyModel {
|
||||
id: proxyServersModel
|
||||
sourceModel: ServersModel
|
||||
|
|
|
@ -299,6 +299,12 @@ PageType {
|
|||
checked: additionalClientCommands !== ""
|
||||
|
||||
text: qsTr("Additional client configuration commands")
|
||||
|
||||
onCheckedChanged: {
|
||||
if (!checked) {
|
||||
additionalClientCommands = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextAreaType {
|
||||
|
|
|
@ -21,7 +21,7 @@ PageType {
|
|||
|
||||
function onRestoreBackupFinished() {
|
||||
PageController.showNotificationMessage(qsTr("Settings restored from backup file"))
|
||||
goToStartPage()
|
||||
//goToStartPage()
|
||||
PageController.goToPageHome()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ PageType {
|
|||
questionDrawer.visible = false
|
||||
goToPage(PageEnum.PageDeinstalling)
|
||||
if (ServersModel.isDefaultServerCurrentlyProcessed() && ConnectionController.isConnected) {
|
||||
ConnectionController.closeVpnConnection()
|
||||
ConnectionController.closeConnection()
|
||||
}
|
||||
InstallController.removeAllContainers()
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ import "../Config"
|
|||
PageType {
|
||||
id: root
|
||||
|
||||
Component.onCompleted: PageController.enableTabBar(false)
|
||||
Component.onDestruction: PageController.enableTabBar(true)
|
||||
|
||||
Connections {
|
||||
target: InstallController
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@ PageType {
|
|||
|
||||
function onGoToPageHome() {
|
||||
tabBar.currentIndex = 0
|
||||
tabBarStackView.goToTabBarPage(PageController.getPagePath(PageEnum.PageHome))
|
||||
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
||||
}
|
||||
|
||||
function onGoToPageSettings() {
|
||||
tabBar.currentIndex = 2
|
||||
tabBarStackView.goToTabBarPage(PageController.getPagePath(PageEnum.PageSettings))
|
||||
tabBarStackView.goToTabBarPage(PageEnum.PageSettings)
|
||||
}
|
||||
|
||||
function onGoToPageViewConfig() {
|
||||
|
@ -37,6 +37,10 @@ PageType {
|
|||
tabBar.enabled = !visible
|
||||
}
|
||||
|
||||
function onEnableTabBar(enabled) {
|
||||
tabBar.enabled = enabled
|
||||
}
|
||||
|
||||
function onClosePage() {
|
||||
if (tabBarStackView.depth <= 1) {
|
||||
return
|
||||
|
|
|
@ -157,9 +157,6 @@ void UiLogic::initializeUiLogic()
|
|||
// }
|
||||
|
||||
m_selectedServerIndex = m_settings->defaultServerIndex();
|
||||
|
||||
qInfo().noquote() << QString("Started %1 version %2").arg(APPLICATION_NAME).arg(APP_VERSION);
|
||||
qInfo().noquote() << QString("%1 (%2)").arg(QSysInfo::prettyProductName()).arg(QSysInfo::currentCpuArchitecture());
|
||||
}
|
||||
|
||||
void UiLogic::showOnStartup()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue