MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / LoadPlugins

Method LoadPlugins

Src/Manager.cpp:185–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185int CManager::LoadPlugins()
186{
187 int nRet = 0;
188 /*
189 foreach (QObject *plugin, QPluginLoader::staticInstances())
190 {
191 CPlugin* p = qobject_cast<CPlugin*>(plugin);
192 if(p)
193 {
194 if(m_Plugins.find(p->Id()) == m_Plugins.end())
195 {
196 qInfo(log) << "Success: Load plugin" << p->Name();
197 AppendPlugin(p);
198 }
199 else
200 qWarning(log) << "The plugin" << p->Name() << " is exist.";
201 }
202 }//*/
203
204 QStringList lstPaths;
205 if(m_pParameterPlugin->GetEnableSetPluginsPath()) {
206 lstPaths = m_pParameterPlugin->GetPluginsPath();
207 }
208 else
209 lstPaths << RabbitCommon::CDir::Instance()->GetDirPlugins();
210 if(lstPaths.isEmpty())
211 qWarning(log) << "The plugins path is empty. please set it from: `Menu` -> `Tools` -> `Settings` -> `Load Plugins`";
212
213 if(m_pParameterPlugin->GetOnlyLoadInWhitelist()) {
214 m_pParameterPlugin->m_WhiteList.OnProcess([this, lstPaths](const QString& szPath) -> int{
215 QFileInfo fi(szPath);
216 if(fi.isAbsolute())
217 return LoadPlugin(szPath);
218 foreach (auto d, lstPaths) {
219 if(d.isEmpty()) continue;
220 QString szFile = d + QDir::separator() + szPath;
221 return LoadPlugin(szFile);
222 }
223 return -1;
224 });
225 return 0;
226 }
227
228 foreach (auto szPath, lstPaths) {
229 //QString szPath = RabbitCommon::CDir::Instance()->GetDirPlugins();
230
231 QStringList filters;
232 if(filters.isEmpty())
233 {
234#if defined (Q_OS_WINDOWS) || defined(Q_OS_WIN)
235 filters << "*Plugin*.dll";
236#elif defined(Q_OS_MACOS) || defined(Q_OS_MAC)
237 filters << "*Plugin*.dylib";
238#else
239 filters << "*Plugin*.so";
240#endif
241 }
242 nRet = FindPlugins(szPath, filters);

Callers

nothing calls this directly

Calls 5

GetPluginsPathMethod · 0.80
isEmptyMethod · 0.45
OnProcessMethod · 0.45

Tested by

no test coverage detected