From 0a9fa2fe090ff5355d9640a265da645f2049d95a Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Wed, 8 Feb 2023 00:37:12 +0100 Subject: [PATCH] Clean up header generation code --- src/widgets/settingspages/PluginsPage.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/widgets/settingspages/PluginsPage.cpp b/src/widgets/settingspages/PluginsPage.cpp index bfc42b82c..05f194453 100644 --- a/src/widgets/settingspages/PluginsPage.cpp +++ b/src/widgets/settingspages/PluginsPage.cpp @@ -70,14 +70,20 @@ void PluginsPage::rebuildContent() auto layout = frame.setLayoutType(); 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 )" 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(headerText); auto pl = plgroup.setLayoutType();