From be63ee493a0e6c62b94e177cc21627eee0c45535 Mon Sep 17 00:00:00 2001 From: QxQ <59914293+U-v-U@users.noreply.github.com> Date: Tue, 22 Sep 2020 22:30:46 +0800 Subject: [PATCH] fix: fixed TrojanGo plugin settings save issue --- TrojanGoPlugin.cpp | 5 +++-- TrojanGoPlugin.hpp | 2 +- core/Kernel.cpp | 6 +++--- interface | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) 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