diff --git a/source/utils/config/ConfigDisplayItem.cpp b/source/utils/config/ConfigDisplayItem.cpp index d56233d..cd3b244 100644 --- a/source/utils/config/ConfigDisplayItem.cpp +++ b/source/utils/config/ConfigDisplayItem.cpp @@ -1,12 +1,22 @@ #include "ConfigDisplayItem.h" #include "config/WUPSConfig.h" -ConfigDisplayItem::ConfigDisplayItem(GeneralConfigInformation &info, std::unique_ptr config) : mConfig(std::move(config)), mInfo(std::move(info)) { +ConfigDisplayItem::ConfigDisplayItem(GeneralConfigInformation &info, + std::unique_ptr config, + const bool isActive) : mConfig(std::move(config)), + mInfo(std::move(info)), + mIsActivePlugin(isActive) { assert(mConfig); } + const GeneralConfigInformation &ConfigDisplayItem::getConfigInformation() const { return mInfo; } + const WUPSConfigAPIBackend::WUPSConfig &ConfigDisplayItem::getConfig() const { return *mConfig; +} + +bool ConfigDisplayItem::isActivePlugin() const { + return mIsActivePlugin; } \ No newline at end of file diff --git a/source/utils/config/ConfigDisplayItem.h b/source/utils/config/ConfigDisplayItem.h index e0711f8..03ebb95 100644 --- a/source/utils/config/ConfigDisplayItem.h +++ b/source/utils/config/ConfigDisplayItem.h @@ -1,6 +1,7 @@ #pragma once #include "config/WUPSConfig.h" +#include "plugin/PluginData.h" #include #include @@ -8,17 +9,21 @@ struct GeneralConfigInformation { std::string name; std::string author; std::string version; + std::shared_ptr pluginData; }; class ConfigDisplayItem { public: - ConfigDisplayItem(GeneralConfigInformation &info, std::unique_ptr config); + ConfigDisplayItem(GeneralConfigInformation &info, std::unique_ptr config, bool isActive); [[nodiscard]] const GeneralConfigInformation &getConfigInformation() const; [[nodiscard]] const WUPSConfigAPIBackend::WUPSConfig &getConfig() const; + [[nodiscard]] bool isActivePlugin() const; + private: std::unique_ptr mConfig; GeneralConfigInformation mInfo; + bool mIsActivePlugin; }; \ No newline at end of file diff --git a/source/utils/config/ConfigUtils.cpp b/source/utils/config/ConfigUtils.cpp index 2c5518d..1054d3e 100644 --- a/source/utils/config/ConfigUtils.cpp +++ b/source/utils/config/ConfigUtils.cpp @@ -77,13 +77,11 @@ void ConfigUtils::displayMenu() { std::vector configs; for (const auto &plugin : gLoadedPlugins) { - if (!plugin.isLinkedAndLoaded()) { - continue; - } GeneralConfigInformation info; - info.name = plugin.getMetaInformation().getName(); - info.author = plugin.getMetaInformation().getAuthor(); - info.version = plugin.getMetaInformation().getVersion(); + info.name = plugin.getMetaInformation().getName(); + info.author = plugin.getMetaInformation().getAuthor(); + info.version = plugin.getMetaInformation().getVersion(); + info.pluginData = plugin.getPluginDataCopy(); std::unique_ptr config; if (const auto configData = plugin.getConfigData()) { @@ -124,8 +122,7 @@ void ConfigUtils::displayMenu() { if (!config) { config = make_unique_nothrow(info.name); } - - configs.emplace_back(info, std::move(config)); + configs.emplace_back(info, std::move(config), plugin.isLinkedAndLoaded()); } // Sort Configs by name