MCPcopy Create free account
hub / github.com/clechasseur/pathcopycopy / IsPluginShown

Method IsPluginShown

PathCopyCopy/src/PluginUtils.cpp:599–632  ·  view source on GitHub ↗

Checks in the Path Copy Copy settings if a specific plugin is shown at all, whether in the main menu or in the submenu. @param p_Settings Object to access settings. @param p_PluginId ID of plugin to look for in the submenu. @return true if the plugin is displayed.

Source from the content-addressed store, hash-verified

597 // @return true if the plugin is displayed.
598 //
599 bool PluginUtils::IsPluginShown(const Settings& p_Settings,
600 const GUID& p_PluginId)
601 {
602 // Assume it's shown.
603 bool shown = true;
604
605 // Get list of plugins in main menu and submenu from settings.
606 GUIDV vPluginsInMainMenu, vPluginsInSubmenu;
607 if (!p_Settings.GetMainMenuPluginDisplayOrder(vPluginsInMainMenu)) {
608 // Not specified, use the default plugin.
609 vPluginsInMainMenu.push_back(Plugins::DefaultPlugin().Id());
610 }
611 if (!p_Settings.GetSubmenuPluginDisplayOrder(vPluginsInSubmenu)) {
612 // Not specified, use default plugins in default order.
613 PluginSPV vspPlugins = PluginsRegistry::GetPluginsInDefaultOrder(
614 &p_Settings, &p_Settings, PipelinePluginsOptions::FetchPipelinePlugins);
615 for (const PluginSP& spPlugin : vspPlugins) {
616 vPluginsInSubmenu.push_back(spPlugin->Id());
617 }
618 }
619
620 // Scan lists to find our plugin.
621 const auto isOurPlugin = [&](const GUID& p_Id) noexcept -> bool {
622 return ::IsEqualGUID(p_Id, p_PluginId) != FALSE;
623 };
624 if (std::find_if(vPluginsInMainMenu.cbegin(), vPluginsInMainMenu.cend(), isOurPlugin) == vPluginsInMainMenu.cend() &&
625 std::find_if(vPluginsInSubmenu.cbegin(), vPluginsInSubmenu.cend(), isOurPlugin) == vPluginsInSubmenu.cend()) {
626
627 // The plugins is not shown.
628 shown = false;
629 }
630
631 return shown;
632 }
633
634} // namespace PCC

Callers

nothing calls this directly

Calls 5

DefaultPluginClass · 0.50
cbeginMethod · 0.45
cendMethod · 0.45

Tested by

no test coverage detected