本文整理汇总了C++中PluginInterface类的典型用法代码示例。如果您正苦于以下问题:C++ PluginInterface类的具体用法?C++ PluginInterface怎么用?C++ PluginInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PluginInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: file
void Ztamp::LoadConfig()
{
QFile file(configFileName);
if (!file.open(QIODevice::ReadOnly))
{
LogError(QString("Cannot open config file for reading : %1").arg(configFileName));
return;
}
QDataStream in(&file);
in.setVersion(QDataStream::Qt_4_3);
in >> GlobalSettings >> PluginsSettings >> listOfPlugins;
if (in.status() != QDataStream::Ok)
{
LogWarning(QString("Problem when loading config file for ztamp : %1").arg(QString(id.toHex())));
}
// "Load" associated ztamp plugins
foreach(QString s, listOfPlugins)
{
PluginInterface * p = PluginManager::Instance().GetPluginByName(s);
if(p)
{
listOfPluginsPtr.append(p);
if(!p->GetEnable())
LogWarning(QString("Ztamp %1 : '%2' is globally disabled !").arg(QString(GetID()), s));
}
else
LogError(QString("Ztamp %1 has invalid plugin !").arg(QString(GetID())));
}
示例2: LoadPlugin
virtual PluginInterface* LoadPlugin(ImageObserverInterface* imageObserver = 0) {
PluginInterface* plugin = 0;
if ((plugin = PluginInterface::AcquireInstance())) {
if ((imageObserver))
plugin->RegisterImageObserver(imageObserver);
}
return plugin;
}
示例3: getScriptLastError
/**
*Returns the javascript's last error for the given plugin if found, an empty QString else.
*/
QString Filter::getScriptLastError(QString plugin) {
for (QVector<PluginInterface *>::iterator i = m_plugins.begin(); i != m_plugins.end(); i++) {
PluginInterface *fiP = *i;
if (fiP->getName() == plugin)
return fiP->getScriptLastError();
}
return "";
}
示例4:
/**
* Returns the attribute list for the given plugin if found, an empty list else.
*/
const QList<QString> Filter::getAttributes(QString plugin) {
for (QVector<PluginInterface *>::iterator i = m_plugins.begin(); i != m_plugins.end(); i++) {
PluginInterface *fiP = *i;
if (fiP->getName() == plugin)
return fiP->getAttributeNames();
}
return QList<QString>();
}
示例5: getAttributeTip
/**
* Return the attribute's tip for the given plugin if found, an empty QString else.
*/
QString Filter::getAttributeTip(QString plugin, QString name) {
for (QVector<PluginInterface *>::iterator i = m_plugins.begin(); i != m_plugins.end(); i++) {
PluginInterface *fiP = *i;
if (fiP->getName() == plugin)
return fiP->getAttributeTip(name);
}
return "";
}
示例6: setScript
/**
* Sets the javascript for the given plugin if found, an empty QString else.
*/
void Filter::setScript(QString plugin, QString script) {
for (QVector<PluginInterface *>::iterator i = m_plugins.begin(); i != m_plugins.end(); i++) {
PluginInterface *fiP = *i;
if (fiP->getName() == plugin) {
#ifdef _VERBOSE_FILTER
qDebug() << "Filter::setScript(" << m_virtualDirectoryPath << ", " << plugin << ", " << script << ")";
#endif
fiP->setScript(script);
return;
}
}
}
示例7: getScript
/**
* Returns the javascript for the given plugin if found, an empty QString else.
*/
QString Filter::getScript(QString plugin) {
for (QVector<PluginInterface *>::iterator i = m_plugins.begin(); i != m_plugins.end(); i++) {
PluginInterface *fiP = *i;
if (fiP->getName() == plugin) {
#ifdef _VERBOSE_FILTER
qDebug() << "Filter::getScript(" << m_virtualDirectoryPath << ", " << plugin << ") -> " << fiP->getScript();
#endif
return fiP->getScript();
}
}
return "";
}
示例8: QFINDTESTDATA
void tst_QPluginLoader::relativePath()
{
// Windows binaries run from release and debug subdirs, so we can't rely on the current dir.
const QString binDir = QFINDTESTDATA("bin");
QVERIFY(!binDir.isEmpty());
QCoreApplication::addLibraryPath(binDir);
QPluginLoader loader("theplugin");
loader.load(); // not recommended, instance() should do the job.
PluginInterface *instance = qobject_cast<PluginInterface*>(loader.instance());
QVERIFY(instance);
QCOMPARE(instance->pluginName(), QLatin1String("Plugin ok"));
QVERIFY(loader.unload());
}
示例9: pluginsDir
void g19daemon::loadPlugins()
{
PluginInterface *pluginint;
QDir pluginsDir(qApp->applicationDirPath());
QString name;
name = settings->value("ActivePlugin").toString();
pluginsDir.cd(PLUGINS_DIR);
QDirIterator iterator(pluginsDir.absolutePath(), QStringList() << "*.so", QDir::Files, QDirIterator::NoIteratorFlags);
while (iterator.hasNext())
{
iterator.next();
QString filename = iterator.fileName();
QPluginLoader pluginLoader(iterator.filePath());
pluginLoader.setLoadHints(QLibrary::ResolveAllSymbolsHint);
QObject *plugin = pluginLoader.instance();
if (plugin)
{
pluginint = qobject_cast<PluginInterface *>(plugin);
if (pluginint)
{
QObject *signalsource = pluginint->getQObject();
connect(signalsource, SIGNAL(doAction(gAction, void *)), this, SLOT(doAction(gAction, void *)));
if (pluginint->isPopup())
{
PopupPlugins.append(pluginint);
}
else
{
plugins.append(pluginint);
if (pluginint->getName().compare(name) == 0)
{
activePlugin = plugins.indexOf(pluginint);
}
}
}
}
else
{
QErrorMessage err(this);
err.showMessage(pluginLoader.errorString());
qDebug() << "\tError: " << pluginLoader.errorString();
}
}
示例10: loader
void Filter::loadPlugin(QString pluginFilename) {
// load the plugin
QPluginLoader loader(pluginFilename);
if (loader.load()) {
#ifdef _VERBOSE_FILTER
qDebug() << "Loaded plugin: " << pluginFilename;
#endif
PluginInterface *pluginP = qobject_cast<PluginInterface *>(loader.instance()); // this singleton instance will be automatically
pluginP = pluginP->newInstance(m_virtualDirectoryPath); // unloaded when the server exits
m_plugins.append(pluginP);
m_pluginFilenames.append(pluginFilename);
}
else
qDebug() << QObject::tr("Failed to load plugin: ") + pluginFilename + QObject::tr(", error: ") + loader.errorString();
}
示例11: tr
void BoxWidget::initPluginWidget()
{
QStringList title;
title << tr("");
pluginModel.setTitle(title);
// pluginModel.insertRows(0,1,QModelIndex());
// QModelIndex qindex = pluginModel.index(0,0,QModelIndex());
// pluginModel.setData(qindex,tr(" "));
pluginModel.insertRows(0,1,QModelIndex());
QModelIndex qindex = pluginModel.index(0,0,QModelIndex());
//set text
pluginModel.setData(qindex, tr("UbuntuKylin Software Center"));
//set icon
pluginModel.setData(qindex,QIcon(QPixmap("://res/ubuntukylin-software-center.png")),Qt::DecorationRole);
//set tooltip
pluginModel.setData(qindex, tr("UbuntuKylin Software Center"),Qt::WhatsThisRole);
QStringList icon_list;
icon_list<<"://res/boot"<<"://res/camera";
QStringList text_list;
text_list << tr("Boot Manager") << tr("Camera");
for (int index = 0;index < 2;++index)
{
pluginModel.insertRows(index + 1,1,QModelIndex());
qindex = pluginModel.index(index + 1,0,QModelIndex());
pluginModel.setData(qindex, text_list.at(index));
//set icon
pluginModel.setData(qindex,QIcon(QPixmap(icon_list.at(index))),Qt::DecorationRole);
//set tooltip
pluginModel.setData(qindex, text_list.at(index),Qt::WhatsThisRole);
}
int count = PluginManager::Instance()->count();
for (int i = 0;i < count;++i)
{
PluginInterface* ICommon = PluginManager::Instance()->getInterfaceByindex<PluginInterface>(i);
QString picture = ICommon->getPicture();
QString pacture_path = QString(":/model/res/plugin/%1").arg(picture);
pluginModel.setGuid(ICommon->getGuid());
// pluginModel.insertRows(i + 1,1,QModelIndex());
// qindex = pluginModel.index(i + 1,0,QModelIndex());
pluginModel.insertRows(i + 3,1,QModelIndex());
qindex = pluginModel.index(i + 3,0,QModelIndex());
pluginModel.setData(qindex,ICommon->getName());
pluginModel.setData(qindex,QIcon(QPixmap(pacture_path)),Qt::DecorationRole);
pluginModel.setData(qindex,ICommon->getName(),Qt::WhatsThisRole);
}
}
示例12: tr
void tst_XQPluginLoader::listThePlugins()
{
QList<XQPluginInfo> plugins;
XQPluginLoader loader;
loader.listImplementations( tr( "xtheplugin.dll" ), plugins );
QVERIFY( plugins.count() != 0 );
for( int i( 0 ); i < plugins.count(); ++i ) {
loader.setUid( plugins[i ].uid() );
QCOMPARE( loader.load(), true );
PluginInterface *instance = qobject_cast<PluginInterface*>(loader.instance());
QCOMPARE(instance->pluginName(), QLatin1String("Plugin ok"));
QCOMPARE(loader.unload(), true);
}
plugins.clear();
}
示例13: Q_ASSERT
void PluginModel::setPluginEnabled(bool enabled, int i)
{
Q_ASSERT(i >= 0 && i < count());
PluginInterface *plugin = m_plugins.at(i);
plugin->setEnabled(enabled);
auto *pluginObj = dynamic_cast<QObject*>(plugin);
if (!pluginObj) {
qWarning() << Q_FUNC_INFO << "pluginObj is null" << enabled << i;
return;
}
const QString pluginName = pluginObj->metaObject()->className();
m_kernel->settings()->beginGroup("plugins");
m_kernel->settings()->setValue(pluginName + ".enabled", enabled);
m_kernel->settings()->endGroup();
plugin->setEnabled(enabled);
emit dataChanged(index(0, 0), index(rowCount()-1, 0));
}
示例14: QString
ApiManager::ApiAnswer * ApiManager::ProcessPluginApiCall(Account const& account, QString const& request, HTTPRequest & hRequest)
{
QStringList list = QString(request).split('/', QString::SkipEmptyParts);
if(list.size() != 2)
return new ApiManager::ApiError(QString("Malformed Plugin Api Call : %1").arg(hRequest.toString()));
QString const& pluginName = list.at(0);
QString const& functionName = list.at(1);
PluginInterface * plugin = PluginManager::Instance().GetPluginByName(pluginName);
if(!plugin)
return new ApiManager::ApiError(QString("Unknown Plugin : %1<br />Request was : %2").arg(pluginName,hRequest.toString()));
if(!plugin->GetEnable())
return new ApiManager::ApiError("This plugin is disabled");
return plugin->ProcessApiCall(account, functionName, hRequest);
}
示例15: if
void BoxWidget::OnClickListView(const QModelIndex & index)
{
if(index.row() == 0)
{
sessionProxy->runApp("ubuntu-kylin-software-center");
}
else if(index.row() == 1) {
emit this->sendSubIndex(0);
}
else if(index.row() == 2) {
emit this->sendSubIndex(1);
}
else
{
// QString guid = pluginModel.getGuid(index.row() - 1);
QString guid = pluginModel.getGuid(index.row() - 3);
PluginInterface* interface = PluginManager::Instance()->getInterfaceByGuid<PluginInterface>(guid);
interface->doAction();
}
}