mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-19 02:10:28 +08:00
add: added SystemProxyEvent
This commit is contained in:
parent
0bd4e4bd22
commit
f439cc7f49
@ -63,11 +63,8 @@ namespace Qv2ray::components::plugins
|
||||
info.errorMessage = tr("This plugin was built against an incompactable version of Qv2ray Plugin Interface.") + NEWLINE +
|
||||
QObject::tr("Please contact the plugin provider or report the issue to Qv2ray Workgroup.");
|
||||
}
|
||||
|
||||
connect(dynamic_cast<QObject *>(info.pluginInterface), SIGNAL(PluginLog(const QString &)), this,
|
||||
SLOT(QvPluginLog(const QString &)));
|
||||
connect(dynamic_cast<QObject *>(info.pluginInterface), SIGNAL(PluginErrorMessageBox(const QString &)), this,
|
||||
SLOT(QvPluginMessageBox(const QString &)));
|
||||
connect(plugin, SIGNAL(PluginLog(const QString &)), this, SLOT(QvPluginLog(const QString &)));
|
||||
connect(plugin, SIGNAL(PluginErrorMessageBox(const QString &)), this, SLOT(QvPluginMessageBox(const QString &)));
|
||||
LOG(MODULE_PLUGINHOST, "Loaded plugin: \"" + info.metadata.Name + "\" made by: \"" + info.metadata.Author + "\"")
|
||||
plugins.insert(info.metadata.InternalName, info);
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 79632b01f48bbfff9404af740f10e543d77bb0a3
|
||||
Subproject commit 95f4540ac3b8e32b6bc7251212d4aee2182f9740
|
@ -1,6 +1,7 @@
|
||||
#include "QvProxyConfigurator.hpp"
|
||||
|
||||
#include "common/QvHelpers.hpp"
|
||||
#include "components/plugins/QvPluginHost.hpp"
|
||||
#ifdef Q_OS_WIN
|
||||
#include <WinInet.h>
|
||||
#include <Windows.h>
|
||||
@ -234,21 +235,6 @@ namespace Qv2ray::components::proxy
|
||||
{
|
||||
LOG(MODULE_PROXY, "KDE detected")
|
||||
}
|
||||
//
|
||||
// if (usePAC)
|
||||
// {
|
||||
// actions << QString("gsettings set org.gnome.system.proxy autoconfig-url '%1'").arg(address);
|
||||
// if (isKDE)
|
||||
// {
|
||||
// actions << QString("kwriteconfig5 --file " + QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) +
|
||||
// "/kioslaverc --group \"Proxy Settings\" --key ProxyType 2");
|
||||
|
||||
// actions << QString("kwriteconfig5 --file " + QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) +
|
||||
// "/kioslaverc --group \"Proxy Settings\" --key \"Proxy Config Script\" " + address);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
if (isKDE)
|
||||
{
|
||||
actions << QString("kwriteconfig5 --file " + QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) +
|
||||
@ -309,13 +295,6 @@ namespace Qv2ray::components::proxy
|
||||
{
|
||||
LOG(MODULE_PROXY, "Setting proxy for interface: " + service)
|
||||
|
||||
// if (usePAC)
|
||||
// {
|
||||
// QProcess::execute("/usr/sbin/networksetup -setautoproxystate " + service + " on");
|
||||
// QProcess::execute("/usr/sbin/networksetup -setautoproxyurl " + service + " " + address);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
if (hasHTTP)
|
||||
{
|
||||
QProcess::execute("/usr/sbin/networksetup -setwebproxystate " + service + " on");
|
||||
@ -329,10 +308,17 @@ namespace Qv2ray::components::proxy
|
||||
QProcess::execute("/usr/sbin/networksetup -setsocksfirewallproxystate " + service + " on");
|
||||
QProcess::execute("/usr/sbin/networksetup -setsocksfirewallproxy " + service + " " + address + " " + QSTRN(socksPort));
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
#endif
|
||||
//
|
||||
// Trigger plugin events
|
||||
QMap<QvSystemProxyType, int> portSettings;
|
||||
if (hasHTTP)
|
||||
portSettings.insert(QvSystemProxyType::SystemProxy_HTTP, httpPort);
|
||||
if (hasSOCKS)
|
||||
portSettings.insert(QvSystemProxyType::SystemProxy_SOCKS, socksPort);
|
||||
PluginHost->Send_SystemProxyEvent(QvSystemProxyEventObject{ portSettings, QvSystemProxyStateType::SystemProxyState_SetProxy });
|
||||
}
|
||||
|
||||
void ClearSystemProxy()
|
||||
@ -386,5 +372,8 @@ namespace Qv2ray::components::proxy
|
||||
}
|
||||
|
||||
#endif
|
||||
//
|
||||
// Trigger plugin events
|
||||
PluginHost->Send_SystemProxyEvent(QvSystemProxyEventObject{ {}, QvSystemProxyStateType::SystemProxyState_ClearProxy });
|
||||
}
|
||||
} // namespace Qv2ray::components::proxy
|
||||
|
Loading…
Reference in New Issue
Block a user