[CPlugin CreateOperate]
| 80 | |
| 81 | //! [CPlugin CreateOperate] |
| 82 | COperate* CPlugin::CreateOperate( |
| 83 | const QString &szId, CParameterPlugin* para) |
| 84 | { |
| 85 | COperate* p = OnCreateOperate(szId); |
| 86 | if(p) { |
| 87 | int nRet = 0; |
| 88 | //nRet = p->Initial(); |
| 89 | bool bRet = QMetaObject::invokeMethod( |
| 90 | p, |
| 91 | "Initial", |
| 92 | Qt::DirectConnection, |
| 93 | Q_RETURN_ARG(int, nRet)); |
| 94 | if(!bRet) { |
| 95 | qCritical(log) << "Call p->Initial() fail."; |
| 96 | return nullptr; |
| 97 | } |
| 98 | if(nRet) { |
| 99 | qCritical(log) << "Operate initial fail" << nRet; |
| 100 | DeleteOperate(p); |
| 101 | return nullptr; |
| 102 | } |
| 103 | //nRet = p->SetPluginParameters(para); |
| 104 | bRet = QMetaObject::invokeMethod( |
| 105 | p, |
| 106 | "SetPluginParameters", |
| 107 | Qt::DirectConnection, |
| 108 | Q_RETURN_ARG(int, nRet), |
| 109 | Q_ARG(CParameterPlugin*, para)); |
| 110 | if(!bRet) { |
| 111 | qCritical(log) << "Call p->SetParameterClient(para) fail."; |
| 112 | return nullptr; |
| 113 | } |
| 114 | if(nRet) { |
| 115 | qCritical(log) << "SetParameterClient fail" << nRet; |
| 116 | DeleteOperate(p); |
| 117 | return nullptr; |
| 118 | } |
| 119 | } |
| 120 | return p; |
| 121 | } |
| 122 | //! [CPlugin CreateOperate] |
| 123 | |
| 124 | int CPlugin::DeleteOperate(COperate *p) |