From bf006826ceb51fc1e4ed74b8a089e397b9081cf1 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Tue, 14 Feb 2023 20:38:12 +0100 Subject: [PATCH] Rip out the duplicate name logic --- src/controllers/plugins/Plugin.hpp | 1 - src/controllers/plugins/PluginController.cpp | 9 --------- src/widgets/settingspages/PluginsPage.cpp | 20 +++++--------------- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/src/controllers/plugins/Plugin.hpp b/src/controllers/plugins/Plugin.hpp index 45f2cdd97..25957824b 100644 --- a/src/controllers/plugins/Plugin.hpp +++ b/src/controllers/plugins/Plugin.hpp @@ -195,7 +195,6 @@ class Plugin public: QString id; PluginMeta meta; - bool isDupeName{}; Plugin(QString id, lua_State *state, PluginMeta meta, const QDir &loadDirectory) diff --git a/src/controllers/plugins/PluginController.cpp b/src/controllers/plugins/PluginController.cpp index 8b02dc08c..95abd25e3 100644 --- a/src/controllers/plugins/PluginController.cpp +++ b/src/controllers/plugins/PluginController.cpp @@ -201,15 +201,6 @@ void PluginController::load(const QFileInfo &index, const QDir &pluginDir, auto pluginName = pluginDir.dirName(); auto plugin = std::make_unique(pluginName, l, meta, pluginDir); - - for (const auto &[id, other] : this->plugins_) - { - if (other->meta.name == meta.name) - { - plugin->isDupeName = true; - other->isDupeName = true; - } - } this->plugins_.insert({pluginName, std::move(plugin)}); if (!PluginController::isEnabled(pluginName)) { diff --git a/src/widgets/settingspages/PluginsPage.cpp b/src/widgets/settingspages/PluginsPage.cpp index 7c7c85738..060add39e 100644 --- a/src/widgets/settingspages/PluginsPage.cpp +++ b/src/widgets/settingspages/PluginsPage.cpp @@ -71,21 +71,11 @@ void PluginsPage::rebuildContent() layout->setParent(this->dataFrame_); for (const auto &[id, plugin] : getApp()->plugins->plugins()) { - QString groupHeaderText; - if (plugin->isDupeName) - { - groupHeaderText = QString("%1 (%2, from %3)") - .arg(plugin->meta.name, - QString::fromStdString( - plugin->meta.version.to_string()), - id); - } - else - { - groupHeaderText = QString("%1 (%2)").arg( - plugin->meta.name, - QString::fromStdString(plugin->meta.version.to_string())); - } + auto groupHeaderText = + QString("%1 (%2, from %3)") + .arg(plugin->meta.name, + QString::fromStdString(plugin->meta.version.to_string()), + id); auto groupBox = layout.emplace(groupHeaderText); groupBox->setParent(this->dataFrame_); auto pluginEntry = groupBox.setLayoutType();