Rip out the duplicate name logic

This commit is contained in:
Mm2PL 2023-02-14 20:38:12 +01:00
parent 0051f00ce7
commit bf006826ce
3 changed files with 5 additions and 25 deletions

View file

@ -195,7 +195,6 @@ class Plugin
public:
QString id;
PluginMeta meta;
bool isDupeName{};
Plugin(QString id, lua_State *state, PluginMeta meta,
const QDir &loadDirectory)

View file

@ -201,15 +201,6 @@ void PluginController::load(const QFileInfo &index, const QDir &pluginDir,
auto pluginName = pluginDir.dirName();
auto plugin = std::make_unique<Plugin>(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))
{

View file

@ -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<QGroupBox>(groupHeaderText);
groupBox->setParent(this->dataFrame_);
auto pluginEntry = groupBox.setLayoutType<QFormLayout>();