Clean up header generation code

This commit is contained in:
Mm2PL 2023-02-08 00:37:12 +01:00
parent 1cd1822fcc
commit 0a9fa2fe09
No known key found for this signature in database
GPG key ID: 94AC9B80EFA15ED9

View file

@ -70,14 +70,20 @@ void PluginsPage::rebuildContent()
auto layout = frame.setLayoutType<QVBoxLayout>(); auto layout = frame.setLayoutType<QVBoxLayout>();
for (const auto &[codename, plugin] : getApp()->plugins->plugins()) for (const auto &[codename, plugin] : getApp()->plugins->plugins())
{ {
auto headerText = QString("%1 (%2)").arg( QString headerText;
plugin->meta.name,
QString::fromStdString(plugin->meta.version.to_string()));
if (plugin->isDupeName) if (plugin->isDupeName)
{ {
// add ", from <folder name>)" in place of ")" headerText = QString("%1 (%2, from %3)")
headerText.chop(1); .arg(plugin->meta.name,
headerText += ", from " + codename + ")"; QString::fromStdString(
plugin->meta.version.to_string()),
codename);
}
else
{
headerText = QString("%1 (%2)").arg(
plugin->meta.name,
QString::fromStdString(plugin->meta.version.to_string()));
} }
auto plgroup = layout.emplace<QGroupBox>(headerText); auto plgroup = layout.emplace<QGroupBox>(headerText);
auto pl = plgroup.setLayoutType<QFormLayout>(); auto pl = plgroup.setLayoutType<QFormLayout>();