本文整理汇总了C++中PluginManager::loadPlugins方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginManager::loadPlugins方法的具体用法?C++ PluginManager::loadPlugins怎么用?C++ PluginManager::loadPlugins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginManager
的用法示例。
在下文中一共展示了PluginManager::loadPlugins方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadPlugins
void MainWindowBase::loadPlugins(const QString &pluginsDirPath) {
qDebug() << "----MainWindowBase::loadPlugins(...)~~Plugins Path:"<< pluginsDirPath;
PluginManager *pluginManager = PluginManager::instance();
connect(pluginManager, SIGNAL(signalPluginLoaded(AbstractPluginInterface*)), this, SLOT(slotInitPlugin(AbstractPluginInterface*)));
pluginManager->loadPlugins(pluginsDirPath);
// plugins = PluginManager::instance()->pluginsList();
// for (int i = 0; i < plugins.size(); i++) {
// AbstractPluginInterface *plugin = plugins.value(i);
// HEHUI::GUIInterface *guiInterface =
// static_cast<HEHUI::GUIInterface *> (plugin);
// if (guiInterface) {
// guiPlugins.append(guiInterface);
// }
// }
//
// return;
/*
QDir pluginsDir(pluginsPath);
foreach(QString fileName, pluginsDir.entryList(QDir::Files))
{
qDebug() << QString("~~ Testing library %1").arg(
pluginsDir.absoluteFilePath(fileName));
QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName));
QObject *plugin = pluginLoader.instance();
if (plugin) {
HEHUI::AbstractInterface *coreInterface = qobject_cast<HEHUI::AbstractInterface *> (plugin);
if (coreInterface) {
corePlugins.append(coreInterface);
qDebug() << QString("~~ Loading Core Plugin %1").arg(fileName);
HEHUI::GUIInterface *guiInterface = qobject_cast<HEHUI::GUIInterface *> (plugin);
if (guiInterface) {
guiPlugins.append(guiInterface);
qDebug() << QString("~~ Loading GUI Plugin %1").arg(fileName);
}
} else {
qCritical() << QString("XX Unknown Plugin! ");
break;
}
} else {
qDebug() << QString("XX An error occurred while loading plugin : %1").arg(
pluginLoader.errorString());
}
}
*/
}
示例2: main
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
CommandLineParser parser;
Commands commands;
parser.registerDataSink( &commands );
if ( !parser.parse( true ) ) {
a.quit();
return -1;
}
Log::instance()->setMessageTypeEnabled( QtDebugMsg, commands.verbose );
PluginManager* pluginManager = PluginManager::instance();
pluginManager->loadPlugins();
if ( commands.listPlugins ) {
printf( "%s\n\n", printStringTable( pluginManager->importerPlugins(), 1, "Importer Plugins" ).toUtf8().constData() );
printf( "%s\n\n", printStringTable( pluginManager->routerPlugins(), 1, "Router Plugins" ).toUtf8().constData() );
printf( "%s\n\n", printStringTable( pluginManager->gpsLookupPlugins(), 1, "GPS Lookup Plugins" ).toUtf8().constData() );
printf( "%s\n\n", printStringTable( pluginManager->rendererPlugins(), 1, "Renderer Plugins" ).toUtf8().constData() );
printf( "%s\n\n", printStringTable( pluginManager->addressLookupPlugins(), 1, "Address Lookup Plugins" ).toUtf8().constData() );
a.quit();
return 0;
}
if ( !commands.settings.isEmpty() ) {
QSettings settings( commands.settings, QSettings::IniFormat );
pluginManager->loadSettings( &settings );
commands.importer = settings.value( "importer" ).toString();
commands.router = settings.value( "router" ).toString();
commands.gpsLookup = settings.value( "gpsLookup" ).toString();
commands.renderer = settings.value( "renderer" ).toString();
commands.addressLookup = settings.value( "addressLookup" ).toString();
}
// parse a second time including all plugins
// otherwise console settings would be overwritten by the settings file
QVector< QObject* > plugins = pluginManager->plugins();
foreach( QObject* plugin, plugins ) {
IConsoleSettings* settings = qobject_cast< IConsoleSettings* >( plugin );
if ( settings!= NULL ) {
parser.registerDataSink( settings );
}
}
示例3: QWidget
/*! Constructor */
ExperimentLoaderWidget::ExperimentLoaderWidget(QString pluginPath, QWidget* parent) : QWidget(parent) {
//Create vertical box to organize layout
mainVerticalBox = new QVBoxLayout(this);
try{
//Get list of available analysis plugins
PluginManager* pluginManager = new PluginManager(pluginPath);
pluginManager->loadPlugins();
QStringList pluginList = pluginManager->getPluginNames();
//Add list to combo box
QComboBox* pluginsCombo = new QComboBox(this);
pluginsCombo->addItems(pluginList);
//Add combo to layout
QHBoxLayout *comboBox = new QHBoxLayout();
comboBox->addWidget(new QLabel("Experiment plugins: "));
comboBox->addWidget(pluginsCombo);
comboBox->addStretch(5);
mainVerticalBox->addLayout(comboBox);
//Add the widgets to a stacked widget
stackedWidget = new QStackedWidget();
for(QList<QString>::iterator iter = pluginList.begin(); iter != pluginList.end(); ++iter){
QWidget* tmpWidget = pluginManager->getPlugin(*iter);
abstractExperimentList.append((AbstractExperimentWidget*)tmpWidget);
pluginWidgetMap[*iter] = stackedWidget->addWidget(tmpWidget);
}
//Add stacked widget to layout
mainVerticalBox->addWidget(stackedWidget);
//Connect combo changed signal to slot loading appropriate analysis widget
connect(pluginsCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(showExperimentWidget(int)) );
}
catch(SpikeStreamException& ex){
qCritical()<<ex.getMessage();
}
}