mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Rip out the duplicate name logic
This commit is contained in:
parent
0051f00ce7
commit
bf006826ce
3 changed files with 5 additions and 25 deletions
|
@ -195,7 +195,6 @@ class Plugin
|
|||
public:
|
||||
QString id;
|
||||
PluginMeta meta;
|
||||
bool isDupeName{};
|
||||
|
||||
Plugin(QString id, lua_State *state, PluginMeta meta,
|
||||
const QDir &loadDirectory)
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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)")
|
||||
auto groupHeaderText =
|
||||
QString("%1 (%2, from %3)")
|
||||
.arg(plugin->meta.name,
|
||||
QString::fromStdString(
|
||||
plugin->meta.version.to_string()),
|
||||
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 groupBox = layout.emplace<QGroupBox>(groupHeaderText);
|
||||
groupBox->setParent(this->dataFrame_);
|
||||
auto pluginEntry = groupBox.setLayoutType<QFormLayout>();
|
||||
|
|
Loading…
Reference in a new issue