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

Method LoadPlugin

Src/Manager.cpp:300–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300int CManager::LoadPlugin(const QString &szPath)
301{
302 int nRet = -1;
303 QPluginLoader loader(szPath);
304 QObject *plugin = loader.instance();
305 if (plugin) {
306 CPlugin* p = qobject_cast<CPlugin*>(plugin);
307 if(p)
308 {
309 if(m_Plugins.find(p->Id()) == m_Plugins.end())
310 {
311 qInfo(log) << "Success: Load plugin"
312 << p->Name() << "from" << szPath;
313 AppendPlugin(p);
314 }
315 else
316 qWarning(log) << "The plugin [" << p->Name() << "] is exist.";
317 return 0;
318 } else
319 qCritical(log) << "The plugin is not \"CPlugin\":" << szPath;
320 } else {
321 QString szMsg;
322 szMsg = "Error: Load plugin fail from " + szPath;
323 if(!loader.errorString().isEmpty())
324 szMsg += "; Error: " + loader.errorString();
325 qCritical(log) << szMsg.toStdString().c_str();
326 }
327 return nRet;
328}
329
330int CManager::AppendPlugin(CPlugin *p)
331{

Callers

nothing calls this directly

Calls 4

errorStringMethod · 0.80
IdMethod · 0.45
NameMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected