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:
|
public:
|
||||||
QString id;
|
QString id;
|
||||||
PluginMeta meta;
|
PluginMeta meta;
|
||||||
bool isDupeName{};
|
|
||||||
|
|
||||||
Plugin(QString id, lua_State *state, PluginMeta meta,
|
Plugin(QString id, lua_State *state, PluginMeta meta,
|
||||||
const QDir &loadDirectory)
|
const QDir &loadDirectory)
|
||||||
|
|
|
@ -201,15 +201,6 @@ void PluginController::load(const QFileInfo &index, const QDir &pluginDir,
|
||||||
|
|
||||||
auto pluginName = pluginDir.dirName();
|
auto pluginName = pluginDir.dirName();
|
||||||
auto plugin = std::make_unique<Plugin>(pluginName, l, meta, pluginDir);
|
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)});
|
this->plugins_.insert({pluginName, std::move(plugin)});
|
||||||
if (!PluginController::isEnabled(pluginName))
|
if (!PluginController::isEnabled(pluginName))
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,21 +71,11 @@ void PluginsPage::rebuildContent()
|
||||||
layout->setParent(this->dataFrame_);
|
layout->setParent(this->dataFrame_);
|
||||||
for (const auto &[id, plugin] : getApp()->plugins->plugins())
|
for (const auto &[id, plugin] : getApp()->plugins->plugins())
|
||||||
{
|
{
|
||||||
QString groupHeaderText;
|
auto groupHeaderText =
|
||||||
if (plugin->isDupeName)
|
QString("%1 (%2, from %3)")
|
||||||
{
|
.arg(plugin->meta.name,
|
||||||
groupHeaderText = QString("%1 (%2, from %3)")
|
QString::fromStdString(plugin->meta.version.to_string()),
|
||||||
.arg(plugin->meta.name,
|
id);
|
||||||
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);
|
auto groupBox = layout.emplace<QGroupBox>(groupHeaderText);
|
||||||
groupBox->setParent(this->dataFrame_);
|
groupBox->setParent(this->dataFrame_);
|
||||||
auto pluginEntry = groupBox.setLayoutType<QFormLayout>();
|
auto pluginEntry = groupBox.setLayoutType<QFormLayout>();
|
||||||
|
|
Loading…
Reference in a new issue