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>();
for (const auto &[codename, plugin] : getApp()->plugins->plugins())
{
auto headerText = QString("%1 (%2)").arg(
plugin->meta.name,
QString::fromStdString(plugin->meta.version.to_string()));
QString headerText;
if (plugin->isDupeName)
{
// add ", from <folder name>)" in place of ")"
headerText.chop(1);
headerText += ", from " + codename + ")";
headerText = QString("%1 (%2, from %3)")
.arg(plugin->meta.name,
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 pl = plgroup.setLayoutType<QFormLayout>();