Merge branch 'bugfix/split-tunneling' of github.com:amnezia-vpn/amnezia-client into bugfix/split-tunneling

This commit is contained in:
vladimir.kuznetsov 2023-10-18 12:18:46 +05:00
commit fcf6bb43b7
4 changed files with 22 additions and 10 deletions

View file

@ -139,7 +139,8 @@ void AmneziaApplication::init()
&ConnectionController::openConnection); &ConnectionController::openConnection);
connect(m_notificationHandler.get(), &NotificationHandler::disconnectRequested, m_connectionController.get(), connect(m_notificationHandler.get(), &NotificationHandler::disconnectRequested, m_connectionController.get(),
&ConnectionController::closeConnection); &ConnectionController::closeConnection);
connect(this, &AmneziaApplication::translationsUpdated, m_notificationHandler.get(), &NotificationHandler::onTranslationsUpdated); connect(this, &AmneziaApplication::translationsUpdated, m_notificationHandler.get(),
&NotificationHandler::onTranslationsUpdated);
m_engine->load(url); m_engine->load(url);
m_systemController->setQmlRoot(m_engine->rootObjects().value(0)); m_systemController->setQmlRoot(m_engine->rootObjects().value(0));
@ -226,14 +227,13 @@ void AmneziaApplication::loadTranslator()
updateTranslator(locale); updateTranslator(locale);
} }
void AmneziaApplication::updateTranslator(const QLocale &locale) void AmneziaApplication::updateTranslator(const QLocale &locale)
{ {
if (!m_translator->isEmpty()) { if (!m_translator->isEmpty()) {
QCoreApplication::removeTranslator(m_translator.get()); QCoreApplication::removeTranslator(m_translator.get());
} }
QString strFileName = QString(":/translations/amneziavpn")+QLatin1String("_")+locale.name()+".qm"; QString strFileName = QString(":/translations/amneziavpn") + QLatin1String("_") + locale.name() + ".qm";
if (m_translator->load(strFileName)) { if (m_translator->load(strFileName)) {
if (QCoreApplication::installTranslator(m_translator.get())) { if (QCoreApplication::installTranslator(m_translator.get())) {
m_settings->setAppLanguage(locale); m_settings->setAppLanguage(locale);
@ -295,11 +295,13 @@ void AmneziaApplication::initModels()
m_sitesModel.reset(new SitesModel(m_settings, this)); m_sitesModel.reset(new SitesModel(m_settings, this));
m_engine->rootContext()->setContextProperty("SitesModel", m_sitesModel.get()); m_engine->rootContext()->setContextProperty("SitesModel", m_sitesModel.get());
connect(m_containersModel.get(), &ContainersModel::defaultContainerChanged, this, [this]() { connect(m_containersModel.get(), &ContainersModel::defaultContainerChanged, this, [this]() {
if (m_containersModel->getDefaultContainer() == DockerContainer::WireGuard if ((m_containersModel->getDefaultContainer() == DockerContainer::WireGuard
|| m_containersModel->getDefaultContainer() == DockerContainer::Awg)
&& m_sitesModel->isSplitTunnelingEnabled()) { && m_sitesModel->isSplitTunnelingEnabled()) {
m_sitesModel->toggleSplitTunneling(false); m_sitesModel->toggleSplitTunneling(false);
emit m_pageController->showNotificationMessage( emit m_pageController->showNotificationMessage(
tr("Split tunneling for WireGuard is not implemented, the option was disabled")); tr("Split tunneling for %1 is not implemented, the option was disabled")
.arg(ContainerProps::containerHumanNames().value(m_containersModel->getDefaultContainer())));
} }
}); });
@ -335,7 +337,8 @@ void AmneziaApplication::initControllers()
m_connectionController.reset(new ConnectionController(m_serversModel, m_containersModel, m_vpnConnection)); m_connectionController.reset(new ConnectionController(m_serversModel, m_containersModel, m_vpnConnection));
m_engine->rootContext()->setContextProperty("ConnectionController", m_connectionController.get()); m_engine->rootContext()->setContextProperty("ConnectionController", m_connectionController.get());
connect(this, &AmneziaApplication::translationsUpdated, m_connectionController.get(), &ConnectionController::onTranslationsUpdated); connect(this, &AmneziaApplication::translationsUpdated, m_connectionController.get(),
&ConnectionController::onTranslationsUpdated);
m_pageController.reset(new PageController(m_serversModel, m_settings)); m_pageController.reset(new PageController(m_serversModel, m_settings));
m_engine->rootContext()->setContextProperty("PageController", m_pageController.get()); m_engine->rootContext()->setContextProperty("PageController", m_pageController.get());

View file

@ -4,9 +4,13 @@
<context> <context>
<name>AmneziaApplication</name> <name>AmneziaApplication</name>
<message> <message>
<location filename="../amnezia_application.cpp" line="302"/>
<source>Split tunneling for WireGuard is not implemented, the option was disabled</source> <source>Split tunneling for WireGuard is not implemented, the option was disabled</source>
<translation>Раздельное туннелирование для &quot;Wireguard&quot; не реализовано,опция отключена</translation> <translation type="vanished">Раздельное туннелирование для &quot;Wireguard&quot; не реализовано,опция отключена</translation>
</message>
<message>
<location filename="../amnezia_application.cpp" line="303"/>
<source>Split tunneling for %1 is not implemented, the option was disabled</source>
<translation>Раздельное туннелирование для %1 не реализовано, опция отключена</translation>
</message> </message>
</context> </context>
<context> <context>

View file

@ -4,9 +4,13 @@
<context> <context>
<name>AmneziaApplication</name> <name>AmneziaApplication</name>
<message> <message>
<location filename="../amnezia_application.cpp" line="302"/>
<source>Split tunneling for WireGuard is not implemented, the option was disabled</source> <source>Split tunneling for WireGuard is not implemented, the option was disabled</source>
<translation>WireGuard协议的VPN分离</translation> <translation type="vanished">WireGuard协议的VPN分离</translation>
</message>
<message>
<location filename="../amnezia_application.cpp" line="303"/>
<source>Split tunneling for %1 is not implemented, the option was disabled</source>
<translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context> <context>

View file

@ -112,6 +112,7 @@ void SitesModel::toggleSplitTunneling(bool enabled)
} else { } else {
m_settings->setRouteMode(Settings::RouteMode::VpnAllSites); m_settings->setRouteMode(Settings::RouteMode::VpnAllSites);
} }
m_isSplitTunnelingEnabled = enabled;
} }
QVector<QPair<QString, QString> > SitesModel::getCurrentSites() QVector<QPair<QString, QString> > SitesModel::getCurrentSites()