83 lines
1.8 KiB
C++
83 lines
1.8 KiB
C++
#include "CallPlugin.h"
|
|
#include "HPluginInterface.h"
|
|
#include "HPluginManage.h"
|
|
|
|
CallPlugin::CallPlugin(QObject *parent) : QObject(parent)
|
|
{
|
|
|
|
}
|
|
|
|
CallPlugin::~CallPlugin()
|
|
{
|
|
|
|
}
|
|
|
|
CallPlugin *CallPlugin::getInstance()
|
|
{
|
|
static CallPlugin ref;
|
|
return &ref;
|
|
}
|
|
|
|
QWidget *CallPlugin::getPluginWidget(QString strPluginName, QWidget *parent)
|
|
{
|
|
if (strPluginName == "")
|
|
return nullptr;
|
|
|
|
foreach (HPLUGIN_INFO *pluItem, HPluginManage::getInstance()->getPluginList())
|
|
{
|
|
HPluginInterface *pluInter = reinterpret_cast<HPluginInterface *>(pluItem->pluClass);
|
|
if (pluItem->pluName == strPluginName)
|
|
{
|
|
QWidget *pWidget = pluInter->createWindow(parent);
|
|
return pWidget;
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
int CallPlugin::getPluginType(QString strPluginName)
|
|
{
|
|
if (strPluginName == "")
|
|
return -1;
|
|
|
|
foreach (HPLUGIN_INFO *pluItem, HPluginManage::getInstance()->getPluginList())
|
|
{
|
|
HPluginInterface *pluInter = reinterpret_cast<HPluginInterface *>(pluItem->pluClass);
|
|
if (pluItem->pluName == strPluginName)
|
|
{
|
|
return pluInter->windowType();
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
QString CallPlugin::getPluginParams(QString strPluginName)
|
|
{
|
|
if (strPluginName == "")
|
|
return "";
|
|
|
|
foreach (HPLUGIN_INFO *pluItem, HPluginManage::getInstance()->getPluginList())
|
|
{
|
|
HPluginInterface *pluInter = reinterpret_cast<HPluginInterface *>(pluItem->pluClass);
|
|
if (pluItem->pluName == strPluginName)
|
|
{
|
|
return pluInter->getParams();
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
void CallPlugin::setPluginParams(QString strPluginName, QString strParams)
|
|
{
|
|
if (strPluginName == "")
|
|
return;
|
|
|
|
foreach (HPLUGIN_INFO *pluItem, HPluginManage::getInstance()->getPluginList())
|
|
{
|
|
HPluginInterface *pluInter = reinterpret_cast<HPluginInterface *>(pluItem->pluClass);
|
|
if (pluItem->pluName == strPluginName)
|
|
{
|
|
return pluInter->setParams(strParams);
|
|
}
|
|
}
|
|
} |