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

Method Initialize

PathCopyCopy/src/PathCopyCopyConfigHelper.cpp:106–136  ·  view source on GitHub ↗

Performs late-initialization of members.

Source from the content-addressed store, hash-verified

104// Performs late-initialization of members.
105//
106void CPathCopyCopyConfigHelper::Initialize()
107{
108 // Only initialize once.
109 if (m_spSettings == nullptr) {
110 // This helper allowed the UI to access all known plugins in the proper order.
111 // What we'll do is fetch set of all plugins, then order them as we would in the submenu.
112 // We'll also include unknown plugins at the end.
113 m_spSettings = std::make_shared<PCC::Settings>();
114 m_vspPluginsInDefaultOrder = PCC::PluginsRegistry::GetPluginsInDefaultOrder(
115 m_spSettings.get(), m_spSettings.get(), PCC::PipelinePluginsOptions::FetchBoth);
116 m_sspAllPlugins.insert(m_vspPluginsInDefaultOrder.cbegin(), m_vspPluginsInDefaultOrder.cend());
117 m_spPluginProvider = std::make_shared<PCC::AllPluginsProvider>(m_sspAllPlugins);
118 PCC::GUIDV vKnownPlugins, vSubmenuPluginDisplayOrder;
119 {
120 const PCC::GUIDV* const pvKnownPlugins = m_spSettings->GetKnownPlugins(vKnownPlugins) ? &vKnownPlugins : nullptr;
121 if (m_spSettings->GetSubmenuPluginDisplayOrder(vSubmenuPluginDisplayOrder)) {
122 m_vspPlugins = PCC::PluginsRegistry::OrderPluginsToDisplay(m_sspAllPlugins,
123 vSubmenuPluginDisplayOrder, pvKnownPlugins, &m_vspPluginsInDefaultOrder);
124 } else {
125 // Submenu plugin display order unspecified, use default.
126 m_vspPlugins = m_vspPluginsInDefaultOrder;
127 }
128 }
129
130 // Provide each plugin with settings object and plugin provider, since some require this to work.
131 for (const PCC::PluginSP& spPlugin : m_vspPlugins) {
132 spPlugin->SetSettings(m_spSettings.get());
133 spPlugin->SetPluginProvider(m_spPluginProvider.get());
134 }
135 }
136}

Callers

nothing calls this directly

Calls 6

GetKnownPluginsMethod · 0.80
SetSettingsMethod · 0.80
SetPluginProviderMethod · 0.80
cbeginMethod · 0.45
cendMethod · 0.45

Tested by

no test coverage detected