diff --git a/TrojanGoPlugin.cpp b/TrojanGoPlugin.cpp index e6e212e..272fa20 100644 --- a/TrojanGoPlugin.cpp +++ b/TrojanGoPlugin.cpp @@ -6,10 +6,11 @@ #include #include -bool QvTrojanGoPlugin::InitializePlugin(const QString &, const QJsonObject &) +bool QvTrojanGoPlugin::InitializePlugin(const QString &, const QJsonObject &_settings) { emit PluginLog("Initialize plugin."); - PluginInstance = this; + this->settings = _settings; + QvTrojanGoPluginInstance = this; outboundHandler = std::make_shared(); eventHandler = std::make_shared(); kernelInterface = std::make_unique(); diff --git a/TrojanGoPlugin.hpp b/TrojanGoPlugin.hpp index d456ec9..726d69c 100644 --- a/TrojanGoPlugin.hpp +++ b/TrojanGoPlugin.hpp @@ -43,4 +43,4 @@ class QvTrojanGoPlugin void PluginErrorMessageBox(const QString &, const QString &) const override; }; -inline QvTrojanGoPlugin *PluginInstance; +DECLARE_PLUGIN_INSTANCE(QvTrojanGoPlugin); diff --git a/core/Kernel.cpp b/core/Kernel.cpp index d8026d6..0bf3701 100644 --- a/core/Kernel.cpp +++ b/core/Kernel.cpp @@ -12,11 +12,11 @@ QvTrojanGoPluginKernel::QvTrojanGoPluginKernel() : Qv2rayPlugin::PluginKernel() bool QvTrojanGoPluginKernel::StartKernel() { - const auto executablePath = PluginInstance->GetSettngs()["kernelPath"].toString(); + const auto executablePath = QvTrojanGoPluginInstance->GetSettngs()["kernelPath"].toString(); if (!QFile::exists(executablePath)) { - PluginInstance->PluginErrorMessageBox(tr("Stupid Configuration?"), - tr("We cannot find your Trojan-Go kernel. Please configure it in the plugin settings.")); + QvTrojanGoPluginInstance->PluginErrorMessageBox(tr("Stupid Configuration?"), + tr("We cannot find your Trojan-Go kernel. Please configure it in the plugin settings.")); return false; } diff --git a/interface b/interface index ba2a5eb..5f0a270 160000 --- a/interface +++ b/interface @@ -1 +1 @@ -Subproject commit ba2a5eb5be6bdb946f49f0b354b6961ed86fa26d +Subproject commit 5f0a270874d5d1ec1b02bc7d8fe069628c562dbd