00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 #include "Core.hh"
00057
00058 #include <QMenuBar>
00059 #include <QToolBox>
00060 #include <QMessageBox>
00061 #include <QApplication>
00062 #include <QScrollArea>
00063
00064 #include <QPluginLoader>
00065 #include "OpenFlipper/BasePlugin/BaseInterface.hh"
00066 #include "OpenFlipper/BasePlugin/KeyInterface.hh"
00067 #include "OpenFlipper/BasePlugin/BackupInterface.hh"
00068 #include "OpenFlipper/BasePlugin/LoggingInterface.hh"
00069 #include "OpenFlipper/BasePlugin/MouseInterface.hh"
00070 #include "OpenFlipper/BasePlugin/PickingInterface.hh"
00071 #include "OpenFlipper/BasePlugin/ToolboxInterface.hh"
00072 #include "OpenFlipper/BasePlugin/OptionsInterface.hh"
00073 #include "OpenFlipper/BasePlugin/ToolbarInterface.hh"
00074 #include "OpenFlipper/BasePlugin/TextureInterface.hh"
00075 #include "OpenFlipper/BasePlugin/MenuInterface.hh"
00076 #include "OpenFlipper/BasePlugin/ContextMenuInterface.hh"
00077 #include "OpenFlipper/BasePlugin/ProcessInterface.hh"
00078 #include "OpenFlipper/BasePlugin/ViewInterface.hh"
00079 #include "OpenFlipper/BasePlugin/ViewModeInterface.hh"
00080 #include "OpenFlipper/BasePlugin/LoadSaveInterface.hh"
00081 #include "OpenFlipper/BasePlugin/StatusbarInterface.hh"
00082 #include "OpenFlipper/BasePlugin/INIInterface.hh"
00083 #include "OpenFlipper/BasePlugin/FileInterface.hh"
00084 #include "OpenFlipper/BasePlugin/RPCInterface.hh"
00085 #include "OpenFlipper/BasePlugin/ScriptInterface.hh"
00086 #include "OpenFlipper/BasePlugin/SecurityInterface.hh"
00087 #include "OpenFlipper/BasePlugin/TypeInterface.hh"
00088
00089 #include "OpenFlipper/INIFile/INIFile.hh"
00090
00091 #include "OpenFlipper/common/GlobalOptions.hh"
00092
00093 #include <QMessageBox>
00094 #include <QtScript/QScriptValueIterator>
00095
00096 #include <ACG/QtWidgets/QtFileDialog.hh>
00097 #include "OpenFlipper/widgets/PluginDialog/PluginDialog.hh"
00098
00099
00100
00101
00102 bool Core::checkSlot(QObject* _plugin , const char* _slotSignature) {
00103 const QMetaObject* meta = _plugin->metaObject();
00104 int id = meta->indexOfSlot( QMetaObject::normalizedSignature( _slotSignature ) );
00105 return ( id != -1 );
00106 }
00107
00108 bool Core::checkSignal(QObject* _plugin , const char* _signalSignature) {
00109 const QMetaObject* meta = _plugin->metaObject();
00110 int id = meta->indexOfSignal( QMetaObject::normalizedSignature( _signalSignature ) );
00111 return ( id != -1 );
00112 }
00113
00116 void Core::loadPlugins()
00117 {
00118
00119 QDir tempDir = QDir(OpenFlipper::Options::pluginDir());
00120
00121
00122 QStringList filter;
00123 if ( OpenFlipper::Options::isWindows() )
00124 filter << "*.dll";
00125 else if ( OpenFlipper::Options::isDarwin() )
00126 filter << "*.so";
00127
00128 else
00129 filter << "*.so";
00130
00131
00132 QStringList pluginlist = tempDir.entryList(filter,QDir::Files);
00133
00134
00135 for (int i=0; i < pluginlist.size(); i++) {
00136 pluginlist[i] = tempDir.absoluteFilePath(pluginlist[i]);
00137 }
00138
00139
00140 QStringList dontLoadPlugins = OpenFlipperSettings().value("PluginControl/DontLoadNames").toStringList();
00141
00142
00143 for ( int i = 0 ; i < dontLoadPlugins.size(); ++i)
00144 emit log(LOGOUT,tr("dontLoadPlugins Plugin from ini file: %1").arg( dontLoadPlugins[i] ) );
00145
00146
00147 QStringList additionalPlugins = OpenFlipperSettings().value("PluginControl/AdditionalPlugins").toStringList();
00148
00149
00150 for ( int i = 0 ; i < additionalPlugins.size(); ++i) {
00151 emit log(LOGOUT,tr("Additional Plugin from file: %1").arg( additionalPlugins[i] ) );
00152 }
00153
00154
00155 pluginlist = additionalPlugins << pluginlist;
00156
00157
00158 QStringList typePlugins;
00159 QStringList filePlugins;
00160 QStringList textureControl;
00161 QStringList otherPlugins;
00162
00163 for (int i=0; i < pluginlist.size(); i++)
00164 if (pluginlist[i].contains("Plugin-Type") )
00165 typePlugins.push_back(pluginlist[i]);
00166 else if (pluginlist[i].contains("Plugin-File") )
00167 filePlugins.push_back(pluginlist[i]);
00168 else if (pluginlist[i].contains("TextureControl"))
00169 textureControl.push_back(pluginlist[i]);
00170 else
00171 otherPlugins.push_back(pluginlist[i]);
00172
00173
00174
00175
00176
00177
00178 pluginlist = typePlugins << filePlugins << textureControl << otherPlugins;
00179
00180 for ( int i = 0 ; i < dontLoadPlugins.size(); ++i )
00181 emit log(LOGWARN,tr("Skipping Plugins :\t %1").arg( dontLoadPlugins[i] ) );
00182
00183 emit log(LOGOUT,"================================================================================");
00184
00185
00186 for ( int i = 0 ; i < pluginlist.size() ; ++i) {
00187
00188 if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) {
00189 splashMessage_ = tr("Loading Plugin %1/%2").arg(i).arg(pluginlist.size()) ;
00190 splash_->showMessage( splashMessage_ , Qt::AlignBottom | Qt::AlignLeft , Qt::white);
00191 QApplication::processEvents();
00192 }
00193
00194 loadPlugin(pluginlist[i],true);
00195 }
00196
00197 splashMessage_ = "";
00198
00199 emit pluginsInitialized();
00200
00201 emit log(LOGOUT,tr("Loaded %n Plugin(s)","",plugins.size()) );
00202 }
00203
00206 void Core::slotLoadPlugin(){
00207
00208 if ( OpenFlipper::Options::nogui() )
00209 return;
00210
00211
00212 QString filter;
00213 if ( OpenFlipper::Options::isWindows() )
00214 filter = "Plugins (*.dll)";
00215 else if ( OpenFlipper::Options::isDarwin() )
00216
00217 filter = "Plugins (*.so)";
00218 else
00219 filter = "Plugins (*.so)";
00220
00221
00222 QString filename = ACG::getOpenFileName(coreWidget_,tr("Load Plugin"),filter, OpenFlipperSettings().value("Core/CurrentDir").toString() );
00223
00224 if (filename.isEmpty())
00225 return;
00226
00227
00228
00229 QPluginLoader loader( filename );
00230 QObject *plugin = loader.instance();
00231 QString name;
00232
00233
00234 if (plugin) {
00235
00236 BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugin);
00237 if ( basePlugin ) {
00238 name = basePlugin->name();
00239 }else
00240 return;
00241 }else
00242 return;
00243
00244
00245 QStringList dontLoadPlugins = OpenFlipperSettings().value("PluginControl/DontLoadNames").toStringList();
00246 if (dontLoadPlugins.contains(name)){
00247 int ret = QMessageBox::question(0, tr("Plugin Loading Prevention"),
00248 tr("OpenFlipper is currently configured to prevent loading this plugin.\n"
00249 "Do you want to enable this plugin permanently?"),
00250 QMessageBox::Yes | QMessageBox::No,
00251 QMessageBox::Yes);
00252 if (ret == QMessageBox::Yes) {
00253 dontLoadPlugins.removeAll(name);
00254 OpenFlipperSettings().setValue("PluginControl/DontLoadNames",dontLoadPlugins);
00255 } else
00256 return;
00257 }
00258
00259
00260 QStringList additionalPlugins = OpenFlipperSettings().value("PluginControl/AdditionalPlugins").toStringList();
00261 if (!additionalPlugins.contains(name)){
00262 int ret = QMessageBox::question(0, tr("Plugin Loading ..."),
00263 tr("Should OpenFlipper load this plugin on next startup?"),
00264 QMessageBox::Yes | QMessageBox::No,
00265 QMessageBox::Yes);
00266 if (ret == QMessageBox::Yes) {
00267 additionalPlugins << filename;
00268 std::cerr << "Added: " << filename.toStdString() << std::endl;
00269 OpenFlipperSettings().setValue("PluginControl/AdditionalPlugins",additionalPlugins);
00270 }
00271 }
00272
00273 loadPlugin(filename,false);
00274 }
00275
00278 void Core::slotShowPlugins(){
00279
00280 if ( OpenFlipper::Options::gui() ){
00281
00282 int ret = 0;
00283
00284 while (ret == 0){
00285
00286 PluginDialog* dialog = new PluginDialog(plugins, coreWidget_);
00287
00288
00289 connect(dialog, SIGNAL(unloadPlugin(QString)), this, SLOT(unloadPlugin(QString)));
00290 connect(dialog, SIGNAL( loadPlugin() ), this, SLOT( slotLoadPlugin() ));
00291
00292
00293 ret = dialog->exec();
00294
00295 delete dialog;
00296 }
00297 }
00298 }
00299
00303 void Core::unloadPlugin(QString name){
00304 for (uint i=0; i < plugins.size(); i++)
00305 if (plugins[i].rpcName == name){
00306 if ( checkSlot( plugins[i].plugin , "exit()" ) )
00307 QMetaObject::invokeMethod(plugins[i].plugin, "exit", Qt::DirectConnection);
00308
00309
00310 QString name_nospace = name;
00311 name_nospace.remove(" ");
00312 if ( coreWidget_->viewModes_[0]->visibleToolboxes.contains(name_nospace) )
00313 coreWidget_->viewModes_[0]->visibleToolboxes.removeAt(coreWidget_->viewModes_[0]->visibleToolboxes.indexOf(name_nospace));
00314 for ( uint j = 0 ; j < plugins[i].toolboxWidgets.size() ; ++j )
00315 if (plugins[i].toolboxWidgets[j].second ){
00316 plugins[i].toolboxWidgets[j].second->setVisible(false);
00317 delete plugins[i].toolboxWidgets[j].second;
00318 }
00319
00320 plugins.erase(plugins.begin() + i);
00321
00322 emit log(LOGOUT,tr("Unloaded Plugin :\t\t %1").arg( name) );
00323
00324 return;
00325 }
00326
00327 log(LOGERR, tr("Unable to unload plugin '%1' (plugin wasn't found)").arg(name));
00328 }
00329
00334 void Core::loadPlugin(QString filename, bool silent){
00335
00336
00337 if ( OpenFlipper::Options::isWindows() ) {
00338 QString dllname = filename;
00339 if ( ! dllname.endsWith( ".dll" ) )
00340 return;
00341 }
00342
00343
00344 if ( OpenFlipper::Options::isLinux() ) {
00345 QString soname = filename;
00346 if ( ! soname.endsWith( ".so" ) )
00347 return;
00348 }
00349
00350
00351 QPluginLoader loader( filename );
00352 QObject *plugin = loader.instance();
00353
00354
00355 if (plugin) {
00356 PluginInfo info;
00357 QString supported;
00358
00359 emit log(LOGOUT,tr("Location : \t %2").arg(filename) );
00360
00361
00362 BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugin);
00363 if ( basePlugin ) {
00364 emit log(LOGOUT,tr("Found Plugin : \t %1").arg(basePlugin->name()) );
00365 emit log(LOGOUT,tr("Location : \t %2").arg(filename) );
00366
00367 if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) {
00368 splashMessage_ = splashMessage_ + " " + basePlugin->name() ;
00369 splash_->showMessage( splashMessage_ , Qt::AlignBottom | Qt::AlignLeft , Qt::white);
00370 QApplication::processEvents();
00371 }
00372
00373
00374 for (uint k=0; k < plugins.size(); k++){
00375
00376 QString name_nospace = basePlugin->name();
00377 name_nospace.remove(" ");
00378
00379 if (plugins[k].name == name_nospace){
00380 if (silent || OpenFlipper::Options::nogui() ){
00381 emit log(LOGWARN, tr("\t\t\t Already loaded from %1").arg( plugins[k].path) );
00382 emit log(LOGOUT,"================================================================================");
00383 return;
00384 }else{
00385 int ret = QMessageBox::question(coreWidget_,
00386 tr("Plugin already loaded"),
00387 tr("A Plugin with the same name was already loaded from %1.\n"
00388 "You can only load the new plugin if you unload the existing one first.\n\n"
00389 "Do you want to unload the existing plugin first?").arg( plugins[k].path),
00390 QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
00391 if (ret == QMessageBox::Yes)
00392 unloadPlugin(plugins[k].name);
00393 else{
00394 emit log(LOGWARN, tr("\t\t\t Already loaded from %1.").arg( plugins[k].path));
00395 emit log(LOGOUT,"================================================================================");
00396 return;
00397 }
00398 }
00399 }
00400 }
00401
00402 QStringList dontLoadPlugins = OpenFlipperSettings().value("PluginControl/DontLoadNames").toStringList();
00403
00404 if ( dontLoadPlugins.contains(basePlugin->name(), Qt::CaseInsensitive) ) {
00405 emit log(LOGWARN,tr("OpenFlipper.ini prevented Plugin %1 from being loaded! ").arg( basePlugin->name() ));
00406 emit log(LOGOUT,"================================================================================");
00407 return;
00408 }
00409
00410
00411 SecurityInterface * securePlugin = qobject_cast< SecurityInterface * >(plugin);
00412 if ( securePlugin ) {
00413 emit log(LOGINFO,tr("Plugin uses security interface. Trying to authenticate against plugin ..."));
00414
00415 bool success = false;
00416 QMetaObject::invokeMethod(plugin,"authenticate", Q_RETURN_ARG( bool , success ) ) ;
00417
00418 if ( success )
00419 emit log(LOGINFO,tr("... ok. Loading plugin "));
00420 else {
00421 emit log(LOGERR,tr("... failed. Plugin access denied."));
00422 emit log(LOGOUT,"================================================================================");
00423 return;
00424 }
00425 }
00426
00427
00428 emit log(LOGOUT,tr("Plugin Desciption :\t %1 ").arg( basePlugin->description()) );
00429
00430 supported = "BaseInterface ";
00431
00432 info.name = basePlugin->name();
00433 info.description = basePlugin->description();
00434 info.plugin = plugin;
00435 info.path = filename;
00436
00437 if ( checkSlot(plugin,"version()") )
00438 info.version = basePlugin->version();
00439 else
00440 info.version = QString::number(-1);
00441
00442 if ( OpenFlipper::Options::nogui() ) {
00443
00444 if ( ! checkSlot( plugin , "noguiSupported()" ) ) {
00445 emit log(LOGWARN,tr("Running in nogui mode which is unsupported by this plugin, skipping") );
00446 emit log(LOGOUT,"================================================================================");
00447 return;
00448 }
00449
00450 }
00451
00452
00453
00454 if ( checkSignal(plugin,"updated_objects(int)") ) {
00455 log(LOGERR,tr("Plugin Uses old style updated_objects! Convert to updatedObject!"));
00456 emit log(LOGOUT,"================================================================================");
00457 return;
00458 }
00459
00460 if ( checkSignal(plugin,"update_view()") ) {
00461 log(LOGERR,tr("Plugin Uses old style update_view! Convert to updateView!"));
00462 emit log(LOGOUT,"================================================================================");
00463 return;
00464 }
00465
00466 if ( checkSignal(plugin,"updateView()") )
00467 connect(plugin,SIGNAL(updateView()),this,SLOT(updateView()));
00468
00469
00470 if ( checkSignal(plugin,"updatedObject(int)") && checkSignal(plugin,"updatedObject(int,const UpdateType)") ){
00471
00472 log(LOGERR,tr("Plugin uses deprecated and(!) new updatedObject. Only new updatedObject will be active."));
00473 connect(plugin,SIGNAL(updatedObject(int,const UpdateType)),this,SLOT(slotObjectUpdated(int,const UpdateType)), Qt::DirectConnection);
00474
00475 } else {
00476
00477 if ( checkSignal(plugin,"updatedObject(int)") ){
00478 log(LOGWARN,tr("Plugin uses deprecated updatedObject."));
00479 connect(plugin,SIGNAL(updatedObject(int)),this,SLOT(slotObjectUpdated(int)), Qt::DirectConnection);
00480 }
00481
00482 if ( checkSignal(plugin,"updatedObject(int,const UpdateType)") )
00483 connect(plugin,SIGNAL(updatedObject(int,const UpdateType)),this,SLOT(slotObjectUpdated(int,const UpdateType)), Qt::DirectConnection);
00484 }
00485
00486 if ( checkSlot( plugin , "slotObjectUpdated(int)" ) && checkSlot( plugin , "slotObjectUpdated(int,const UpdateType)" ) ){
00487
00488 log(LOGERR,tr("Plugin uses deprecated and(!) new slotObjectUpdated. Only new slotObjectUpdated will be active."));
00489 connect(this,SIGNAL(signalObjectUpdated(int)),plugin,SLOT(slotObjectUpdated(int)), Qt::DirectConnection);
00490
00491 } else {
00492
00493 if ( checkSlot( plugin , "slotObjectUpdated(int)" ) ){
00494 log(LOGWARN,tr("Plugin uses deprecated slotObjectUpdated."));
00495 connect(this,SIGNAL(signalObjectUpdated(int)),plugin,SLOT(slotObjectUpdated(int)), Qt::DirectConnection);
00496 }
00497
00498 if ( checkSlot( plugin , "slotObjectUpdated(int,const UpdateType)" ) )
00499 connect(this,SIGNAL(signalObjectUpdated(int,const UpdateType)),plugin,SLOT(slotObjectUpdated(int,const UpdateType)), Qt::DirectConnection);
00500 }
00501
00502 if ( checkSignal(plugin,"objectPropertiesChanged(int)")) {
00503 emit log (LOGERR,tr("Signal objectPropertiesChanged(int) is deprecated. " ));
00504 emit log (LOGERR,tr("The signal will be automatically emitted by the object that has been changed and the core will deliver it to the plugins!. "));
00505 emit log (LOGERR,tr("Please remove this signal from your plugins!. "));
00506
00507 }
00508
00509 if ( checkSlot( plugin , "slotViewChanged()" ) )
00510 connect(this,SIGNAL(pluginViewChanged()),plugin,SLOT(slotViewChanged()), Qt::DirectConnection);
00511
00512 if ( checkSlot(plugin,"slotObjectPropertiesChanged(int)"))
00513 connect(this,SIGNAL(objectPropertiesChanged(int)),plugin,SLOT(slotObjectPropertiesChanged(int)), Qt::DirectConnection);
00514
00515 if ( checkSignal(plugin,"visibilityChanged()" ) )
00516 emit log (LOGERR,tr("Signal visibilityChanged() now requires objectid or -1 as argument " ));
00517
00518 if ( checkSignal(plugin,"visibilityChanged(int)") ) {
00519 emit log (LOGERR,tr("Signal visibilityChanged(int) is deprecated! " ));
00520 emit log (LOGERR,tr("If an object changes its visibility, it will call the required functions automatically." ));
00521 emit log (LOGERR,tr("If you change a scenegraph node, call nodeVisibilityChanged(int). See docu of this function for details." ));
00522 }
00523
00524 if ( checkSignal(plugin,"nodeVisibilityChanged(int)") )
00525 connect(plugin,SIGNAL(nodeVisibilityChanged(int)),this,SLOT(slotVisibilityChanged(int)), Qt::DirectConnection);
00526
00527
00528 if ( checkSlot(plugin,"slotVisibilityChanged(int)") )
00529 connect(this,SIGNAL(visibilityChanged(int)),plugin,SLOT(slotVisibilityChanged(int)), Qt::DirectConnection);
00530
00531 if ( checkSignal(plugin,"activeObjectChanged()" ) )
00532 emit log (LOGERR,tr("Signal activeObjectChanged() is now objectSelectionChanged( int _objectId ) ") );
00533
00534 if ( checkSlot(plugin,"slotActiveObjectChanged()" ) )
00535 emit log (LOGERR,tr("Slot slotActiveObjectChanged() is now slotObjectSelectionChanged( int _objectId ) ") );
00536
00537 if ( checkSlot(plugin,"slotAllCleared()") )
00538 connect(this,SIGNAL(allCleared()),plugin,SLOT(slotAllCleared()));
00539
00540
00541 if ( checkSignal(plugin,"objectSelectionChanged(int)") ) {
00542 emit log (LOGERR,tr("Signal objectSelectionChanged(in) is deprecated!") );
00543 emit log (LOGERR,tr("If the selection for an object is changed, the core will emit the required signals itself!") );
00544 }
00545
00546 if ( checkSlot( plugin , "slotObjectSelectionChanged(int)" ) )
00547 connect(this,SIGNAL(objectSelectionChanged(int)),plugin,SLOT(slotObjectSelectionChanged(int) ), Qt::DirectConnection);
00548
00549
00550 if ( checkSlot( plugin , "pluginsInitialized()" ) )
00551 connect(this,SIGNAL(pluginsInitialized()),plugin,SLOT(pluginsInitialized()), Qt::DirectConnection);
00552
00553 if ( checkSignal(plugin,"setSlotDescription(QString,QString,QStringList,QStringList)") )
00554 connect(plugin, SIGNAL(setSlotDescription(QString,QString,QStringList,QStringList)),
00555 this, SLOT(slotSetSlotDescription(QString,QString,QStringList,QStringList)) );
00556 }
00557
00558
00559 LoggingInterface* logPlugin = qobject_cast< LoggingInterface * >(plugin);
00560 if ( logPlugin ) {
00561 supported = supported + "Logging ";
00562
00563
00564 PluginLogger* newlog = new PluginLogger(info.name);
00565 loggers_.push_back(newlog);
00566 connect(plugin,SIGNAL(log(Logtype, QString )),newlog,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
00567 connect(plugin,SIGNAL(log(QString )),newlog,SLOT(slotLog(QString )),Qt::DirectConnection);
00568
00569
00570 if ( OpenFlipper::Options::gui() )
00571 connect(newlog,SIGNAL(log(Logtype, QString )),coreWidget_,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
00572
00573
00574 connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
00575
00576
00577 connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLogToFile(Logtype, QString )),Qt::DirectConnection);
00578
00579
00580 if ( checkSlot(plugin,"logOutput(Logtype,QString)") )
00581 connect(this,SIGNAL(externalLog(Logtype,QString)), plugin, SLOT(logOutput(Logtype,QString)) ) ;
00582 }
00583
00584
00585 MenuInterface* menubarPlugin = qobject_cast< MenuInterface * >(plugin);
00586 if ( menubarPlugin && OpenFlipper::Options::gui() ) {
00587 supported = supported + "Menubar ";
00588
00589 if ( checkSignal(plugin,"addMenubarAction(QAction*,QString)") )
00590 connect(plugin , SIGNAL(addMenubarAction(QAction*,QString)),
00591 coreWidget_ , SLOT(slotAddMenubarAction(QAction*,QString)),Qt::DirectConnection);
00592 if ( checkSignal(plugin,"getMenubarMenu (QString,QMenu*&,bool)") )
00593 connect(plugin , SIGNAL(getMenubarMenu (QString,QMenu*&,bool)),
00594 coreWidget_ , SLOT(slotGetMenubarMenu (QString,QMenu*&,bool)),Qt::DirectConnection);
00595 }
00596
00597
00598 ContextMenuInterface* contextMenuPlugin = qobject_cast< ContextMenuInterface * >(plugin);
00599 if ( contextMenuPlugin && OpenFlipper::Options::gui() ) {
00600 supported = supported + "ContextMenu ";
00601
00602 if ( checkSignal(plugin,"addContextMenuItem(QAction*,ContextMenuType)") )
00603 connect(plugin , SIGNAL(addContextMenuItem(QAction*,ContextMenuType)),
00604 coreWidget_ , SLOT(slotAddContextItem(QAction*,ContextMenuType)),Qt::DirectConnection);
00605
00606 if ( checkSignal(plugin,"addContextMenuItem(QAction*,DataType,ContextMenuType)") )
00607 connect(plugin , SIGNAL(addContextMenuItem(QAction*,DataType,ContextMenuType)),
00608 coreWidget_ , SLOT(slotAddContextItem(QAction*,DataType,ContextMenuType)),Qt::DirectConnection);
00609
00610 if ( checkSlot(plugin,"slotUpdateContextMenu(int)") )
00611 connect(coreWidget_ , SIGNAL(updateContextMenu(int)),
00612 plugin , SLOT(slotUpdateContextMenu(int)),Qt::DirectConnection);
00613
00614 if ( checkSlot(plugin,"slotUpdateContextMenuNode(int)") )
00615 connect(coreWidget_ , SIGNAL(updateContextMenuNode(int)),
00616 plugin , SLOT(slotUpdateContextMenuNode(int)),Qt::DirectConnection);
00617
00618 if ( checkSlot(plugin,"slotUpdateContextMenuBackground()") )
00619 connect(coreWidget_ , SIGNAL(updateContextMenuBackground()),
00620 plugin , SLOT(slotUpdateContextMenuBackground()),Qt::DirectConnection);
00621 }
00622
00623
00624 ToolboxInterface* toolboxPlugin = qobject_cast< ToolboxInterface * >(plugin);
00625 if ( toolboxPlugin && OpenFlipper::Options::gui() ) {
00626 supported = supported + "Toolbox ";
00627
00628
00629 if ( checkSignal(plugin, "addToolbox(QString,QWidget*)"))
00630 connect(plugin, SIGNAL( addToolbox(QString,QWidget*) ),
00631 this, SLOT( addToolbox(QString,QWidget*) ),Qt::DirectConnection );
00632
00633
00634
00635 }
00636
00637
00638 ViewModeInterface* viewModePlugin = qobject_cast< ViewModeInterface * >(plugin);
00639 if ( viewModePlugin && OpenFlipper::Options::gui() ) {
00640 supported = supported + "ViewMode ";
00641
00642 if ( checkSignal(plugin, "defineViewModeToolboxes(QString,QStringList)"))
00643 connect(plugin, SIGNAL( defineViewModeToolboxes(QString, QStringList) ),
00644 coreWidget_, SLOT( slotAddViewModeToolboxes(QString, QStringList) ),Qt::DirectConnection );
00645
00646 if ( checkSignal(plugin, "defineViewModeToolbars(QString,QStringList)"))
00647 connect(plugin, SIGNAL( defineViewModeToolbars(QString, QStringList) ),
00648 coreWidget_, SLOT( slotAddViewModeToolbars(QString, QStringList) ),Qt::DirectConnection );
00649
00650 if ( checkSignal(plugin, "defineViewModeIcon(QString,QString)"))
00651 connect(plugin, SIGNAL( defineViewModeIcon(QString, QString) ),
00652 coreWidget_, SLOT( slotSetViewModeIcon(QString, QString) ),Qt::DirectConnection );
00653
00654 }
00655
00656
00657 OptionsInterface* optionsPlugin = qobject_cast< OptionsInterface * >(plugin);
00658 if ( optionsPlugin && OpenFlipper::Options::gui() ) {
00659 supported = supported + "Options ";
00660
00661 QWidget* widget = 0;
00662 if ( optionsPlugin->initializeOptionsWidget( widget ) ) {
00663 info.optionsWidget = widget;
00664
00665 if ( checkSlot(plugin,"applyOptions()") )
00666 connect(coreWidget_ , SIGNAL( applyOptions() ),
00667 plugin , SLOT( applyOptions() ),Qt::DirectConnection);
00668 }
00669 }
00670
00671
00672 ToolbarInterface* toolbarPlugin = qobject_cast< ToolbarInterface * >(plugin);
00673 if ( toolbarPlugin && OpenFlipper::Options::gui() ) {
00674 supported = supported + "Toolbars ";
00675
00676 if ( checkSignal(plugin,"addToolbar(QToolBar*)") )
00677 connect(plugin,SIGNAL(addToolbar(QToolBar*)),
00678 coreWidget_,SLOT(slotAddToolbar(QToolBar*)),Qt::DirectConnection);
00679
00680 if ( checkSignal(plugin,"removeToolbar(QToolBar*)") )
00681 connect(plugin,SIGNAL(removeToolbar(QToolBar*)),
00682 coreWidget_,SLOT(slotRemoveToolbar(QToolBar*)),Qt::DirectConnection);
00683
00684 if ( checkSignal(plugin,"getToolBar(QString,QToolBar*&)") )
00685 connect(plugin,SIGNAL(getToolBar(QString,QToolBar*&)),
00686 coreWidget_,SLOT(getToolBar(QString,QToolBar*&)),Qt::DirectConnection);
00687
00688 }
00689
00690
00691 StatusbarInterface* statusbarPlugin = qobject_cast< StatusbarInterface * >(plugin);
00692 if ( statusbarPlugin && OpenFlipper::Options::gui() ) {
00693 supported = supported + "StatusBar ";
00694
00695 if ( checkSignal(plugin,"showStatusMessage(QString,int)") )
00696 connect(plugin,SIGNAL(showStatusMessage(QString,int)),
00697 coreWidget_,SLOT(statusMessage(QString,int)),Qt::DirectConnection);
00698
00699
00700 if ( checkSignal(plugin,"setStatus(ApplicationStatus::applicationStatus)") )
00701 connect(plugin,SIGNAL(setStatus(ApplicationStatus::applicationStatus)),
00702 coreWidget_,SLOT(setStatus(ApplicationStatus::applicationStatus)),Qt::DirectConnection);
00703
00704 if ( checkSignal(plugin,"clearStatusMessage()") )
00705 connect(plugin,SIGNAL(clearStatusMessage()),
00706 coreWidget_,SLOT(clearStatusMessage()));
00707
00708 if ( checkSignal(plugin,"addWidgetToStatusbar(QWidget*)") )
00709 connect(plugin,SIGNAL(addWidgetToStatusbar(QWidget*)), coreWidget_,SLOT(addWidgetToStatusbar(QWidget*)));
00710 }
00711
00712
00713 KeyInterface* keyPlugin = qobject_cast< KeyInterface * >(plugin);
00714 if ( keyPlugin && OpenFlipper::Options::gui() ) {
00715 supported = supported + "KeyboardEvents ";
00716
00717 if ( checkSignal(plugin,"registerKey(int,Qt::KeyboardModifiers,QString,bool)") )
00718 connect(plugin,SIGNAL( registerKey(int, Qt::KeyboardModifiers, QString, bool) ),
00719 coreWidget_,SLOT(slotRegisterKey(int, Qt::KeyboardModifiers, QString, bool)) );
00720
00721
00722
00723
00724
00725
00726 }
00727
00728
00729 MouseInterface* mousePlugin = qobject_cast< MouseInterface * >(plugin);
00730 if ( mousePlugin && OpenFlipper::Options::gui() ) {
00731 supported = supported + "MouseEvents ";
00732
00733 if ( checkSlot( plugin , "slotMouseWheelEvent(QWheelEvent*,const std::string&)" ) )
00734 connect(this , SIGNAL(PluginWheelEvent(QWheelEvent * , const std::string & )),
00735 plugin , SLOT(slotMouseWheelEvent(QWheelEvent* , const std::string & )));
00736
00737 if ( checkSlot( plugin , "slotMouseEvent(QMouseEvent*)" ) )
00738 connect(this , SIGNAL(PluginMouseEvent(QMouseEvent*)),
00739 plugin , SLOT(slotMouseEvent(QMouseEvent*)));
00740
00741 if ( checkSlot( plugin , "slotMouseEventIdentify(QMouseEvent*)" ) )
00742 connect(this , SIGNAL(PluginMouseEventIdentify(QMouseEvent*)),
00743 plugin , SLOT(slotMouseEventIdentify(QMouseEvent*)));
00744
00745 }
00746
00747
00748 PickingInterface* pickPlugin = qobject_cast< PickingInterface * >(plugin);
00749 if ( pickPlugin && OpenFlipper::Options::gui() ) {
00750 supported = supported + "Picking ";
00751
00752 if ( checkSlot( plugin , "slotPickModeChanged(const std::string&)" ) )
00753 connect(coreWidget_,SIGNAL(signalPickModeChanged (const std::string &)),
00754 plugin,SLOT(slotPickModeChanged( const std::string &)));
00755
00756 if ( checkSignal(plugin,"addPickMode(const std::string)") )
00757 connect(plugin,SIGNAL(addPickMode( const std::string )),
00758 this,SLOT(slotAddPickMode( const std::string )),Qt::DirectConnection);
00759
00760 if ( checkSignal(plugin,"addHiddenPickMode(const std::string)") )
00761 connect(plugin,SIGNAL(addHiddenPickMode( const std::string )),
00762 this,SLOT(slotAddHiddenPickMode( const std::string )),Qt::DirectConnection);
00763
00764 if ( checkSignal(plugin,"setPickModeCursor(const std::string,QCursor)") )
00765 for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
00766 connect(plugin,SIGNAL(setPickModeCursor( const std::string ,QCursor)),
00767 coreWidget_,SLOT(setPickModeCursor( const std::string ,QCursor)),Qt::DirectConnection);
00768
00769 if ( checkSignal(plugin,"setPickModeMouseTracking(const std::string,bool)") )
00770 for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
00771 connect(plugin,SIGNAL(setPickModeMouseTracking( const std::string ,bool)),
00772 coreWidget_,SLOT(setPickModeMouseTracking( const std::string ,bool)),Qt::DirectConnection);
00773
00774 if ( checkSignal(plugin,"setPickModeToolbar(const std::string,QToolBar*)") )
00775 connect(plugin,SIGNAL(setPickModeToolbar (const std::string, QToolBar*)),
00776 coreWidget_,SLOT(setPickModeToolbar (const std::string, QToolBar*)),Qt::DirectConnection);
00777
00778 if ( checkSignal(plugin,"removePickModeToolbar(const std::string)") )
00779 connect(plugin,SIGNAL(removePickModeToolbar( const std::string)),
00780 coreWidget_,SLOT(removePickModeToolbar( const std::string)),Qt::DirectConnection);
00781
00782 }
00783
00784
00785 INIInterface* iniPlugin = qobject_cast< INIInterface * >(plugin);
00786 if ( iniPlugin ) {
00787 supported = supported + "INIFile ";
00788
00789 if ( checkSlot( plugin , "loadIniFile(INIFile&,int)" ) )
00790 connect(this , SIGNAL(iniLoad( INIFile&,int)),
00791 plugin , SLOT( loadIniFile( INIFile&,int) ),Qt::DirectConnection);
00792
00793 if ( checkSlot( plugin , "saveIniFile(INIFile&,int)" ) )
00794 connect(this , SIGNAL(iniSave( INIFile& , int )),
00795 plugin , SLOT( saveIniFile( INIFile& , int ) ),Qt::DirectConnection);
00796
00797 if ( checkSlot( plugin , "saveIniFileOptions(INIFile&)" ) )
00798 connect(this , SIGNAL(iniSaveOptions( INIFile& )),
00799 plugin , SLOT( saveIniFileOptions( INIFile& ) ),Qt::DirectConnection);
00800
00801 if ( checkSlot( plugin , "saveOnExit(INIFile&)" ) )
00802 connect(this , SIGNAL(saveOnExit( INIFile& )),
00803 plugin , SLOT( saveOnExit( INIFile& ) ),Qt::DirectConnection);
00804
00805 if ( checkSlot( plugin , "loadIniFileOptions(INIFile&)" ) )
00806 connect(this , SIGNAL(iniLoadOptions( INIFile& )),
00807 plugin , SLOT( loadIniFileOptions( INIFile& ) ),Qt::DirectConnection);
00808
00809 if ( checkSlot( plugin , "loadIniFileOptionsLast(INIFile&)" ) )
00810 connect(this , SIGNAL(iniLoadOptionsLast( INIFile& )),
00811 plugin , SLOT( loadIniFileOptionsLast( INIFile& ) ),Qt::DirectConnection);
00812 }
00813
00814
00815 TextureInterface* texturePlugin = qobject_cast< TextureInterface * >(plugin);
00816 if ( texturePlugin && OpenFlipper::Options::gui() ) {
00817 supported = supported + "Textures ";
00818
00819 if ( checkSignal(plugin,"addTexture(QString,QString,uint,int)") )
00820 connect(plugin , SIGNAL(addTexture( QString , QString , uint , int )),
00821 this , SLOT(slotAddTexture(QString, QString, uint, int)),Qt::DirectConnection);
00822
00823 if ( checkSlot( plugin , "slotTextureAdded(QString,QString,uint,int)" ) )
00824 connect(this , SIGNAL(addTexture(QString,QString, uint, int)),
00825 plugin , SLOT(slotTextureAdded(QString,QString, uint, int)),Qt::DirectConnection);
00826
00827 if ( checkSignal(plugin,"addTexture(QString,QString,uint)") )
00828 connect(plugin , SIGNAL(addTexture( QString , QString , uint )),
00829 this , SLOT(slotAddTexture(QString, QString, uint)),Qt::DirectConnection);
00830
00831 if ( checkSlot( plugin , "slotTextureAdded(QString,QString,uint)" ) )
00832 connect(this , SIGNAL(addTexture(QString,QString, uint)),
00833 plugin , SLOT(slotTextureAdded(QString,QString, uint)),Qt::DirectConnection);
00834
00835 if ( checkSignal(plugin,"updateTexture(QString,int)") )
00836 connect(plugin , SIGNAL(updateTexture( QString ,int )),
00837 this , SLOT(slotUpdateTexture(QString , int)),Qt::DirectConnection);
00838
00839 if ( checkSlot( plugin , "slotUpdateTexture(QString,int)" ) )
00840 connect(this , SIGNAL(updateTexture(QString ,int)),
00841 plugin , SLOT(slotUpdateTexture(QString,int )),Qt::DirectConnection);
00842
00843 if ( checkSignal(plugin,"updateAllTextures()") )
00844 connect(plugin , SIGNAL(updateAllTextures()),
00845 this , SLOT(slotUpdateAllTextures()));
00846
00847 if ( checkSlot( plugin , "slotUpdateAllTextures()" ) )
00848 connect(this , SIGNAL(updateAllTextures()),
00849 plugin , SLOT(slotUpdateAllTextures()));
00850
00851 if ( checkSignal(plugin,"updatedTextures(QString,int)") )
00852 connect(plugin , SIGNAL(updatedTextures( QString , int )),
00853 this , SLOT(slotTextureUpdated( QString, int ) ),Qt::DirectConnection);
00854
00855 if ( checkSlot( plugin , "slotTextureUpdated(QString,int)" ) )
00856 connect(this , SIGNAL(updatedTextures( QString , int )),
00857 plugin , SLOT(slotTextureUpdated( QString, int ) ),Qt::DirectConnection);
00858
00859 if ( checkSignal(plugin,"setTextureMode(QString,QString,int)") )
00860 connect(plugin , SIGNAL(setTextureMode(QString, QString, int )),
00861 this , SLOT(slotSetTextureMode(QString, QString, int )),Qt::DirectConnection );
00862
00863 if ( checkSlot( plugin , "slotSetTextureMode(QString,QString,int)" ) )
00864 connect(this , SIGNAL(setTextureMode(QString, QString, int )),
00865 plugin , SLOT(slotSetTextureMode(QString, QString, int )),Qt::DirectConnection );
00866
00867 if ( checkSignal(plugin,"setTextureMode(QString,QString)") )
00868 connect(plugin , SIGNAL(setTextureMode(QString ,QString )),
00869 this , SLOT(slotSetTextureMode(QString ,QString )),Qt::DirectConnection );
00870
00871 if ( checkSlot( plugin , "slotSetTextureMode(QString,QString)" ) )
00872 connect(this , SIGNAL(setTextureMode(QString ,QString )),
00873 plugin , SLOT(slotSetTextureMode(QString ,QString )),Qt::DirectConnection );
00874
00875 if ( checkSignal(plugin,"switchTexture(QString,int)") )
00876 connect(plugin , SIGNAL(switchTexture(QString, int )),
00877 this , SLOT(slotSwitchTexture(QString, int )),Qt::DirectConnection);
00878
00879 if ( checkSlot( plugin , "slotSwitchTexture(QString,int)" ) )
00880 connect(this , SIGNAL(switchTexture(QString, int )),
00881 plugin , SLOT(slotSwitchTexture(QString, int )),Qt::DirectConnection);
00882
00883 if ( checkSignal(plugin,"switchTexture(QString)") )
00884 connect(plugin , SIGNAL(switchTexture(QString )),
00885 this , SLOT(slotSwitchTexture(QString )),Qt::DirectConnection);
00886
00887 if ( checkSlot( plugin , "slotSwitchTexture(QString)" ) )
00888 connect(this , SIGNAL(switchTexture(QString )),
00889 plugin , SLOT(slotSwitchTexture(QString )),Qt::DirectConnection);
00890
00891
00892
00893 if ( checkSignal( plugin , "textureChangeImage(QString,QImage&,int)" ) )
00894 connect(plugin , SIGNAL(textureChangeImage(QString,QImage&,int)),
00895 this , SLOT(slotTextureChangeImage(QString,QImage&,int)),Qt::DirectConnection);
00896
00897 if ( checkSlot( plugin , "slotTextureChangeImage(QString,QImage&,int)" ) )
00898 connect(this , SIGNAL(textureChangeImage(QString,QImage&,int)),
00899 plugin , SLOT(slotTextureChangeImage(QString,QImage&,int)),Qt::DirectConnection);
00900
00901 if ( checkSignal( plugin , "textureChangeImage(QString,QImage&)" ) )
00902 connect(plugin , SIGNAL(textureChangeImage(QString,QImage&)),
00903 this , SLOT(slotTextureChangeImage(QString,QImage&)),Qt::DirectConnection);
00904
00905 if ( checkSlot( plugin , "slotTextureChangeImage(QString,QImage&)" ) )
00906 connect(this , SIGNAL(textureChangeImage(QString,QImage&)),
00907 plugin , SLOT(slotTextureChangeImage(QString,QImage&)),Qt::DirectConnection);
00908
00909 if ( checkSignal( plugin , "addMultiTexture(QString,QString,QString,int,int&)" ) )
00910 connect(plugin , SIGNAL(addMultiTexture(QString,QString,QString,int,int&) ),
00911 this , SLOT(slotMultiTextureAdded(QString,QString,QString,int,int&) ),Qt::DirectConnection);
00912
00913 if ( checkSlot( plugin , "slotMultiTextureAdded( QString,QString,QString,int,int&)" ) )
00914 connect(this , SIGNAL(addMultiTexture(QString,QString,QString,int,int&) ),
00915 plugin , SLOT(slotMultiTextureAdded( QString,QString,QString,int,int&) ),Qt::DirectConnection);
00916
00917 }
00918
00919
00920 BackupInterface* backupPlugin = qobject_cast< BackupInterface * >(plugin);
00921 if ( backupPlugin ) {
00922 supported = supported + "Backups ";
00923
00924 if ( checkSignal( plugin , "createBackup(int,QString)" ) )
00925 connect(plugin , SIGNAL(createBackup( int , QString )) ,
00926 this , SLOT(backupRequest( int , QString )),Qt::DirectConnection );
00927
00928 if ( checkSlot( plugin , "slotBackupRequested(int,QString,int)" ) )
00929 connect(this , SIGNAL(createBackup(int,QString,int)) ,
00930 plugin , SLOT( slotBackupRequested(int,QString,int) ),Qt::DirectConnection);
00931 }
00932
00933
00934 LoadSaveInterface* LoadSavePlugin = qobject_cast< LoadSaveInterface * >(plugin);
00935 if ( LoadSavePlugin ) {
00936 supported = supported + "Load/Save ";
00937 if ( checkSignal(plugin,"load( QString,DataType,int& )" ) )
00938 connect(plugin , SIGNAL(load( QString,DataType,int& )) ,
00939 this , SLOT(slotLoad( QString,DataType,int& )),Qt::DirectConnection );
00940 if ( checkSignal(plugin,"save(int,QString)" ) )
00941 connect(plugin , SIGNAL( save(int,QString) ) ,
00942 this , SLOT( saveObject(int,QString) ), Qt::DirectConnection);
00943
00944 if ( checkSlot( plugin , "fileOpened(int)" ) )
00945 connect(this , SIGNAL( openedFile( int) ) ,
00946 plugin , SLOT( fileOpened( int ) ),Qt::DirectConnection);
00947
00948 if ( checkSignal(plugin,"openedFile(int)" ) )
00949 connect(plugin , SIGNAL( openedFile( int ) ) ,
00950 this , SLOT( slotObjectOpened ( int ) ),Qt::DirectConnection);
00951
00952 if ( checkSignal(plugin,"addEmptyObject(DataType,int&)" ) )
00953 connect(plugin , SIGNAL( addEmptyObject( DataType, int& )) ,
00954 this , SLOT( slotAddEmptyObject( DataType, int&) ),Qt::DirectConnection);
00955
00956 if ( checkSignal(plugin,"copyObject(int,int&)" ) )
00957 connect(plugin , SIGNAL( copyObject( int, int& )) ,
00958 this , SLOT( slotCopyObject( int, int&) ),Qt::DirectConnection);
00959
00960
00961 if ( checkSignal(plugin,"emptyObjectAdded(int)" ) )
00962 connect(plugin , SIGNAL( emptyObjectAdded( int ) ) ,
00963 this , SLOT( slotEmptyObjectAdded ( int ) ),Qt::DirectConnection);
00964
00965
00966 if ( checkSlot(plugin,"addedEmptyObject(int)" ) )
00967 connect(this , SIGNAL( emptyObjectAdded( int ) ) ,
00968 plugin , SLOT( addedEmptyObject( int ) ),Qt::DirectConnection);
00969
00970 if ( checkSignal(plugin,"getAllFilters(QStringList&)" ) )
00971 connect(plugin , SIGNAL( getAllFilters( QStringList& ) ) ,
00972 this , SLOT( slotGetAllFilters ( QStringList& ) ),Qt::DirectConnection);
00973
00974 if ( checkSignal(plugin,"deleteObject(int)" ) )
00975 connect(plugin , SIGNAL( deleteObject( int ) ) ,
00976 this , SLOT( slotDeleteObject( int ) ),Qt::DirectConnection);
00977
00978 if ( checkSignal(plugin,"deleteAllObjects()" ) )
00979 connect(plugin , SIGNAL( deleteAllObjects() ) ,
00980 this , SLOT( slotDeleteAllObjects() ),Qt::DirectConnection);
00981
00982 if ( checkSlot(plugin,"objectDeleted(int)" ) )
00983 connect(this , SIGNAL( objectDeleted( int ) ) ,
00984 plugin , SLOT( objectDeleted( int ) ),Qt::DirectConnection);
00985
00986 }
00987
00988
00989 ViewInterface* viewPlugin = qobject_cast< ViewInterface * >(plugin);
00990 if ( viewPlugin && OpenFlipper::Options::gui() ) {
00991 supported = supported + "View ";
00992
00993 if ( checkSignal(plugin,"getStackWidget(QString,QWidget*&)" ) )
00994 connect(plugin , SIGNAL(getStackWidget( QString , QWidget*&)),
00995 coreWidget_ , SLOT( slotGetStackWidget( QString , QWidget*& ) ) ,Qt::DirectConnection );
00996 if ( checkSignal(plugin,"addStackWidget(QString,QWidget*)" ) )
00997 connect(plugin , SIGNAL(addStackWidget( QString , QWidget*)),
00998 coreWidget_ , SLOT( slotAddStackWidget( QString , QWidget* ) ) ,Qt::DirectConnection );
00999 if ( checkSignal(plugin,"updateStackWidget(QString,QWidget*)" ) )
01000 connect(plugin , SIGNAL(updateStackWidget( QString , QWidget*)),
01001 coreWidget_ , SLOT( slotUpdateStackWidget( QString , QWidget* ) ) ,Qt::DirectConnection );
01002 }
01003
01004
01005 ProcessInterface* processPlugin = qobject_cast< ProcessInterface * >(plugin);
01006 if ( processPlugin ) {
01007 supported = supported + "Process ";
01008
01009 if ( checkSignal(plugin,"startJob(QString,QString,int,int,bool)" ) )
01010 connect(plugin , SIGNAL(startJob(QString, QString,int,int,bool)),
01011 this , SLOT( slotStartJob(QString, QString,int,int,bool) ), Qt::DirectConnection );
01012 else
01013 emit log(LOGERR,"Process Interface defined but no startJob signal found!");
01014
01015 if ( checkSignal(plugin,"setJobState(QString,int)" ) )
01016 connect(plugin , SIGNAL(setJobState(QString,int)),
01017 this , SLOT( slotSetJobState(QString,int) ), Qt::QueuedConnection );
01018 else
01019 emit log(LOGERR,"Process Interface defined but no setJobState signal found!");
01020
01021 if ( checkSignal(plugin,"setJobName(QString,QString)" ) )
01022 connect(plugin , SIGNAL(setJobName(QString, QString)),
01023 this , SLOT( slotSetJobName(QString, QString) ), Qt::QueuedConnection );
01024 else
01025 emit log(LOGERR,"Process Interface defined but no setJobName signal found!");
01026
01027 if ( checkSignal(plugin,"setJobDescription(QString,QString)" ) )
01028 connect(plugin , SIGNAL(setJobDescription(QString, QString)),
01029 this , SLOT( slotSetJobDescription(QString, QString) ), Qt::QueuedConnection );
01030 else
01031 emit log(LOGERR,"Process Interface defined but no setJobDescription signal found!");
01032
01033 if ( checkSignal(plugin,"cancelJob(QString)" ) )
01034 connect(plugin , SIGNAL(cancelJob(QString)),
01035 this , SLOT( slotCancelJob(QString) ), Qt::QueuedConnection );
01036
01037 if ( checkSignal(plugin,"finishJob(QString)" ) )
01038 connect(plugin , SIGNAL(finishJob(QString)),
01039 this , SLOT( slotFinishJob(QString) ), Qt::DirectConnection );
01040 else
01041 emit log(LOGERR,"Process Interface defined but no finishJob signal found!");
01042
01043
01044 if ( checkSlot(plugin,"canceledJob(QString)" ) )
01045 connect(this , SIGNAL( jobCanceled( QString ) ) ,
01046 plugin , SLOT( canceledJob(QString) ),Qt::DirectConnection);
01047 else
01048 emit log(LOGERR,"Process Interface defined but no cancel canceledJob slot found!");
01049 }
01050
01051
01052 RPCInterface* rpcPlugin = qobject_cast< RPCInterface * >(plugin);
01053 if ( rpcPlugin ) {
01054 supported = supported + "RPC ";
01055
01056 if ( checkSignal(plugin,"pluginExists(QString,bool&)" ) )
01057 connect(plugin , SIGNAL( pluginExists(QString,bool&) ),
01058 this , SLOT( slotPluginExists(QString,bool&) ) ,Qt::DirectConnection );
01059 if ( checkSignal(plugin,"functionExists(QString,QString,bool&)" ) )
01060 connect(plugin , SIGNAL(functionExists(QString,QString,bool&)),
01061 this , SLOT( slotFunctionExists(QString,QString,bool&) ) ,Qt::DirectConnection );
01062 if ( checkSignal(plugin,"call(QString,QString,bool&)" ) )
01063 connect(plugin , SIGNAL(call(QString,QString,bool&)),
01064 this , SLOT(slotCall(QString,QString,bool&)) ,Qt::DirectConnection );
01065 if ( checkSignal(plugin,"call(QString,bool&)" ) )
01066 connect(plugin , SIGNAL(call(QString,bool&)),
01067 this , SLOT(slotCall(QString,bool&)) ,Qt::DirectConnection );
01068 if ( checkSignal(plugin,"getValue(QString,QVariant&)" ) )
01069 connect(plugin , SIGNAL(getValue(QString,QVariant&)),
01070 this , SLOT(slotGetValue(QString,QVariant&)) ,Qt::DirectConnection );
01071 }
01072
01073
01074
01075
01076 QScriptValue scriptInstance = scriptEngine_.newQObject(plugin,
01077 QScriptEngine::QtOwnership,
01078 QScriptEngine::ExcludeChildObjects |
01079 QScriptEngine::ExcludeSuperClassMethods |
01080 QScriptEngine::ExcludeSuperClassProperties
01081 );
01082
01083
01084 QString scriptingName = info.name.remove(" ").toLower();
01085
01086 scriptEngine_.globalObject().setProperty(scriptingName, scriptInstance);
01087
01088 info.rpcName = scriptingName;
01089
01090 QScriptValueIterator it(scriptInstance);
01091 while (it.hasNext()) {
01092 it.next();
01093
01095 if ( checkSignal( plugin, it.name().toAscii() ) )
01096 continue;
01097
01098 info.rpcFunctions.push_back( it.name() );
01099
01100 scriptingFunctions_.push_back( scriptingName + "." + it.name() );
01101
01102 }
01103
01104
01105 ScriptInterface* scriptPlugin = qobject_cast< ScriptInterface * >(plugin);
01106 if ( scriptPlugin ) {
01107 supported = supported + "Scripting ";
01108
01109
01110 ScriptingWrapper* newScript = new ScriptingWrapper(info.rpcName);
01111 scriptingWrappers_.push_back(newScript);
01112
01113
01114
01115 if ( checkSignal(plugin,"scriptInfo(QString)" ) ) {
01116
01117
01118 connect(plugin , SIGNAL( scriptInfo(QString) ),
01119 newScript , SLOT( slotScriptInfo(QString) ) ,Qt::DirectConnection );
01120
01121
01122 connect(newScript , SIGNAL( scriptInfo(QString,QString) ),
01123 this , SLOT( slotScriptInfo(QString,QString) ));
01124 }
01125
01126
01127 if ( checkSlot(plugin,"slotScriptInfo(QString,QString)") ) {
01128 connect(this , SIGNAL(scriptInfo(QString,QString)),
01129 plugin , SLOT(slotScriptInfo(QString,QString)));
01130 }
01131
01132
01133 if ( checkSignal(plugin,"getDescription(QString,QString&,QStringList&,QStringList&)") )
01134 connect(plugin , SIGNAL( getDescription(QString,QString&,QStringList&,QStringList&) ),
01135 this , SLOT( slotGetDescription(QString,QString&,QStringList&,QStringList&) ));
01136
01137
01138
01139
01140 if ( checkSignal(plugin,"executeScript(QString)") )
01141 connect(plugin , SIGNAL(executeScript(QString)),
01142 this , SLOT(slotExecuteScript(QString)));
01143
01144
01145 if ( checkSlot(plugin,"slotExecuteScript(QString)") )
01146 connect(this , SIGNAL(executeScript(QString)),
01147 plugin , SLOT(slotExecuteScript(QString)));
01148
01149
01150 if ( checkSlot(plugin,"slotExecuteFileScript(QString)") )
01151 connect(this , SIGNAL(executeFileScript(QString)),
01152 plugin , SLOT(slotExecuteFileScript(QString)));
01153
01154
01155
01156
01157 if ( checkSignal(plugin,"getScriptingEngine(QScriptEngine*&)") )
01158 connect(plugin , SIGNAL(getScriptingEngine(QScriptEngine*&)),
01159 this , SLOT(slotGetScriptingEngine(QScriptEngine*&)));
01160
01161
01162 if ( checkSignal(plugin,"getAvailableFunctions(QStringList&)") )
01163 connect(plugin , SIGNAL(getAvailableFunctions(QStringList&)),
01164 this , SLOT(slotGetAllAvailableFunctions(QStringList&)));
01165
01166 }
01167
01168
01169
01170
01171 plugins.push_back(info);
01172
01173
01174 if ( basePlugin ) {
01175 if ( checkSlot(plugin,"initializePlugin()") )
01176 QMetaObject::invokeMethod(plugin, "initializePlugin", Qt::DirectConnection);
01177 }
01178
01179
01180
01181 FileInterface* filePlugin = qobject_cast< FileInterface * >(plugin);
01182 if ( filePlugin ){
01183 supported = supported + "File ";
01184
01185
01186 fileTypes ft;
01187 ft.name = basePlugin->name();
01188 ft.type = filePlugin->supportedType();
01189 ft.loadFilters = filePlugin->getLoadFilters();
01190 ft.saveFilters = filePlugin->getSaveFilters();
01191 ft.plugin = filePlugin;
01192 ft.object = plugin;
01193
01194 supportedTypes_.push_back(ft);
01195 }
01196
01197
01198 TypeInterface* typePlugin = qobject_cast< TypeInterface * >(plugin);
01199 if ( typePlugin ){
01200 supported = supported + "Type ";
01201
01202
01203 typePlugin->registerType();
01204
01205
01206 dataTypes dt;
01207 dt.name = basePlugin->name();
01208 dt.type = typePlugin->supportedType();
01209 dt.plugin = typePlugin;
01210
01211
01212 supportedDataTypes_.push_back(dt);
01213
01214
01215 if ( !LoadSavePlugin && checkSignal(plugin,"emptyObjectAdded(int)" ) )
01216 connect(plugin , SIGNAL( emptyObjectAdded( int ) ) ,
01217 this , SLOT( slotEmptyObjectAdded ( int ) ),Qt::DirectConnection);
01218 }
01219
01220 emit log(LOGOUT,"================================================================================");
01221 } else {
01222 emit log(LOGERR,tr("Unable to load Plugin :\t %1").arg( filename ) );
01223 emit log(LOGERR,tr("Error was : ") + loader.errorString() );
01224 emit log(LOGOUT,"================================================================================");
01225 }
01226
01227
01228
01229 }