diff --git a/src/components/plugins/QvPluginHost.cpp b/src/components/plugins/QvPluginHost.cpp index ef421ef9..4f899e94 100644 --- a/src/components/plugins/QvPluginHost.cpp +++ b/src/components/plugins/QvPluginHost.cpp @@ -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(info.pluginInterface), SIGNAL(PluginLog(const QString &)), this, - SLOT(QvPluginLog(const QString &))); - connect(dynamic_cast(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); } diff --git a/src/components/plugins/interface b/src/components/plugins/interface index 79632b01..95f4540a 160000 --- a/src/components/plugins/interface +++ b/src/components/plugins/interface @@ -1 +1 @@ -Subproject commit 79632b01f48bbfff9404af740f10e543d77bb0a3 +Subproject commit 95f4540ac3b8e32b6bc7251212d4aee2182f9740 diff --git a/src/components/proxy/QvProxyConfigurator.cpp b/src/components/proxy/QvProxyConfigurator.cpp index c1bb628b..64fb6d4f 100644 --- a/src/components/proxy/QvProxyConfigurator.cpp +++ b/src/components/proxy/QvProxyConfigurator.cpp @@ -1,6 +1,7 @@ #include "QvProxyConfigurator.hpp" #include "common/QvHelpers.hpp" +#include "components/plugins/QvPluginHost.hpp" #ifdef Q_OS_WIN #include #include @@ -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 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