Utils: Use more views in Id setup

Since this means that StringBuilder expressions are not usable
as arguments anymore, use .withSuffix() more extensively.

This makes this "unusual" construction also a bit better findable.

No measurable performance gain or loss in either direction.

Change-Id: I04508e77764455bd9d3a21eda63bc6de01508e4b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2024-07-23 19:11:52 +02:00
parent f64440e4b8
commit 87280f25ce
18 changed files with 69 additions and 75 deletions

View File

@@ -204,7 +204,7 @@ void addFetchModule()
}
Utils::InfoBarEntry entry{
Utils::Id::fromString("Fetch" + pluginName),
Utils::Id("Fetch").withSuffix(pluginName),
Tr::tr("Allow the extension \"%1\" to fetch data from the internet?")
.arg(pluginName)};
entry.setDetailsWidgetCreator([pluginName, url] {
@@ -221,16 +221,16 @@ void addFetchModule()
});
entry.addCustomButton(Tr::tr("Always Allow"), [mod, pluginName, fetch]() {
mod->setAllowedToFetch(pluginName, Module::IsAllowed::Yes);
Core::ICore::infoBar()->removeInfo(Utils::Id::fromString("Fetch" + pluginName));
Core::ICore::infoBar()->removeInfo(Utils::Id("Fetch").withSuffix(pluginName));
fetch();
});
entry.addCustomButton(Tr::tr("Allow Once"), [pluginName, fetch]() {
Core::ICore::infoBar()->removeInfo(Utils::Id::fromString("Fetch" + pluginName));
Core::ICore::infoBar()->removeInfo(Utils::Id("Fetch").withSuffix(pluginName));
fetch();
});
entry.setCancelButtonInfo(Tr::tr("Deny"), [mod, notAllowed, pluginName]() {
Core::ICore::infoBar()->removeInfo(Utils::Id::fromString("Fetch" + pluginName));
Core::ICore::infoBar()->removeInfo(Utils::Id("Fetch").withSuffix(pluginName));
mod->setAllowedToFetch(pluginName, Module::IsAllowed::No);
notAllowed();
});