Developer Documentation
PluginLoader.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 
43 
44 //=============================================================================
45 //
46 // CLASS Core - IMPLEMENTATION of the Plugin Loading
47 //
48 //=============================================================================
49 
50 
51 //== INCLUDES =================================================================
52 
53 // -------------------- mview
54 #include "Core.hh"
55 
56 
65 #include "OpenFlipper/BasePlugin/TextureInterface.hh"
69 #include "OpenFlipper/BasePlugin/INIInterface.hh"
76 #include "OpenFlipper/BasePlugin/PluginFunctionsCore.hh"
77 
78 
79 #include <ACG/QtWidgets/QtFileDialog.hh>
80 #include "OpenFlipper/widgets/PluginDialog/PluginDialog.hh"
81 
84 
85 #include <OpenFlipper/BasePlugin/PythonFunctionsCore.hh>
86 
91 static const int PRELOAD_THREADS_COUNT = (QThread::idealThreadCount() != -1) ? QThread::idealThreadCount() : 8;
92 
93 namespace cmake { extern const char *static_plugins; };
94 
96  public:
97  PreloadAggregator() : expectedLoaders_(0) {}
98 
108  void expectLoaders(int count) {
109  QMutexLocker loadersLock(&loadersMutex_);
110  expectedLoaders_ += count;
111  }
112 
119  void loaderReady(QPluginLoader *loader) {
120  QMutexLocker loadersLock(&loadersMutex_);
121  loaders_.push_back(loader);
122  --expectedLoaders_;
123  pluginAvailable_.wakeOne();
124  }
125 
137  QPluginLoader *waitForNextLoader() {
138  QMutexLocker loadersLock(&loadersMutex_);
139  if (loaders_.empty()) {
140  if (expectedLoaders_ > 0) {
141  pluginAvailable_.wait(&loadersMutex_);
142  } else {
143  return 0;
144  }
145  }
146 
147  /*
148  * At this point, it is guaranteed that
149  * loaders_.size() > 0.
150  */
151  QPluginLoader *result = loaders_.front();
152  loaders_.pop_front();
153  return result;
154  }
155 
156  protected:
157  std::deque<QPluginLoader *> loaders_;
158  QWaitCondition pluginAvailable_;
159  QMutex loadersMutex_;
160 
161  int expectedLoaders_;
162 };
163 
164 class PreloadThread : public QThread
165 {
166  public:
167 
174  explicit PreloadThread(PreloadAggregator *aggregator) : aggregator_(aggregator) {
175  }
176 
177  public:
178 
179  void addFilename(const QString &filename) {
180  QMutexLocker filenamesLock(&filenamesMutex_);
181  filenames_.push_back(filename);
182  aggregator_->expectLoaders(1);
183  }
184 
189  void run() {
190  for (;;) {
191  QString fileName;
192  {
193  /*
194  * Just to be on the safe side, we protect
195  * filenames_. (addFilename() could be called from
196  * a different thread.)
197  */
198  QMutexLocker filenamesLock(&filenamesMutex_);
199  if (filenames_.empty()) break;
200  fileName = filenames_.front();
201  filenames_.pop_front();
202  }
203 
204  QPluginLoader *loader = new QPluginLoader;
205  loader->setFileName(fileName);
206  loader->load();
207  aggregator_->loaderReady(loader);
208  }
209  }
210 
211  private:
212  std::deque<QString> filenames_;
213  QMutex filenamesMutex_;
214  PreloadAggregator *aggregator_;
215 };
216 
226  public:
227  size_t getTypeOrdinal(const QString &name) const {
228  const QString basename = QFileInfo(name).baseName();
229  if (basename.contains("Plugin-Type"))
230  return 0;
231  else if (basename.contains("Plugin-File"))
232  return 1;
233  else if (basename.contains("TextureControl"))
234  return 2;
235  else
236  return 3;
237 
238  }
239  bool operator() (const QString &a, const QString &b) const {
240  const size_t typeA = getTypeOrdinal(a);
241  const size_t typeB = getTypeOrdinal(b);
242  if (typeA != typeB) { return typeA < typeB; }
243  return a < b;
244  }
245 
246  bool operator() (const QPluginLoader *a, const QPluginLoader *b) const {
247  return operator() (a->fileName(), b->fileName());
248  }
249 };
250 
251 //== IMPLEMENTATION ==========================================================
252 
253 
254 bool Core::checkSlot(QObject* _plugin , const char* _slotSignature) {
255  const QMetaObject* meta = _plugin->metaObject();
256  int id = meta->indexOfSlot( QMetaObject::normalizedSignature( _slotSignature ) );
257  return ( id != -1 );
258 }
259 
260 bool Core::checkSignal(QObject* _plugin , const char* _signalSignature) {
261  const QMetaObject* meta = _plugin->metaObject();
262  int id = meta->indexOfSignal( QMetaObject::normalizedSignature( _signalSignature ) );
263  return ( id != -1 );
264 }
265 
269 {
270 
271  //regsiter custom datatypes for signal/slots
272  registerTypes();
273 
274  QString licenseTexts = "";
275 
276  //try to load plugins from new location
277  QDir tempDir = QDir(OpenFlipper::Options::pluginDir());
278 
279  // Possible Plugin extensions
280  // Windows gets DLLs
281  // Mac and Linux use so
282  // We don't use the dylib extension on Mac at the moment.
283  QStringList filter;
284  if ( OpenFlipper::Options::isWindows() )
285  filter << "*.dll";
286  else
287  filter << "*.so";
288 
289  // Get all files in the Plugin dir
290  QStringList pluginlist = tempDir.entryList(filter,QDir::Files);
291 
292  // Convert local file path to absolute path
293  for (int i=0; i < pluginlist.size(); i++) {
294  pluginlist[i] = tempDir.absoluteFilePath(pluginlist[i]);
295  }
296 
297  // get all Plugin Names which will not be loaded
298  QStringList dontLoadPlugins = OpenFlipperSettings().value("PluginControl/DontLoadNames", QStringList()).toStringList();
299 
300  // Output info about additional plugins
301  for ( int i = 0 ; i < dontLoadPlugins.size(); ++i)
302  emit log(LOGOUT,tr("dontLoadPlugins Plugin from ini file: %1").arg( dontLoadPlugins[i] ) );
303 
304  // get all Plugins which should be loaded in addition to the standard plugins
305  QStringList additionalPlugins = OpenFlipperSettings().value("PluginControl/AdditionalPlugins", QStringList()).toStringList();
306 
307  // Output info about additional plugins
308  for ( int i = 0 ; i < additionalPlugins.size(); ++i) {
309  emit log(LOGOUT,tr("Additional Plugin from file: %1").arg( additionalPlugins[i] ) );
310  }
311 
312  // Prepend the additional Plugins to the plugin list
313  pluginlist = additionalPlugins << pluginlist;
314 
315  /*
316  * Remove static plugins from dynamically loaded list.
317  */
318  {
319  QSet<QString> staticPlugins = QSet<QString>::fromList(
320  QString::fromUtf8(cmake::static_plugins).split("\n"));
321  for (int i = 0; i < pluginlist.size(); ) {
322  const QString bn = QFileInfo(pluginlist[i]).fileName();
323  if (staticPlugins.contains(bn)) {
324  emit log(LOGOUT, trUtf8("Not loading dynamic %1 as it is statically "
325  "linked against OpenFlipper.").arg(bn));
326  pluginlist.removeAt(i);
327  } else {
328  ++i;
329  }
330  }
331  }
332 
333  /*
334  * Note: This call is not necessary, anymore. Initialization order
335  * is determined later.
336  */
337  //std::sort(pluginlist.begin(), pluginlist.end(), PluginInitializationOrder());
338 
339  for ( int i = 0 ; i < dontLoadPlugins.size(); ++i )
340  emit log(LOGWARN,tr("Skipping Plugins :\t %1").arg( dontLoadPlugins[i] ) );
341 
342  emit log(LOGOUT,"================================================================================");
343 
344  QTime time;
345 
346  time.start();
347 
348  PreloadAggregator preloadAggregator;
349  std::vector< PreloadThread* > loaderThreads(PRELOAD_THREADS_COUNT);
350 
351  /*
352  * Initialize loaderThreads.
353  */
354  for (std::vector< PreloadThread* >::iterator it = loaderThreads.begin();
355  it != loaderThreads.end(); ++it) {
356  *it = new PreloadThread(&preloadAggregator);
357  }
358 
359  /*
360  * Distribute plugins onto loader threads in a round robin fashion.
361  * (only load them in seperate thread. Instance will be created in main thread)
362  */
363  for ( int i = 0 ; i < pluginlist.size() ; ++i) {
364  loaderThreads[i % loaderThreads.size()]->addFilename(pluginlist[i]);
365  }
366 
367  /*
368  * Start plugin preloading.
369  */
370  for (std::vector< PreloadThread* >::iterator it = loaderThreads.begin();
371  it != loaderThreads.end(); ++it) {
372  (*it)->start();
373  }
374 
375  /*
376  * Wait for the plugins to get preloaded
377  */
378  std::vector<QPluginLoader*> loadedPlugins;
379  loadedPlugins.reserve(pluginlist.size());
380 
381  for (QPluginLoader *loader = preloadAggregator.waitForNextLoader(); loader != 0;
382  loader = preloadAggregator.waitForNextLoader()) {
383 
384  loadedPlugins.push_back(loader);
385 
386  if (splash_) {
387  splashMessage_ = tr("Loading Plugin %1/%2").arg(loadedPlugins.size()).arg(pluginlist.size()) ;
388  splash_->showMessage( splashMessage_ , Qt::AlignBottom | Qt::AlignLeft , Qt::white);
389  }
390  }
391 
392  /*
393  * Finalize PreloadThreads.
394  */
395  for (std::vector< PreloadThread* >::iterator it = loaderThreads.begin();
396  it != loaderThreads.end(); ++it) {
397  (*it)->wait();
398  delete *it;
399  }
400 
401  /*
402  * Initialize preloaded plugins in the correct order.
403  */
404  std::sort(loadedPlugins.begin(), loadedPlugins.end(), PluginInitializationOrder());
405  for (std::vector<QPluginLoader*>::iterator it = loadedPlugins.begin();
406  it != loadedPlugins.end(); ++it) {
407 
408  if (splash_) {
409  splashMessage_ = tr("Initializing Plugin %1/%2")
410  .arg(std::distance(loadedPlugins.begin(), it) + 1)
411  .arg(loadedPlugins.size());
412  splash_->showMessage( splashMessage_ , Qt::AlignBottom | Qt::AlignLeft , Qt::white);
413  }
414 
415  if ((*it)->instance() != 0 ) {
416  QString pluginLicenseText = "";
417  loadPlugin((*it)->fileName(),true,pluginLicenseText, (*it)->instance());
418  licenseTexts += pluginLicenseText;
419  } else {
420  emit log(LOGERR,tr("Unable to load Plugin :\t %1").arg( (*it)->fileName() ) );
421  emit log(LOGERR,tr("Error was : ") + (*it)->errorString() );
422  emit log(LOGOUT,"================================================================================");
423  }
424  delete *it;
425  }
426 
427  /*
428  * Initialize static plugins.
429  */
430  QVector<QStaticPlugin> staticPlugins = QPluginLoader::staticPlugins();
431  for (QVector<QStaticPlugin>::iterator it = staticPlugins.begin();
432  it != staticPlugins.end(); ++it) {
433  QObject *instance = it->instance();
434  BaseInterface* basePlugin = qobject_cast< BaseInterface * >(instance);
435  if (basePlugin) {
436  QString fakeName = QString::fromUtf8("<Statically Linked>::/%1.%2")
437  .arg(basePlugin->name())
438  .arg(OpenFlipper::Options::isWindows() ? "dll" : "so");
439  QString pluginLicenseText = "";
440  loadPlugin(fakeName, true, pluginLicenseText, instance);
441  licenseTexts += pluginLicenseText;
442  }
443  }
444 
445  emit log(LOGINFO, tr("Total time needed to load plugins was %1 ms.").arg(time.elapsed()));
446 
447  splashMessage_ = "";
448 
449  if ( licenseTexts != "" ) {
450  if ( OpenFlipper::Options::gui() ) {
451 
452  // split for each license block
453  QStringList licenseBlocks = licenseTexts.split("==");
454 
455  // Cleanup lists to get only the ones containing valid plugins.
456  for ( QStringList::iterator it = licenseBlocks.begin(); it != licenseBlocks.end() ; ++it )
457  if ( ! it->contains("PluginName") ) {
458  licenseBlocks.erase(it);
459  it = licenseBlocks.begin();
460  }
461 
462  // sort by the contact mails
463  QMap< QString , QString > contacts;
464 
465  for ( QStringList::iterator it = licenseBlocks.begin(); it != licenseBlocks.end() ; ++it ) {
466  QStringList lines = it->split("\n");
467 
468  lines = lines.filter ( "Contact mail", Qt::CaseInsensitive );
469 
470  // Corect one found:
471  if (lines.size() == 1) {
472  QString mail = lines[0].section(":",-1).simplified();
473  QString list = contacts.take(mail);
474  list.append(*it);
475  contacts.insert(mail,list);
476  } else {
477  emit log(LOGWARN,tr("Can't extract mail contact from license request"));
478  }
479 
480  }
481 
482  for ( QMap<QString , QString>::iterator it = contacts.begin() ; it != contacts.end() ; ++it ) {
483 
484  QStringList request = it.value().split("\n");
485 
486  // Cleanup lists to get only the relevant part
487  for ( QStringList::iterator lit = request.begin(); lit != request.end() ; ++lit ) {
488 
489  if ( lit->contains("Message:") ) {
490  *lit = lit->section(":",-1).simplified();
491  }
492 
493  if ( lit->contains("Contact mail:") ) {
494  *lit = lit->section(":",-1).simplified();
495  }
496 
497  }
498 
499  QDialog licenseBox;
500 
501  QTextEdit *edit = new QTextEdit(&licenseBox);
502  edit->setText(request.join("\n"));
503 
504  QLabel* mailLabel = new QLabel(&licenseBox);
505  mailLabel->setText(tr("The text has been copied to your clipboard. Open in Mail program?"));
506 
507  QPushButton* noButton = new QPushButton(&licenseBox);
508  noButton->setText(tr("No"));
509  connect( noButton, SIGNAL(clicked ()), &licenseBox, SLOT(reject()) );
510 
511  QPushButton* yesButton = new QPushButton(&licenseBox);
512  yesButton->setText(tr("Yes"));
513  connect( yesButton, SIGNAL(clicked ()), &licenseBox, SLOT(accept()) );
514 
515  QGridLayout *layout = new QGridLayout;
516  layout->addWidget(edit,0,0,1,2);
517  layout->addWidget(mailLabel,1,0,1,2);
518  layout->addWidget(noButton,2,0);
519  layout->addWidget(yesButton,2,1);
520  licenseBox.setLayout(layout);
521 
522  licenseBox.resize(500,500);
523  licenseBox.setModal(true);
524  licenseBox.setWindowTitle(tr("Plugin License check failed, issuer is: %1").arg( it.key() ));
525  int userAnswer =licenseBox.exec();
526 
527  // set a text to the Clipboard
528  QClipboard *cb = QApplication::clipboard();
529  cb->setText(request.join("\n"));
530 
531  if ( userAnswer == 1 ) {
532  QString url = "mailto:" + it.key();
533  url += "?subject=License Request&body=";
534 #ifdef WIN32
535  url += request.join(";;");
536 #else
537  url += request.join("\n");
538 #endif
539 
540  QUrl encodedURL(url, QUrl::TolerantMode);
541  QDesktopServices::openUrl(encodedURL);
542  }
543 
544  }
545 
546 
547  } else {
548 
549  emit log(LOGWARN,tr("Plugin License check failed: "));
550  std::cerr << licenseTexts.toStdString() << std::endl;
551  }
552  }
553 
554  emit pluginsInitialized();
555 
556  emit pluginsInitialized(PluginFunctions::pluginCommandLineOptions());
557 
558  emit log(LOGOUT,tr("Loaded %n Plugin(s)","",int(plugins().size())) );
559 }
560 
564 
565  if ( OpenFlipper::Options::nogui() )
566  return;
567 
568  // Setup filters for possible plugin extensions
569  // Windows gets DLLs
570  // Mac and Linux use so
571  // We don't use the dylib extension on Mac at the moment.
572  QString filter;
573  if ( OpenFlipper::Options::isWindows() )
574  filter = "Plugins (*.dll)";
575  else
576  filter = "Plugins (*.so)";
577 
578  // Ask the user to select the file to load
579  QString filename = ACG::getOpenFileName(coreWidget_,tr("Load Plugin"),filter, OpenFlipperSettings().value("Core/CurrentDir").toString() );
580 
581  if (filename.isEmpty())
582  return;
583 
584  // get the plugin name
585  // and check if Plugin is in the dontLoad List
586  QPluginLoader loader( filename );
587  QObject *plugin = loader.instance();
588  QString name;
589 
590  // Check if a plugin has been loaded
591  if (plugin) {
592  // Check if it is a BasePlugin
593  BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugin);
594  if ( basePlugin ) {
595  name = basePlugin->name();
596  }else
597  return;
598  }else
599  return;
600 
601  // Ask if the plugin is on the block list
602  QStringList dontLoadPlugins = OpenFlipperSettings().value("PluginControl/DontLoadNames", QStringList()).toStringList();
603  if (dontLoadPlugins.contains(name)){
604  int ret = QMessageBox::question(0, tr("Plugin Loading Prevention"),
605  tr("OpenFlipper is currently configured to prevent loading this plugin.\n"
606  "Do you want to enable this plugin permanently?"),
607  QMessageBox::Yes | QMessageBox::No,
608  QMessageBox::Yes);
609  if (ret == QMessageBox::Yes) {
610  dontLoadPlugins.removeAll(name);
611  OpenFlipperSettings().setValue("PluginControl/DontLoadNames",dontLoadPlugins);
612  } else
613  return;
614  }
615 
616  // check if the plugin is not on the additional plugin list
617  QStringList additionalPlugins = OpenFlipperSettings().value("PluginControl/AdditionalPlugins", QStringList()).toStringList();
618  if (!additionalPlugins.contains(name)){
619  int ret = QMessageBox::question(0, tr("Plugin Loading ..."),
620  tr("Should OpenFlipper load this plugin on next startup?"),
621  QMessageBox::Yes | QMessageBox::No,
622  QMessageBox::Yes);
623  if (ret == QMessageBox::Yes) {
624  additionalPlugins << filename;
625  std::cerr << "Added: " << filename.toStdString() << std::endl;
626  OpenFlipperSettings().setValue("PluginControl/AdditionalPlugins",additionalPlugins);
627  }
628  }
629 
630  QString licenseText = "";
631  loadPlugin(filename,false,licenseText);
632 
633  if ( licenseText != "" ) {
634  if ( OpenFlipper::Options::gui() ) {
635  QMessageBox::warning ( 0, tr("Plugin License check failed"), licenseText );
636 
637  std::cerr << "OpenURL: " << std::endl;
638  QDesktopServices::openUrl(QUrl(tr("mailto:contact@openflipper.com?subject=License Request&body=%1").arg(licenseText), QUrl::TolerantMode));
639  } else {
640  std::cerr << "Plugin License check failed" << std::endl;
641  std::cerr << licenseText.toStdString() << std::endl;
642  }
643  }
644 }
645 
649 
650  if ( OpenFlipper::Options::gui() ){
651 
652  int ret = 0;
653 
654  while (ret == 0){
655 
656  PluginDialog* dialog = new PluginDialog(plugins(), coreWidget_);
657 
658  //connect signals
659  connect(dialog, SIGNAL( loadPlugin() ), this, SLOT( slotLoadPlugin() ));
660  connect(dialog, SIGNAL(blockPlugin(const QString&)), this, SLOT(slotBlockPlugin(const QString&)));
661  connect(dialog, SIGNAL(unBlockPlugin(const QString&)), this, SLOT(slotUnBlockPlugin(const QString&)));
662  connect(dialog, SIGNAL(loadPlugin(const QString& ,const bool , QString& , QObject* )),
663  this,SLOT(loadPlugin(const QString& ,const bool , QString& , QObject* )));
664 
665  //if a plugin was deleted/loaded the dialog returns 0 and it needs to be loaded again
666  ret = dialog->exec();
667 
668  delete dialog;
669  }
670  }
671 }
672 
673 void Core::slotBlockPlugin(const QString &_name)
674 {
675  QStringList dontLoadPlugins = OpenFlipperSettings().value("PluginControl/DontLoadNames",QStringList()).toStringList();
676  if ( !dontLoadPlugins.contains(_name) ){
677  dontLoadPlugins << _name;
678  OpenFlipperSettings().setValue("PluginControl/DontLoadNames",dontLoadPlugins);
679  }
680 
681  for (size_t i = 0; i < plugins().size();++i)
682  if (plugins()[i].name == _name)
683  plugins()[i].status = PluginInfo::BLOCKED;
684 }
685 
686 void Core::slotUnBlockPlugin(const QString &_name)
687 {
688  QStringList dontLoadPlugins = OpenFlipperSettings().value("PluginControl/DontLoadNames",QStringList()).toStringList();
689  dontLoadPlugins.removeAll(_name);
690  OpenFlipperSettings().setValue("PluginControl/DontLoadNames",dontLoadPlugins);
691 
692  for (size_t i = 0; i < plugins().size();++i)
693  if (plugins()[i].name == _name)
694  plugins()[i].status = PluginInfo::UNLOADED;
695 }
696 
697 
698 void Core::printPluginLoadLog(const QString& errors,const QString& warnings ) {
699  emit log(LOGERR ,errors );
700  emit log(LOGWARN,warnings );
701  emit log(LOGOUT,"================================================================================");
702 }
703 
710 void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _licenseErrors, QObject* _plugin){
711 
712  _licenseErrors = "";
713 
714  // Only load .dll under windows
715  if ( OpenFlipper::Options::isWindows() ) {
716  QString dllname = _filename;
717  if ( ! dllname.endsWith( ".dll" ) )
718  return;
719  }
720  // Only load .so under linux
721  if ( OpenFlipper::Options::isLinux() ) {
722  QString soname = _filename;
723  if ( ! soname.endsWith( ".so" ) )
724  return;
725  }
726 
727  // This will be the reference to our plugin
728  QObject *plugin = 0;
729 
730  // Collect error and warning info
731  QString errors, warnings;
732 
733 
734  // Try to open the file if we did not get a plugin,
735  // Otherwise use the supplied plugin pointer
736  if ( _plugin == 0 ) {
737  QPluginLoader loader( _filename );
738  plugin = loader.instance();
739 
740  if ( !plugin) {
741 
742  errors += tr("Error: Unable to load Plugin :\t %1").arg( _filename ) + "\n";
743  errors += tr("Error: Error was : ") + loader.errorString() + "\n";
744 
745  emit log(LOGERR,errors );
746 
747  emit log(LOGOUT,"================================================================================");
748  } else {
749  emit log (LOGOUT,tr("Plugin loaded: \t %1").arg(_filename));
750  }
751 
752  } else {
753  plugin = _plugin;
754  }
755 
756  // Check if a plugin has been loaded
757  PluginInfo info;
758  int alreadyLoadedAt = -1;
759  for (unsigned int k=0; k < plugins().size(); k++)
760  {
761  if (plugins()[k].path == _filename)
762  alreadyLoadedAt = static_cast<int>(k);
763  }
764  info.status = PluginInfo::FAILED;
765  info.path = _filename;
766  QString supported;
767 
768  emit log(LOGOUT,tr("Location : \t %1").arg( _filename) );
769 
770  // Check if it is a BasePlugin
771  BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugin);
772  if ( basePlugin ) {
773 
774  //set basic information about plugin
775  info.name = basePlugin->name();
776  info.rpcName = info.name.remove(" ").toLower();
777  info.description = basePlugin->description();
778  info.warnings = "BLA";
779 
780  QStringList additionalPlugins = OpenFlipperSettings().value("PluginControl/AdditionalPlugins", QStringList()).toStringList();
781  info.buildIn = !additionalPlugins.contains(info.path);
782 
783  emit log(LOGOUT,tr("Found Plugin : \t %1").arg(basePlugin->name()) );
784 
785  if (splash_) {
786  splashMessage_ = splashMessage_ + " " + basePlugin->name() ;
787  splash_->showMessage( splashMessage_ , Qt::AlignBottom | Qt::AlignLeft , Qt::white);
788  }
789 
790  //Check if plugin is already loaded
791  for (unsigned int k=0; k < plugins().size(); k++){
792 
793  QString name_nospace = basePlugin->name();
794  name_nospace.remove(" ");
795 
796  if (plugins()[k].name == name_nospace && plugins()[k].path != _filename && plugins()[k].status == PluginInfo::LOADED){
797  if (_silent || OpenFlipper::Options::nogui() ){ //dont load the plugin
798 
799  warnings += tr("Warning: Already loaded from %1").arg( plugins()[k].path) + "\n";
800 
801  printPluginLoadLog(errors, warnings);
802 
803  info.description = basePlugin->description() + tr(" *Already loaded.*");
804 
805  info.errors = errors;
806  info.warnings = warnings;
807 
808  PluginStorage::pluginsFailed().push_back(info);
809 
810  return;
811  }else{ //ask the user
812  int ret = QMessageBox::question(coreWidget_,
813  tr("Plugin already loaded"),
814  tr("A Plugin with the same name was already loaded from %1.\n"
815  "You can only load the new plugin if you unload the existing one first.\n\n"
816  "Do you want to unload the existing plugin first?").arg( plugins()[k].path),
817  QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
818  if (ret == QMessageBox::No)
819  {
820  warnings += tr("Warning: Already loaded from %1.").arg( plugins()[k].path) + "\n";
821 
822  printPluginLoadLog(errors, warnings);
823 
824  info.description = basePlugin->description() + tr(" *Already loaded.*");
825 
826  info.errors = errors;
827  info.warnings = warnings;
828 
829  PluginStorage::pluginsFailed().push_back(info);
830  return;
831  }
832  }
833  }
834  }
835 
836  QStringList dontLoadPlugins = OpenFlipperSettings().value("PluginControl/DontLoadNames",QStringList()).toStringList();
837 
838  if ( dontLoadPlugins.contains(basePlugin->name(), Qt::CaseInsensitive) ) {
839 
840  warnings += tr("Warning: OpenFlipper.ini prevented Plugin %1 from being loaded! ").arg( basePlugin->name() ) + "\n";
841 
842  printPluginLoadLog(errors, warnings);
843 
844  info.status = PluginInfo::BLOCKED;
845 
846  info.errors = errors;
847  info.warnings = warnings;
848 
849  PluginStorage::pluginsFailed().push_back(info);
850 
851  return;
852  }
853 
854  //Check if it is a BasePlugin
855  SecurityInterface * securePlugin = qobject_cast< SecurityInterface * >(plugin);
856  if ( securePlugin ) {
857  emit log(LOGINFO,tr("Plugin uses security interface. Trying to authenticate against plugin ..."));
858 
859  bool success = false;
860  QMetaObject::invokeMethod(plugin,"authenticate", Q_RETURN_ARG( bool , success ) ) ;
861 
862  QString message = "";
863  QMetaObject::invokeMethod(plugin,"licenseError", Q_RETURN_ARG( QString , message ) ) ;
864  _licenseErrors = message;
865 
866  if ( success )
867  emit log(LOGINFO,tr("... ok. Loading plugin "));
868  else {
869 
870  errors += tr("Error: Failed to load plugin. Plugin access denied by license management.");
871 
872  printPluginLoadLog(errors, warnings);
873 
874  info.description = basePlugin->description() + tr(" *Plugin access denied.*");
875  // Abort here, as the plugin will not do anything else until correct authentication.
876 
877  info.errors = errors;
878  info.warnings = warnings;
879 
880  PluginStorage::pluginsFailed().push_back(info);
881  return;
882  }
883  }
884 
885 
886  emit log(LOGOUT,tr("Plugin Description :\t %1 ").arg( basePlugin->description()) );
887 
888  supported = "BaseInterface ";
889 
890  info.plugin = plugin;
891  if ( checkSlot(plugin,"version()") )
892  info.version = basePlugin->version();
893  else
894  info.version = QString::number(-1);
895 
896  if ( OpenFlipper::Options::nogui() ) {
897 
898  if ( ! checkSlot( plugin , "noguiSupported()" ) ) {
899  warnings += tr("Warning: Running in nogui mode which is unsupported by this plugin, skipping");
900 
901  printPluginLoadLog(errors, warnings);
902 
903  info.errors = errors;
904  info.warnings = warnings;
905 
906  PluginStorage::pluginsFailed().push_back(info);
907 
908  return;
909  }
910 
911  }
912 
913 
914  // Check for baseInterface of old style!
915  if ( checkSignal(plugin,"updated_objects(int)") ) {
916 
917  errors += tr("Error: Plugin Uses old style updated_objects! Convert to updatedObject!") + "\n";
918 
919  printPluginLoadLog(errors, warnings);
920 
921  info.errors = errors;
922  info.warnings = warnings;
923 
924  PluginStorage::pluginsFailed().push_back(info);
925 
926  return;
927  }
928 
929  if ( checkSignal(plugin,"update_view()") ) {
930  errors += tr("Error: Plugin Uses old style update_view! Convert to updateView!") + "\n";
931 
932  printPluginLoadLog(errors, warnings);
933 
934  info.errors = errors;
935  info.warnings = warnings;
936 
937  PluginStorage::pluginsFailed().push_back(info);
938 
939  return;
940  }
941 
942  if ( checkSignal(plugin,"updateView()") )
943  connect(plugin,SIGNAL(updateView()),this,SLOT(updateView()), Qt::AutoConnection);
944 
945  if ( checkSignal(plugin,"blockScenegraphUpdates(bool)") )
946  connect(plugin,SIGNAL(blockScenegraphUpdates(bool)),this,SLOT(blockScenegraphUpdates(bool)), Qt::QueuedConnection);
947 
948  if ( checkSignal(plugin,"updatedObject(int)") && checkSignal(plugin,"updatedObject(int,const UpdateType&)") ){
949 
950  errors += tr("Error: Plugin uses deprecated and(!) new updatedObject. Only new updatedObject will be active.") + "\n";
951 
952  log(LOGERR,tr("Plugin uses deprecated and(!) new updatedObject. Only new updatedObject will be active."));
953  connect(plugin,SIGNAL(updatedObject(int,const UpdateType&)),this,SLOT(slotObjectUpdated(int,const UpdateType&)), Qt::AutoConnection);
954 
955  } else {
956 
957  if ( checkSignal(plugin,"updatedObject(int)") ){
958  warnings += tr("Warning: Plugin uses deprecated updatedObject.") + "\n";
959 
960  log(LOGWARN,tr("Plugin uses deprecated updatedObject."));
961  connect(plugin,SIGNAL(updatedObject(int)),this,SLOT(slotObjectUpdated(int)), Qt::AutoConnection);
962  }
963 
964  if ( checkSignal(plugin,"updatedObject(int,const UpdateType&)") )
965  connect(plugin,SIGNAL(updatedObject(int,const UpdateType&)),this,SLOT(slotObjectUpdated(int,const UpdateType&)), Qt::AutoConnection);
966  }
967 
968  if ( checkSlot( plugin , "slotObjectUpdated(int)" ) && checkSlot( plugin , "slotObjectUpdated(int,const UpdateType&)" ) ){
969  errors += tr("Error: Plugin uses deprecated and(!) new slotObjectUpdated. Only new slotObjectUpdated will be active.") + "\n";
970 
971  log(LOGERR,tr("Plugin uses deprecated and(!) new slotObjectUpdated. Only new slotObjectUpdated will be active."));
972  connect(this,SIGNAL(signalObjectUpdated(int,const UpdateType&)),plugin,SLOT(slotObjectUpdated(int,const UpdateType&)), Qt::DirectConnection);
973 
974  } else {
975 
976  if ( checkSlot( plugin , "slotObjectUpdated(int)" ) ){
977  warnings += tr("Warning: Plugin uses deprecated slotObjectUpdated.") + "\n";
978  log(LOGWARN,tr("Plugin uses deprecated slotObjectUpdated."));
979  connect(this,SIGNAL(signalObjectUpdated(int)),plugin,SLOT(slotObjectUpdated(int)), Qt::DirectConnection);
980  }
981 
982  if ( checkSlot( plugin , "slotObjectUpdated(int,const UpdateType&)" ) )
983  connect(this,SIGNAL(signalObjectUpdated(int,const UpdateType&)),plugin,SLOT(slotObjectUpdated(int,const UpdateType&)), Qt::DirectConnection);
984  }
985 
986  if ( checkSignal(plugin,"objectPropertiesChanged(int)")) {
987  errors += tr("Error: Signal objectPropertiesChanged(int) is deprecated.") + "\n";
988  errors += tr("Error: The signal will be automatically emitted by the object that has been changed and the core will deliver it to the plugins!.") + "\n";
989  errors += tr("Error: Please remove this signal from your plugins!.") + "\n";
990  }
991 
992  if ( checkSlot( plugin , "slotViewChanged()" ) )
993  connect(this,SIGNAL(pluginViewChanged()),plugin,SLOT(slotViewChanged()), Qt::DirectConnection);
994 
995  if ( checkSlot( plugin , "slotSceneDrawn()" ) )
996  connect(this,SIGNAL(pluginSceneDrawn()),plugin,SLOT(slotSceneDrawn()), Qt::DirectConnection);
997 
998  if ( checkSlot( plugin , "slotDrawModeChanged(int)" ) )
999  connect(coreWidget_,SIGNAL(drawModeChanged(int)),plugin,SLOT(slotDrawModeChanged(int)), Qt::DirectConnection);
1000 
1001  if ( checkSlot(plugin,"slotObjectPropertiesChanged(int)"))
1002  connect(this,SIGNAL(objectPropertiesChanged(int)),plugin,SLOT(slotObjectPropertiesChanged(int)), Qt::DirectConnection);
1003 
1004  if ( checkSignal(plugin,"visibilityChanged()" ) ) {
1005  errors += tr("Error: Signal visibilityChanged() now requires objectid or -1 as argument.") + "\n";
1006  }
1007 
1008  if ( checkSignal(plugin,"visibilityChanged(int)") ) {
1009  errors += tr("Error: Signal visibilityChanged(int) is deprecated!") + "\n";
1010  errors += tr("Error: If an object changes its visibility, it will call the required functions automatically.") + "\n";
1011  errors += tr("Error: If you change a scenegraph node, call nodeVisibilityChanged(int). See docu of this function for details.") + "\n";
1012  }
1013 
1014  if ( checkSignal(plugin,"nodeVisibilityChanged(int)") )
1015  connect(plugin,SIGNAL(nodeVisibilityChanged(int)),this,SLOT(slotVisibilityChanged(int)), Qt::DirectConnection);
1016 
1017 
1018  if ( checkSlot(plugin,"slotVisibilityChanged(int)") )
1019  connect(this,SIGNAL(visibilityChanged(int)),plugin,SLOT(slotVisibilityChanged(int)), Qt::DirectConnection);
1020 
1021  if ( checkSignal(plugin,"activeObjectChanged()" ) ) {
1022  errors += tr("Error: Signal activeObjectChanged() is now objectSelectionChanged( int _objectId )") + "\n";
1023  }
1024 
1025  if ( checkSlot(plugin,"slotActiveObjectChanged()" ) ) {
1026  errors += tr("Error: Slot slotActiveObjectChanged() is now slotObjectSelectionChanged( int _objectId ) ") + "\n";
1027  }
1028 
1029  if ( checkSlot(plugin,"slotAllCleared()") )
1030  connect(this,SIGNAL(allCleared()),plugin,SLOT(slotAllCleared()));
1031 
1032 
1033  if ( checkSignal(plugin,"objectSelectionChanged(int)") ) {
1034  errors += tr("Error: Signal objectSelectionChanged(in) is deprecated!") + "\n";
1035  errors += tr("Error: If the selection for an object is changed, the core will emit the required signals itself!") + "\n";
1036  }
1037 
1038  if ( checkSlot( plugin , "slotObjectSelectionChanged(int)" ) )
1039  connect(this,SIGNAL(objectSelectionChanged(int)),plugin,SLOT(slotObjectSelectionChanged(int) ), Qt::DirectConnection);
1040 
1041 
1042  if ( checkSlot( plugin , "pluginsInitialized()" ) )
1043  connect(this,SIGNAL(pluginsInitialized()),plugin,SLOT(pluginsInitialized()), Qt::DirectConnection);
1044 
1045  if ( checkSlot( plugin , "pluginsInitialized(QVector<QPair<QString,QString>>const&)" ) )
1046  connect(this,SIGNAL(pluginsInitialized(QVector<QPair<QString,QString>>const&)),plugin,SLOT(pluginsInitialized(QVector<QPair<QString,QString>>const&)), Qt::DirectConnection);
1047 
1048  if ( checkSignal(plugin,"setSlotDescription(QString,QString,QStringList,QStringList)") )
1049  connect(plugin, SIGNAL(setSlotDescription(QString,QString,QStringList,QStringList)),
1050  this, SLOT(slotSetSlotDescription(QString,QString,QStringList,QStringList)) );
1051 
1052  // =============================================
1053  // Function allowing switching of renderers from other plugins
1054  // =============================================
1055  if ( checkSignal(plugin,"setRenderer(unsigned int,QString)" ) ) {
1056  connect(plugin,SIGNAL(setRenderer(unsigned int,QString)),this,SLOT(slotSetRenderer(unsigned int,QString)));
1057  }
1058 
1059  if ( checkSignal(plugin,"getCurrentRenderer(unsigned int,QString&)" ) ) {
1060  connect(plugin,SIGNAL(getCurrentRenderer(unsigned int,QString&)),this,SLOT(slotGetCurrentRenderer(unsigned int,QString&)), Qt::DirectConnection);
1061  }
1062 
1063 
1064  }
1065 
1066  //Check if the plugin supports Logging
1067  LoggingInterface* logPlugin = qobject_cast< LoggingInterface * >(plugin);
1068  if ( logPlugin ) {
1069  supported = supported + "Logging ";
1070 
1071  // Create intermediate logger class which will mangle the output
1072  PluginLogger* newlog = new PluginLogger(info.name);
1073  loggers_.push_back(newlog);
1074  connect(plugin,SIGNAL(log(Logtype, QString )),newlog,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
1075  connect(plugin,SIGNAL(log(QString )),newlog,SLOT(slotLog(QString )),Qt::DirectConnection);
1076 
1077  // Connect it to the core widget logger
1078  if ( OpenFlipper::Options::gui() )
1079  connect(newlog,SIGNAL(log(Logtype, QString )),coreWidget_,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
1080 
1081  // connection to console logger
1082  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLog(Logtype, QString )),Qt::DirectConnection);
1083 
1084  // connection to file logger
1085  connect(newlog,SIGNAL(log(Logtype, QString )),this,SLOT(slotLogToFile(Logtype, QString )),Qt::DirectConnection);
1086 
1087  // connection to external plugin logger
1088  if ( checkSlot(plugin,"logOutput(Logtype,QString)") )
1089  connect(this,SIGNAL(externalLog(Logtype,QString)), plugin, SLOT(logOutput(Logtype,QString)) ) ;
1090  }
1091 
1092  //Check if the plugin supports Menubar-Interface
1093  MenuInterface* menubarPlugin = qobject_cast< MenuInterface * >(plugin);
1094  if ( menubarPlugin && OpenFlipper::Options::gui() ) {
1095  supported = supported + "Menubar ";
1096 
1097  if ( checkSignal(plugin,"addMenubarAction(QAction*,QString)") )
1098  connect(plugin , SIGNAL(addMenubarAction(QAction*,QString)),
1099  coreWidget_ , SLOT(slotAddMenubarAction(QAction*,QString)),Qt::DirectConnection);
1100  if ( checkSignal(plugin,"addMenubarActions(std::vector<QAction*>, QString)") )
1101  connect(plugin , SIGNAL(addMenubarActions(std::vector<QAction*>,QString)),
1102  coreWidget_ , SLOT(slotAddMenubarActions(std::vector<QAction*>,QString)),Qt::DirectConnection);
1103  if ( checkSignal(plugin,"getMenubarMenu (QString,QMenu*&,bool)") )
1104  connect(plugin , SIGNAL(getMenubarMenu (QString,QMenu*&,bool)),
1105  coreWidget_ , SLOT(slotGetMenubarMenu (QString,QMenu*&,bool)),Qt::DirectConnection);
1106  }
1107 
1108  //Check if the plugin supports ContextMenuInterface
1109  ContextMenuInterface* contextMenuPlugin = qobject_cast< ContextMenuInterface * >(plugin);
1110  if ( contextMenuPlugin && OpenFlipper::Options::gui() ) {
1111  supported = supported + "ContextMenu ";
1112 
1113  if ( checkSignal(plugin,"addContextMenuItem(QAction*,ContextMenuType)") )
1114  connect(plugin , SIGNAL(addContextMenuItem(QAction*,ContextMenuType)),
1115  coreWidget_ , SLOT(slotAddContextItem(QAction*,ContextMenuType)),Qt::DirectConnection);
1116 
1117  if ( checkSignal(plugin,"addContextMenuItem(QAction*,DataType,ContextMenuType)") )
1118  connect(plugin , SIGNAL(addContextMenuItem(QAction*,DataType,ContextMenuType)),
1119  coreWidget_ , SLOT(slotAddContextItem(QAction*,DataType,ContextMenuType)),Qt::DirectConnection);
1120 
1121  if ( checkSignal(plugin,"hideContextMenu()") )
1122  connect(plugin , SIGNAL(hideContextMenu()),
1123  coreWidget_ , SLOT(slotHideContextMenu()),Qt::DirectConnection);
1124 
1125  if ( checkSlot(plugin,"slotUpdateContextMenu(int)") )
1126  connect(coreWidget_ , SIGNAL(updateContextMenu(int)),
1127  plugin , SLOT(slotUpdateContextMenu(int)),Qt::DirectConnection);
1128 
1129  if ( checkSlot(plugin,"slotUpdateContextMenuNode(int)") )
1130  connect(coreWidget_ , SIGNAL(updateContextMenuNode(int)),
1131  plugin , SLOT(slotUpdateContextMenuNode(int)),Qt::DirectConnection);
1132 
1133  if ( checkSlot(plugin,"slotUpdateContextMenuBackground()") )
1134  connect(coreWidget_ , SIGNAL(updateContextMenuBackground()),
1135  plugin , SLOT(slotUpdateContextMenuBackground()),Qt::DirectConnection);
1136  }
1137 
1138  //Check if the plugin supports Toolbox-Interface
1139  ToolboxInterface* toolboxPlugin = qobject_cast< ToolboxInterface * >(plugin);
1140  if ( toolboxPlugin && OpenFlipper::Options::gui() ) {
1141  supported = supported + "Toolbox ";
1142 
1143 
1144  if ( checkSignal(plugin, "addToolbox(QString,QWidget*)"))
1145  connect(plugin, SIGNAL( addToolbox(QString,QWidget*) ),
1146  this, SLOT( addToolbox(QString,QWidget*) ),Qt::DirectConnection );
1147 
1148  if ( checkSignal(plugin, "addToolbox(QString,QWidget*,QIcon*)"))
1149  connect(plugin, SIGNAL( addToolbox(QString,QWidget*,QIcon*) ),
1150  this, SLOT( addToolbox(QString,QWidget*,QIcon*) ),Qt::DirectConnection );
1151 
1152  if ( checkSignal(plugin, "addToolbox(QString,QWidget*,QIcon*,QWidget*)"))
1153  connect(plugin, SIGNAL( addToolbox(QString,QWidget*,QIcon*,QWidget*) ),
1154  this, SLOT( addToolbox(QString,QWidget*,QIcon*,QWidget*) ),Qt::DirectConnection );
1155 }
1156 
1157  //Check if the plugin supports ViewMode-Interface
1158  ViewModeInterface* viewModePlugin = qobject_cast< ViewModeInterface * >(plugin);
1159  if ( viewModePlugin && OpenFlipper::Options::gui() ) {
1160  supported = supported + "ViewMode ";
1161 
1162  if ( checkSignal(plugin, "defineViewModeToolboxes(QString,QStringList)"))
1163  connect(plugin, SIGNAL( defineViewModeToolboxes(QString, QStringList) ),
1164  coreWidget_, SLOT( slotAddViewModeToolboxes(QString, QStringList) ),Qt::DirectConnection );
1165 
1166  if ( checkSignal(plugin, "defineViewModeToolbars(QString,QStringList)"))
1167  connect(plugin, SIGNAL( defineViewModeToolbars(QString, QStringList) ),
1168  coreWidget_, SLOT( slotAddViewModeToolbars(QString, QStringList) ),Qt::DirectConnection );
1169 
1170  if ( checkSignal(plugin, "defineViewModeContextMenus(QString,QStringList)"))
1171  connect(plugin, SIGNAL( defineViewModeContextMenus(QString, QStringList) ),
1172  coreWidget_, SLOT( slotAddViewModeContextMenus(QString, QStringList) ),Qt::DirectConnection );
1173 
1174  if ( checkSignal(plugin, "defineViewModeIcon(QString,QString)"))
1175  connect(plugin, SIGNAL( defineViewModeIcon(QString, QString) ),
1176  coreWidget_, SLOT( slotSetViewModeIcon(QString, QString) ),Qt::DirectConnection );
1177 
1178  if ( checkSignal(plugin, "setViewMode(QString,bool)"))
1179  connect(plugin, SIGNAL( setViewMode(QString, bool) ),
1180  coreWidget_, SLOT( setViewMode(QString, bool) ),Qt::DirectConnection );
1181  }
1182 
1183  //Check if the plugin supports Options-Interface
1184  OptionsInterface* optionsPlugin = qobject_cast< OptionsInterface * >(plugin);
1185  if ( optionsPlugin && OpenFlipper::Options::gui() ) {
1186  supported = supported + "Options ";
1187 
1188  QWidget* widget = 0;
1189  if ( optionsPlugin->initializeOptionsWidget( widget ) ) {
1190  info.optionsWidget = widget;
1191 
1192  if ( checkSlot(plugin,"applyOptions()") )
1193  connect(coreWidget_ , SIGNAL( applyOptions() ),
1194  plugin , SLOT( applyOptions() ),Qt::DirectConnection);
1195  }
1196  }
1197 
1198  //Check if the plugin supports Toolbar-Interface
1199  ToolbarInterface* toolbarPlugin = qobject_cast< ToolbarInterface * >(plugin);
1200  if ( toolbarPlugin && OpenFlipper::Options::gui() ) {
1201  supported = supported + "Toolbars ";
1202 
1203  if ( checkSignal(plugin,"addToolbar(QToolBar*)") )
1204  connect(plugin,SIGNAL(addToolbar(QToolBar*)),
1205  coreWidget_,SLOT(slotAddToolbar(QToolBar*)),Qt::DirectConnection);
1206 
1207  if ( checkSignal(plugin,"removeToolbar(QToolBar*)") )
1208  connect(plugin,SIGNAL(removeToolbar(QToolBar*)),
1209  coreWidget_,SLOT(slotRemoveToolbar(QToolBar*)),Qt::DirectConnection);
1210 
1211  if ( checkSignal(plugin,"getToolBar(QString,QToolBar*&)") )
1212  connect(plugin,SIGNAL(getToolBar(QString,QToolBar*&)),
1213  coreWidget_,SLOT(getToolBar(QString,QToolBar*&)),Qt::DirectConnection);
1214 
1215  }
1216 
1217  //Check if the plugin supports StatusBar-Interface
1218  StatusbarInterface* statusbarPlugin = qobject_cast< StatusbarInterface * >(plugin);
1219  if ( statusbarPlugin && OpenFlipper::Options::gui() ) {
1220  supported = supported + "StatusBar ";
1221 
1222  if ( checkSignal(plugin,"showStatusMessage(QString,int)") )
1223  connect(plugin,SIGNAL(showStatusMessage(QString,int)),
1224  coreWidget_,SLOT(statusMessage(QString,int)),Qt::DirectConnection);
1225 
1226 
1227  if ( checkSignal(plugin,"setStatus(ApplicationStatus::applicationStatus)") )
1228  connect(plugin,SIGNAL(setStatus(ApplicationStatus::applicationStatus)),
1229  coreWidget_,SLOT(setStatus(ApplicationStatus::applicationStatus)),Qt::DirectConnection);
1230 
1231  if ( checkSignal(plugin,"clearStatusMessage()") )
1232  connect(plugin,SIGNAL(clearStatusMessage()),
1233  coreWidget_,SLOT(clearStatusMessage()));
1234 
1235  if ( checkSignal(plugin,"addWidgetToStatusbar(QWidget*)") )
1236  connect(plugin,SIGNAL(addWidgetToStatusbar(QWidget*)), coreWidget_,SLOT(addWidgetToStatusbar(QWidget*)));
1237  }
1238 
1239  //Check if the plugin supports Key-Interface
1240  KeyInterface* keyPlugin = qobject_cast< KeyInterface * >(plugin);
1241  if ( keyPlugin && OpenFlipper::Options::gui() ) {
1242  supported = supported + "KeyboardEvents ";
1243 
1244  if ( checkSignal(plugin,"registerKey(int,Qt::KeyboardModifiers,QString,bool)") )
1245  connect(plugin,SIGNAL( registerKey(int, Qt::KeyboardModifiers, QString, bool) ),
1246  coreWidget_,SLOT(slotRegisterKey(int, Qt::KeyboardModifiers, QString, bool)) );
1247  }
1248 
1249  //Check if the plugin supports Mouse-Interface
1250  MouseInterface* mousePlugin = qobject_cast< MouseInterface * >(plugin);
1251  if ( mousePlugin && OpenFlipper::Options::gui() ) {
1252  supported = supported + "MouseEvents ";
1253 
1254  if ( checkSlot( plugin , "slotMouseWheelEvent(QWheelEvent*,const std::string&)" ) )
1255  connect(this , SIGNAL(PluginWheelEvent(QWheelEvent * , const std::string & )),
1256  plugin , SLOT(slotMouseWheelEvent(QWheelEvent* , const std::string & )));
1257 
1258  if ( checkSlot( plugin , "slotMouseEvent(QMouseEvent*)" ) )
1259  connect(this , SIGNAL(PluginMouseEvent(QMouseEvent*)),
1260  plugin , SLOT(slotMouseEvent(QMouseEvent*)));
1261 
1262  if ( checkSlot( plugin , "slotMouseEventLight(QMouseEvent*)" ) )
1263  connect(this , SIGNAL(PluginMouseEventLight(QMouseEvent*)),
1264  plugin , SLOT(slotMouseEventLight(QMouseEvent*)));
1265 
1266  }
1267 
1268  //Check if the plugin supports InformationInterface
1269  InformationInterface* infoPlugin = qobject_cast< InformationInterface * >(plugin);
1270  if ( infoPlugin && OpenFlipper::Options::gui() ) {
1271  supported = supported + "TypeInformation ";
1272 
1273  DataType dtype = infoPlugin->supportedDataTypes();
1274  supportedInfoTypes().insert(std::pair<InformationInterface*,DataType>(infoPlugin,dtype));
1275  }
1276 
1277  //Check if the plugin supports Picking-Interface
1278  PickingInterface* pickPlugin = qobject_cast< PickingInterface * >(plugin);
1279  if ( pickPlugin && OpenFlipper::Options::gui() ) {
1280  supported = supported + "Picking ";
1281 
1282  if ( checkSlot( plugin , "slotPickModeChanged(const std::string&)" ) )
1283  connect(coreWidget_,SIGNAL(signalPickModeChanged (const std::string &)),
1284  plugin,SLOT(slotPickModeChanged( const std::string &)));
1285 
1286  if ( checkSignal(plugin,"addPickMode(const std::string&)") )
1287  connect(plugin,SIGNAL(addPickMode( const std::string& )),
1288  this,SLOT(slotAddPickMode( const std::string& )),Qt::DirectConnection);
1289 
1290  if ( checkSignal(plugin,"addHiddenPickMode(const std::string&)") )
1291  connect(plugin,SIGNAL(addHiddenPickMode( const std::string& )),
1292  this,SLOT(slotAddHiddenPickMode( const std::string& )),Qt::DirectConnection);
1293 
1294  if ( checkSignal(plugin,"setPickModeCursor(const std::string&,QCursor)") )
1295  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
1296  connect(plugin,SIGNAL(setPickModeCursor( const std::string& ,QCursor)),
1297  coreWidget_,SLOT(setPickModeCursor( const std::string& ,QCursor)),Qt::DirectConnection);
1298 
1299  if ( checkSignal(plugin,"setPickModeMouseTracking(const std::string&,bool)") )
1300  for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
1301  connect(plugin,SIGNAL(setPickModeMouseTracking( const std::string& ,bool)),
1302  coreWidget_,SLOT(setPickModeMouseTracking( const std::string& ,bool)),Qt::DirectConnection);
1303 
1304  if ( checkSignal(plugin,"setPickModeToolbar(const std::string&,QToolBar*)") )
1305  connect(plugin,SIGNAL(setPickModeToolbar (const std::string&, QToolBar*)),
1306  coreWidget_,SLOT(setPickModeToolbar (const std::string&, QToolBar*)),Qt::DirectConnection);
1307 
1308  if ( checkSignal(plugin,"removePickModeToolbar(const std::string&)") )
1309  connect(plugin,SIGNAL(removePickModeToolbar( const std::string&)),
1310  coreWidget_,SLOT(removePickModeToolbar( const std::string&)),Qt::DirectConnection);
1311 
1312  }
1313 
1314  //Check if the plugin supports INI-Interface
1315  INIInterface* iniPlugin = qobject_cast< INIInterface * >(plugin);
1316  if ( iniPlugin ) {
1317  supported = supported + "INIFile ";
1318 
1319  if ( checkSlot( plugin , "loadIniFile(INIFile&,int)" ) )
1320  connect(this , SIGNAL(iniLoad( INIFile&,int)),
1321  plugin , SLOT( loadIniFile( INIFile&,int) ),Qt::DirectConnection);
1322 
1323  if ( checkSlot( plugin , "saveIniFile(INIFile&,int)" ) )
1324  connect(this , SIGNAL(iniSave( INIFile& , int )),
1325  plugin , SLOT( saveIniFile( INIFile& , int ) ),Qt::DirectConnection);
1326 
1327  if ( checkSlot( plugin , "saveIniFileOptions(INIFile&)" ) )
1328  connect(this , SIGNAL(iniSaveOptions( INIFile& )),
1329  plugin , SLOT( saveIniFileOptions( INIFile& ) ),Qt::DirectConnection);
1330 
1331  if ( checkSlot( plugin , "saveOnExit(INIFile&)" ) )
1332  connect(this , SIGNAL(saveOnExit( INIFile& )),
1333  plugin , SLOT( saveOnExit( INIFile& ) ),Qt::DirectConnection);
1334 
1335  if ( checkSlot( plugin , "loadIniFileOptions(INIFile&)" ) )
1336  connect(this , SIGNAL(iniLoadOptions( INIFile& )),
1337  plugin , SLOT( loadIniFileOptions( INIFile& ) ),Qt::DirectConnection);
1338 
1339  if ( checkSlot( plugin , "loadIniFileOptionsLast(INIFile&)" ) )
1340  connect(this , SIGNAL(iniLoadOptionsLast( INIFile& )),
1341  plugin , SLOT( loadIniFileOptionsLast( INIFile& ) ),Qt::DirectConnection);
1342  }
1343 
1344 #ifdef PYTHON_ENABLED
1345 
1346  // Check if the plugin supports Python Interface
1347  PythonInterface* pythonPlugin = qobject_cast< PythonInterface * >(plugin);
1348 
1349  if ( pythonPlugin ) {
1350  supported = supported + "PythonInterface ";
1351 
1352  QObject* currentPluginPointer = qobject_cast< QObject * >(plugin);
1353 
1354  setPluginPointer(basePlugin->name() , currentPluginPointer);
1355 
1356  }
1357 
1358 #endif
1359 
1360  //Check if the plugin supports Selection-Interface
1361  SelectionInterface* selectionPlugin = qobject_cast< SelectionInterface * >(plugin);
1362  if ( selectionPlugin && OpenFlipper::Options::gui() ) {
1363  supported = supported + "SelectionBase ";
1364 
1365  if ( checkSignal(plugin,"addSelectionEnvironment(QString,QString,QIcon,QString&)") ) {
1366  errors += tr("Error: Plugin uses deprecated addSelectionEnvironment(QString,QString,QIcon,QString&) , Replace the qicon by the path to the icon!") + "\n";
1367  log(LOGERR,tr("Plugin uses deprecated addSelectionEnvironment(QString,QString,QIcon,QString&) , Replace the qicon by the path to the icon!"));
1368  }
1369 
1370  if ( checkSignal(plugin,"addSelectionEnvironment(QString,QString,QString,QString&)") )
1371  connect(plugin , SIGNAL(addSelectionEnvironment(QString,QString,QString,QString&)),
1372  this , SLOT(slotAddSelectionEnvironment(QString,QString,QString,QString&)),Qt::DirectConnection);
1373 
1374  // ===============
1375 
1376  if ( checkSlot(plugin,"slotAddSelectionEnvironment(QString,QString,QIcon,QString&)") ) {
1377  errors += tr("Error: Plugin uses deprecated slotAddSelectionEnvironment(QString,QString,QIcon,QString&) , Replace the qicon by the path to the icon!") + "\n";
1378  }
1379 
1380  if ( checkSlot( plugin , "slotAddSelectionEnvironment(QString,QString,QString,QString&)" ) )
1381  connect(this , SIGNAL(addSelectionEnvironment(QString,QString,QString,QString&)),
1382  plugin , SLOT(slotAddSelectionEnvironment(QString,QString,QString,QString&)),Qt::DirectConnection);
1383 
1384  // ===============
1385 
1386  if ( checkSignal(plugin,"registerType(QString,DataType)") )
1387  connect(plugin , SIGNAL(registerType(QString,DataType)),
1388  this , SLOT(slotRegisterType(QString,DataType)),Qt::DirectConnection);
1389 
1390  // ===============
1391 
1392  if ( checkSlot( plugin , "slotRegisterType(QString,DataType)" ) )
1393  connect(this , SIGNAL(registerType(QString,DataType)),
1394  plugin , SLOT(slotRegisterType(QString,DataType)),Qt::DirectConnection);
1395 
1396  // ===============
1397 
1398  if ( checkSignal(plugin,"addPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&)") ) {
1399  errors += tr("Error: Plugin uses deprecated addPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&) , Replace the qicon by the path to the icon!") + "\n";
1400  }
1401 
1402  if ( checkSignal(plugin,"addPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)") )
1403  connect(plugin , SIGNAL(addPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)),
1404  this , SLOT(slotAddPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)),Qt::DirectConnection);
1405 
1406  // ===============
1407 
1408  if ( checkSlot(plugin,"slotAddPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&)") )
1409  log(LOGERR,tr("Plugin uses deprecated slotAddPrimitiveType(QString,QString,QIcon,SelectionInterface::PrimitiveType&) , Replace the qicon by the path to the icon!"));
1410 
1411  if ( checkSlot( plugin , "slotAddPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)" ) )
1412  connect(this , SIGNAL(addPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)),
1413  plugin , SLOT(slotAddPrimitiveType(QString,QString,QString,SelectionInterface::PrimitiveType&)),Qt::DirectConnection);
1414 
1415  // ===============
1416 
1417  if ( checkSignal(plugin,"addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&)") ) {
1418  errors += tr("Error: Plugin uses deprecated addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&) , Replace the qicon by the path to the icon!") + "\n";
1419 
1420  log(LOGERR,tr("Plugin uses deprecated addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&) , Replace the qicon by the path to the icon!"));
1421  }
1422 
1423  if ( checkSignal(plugin,"addCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)") )
1424  connect(plugin , SIGNAL(addCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)),
1425  this , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)),Qt::DirectConnection);
1426 
1427  // ===============
1428 
1429  if ( checkSignal(plugin,"addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)") ) {
1430  errors += tr("Error: Plugin uses deprecated addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType) , Replace the qicon by the path to the icon!") + "\n";
1431  log(LOGERR,tr("Plugin uses deprecated addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType) , Replace the qicon by the path to the icon!"));
1432  }
1433 
1434  if ( checkSignal(plugin,"addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)") )
1435  connect(plugin , SIGNAL(addCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)),
1436  this , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)),Qt::DirectConnection);
1437 
1438  // ===============
1439 
1440  if ( checkSlot(plugin,"slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&)") ) {
1441  errors += tr("Error: Plugin uses deprecated slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&) , Replace the qicon by the path to the icon!") + "\n";
1442  log(LOGERR,tr("Plugin uses deprecated slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&) , Replace the qicon by the path to the icon!"));
1443  }
1444 
1445  if ( checkSlot( plugin , "slotAddCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)" ) )
1446  connect(this , SIGNAL(addCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)),
1447  plugin , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&)),Qt::DirectConnection);
1448 
1449  // ===============
1450 
1451  if ( checkSlot(plugin,"slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType)") ) {
1452  errors += tr("Error: Plugin uses deprecated slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType) , Replace the qicon by the path to the icon!") + "\n";
1453  log(LOGERR,tr("Plugin uses deprecated slotAddCustomSelectionMode(QString,QString,QString,QIcon,SelectionInterface::PrimitiveType,QString&,DataType) , Replace the qicon by the path to the icon!"));
1454  }
1455 
1456  if ( checkSlot( plugin , "slotAddCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&,DataType)" ) )
1457  connect(this , SIGNAL(addCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&,DataType)),
1458  plugin , SLOT(slotAddCustomSelectionMode(QString,QString,QString,QString,SelectionInterface::PrimitiveType,QString&,DataType)),Qt::DirectConnection);
1459 
1460  // ===============
1461 
1462 
1463  if ( checkSignal(plugin,"addSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)") )
1464  connect(plugin , SIGNAL(addSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)),
1465  this , SLOT(slotAddSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1466 
1467  if ( checkSlot( plugin , "slotAddSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)" ) )
1468  connect(this , SIGNAL(addSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)),
1469  plugin , SLOT(slotAddSelectionOperations(QString,QStringList,QString,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1470 
1471  if ( checkSignal(plugin,"addSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)") )
1472  connect(plugin , SIGNAL(addSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)),
1473  this , SLOT(slotAddSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1474 
1475  if ( checkSlot( plugin , "slotAddSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)" ) )
1476  connect(this , SIGNAL(addSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)),
1477  plugin , SLOT(slotAddSelectionParameters(QString,QWidget*,QString,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1478 
1479 
1480  if ( checkSignal(plugin,"selectionOperation(QString)") )
1481  connect(plugin , SIGNAL(selectionOperation(QString)),
1482  this , SLOT(slotSelectionOperation(QString)),Qt::DirectConnection);
1483 
1484  if ( checkSlot( plugin , "slotSelectionOperation(QString)" ) )
1485  connect(this , SIGNAL(selectionOperation(QString)),
1486  plugin , SLOT(slotSelectionOperation(QString)),Qt::DirectConnection);
1487 
1488  if ( checkSignal(plugin,"showToggleSelectionMode(QString,bool,SelectionInterface::PrimitiveType)") )
1489  connect(plugin , SIGNAL(showToggleSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1490  this , SLOT(slotShowToggleSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1491 
1492  if ( checkSlot( plugin , "slotShowToggleSelectionMode(QString,bool,SelectionInterface::PrimitiveType)" ) )
1493  connect(this , SIGNAL(showToggleSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1494  plugin , SLOT(slotShowToggleSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1495 
1496  if ( checkSignal(plugin,"showLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)") )
1497  connect(plugin , SIGNAL(showLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1498  this , SLOT(slotShowLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1499 
1500  if ( checkSlot( plugin , "slotShowLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)" ) )
1501  connect(this , SIGNAL(showLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1502  plugin , SLOT(slotShowLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1503 
1504  if ( checkSignal(plugin,"showVolumeLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)") )
1505  connect(plugin , SIGNAL(showVolumeLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1506  this , SLOT(slotShowVolumeLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1507 
1508  if ( checkSlot( plugin , "slotShowVolumeLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)" ) )
1509  connect(this , SIGNAL(showVolumeLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1510  plugin , SLOT(slotShowVolumeLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1511 
1512  if ( checkSignal(plugin,"showSurfaceLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)") )
1513  connect(plugin , SIGNAL(showSurfaceLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1514  this , SLOT(slotShowSurfaceLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1515 
1516  if ( checkSlot( plugin , "slotShowSurfaceLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)" ) )
1517  connect(this , SIGNAL(showSurfaceLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1518  plugin , SLOT(slotShowSurfaceLassoSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1519 
1520  if ( checkSignal(plugin,"showSphereSelectionMode(QString,bool,SelectionInterface::PrimitiveType)") )
1521  connect(plugin , SIGNAL(showSphereSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1522  this , SLOT(slotShowSphereSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1523 
1524  if ( checkSlot( plugin , "slotShowSphereSelectionMode(QString,bool,SelectionInterface::PrimitiveType)" ) )
1525  connect(this , SIGNAL(showSphereSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1526  plugin , SLOT(slotShowSphereSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1527 
1528  if ( checkSignal(plugin,"showClosestBoundarySelectionMode(QString,bool,SelectionInterface::PrimitiveType)") )
1529  connect(plugin , SIGNAL(showClosestBoundarySelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1530  this , SLOT(slotShowClosestBoundarySelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1531 
1532  if ( checkSlot( plugin , "slotShowClosestBoundarySelectionMode(QString,bool,SelectionInterface::PrimitiveType)" ) )
1533  connect(this , SIGNAL(showClosestBoundarySelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1534  plugin , SLOT(slotShowClosestBoundarySelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1535 
1536  if ( checkSignal(plugin,"showFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)") )
1537  connect(plugin , SIGNAL(showFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1538  this , SLOT(slotShowFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1539 
1540  if ( checkSlot( plugin , "slotShowFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)" ) )
1541  connect(this , SIGNAL(showFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1542  plugin , SLOT(slotShowFloodFillSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1543 
1544  if ( checkSignal(plugin,"showComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)") )
1545  connect(plugin , SIGNAL(showComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1546  this , SLOT(slotShowComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1547 
1548  if ( checkSlot( plugin , "slotShowComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)" ) )
1549  connect(this , SIGNAL(showComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),
1550  plugin , SLOT(slotShowComponentsSelectionMode(QString,bool,SelectionInterface::PrimitiveType)),Qt::DirectConnection);
1551 
1552  if ( checkSignal(plugin,"toggleSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") )
1553  connect(plugin , SIGNAL(toggleSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1554  this , SLOT(slotToggleSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1555 
1556  if ( checkSlot( plugin , "slotToggleSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)" ) )
1557  connect(this , SIGNAL(toggleSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1558  plugin , SLOT(slotToggleSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1559 
1560  if ( checkSignal(plugin,"lassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") )
1561  connect(plugin , SIGNAL(lassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1562  this , SLOT(slotLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1563 
1564  if ( checkSlot( plugin , "slotLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)" ) )
1565  connect(this , SIGNAL(lassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1566  plugin , SLOT(slotLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1567 
1568  if ( checkSignal(plugin,"volumeLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") )
1569  connect(plugin , SIGNAL(volumeLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1570  this , SLOT(slotVolumeLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1571 
1572  if ( checkSlot( plugin , "slotVolumeLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)" ) )
1573  connect(this , SIGNAL(volumeLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1574  plugin , SLOT(slotVolumeLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1575 
1576  if ( checkSignal(plugin,"surfaceLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") )
1577  connect(plugin , SIGNAL(surfaceLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1578  this , SLOT(slotSurfaceLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1579 
1580  if ( checkSlot( plugin , "slotSurfaceLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)" ) )
1581  connect(this , SIGNAL(surfaceLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1582  plugin , SLOT(slotSurfaceLassoSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1583 
1584  if ( checkSignal(plugin,"sphereSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)") )
1585  connect(plugin , SIGNAL(sphereSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)),
1586  this , SLOT(slotSphereSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1587 
1588  if ( checkSlot( plugin , "slotSphereSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)" ) )
1589  connect(this , SIGNAL(sphereSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)),
1590  plugin , SLOT(slotSphereSelection(QMouseEvent*,double,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1591 
1592  if ( checkSignal(plugin,"closestBoundarySelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") )
1593  connect(plugin , SIGNAL(closestBoundarySelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1594  this , SLOT(slotClosestBoundarySelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1595 
1596  if ( checkSlot( plugin , "slotClosestBoundarySelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)" ) )
1597  connect(this , SIGNAL(closestBoundarySelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1598  plugin , SLOT(slotClosestBoundarySelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1599 
1600  if ( checkSignal(plugin,"floodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") )
1601  connect(plugin , SIGNAL(floodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1602  this , SLOT(slotFloodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1603 
1604  if ( checkSlot( plugin , "slotFloodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)" ) )
1605  connect(this , SIGNAL(floodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1606  plugin , SLOT(slotFloodFillSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1607 
1608  if ( checkSignal(plugin,"componentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)") )
1609  connect(plugin , SIGNAL(componentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1610  this , SLOT(slotComponentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1611 
1612  if ( checkSlot( plugin , "slotComponentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)" ) )
1613  connect(this , SIGNAL(componentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),
1614  plugin , SLOT(slotComponentsSelection(QMouseEvent*,SelectionInterface::PrimitiveType,bool)),Qt::DirectConnection);
1615 
1616  if ( checkSignal(plugin,"customSelection(QMouseEvent*,SelectionInterface::PrimitiveType,QString,bool)") )
1617  connect(plugin , SIGNAL(customSelection(QMouseEvent*,SelectionInterface::PrimitiveType,QString,bool)),
1618  this , SLOT(slotCustomSelection(QMouseEvent*,SelectionInterface::PrimitiveType,QString,bool)),Qt::DirectConnection);
1619 
1620  if ( checkSlot( plugin , "slotCustomSelection(QMouseEvent*,SelectionInterface::PrimitiveType,QString,bool)" ) )
1621  connect(this , SIGNAL(customSelection(QMouseEvent*,SelectionInterface::PrimitiveType,QString,bool)),
1622  plugin , SLOT(slotCustomSelection(QMouseEvent*,SelectionInterface::PrimitiveType,QString,bool)),Qt::DirectConnection);
1623 
1624  if ( checkSignal(plugin,"getActiveDataTypes(SelectionInterface::TypeList&)") )
1625  connect(plugin , SIGNAL(getActiveDataTypes(SelectionInterface::TypeList&)),
1626  this , SLOT(slotGetActiveDataTypes(SelectionInterface::TypeList&)),Qt::DirectConnection);
1627 
1628  if ( checkSlot( plugin , "slotGetActiveDataTypes(SelectionInterface::TypeList&)" ) )
1629  connect(this , SIGNAL(getActiveDataTypes(SelectionInterface::TypeList&)),
1630  plugin , SLOT(slotGetActiveDataTypes(SelectionInterface::TypeList&)),Qt::DirectConnection);
1631 
1632  if ( checkSignal(plugin,"getActivePrimitiveType(SelectionInterface::PrimitiveType&)") )
1633  connect(plugin , SIGNAL(getActivePrimitiveType(SelectionInterface::PrimitiveType&)),
1634  this , SLOT(slotGetActivePrimitiveType(SelectionInterface::PrimitiveType&)),Qt::DirectConnection);
1635 
1636  if ( checkSlot( plugin , "slotGetActivePrimitiveType(SelectionInterface::PrimitiveType&)" ) )
1637  connect(this , SIGNAL(getActivePrimitiveType(SelectionInterface::PrimitiveType&)),
1638  plugin , SLOT(slotGetActivePrimitiveType(SelectionInterface::PrimitiveType&)),Qt::DirectConnection);
1639 
1640  if ( checkSignal(plugin,"targetObjectsOnly(bool&)") )
1641  connect(plugin , SIGNAL(targetObjectsOnly(bool&)),
1642  this , SLOT(slotTargetObjectsOnly(bool&)),Qt::DirectConnection);
1643 
1644  if ( checkSlot( plugin , "slotTargetObjectsOnly(bool&)" ) )
1645  connect(this , SIGNAL(targetObjectsOnly(bool&)),
1646  plugin , SLOT(slotTargetObjectsOnly(bool&)),Qt::DirectConnection);
1647 
1648  if ( checkSignal(plugin,"loadSelection(const INIFile&)") )
1649  connect(plugin , SIGNAL(loadSelection(const INIFile&)),
1650  this , SLOT(slotLoadSelection(const INIFile&)),Qt::DirectConnection);
1651 
1652  if ( checkSlot( plugin , "slotLoadSelection(const INIFile&)" ) )
1653  connect(this , SIGNAL(loadSelection(const INIFile&)),
1654  plugin , SLOT(slotLoadSelection(const INIFile&)),Qt::DirectConnection);
1655 
1656  if ( checkSignal(plugin,"saveSelection(INIFile&)") )
1657  connect(plugin , SIGNAL(saveSelection(INIFile&)),
1658  this , SLOT(slotSaveSelection(INIFile&)),Qt::DirectConnection);
1659 
1660  if ( checkSlot( plugin , "slotSaveSelection(INIFile&)" ) )
1661  connect(this , SIGNAL(saveSelection(INIFile&)),
1662  plugin , SLOT(slotSaveSelection(INIFile&)),Qt::DirectConnection);
1663 
1664  if ( checkSignal(plugin,"registerKeyShortcut(int,Qt::KeyboardModifiers)") )
1665  connect(plugin , SIGNAL(registerKeyShortcut(int,Qt::KeyboardModifiers)),
1666  this , SLOT(slotRegisterKeyShortcut(int,Qt::KeyboardModifiers)),Qt::DirectConnection);
1667 
1668  if ( checkSlot( plugin , "slotRegisterKeyShortcut(int,Qt::KeyboardModifiers)" ) )
1669  connect(this , SIGNAL(registerKeyShortcut(int,Qt::KeyboardModifiers)),
1670  plugin , SLOT(slotRegisterKeyShortcut(int,Qt::KeyboardModifiers)),Qt::DirectConnection);
1671 
1672  if ( checkSignal(plugin,"keyShortcutEvent(int,Qt::KeyboardModifiers)") )
1673  connect(plugin , SIGNAL(keyShortcutEvent(int,Qt::KeyboardModifiers)),
1674  this , SLOT(slotKeyShortcutEvent(int,Qt::KeyboardModifiers)),Qt::DirectConnection);
1675 
1676  if ( checkSlot( plugin , "slotKeyShortcutEvent(int,Qt::KeyboardModifiers)" ) )
1677  connect(this , SIGNAL(keyShortcutEvent(int,Qt::KeyboardModifiers)),
1678  plugin , SLOT(slotKeyShortcutEvent(int,Qt::KeyboardModifiers)),Qt::DirectConnection);
1679  }
1680 
1681  //Check if the plugin supports Texture-Interface
1682  TextureInterface* texturePlugin = qobject_cast< TextureInterface * >(plugin);
1683  if ( texturePlugin && OpenFlipper::Options::gui() ) {
1684  supported = supported + "Textures ";
1685 
1686  if ( checkSignal(plugin,"addTexture(QString,QString,uint,int)") )
1687  connect(plugin , SIGNAL(addTexture( QString , QString , uint , int )),
1688  this , SLOT(slotAddTexture(QString, QString, uint, int)),Qt::DirectConnection);
1689 
1690  if ( checkSignal(plugin,"addTexture(QString,QImage,uint,int)") )
1691  connect(plugin , SIGNAL(addTexture( QString , QImage , uint , int )),
1692  this , SLOT(slotAddTexture(QString, QImage, uint, int)),Qt::DirectConnection);
1693 
1694  if ( checkSlot( plugin , "slotTextureAdded(QString,QString,uint,int)" ) )
1695  connect(this , SIGNAL(addTexture(QString,QString, uint, int)),
1696  plugin , SLOT(slotTextureAdded(QString,QString, uint, int)),Qt::DirectConnection);
1697 
1698  if ( checkSlot( plugin , "slotTextureAdded(QString,QImage,uint,int)" ) )
1699  connect(this , SIGNAL(addTexture(QString,QImage, uint, int)),
1700  plugin , SLOT(slotTextureAdded(QString,QImage, uint, int)),Qt::DirectConnection);
1701 
1702  if ( checkSignal(plugin,"addTexture(QString,QString,uint)") )
1703  connect(plugin , SIGNAL(addTexture( QString , QString , uint )),
1704  this , SLOT(slotAddTexture(QString, QString, uint)),Qt::AutoConnection);
1705 
1706  if ( checkSignal(plugin,"addTexture(QString,QImage,uint)") )
1707  connect(plugin , SIGNAL(addTexture( QString , QImage , uint )),
1708  this , SLOT(slotAddTexture(QString, QImage, uint)),Qt::AutoConnection);
1709 
1710  if ( checkSlot( plugin , "slotTextureAdded(QString,QString,uint)" ) )
1711  connect(this , SIGNAL(addTexture(QString,QString, uint)),
1712  plugin , SLOT(slotTextureAdded(QString,QString, uint)),Qt::DirectConnection);
1713 
1714  if ( checkSlot( plugin , "slotTextureAdded(QString,QImage,uint)" ) )
1715  connect(this , SIGNAL(addTexture(QString,QImage, uint)),
1716  plugin , SLOT(slotTextureAdded(QString,QImage, uint)),Qt::DirectConnection);
1717 
1718  if ( checkSignal(plugin,"updateTexture(QString,int)") )
1719  connect(plugin , SIGNAL(updateTexture( QString ,int )),
1720  this , SLOT(slotUpdateTexture(QString , int)),Qt::AutoConnection);
1721 
1722  if ( checkSlot( plugin , "slotUpdateTexture(QString,int)" ) )
1723  connect(this , SIGNAL(updateTexture(QString ,int)),
1724  plugin , SLOT(slotUpdateTexture(QString,int )),Qt::DirectConnection);
1725 
1726  if ( checkSignal(plugin,"updateAllTextures()") )
1727  connect(plugin , SIGNAL(updateAllTextures()),
1728  this , SLOT(slotUpdateAllTextures()));
1729 
1730  if ( checkSlot( plugin , "slotUpdateAllTextures()" ) )
1731  connect(this , SIGNAL(updateAllTextures()),
1732  plugin , SLOT(slotUpdateAllTextures()));
1733 
1734  if ( checkSignal(plugin,"updatedTextures(QString,int)") )
1735  connect(plugin , SIGNAL(updatedTextures( QString , int )),
1736  this , SLOT(slotTextureUpdated( QString, int ) ),Qt::AutoConnection);
1737 
1738  if ( checkSlot( plugin , "slotTextureUpdated(QString,int)" ) )
1739  connect(this , SIGNAL(updatedTextures( QString , int )),
1740  plugin , SLOT(slotTextureUpdated( QString, int ) ),Qt::DirectConnection);
1741 
1742  if ( checkSignal(plugin,"setTextureMode(QString,QString,int)") )
1743  connect(plugin , SIGNAL(setTextureMode(QString, QString, int )),
1744  this , SLOT(slotSetTextureMode(QString, QString, int )),Qt::AutoConnection );
1745 
1746  if ( checkSlot( plugin , "slotSetTextureMode(QString,QString,int)" ) )
1747  connect(this , SIGNAL(setTextureMode(QString, QString, int )),
1748  plugin , SLOT(slotSetTextureMode(QString, QString, int )),Qt::DirectConnection );
1749 
1750  if ( checkSignal(plugin,"setTextureMode(QString,QString)") )
1751  connect(plugin , SIGNAL(setTextureMode(QString ,QString )),
1752  this , SLOT(slotSetTextureMode(QString ,QString )),Qt::AutoConnection );
1753 
1754  if ( checkSlot( plugin , "slotSetTextureMode(QString,QString)" ) )
1755  connect(this , SIGNAL(setTextureMode(QString ,QString )),
1756  plugin , SLOT(slotSetTextureMode(QString ,QString )),Qt::DirectConnection );
1757 
1758  if ( checkSignal(plugin,"switchTexture(QString,int)") )
1759  connect(plugin , SIGNAL(switchTexture(QString, int )),
1760  this , SLOT(slotSwitchTexture(QString, int )),Qt::QueuedConnection);
1761 
1762  if ( checkSlot( plugin , "slotSwitchTexture(QString,int)" ) )
1763  connect(this , SIGNAL(switchTexture(QString, int )),
1764  plugin , SLOT(slotSwitchTexture(QString, int )),Qt::QueuedConnection);
1765 
1766  if ( checkSignal(plugin,"switchTexture(QString)") )
1767  connect(plugin , SIGNAL(switchTexture(QString )),
1768  this , SLOT(slotSwitchTexture(QString )),Qt::QueuedConnection);
1769 
1770  if ( checkSlot( plugin , "slotSwitchTexture(QString)" ) )
1771  connect(this , SIGNAL(switchTexture(QString )),
1772  plugin , SLOT(slotSwitchTexture(QString )),Qt::QueuedConnection);
1773 
1774 
1775 
1776  if ( checkSignal( plugin , "textureChangeImage(QString,QImage&,int)" ) )
1777  connect(plugin , SIGNAL(textureChangeImage(QString,QImage&,int)),
1778  this , SLOT(slotTextureChangeImage(QString,QImage&,int)),Qt::DirectConnection);
1779 
1780  if ( checkSlot( plugin , "slotTextureChangeImage(QString,QImage&,int)" ) )
1781  connect(this , SIGNAL(textureChangeImage(QString,QImage&,int)),
1782  plugin , SLOT(slotTextureChangeImage(QString,QImage&,int)),Qt::DirectConnection);
1783 
1784  if ( checkSignal( plugin , "textureChangeImage(QString,QImage&)" ) )
1785  connect(plugin , SIGNAL(textureChangeImage(QString,QImage&)),
1786  this , SLOT(slotTextureChangeImage(QString,QImage&)),Qt::DirectConnection);
1787 
1788  if ( checkSlot( plugin , "slotTextureChangeImage(QString,QImage&)" ) )
1789  connect(this , SIGNAL(textureChangeImage(QString,QImage&)),
1790  plugin , SLOT(slotTextureChangeImage(QString,QImage&)),Qt::DirectConnection);
1791 
1792  if ( checkSignal( plugin , "addMultiTexture(QString,QString,QString,int,int&)" ) )
1793  connect(plugin , SIGNAL(addMultiTexture(QString,QString,QString,int,int&) ),
1794  this , SLOT(slotMultiTextureAdded(QString,QString,QString,int,int&) ),Qt::DirectConnection);
1795 
1796  if ( checkSignal( plugin , "addMultiTexture(QString,QString,QImage,int,int&)" ) )
1797  connect(plugin , SIGNAL(addMultiTexture(QString,QString,QImage,int,int&) ),
1798  this , SLOT(slotMultiTextureAdded(QString,QString,QImage,int,int&) ),Qt::DirectConnection);
1799 
1800  if ( checkSlot( plugin , "slotMultiTextureAdded( QString,QString,QString,int,int&)" ) )
1801  connect(this , SIGNAL(addMultiTexture(QString,QString,QString,int,int&) ),
1802  plugin , SLOT(slotMultiTextureAdded( QString,QString,QString,int,int&) ),Qt::DirectConnection);
1803 
1804  if ( checkSlot( plugin , "slotMultiTextureAdded( QString,QString,QImage,int,int&)" ) )
1805  connect(this , SIGNAL(addMultiTexture(QString,QString,QImage,int,int&) ),
1806  plugin , SLOT(slotMultiTextureAdded( QString,QString,QImage,int,int&) ),Qt::DirectConnection);
1807 
1808  if ( checkSignal( plugin , "textureGetImage(QString,QImage&,int)" ) )
1809  connect(plugin , SIGNAL(textureGetImage(QString,QImage&,int)),
1810  this , SLOT(slotTextureGetImage(QString,QImage&,int)),Qt::DirectConnection);
1811 
1812  if ( checkSlot( plugin , "slotTextureGetImage(QString,QImage&,int)" ) )
1813  connect(this , SIGNAL(textureGetImage(QString,QImage&,int)),
1814  plugin , SLOT(slotTextureGetImage(QString,QImage&,int)),Qt::DirectConnection);
1815 
1816  if ( checkSignal( plugin , "textureGetImage(QString,QImage&)" ) )
1817  connect(plugin , SIGNAL(textureGetImage(QString,QImage&)),
1818  this , SLOT(slotTextureGetImage(QString,QImage&)),Qt::DirectConnection);
1819 
1820  if ( checkSlot( plugin , "slotTextureGetImage(QString,QImage&)" ) )
1821  connect(this , SIGNAL(textureGetImage(QString,QImage&)),
1822  plugin , SLOT(slotTextureGetImage(QString,QImage&)),Qt::DirectConnection);
1823 
1824  if ( checkSignal( plugin , "textureIndex(QString,int,int&)" ) )
1825  connect(plugin , SIGNAL(textureIndex(QString,int,int&)),
1826  this , SLOT(slotTextureIndex(QString,int,int&)),Qt::DirectConnection);
1827 
1828  if ( checkSlot( plugin , "slotTextureIndex(QString,int,int&)" ) )
1829  connect(this , SIGNAL(textureIndex(QString,int,int&)),
1830  plugin , SLOT(slotTextureIndex(QString,int,int&)),Qt::DirectConnection);
1831 
1832  if ( checkSignal( plugin , "textureIndexPropertyName(int,QString&)" ) )
1833  connect(plugin , SIGNAL(textureIndexPropertyName(int,QString&)),
1834  this , SLOT(slotTextureIndexPropertyName(int,QString&)),Qt::DirectConnection);
1835 
1836  if ( checkSlot( plugin , "slotTextureIndexPropertyName(int,QString&)" ) )
1837  connect(this , SIGNAL(textureIndexPropertyName(int,QString&)),
1838  plugin , SLOT(slotTextureIndexPropertyName(int,QString&)),Qt::DirectConnection);
1839 
1840  if ( checkSignal( plugin , "textureName(int,int,QString&)" ) )
1841  connect(plugin , SIGNAL(textureName(int,int,QString&)),
1842  this , SLOT(slotTextureName(int,int,QString&)),Qt::DirectConnection);
1843 
1844  if ( checkSlot( plugin , "slotTextureName(int,int,QString&)" ) )
1845  connect(this , SIGNAL(textureName(int,int,QString&)),
1846  plugin , SLOT(slotTextureName(int,int,QString&)),Qt::DirectConnection);
1847 
1848  if ( checkSignal( plugin , "textureFilename(int,QString,QString&)" ) )
1849  connect(plugin , SIGNAL(textureFilename(int,QString,QString&)),
1850  this , SLOT(slotTextureFilename(int,QString,QString&)),Qt::DirectConnection);
1851 
1852  if ( checkSlot( plugin , "slotTextureFilename(int,QString,QString&)" ) )
1853  connect(this , SIGNAL(textureFilename(int,QString,QString&)),
1854  plugin , SLOT(slotTextureFilename(int,QString,QString&)),Qt::DirectConnection);
1855 
1856  if ( checkSignal( plugin , "getCurrentTexture(int,QString&)" ) )
1857  connect(plugin , SIGNAL(getCurrentTexture(int,QString&)),
1858  this , SLOT(slotGetCurrentTexture(int,QString&)),Qt::DirectConnection);
1859 
1860  if ( checkSlot( plugin , "slotGetCurrentTexture(int,QString&)" ) )
1861  connect(this , SIGNAL(getCurrentTexture(int,QString&)),
1862  plugin , SLOT(slotGetCurrentTexture(int,QString&)),Qt::DirectConnection);
1863 
1864  if ( checkSignal( plugin , "getSubTextures(int,QString,QStringList&)" ) )
1865  connect(plugin , SIGNAL(getSubTextures(int,QString,QStringList&)),
1866  this , SLOT(slotGetSubTextures(int,QString,QStringList&)),Qt::DirectConnection);
1867 
1868  if ( checkSlot( plugin , "slotGetSubTextures(int,QString,QStringList&)" ) )
1869  connect(this , SIGNAL(getSubTextures(int,QString,QStringList&)),
1870  plugin , SLOT(slotGetSubTextures(int,QString,QStringList&)),Qt::DirectConnection);
1871  }
1872 
1873  //Check if the plugin supports Backup-Interface
1874  BackupInterface* backupPlugin = qobject_cast< BackupInterface * >(plugin);
1875  if ( backupPlugin ) {
1876  supported = supported + "Backups ";
1877 
1878  // Incoming Signal that a backup should be created
1879  if ( checkSignal( plugin , "createBackup(int,QString,UpdateType)" ) ) {
1880  connect(plugin , SIGNAL(createBackup(int,QString,UpdateType)) ,
1881  this , SIGNAL(createBackup(int,QString,UpdateType)),Qt::DirectConnection );
1882  }
1883  // Signal send from core to plugins that they should create a backup
1884  if ( checkSlot( plugin , "slotCreateBackup(int,QString,UpdateType)" ) ) {
1885  connect(this , SIGNAL(createBackup(int,QString,UpdateType)),
1886  plugin , SLOT( slotCreateBackup(int,QString,UpdateType) ),Qt::DirectConnection);
1887  }
1888 
1889  // Incoming Signal that a backup should be created
1890  if ( checkSignal( plugin , "createBackup(IdList,QString,std::vector<UpdateType>)" ) ) {
1891  connect(plugin , SIGNAL(createBackup(IdList,QString,std::vector<UpdateType>)) ,
1892  this , SIGNAL(createBackup(IdList,QString,std::vector<UpdateType>)),Qt::DirectConnection );
1893  }
1894  // Signal send from core to plugins that they should create a backup
1895  if ( checkSlot( plugin , "slotCreateBackup(IdList,QString,std::vector<UpdateType>)" ) ) {
1896  connect(this , SIGNAL(createBackup(IdList,QString,std::vector<UpdateType>)),
1897  plugin , SLOT( slotCreateBackup(IdList,QString,std::vector<UpdateType>) ),Qt::DirectConnection);
1898  }
1899 
1900 
1901  // Signal from plugin to restore an object with the given id
1902  if ( checkSignal( plugin , "undo(int)" ) ) {
1903  connect(plugin , SIGNAL(undo(int)) ,
1904  this , SIGNAL(undo(int)),Qt::DirectConnection );
1905  }
1906 
1907  // Signal send from core to backup plugin that it should restore the given object
1908  if ( checkSlot( plugin , "slotUndo(int)" ) ) {
1909  connect(this , SIGNAL(undo(int)),
1910  plugin , SLOT( slotUndo(int) ),Qt::DirectConnection);
1911  }
1912 
1913  // Signal from plugin to restore an object with the given id
1914  if ( checkSignal( plugin , "redo(int)" ) ) {
1915  connect(plugin , SIGNAL(redo(int)) ,
1916  this , SIGNAL(redo(int)),Qt::DirectConnection );
1917  }
1918 
1919  // Signal send from core to backup plugin that it should restore the given object
1920  if ( checkSlot( plugin , "slotRedo(int)" ) ) {
1921  connect(this , SIGNAL(redo(int)),
1922  plugin , SLOT( slotRedo(int) ),Qt::DirectConnection);
1923  }
1924 
1925  // Signal from plugin to restore an object with the given id
1926  if ( checkSignal( plugin , "undo()" ) ) {
1927  connect(plugin , SIGNAL(undo()) ,
1928  this , SIGNAL(undo()),Qt::DirectConnection );
1929  }
1930 
1931  // Signal send from core to backup plugin that it should restore the given object
1932  if ( checkSlot( plugin , "slotUndo()" ) ) {
1933  connect(this , SIGNAL(undo()),
1934  plugin , SLOT( slotUndo() ),Qt::DirectConnection);
1935  }
1936 
1937  // Signal from plugin to restore an object with the given id
1938  if ( checkSignal( plugin , "redo()" ) ) {
1939  connect(plugin , SIGNAL(redo()) ,
1940  this , SIGNAL(redo()),Qt::DirectConnection );
1941  }
1942 
1943  // Signal send from core to backup plugin that it should restore the given object
1944  if ( checkSlot( plugin , "slotRedo()" ) ) {
1945  connect(this , SIGNAL(redo()),
1946  plugin , SLOT( slotRedo() ),Qt::DirectConnection);
1947  }
1948 
1949  //====================================================================================
1950  // Backup Plugin signals for communication with the other plugins about restore state
1951  //====================================================================================
1952 
1953  // Stage one : restore will happen soon
1954  if ( checkSignal( plugin , "aboutToRestore(int)" ) ) {
1955  connect(plugin , SIGNAL( aboutToRestore(int)) ,
1956  this , SIGNAL( aboutToRestore(int) ),Qt::DirectConnection);
1957  }
1958 
1959  // Stage two: Restore complete
1960  if ( checkSignal( plugin , "restored(int)" ) ) {
1961  connect(plugin , SIGNAL(restored(int)) ,
1962  this , SIGNAL( restored(int) ),Qt::DirectConnection);
1963  }
1964 
1965  //====================================================================================
1966  // Plugin slots about restore state
1967  //====================================================================================
1968 
1969  // Stage one : restore will happen soon
1970  if ( checkSlot( plugin , "slotAboutToRestore(int)" ) ) {
1971  connect(this , SIGNAL( aboutToRestore(int)) ,
1972  plugin , SLOT( slotAboutToRestore(int) ),Qt::DirectConnection);
1973  }
1974 
1975  // Stage two : restore will happen soon
1976  if ( checkSlot( plugin , "slotRestored(int)" ) ) {
1977  connect(this , SIGNAL( restored(int)) ,
1978  plugin , SLOT( slotRestored(int) ),Qt::DirectConnection);
1979  }
1980 
1981  // Signal from plugin to restore a group with the given id
1982  if ( checkSignal( plugin , "generateBackup(int,QString,UpdateType)" ) ) {
1983  connect(plugin , SIGNAL(generateBackup(int,QString,UpdateType)) ,
1984  this , SLOT(slotGenerateBackup(int,QString,UpdateType)),Qt::DirectConnection );
1985  }
1986  }
1987 
1988  //Check if the plugin supports LoadSave-Interface
1989  LoadSaveInterface* LoadSavePlugin = qobject_cast< LoadSaveInterface * >(plugin);
1990  if ( LoadSavePlugin ) {
1991  supported = supported + "Load/Save ";
1992  if ( checkSignal(plugin,"load( QString,DataType,int& )" ) )
1993  connect(plugin , SIGNAL(load( QString,DataType,int& )) ,
1994  this , SLOT(slotLoad( QString,DataType,int& )),Qt::DirectConnection );
1995  if ( checkSignal(plugin,"save(int,QString)" ) )
1996  connect(plugin , SIGNAL( save(int,QString) ) ,
1997  this , SLOT( saveObject(int,QString) ), Qt::DirectConnection);
1998 
1999  if ( checkSlot( plugin , "fileOpened(int)" ) )
2000  connect(this , SIGNAL( openedFile( int) ) ,
2001  plugin , SLOT( fileOpened( int ) ),Qt::DirectConnection);
2002 
2003  if ( checkSignal(plugin,"addEmptyObject(DataType,int&)" ) )
2004  connect(plugin , SIGNAL( addEmptyObject( DataType, int& )) ,
2005  this , SLOT( slotAddEmptyObject( DataType, int&) ),Qt::DirectConnection);
2006 
2007  if ( checkSignal(plugin,"copyObject(int,int&)" ) )
2008  connect(plugin , SIGNAL( copyObject( int, int& )) ,
2009  this , SLOT( slotCopyObject( int, int&) ),Qt::DirectConnection);
2010 
2011  // Plugins to core
2012  if ( checkSignal(plugin,"emptyObjectAdded(int)" ) )
2013  connect(plugin , SIGNAL( emptyObjectAdded( int ) ) ,
2014  this , SLOT( slotEmptyObjectAdded ( int ) ),Qt::QueuedConnection);
2015 
2016  // core to plugins
2017  if ( checkSlot(plugin,"addedEmptyObject(int)" ) )
2018  connect(this , SIGNAL( emptyObjectAdded( int ) ) ,
2019  plugin , SLOT( addedEmptyObject( int ) ),Qt::DirectConnection);
2020 
2021  if ( checkSignal(plugin,"deleteObject(int)" ) )
2022  connect(plugin , SIGNAL( deleteObject( int ) ) ,
2023  this , SLOT( deleteObject( int ) ),Qt::AutoConnection);
2024 
2025  if ( checkSignal(plugin,"deleteAllObjects()" ) )
2026  connect(plugin , SIGNAL( deleteAllObjects() ) ,
2027  this , SLOT( slotDeleteAllObjects() ),Qt::DirectConnection);
2028 
2029  if ( checkSignal(plugin,"getAllFileFilters(QStringList&)" ) )
2030  connect(plugin , SIGNAL( getAllFileFilters(QStringList&) ) ,
2031  this , SLOT( slotGetAllFilters(QStringList&) ),Qt::DirectConnection);
2032 
2033  if ( checkSlot(plugin,"objectDeleted(int)" ) )
2034  connect(this , SIGNAL( objectDeleted( int ) ) ,
2035  plugin , SLOT( objectDeleted( int ) ),Qt::DirectConnection);
2036 
2037  }
2038 
2039  //Check if the plugin supports View-Interface
2040  ViewInterface* viewPlugin = qobject_cast< ViewInterface * >(plugin);
2041  if ( viewPlugin && OpenFlipper::Options::gui() ) {
2042  supported = supported + "View ";
2043 
2044  if ( checkSignal(plugin,"getStackWidget(QString,QWidget*&)" ) )
2045  connect(plugin , SIGNAL(getStackWidget( QString , QWidget*&)),
2046  coreWidget_ , SLOT( slotGetStackWidget( QString , QWidget*& ) ) ,Qt::DirectConnection );
2047  if ( checkSignal(plugin,"addStackWidget(QString,QWidget*)" ) )
2048  connect(plugin , SIGNAL(addStackWidget( QString , QWidget*)),
2049  coreWidget_ , SLOT( slotAddStackWidget( QString , QWidget* ) ) ,Qt::DirectConnection );
2050  if ( checkSignal(plugin,"updateStackWidget(QString,QWidget*)" ) )
2051  connect(plugin , SIGNAL(updateStackWidget( QString , QWidget*)),
2052  coreWidget_ , SLOT( slotUpdateStackWidget( QString , QWidget* ) ) ,Qt::DirectConnection );
2053  }
2054 
2055  //Check if the plugin supports Process-Interface
2056  ProcessInterface* processPlugin = qobject_cast< ProcessInterface * >(plugin);
2057  if ( processPlugin ) {
2058  supported = supported + "Process ";
2059 
2060  if ( checkSignal(plugin,"startJob(QString,QString,int,int,bool)" ) )
2061  connect(plugin , SIGNAL(startJob(QString, QString,int,int,bool)),
2062  this , SLOT( slotStartJob(QString, QString,int,int,bool) ), Qt::DirectConnection );
2063  else {
2064  errors += tr("Error: Process Interface defined but no startJob signal found!") + "\n";
2065  }
2066 
2067  if ( checkSignal(plugin,"setJobState(QString,int)" ) )
2068  connect(plugin , SIGNAL(setJobState(QString,int)),
2069  this , SLOT( slotSetJobState(QString,int) ), Qt::QueuedConnection );
2070  else {
2071  errors += tr("Error: Process Interface defined but no setJobState signal found!") + "\n";
2072  }
2073 
2074  if ( checkSignal(plugin,"setJobName(QString,QString)" ) )
2075  connect(plugin , SIGNAL(setJobName(QString, QString)),
2076  this , SLOT( slotSetJobName(QString, QString) ), Qt::QueuedConnection );
2077  else {
2078  errors += tr("Error: Process Interface defined but no setJobName signal found!") + "\n";
2079  }
2080 
2081  if ( checkSignal(plugin,"setJobDescription(QString,QString)" ) )
2082  connect(plugin , SIGNAL(setJobDescription(QString, QString)),
2083  this , SLOT( slotSetJobDescription(QString, QString) ), Qt::QueuedConnection );
2084  else {
2085  errors += tr("Error: Process Interface defined but no setJobDescription signal found!") + "\n";
2086  }
2087 
2088  if ( checkSignal(plugin,"cancelJob(QString)" ) )
2089  connect(plugin , SIGNAL(cancelJob(QString)),
2090  this , SLOT( slotCancelJob(QString) ), Qt::QueuedConnection );
2091 
2092  if ( checkSignal(plugin,"finishJob(QString)" ) )
2093  connect(plugin , SIGNAL(finishJob(QString)),
2094  this , SLOT( slotFinishJob(QString) ), Qt::QueuedConnection );
2095  else {
2096  errors += tr("Error: Process Interface defined but no finishJob signal found!") + "\n";
2097  }
2098 
2099  if ( checkSlot(plugin,"canceledJob(QString)" ) )
2100  connect(this , SIGNAL( jobCanceled( QString ) ) ,
2101  plugin , SLOT( canceledJob(QString) ),Qt::QueuedConnection);
2102  else {
2103  errors += tr("Error: Process Interface defined but no cancel canceledJob slot found!") + "\n";
2104  }
2105  }
2106 
2107  //Check if the plugin supports RPC-Interface
2108  RPCInterface* rpcPlugin = qobject_cast< RPCInterface * >(plugin);
2109  if ( rpcPlugin ) {
2110  supported = supported + "RPC ";
2111 
2112  if ( checkSignal(plugin,"pluginExists(QString,bool&)" ) )
2113  connect(plugin , SIGNAL( pluginExists(QString,bool&) ),
2114  this , SLOT( slotPluginExists(QString,bool&) ) ,Qt::DirectConnection );
2115  if ( checkSignal(plugin,"functionExists(QString,QString,bool&)" ) )
2116  connect(plugin , SIGNAL(functionExists(QString,QString,bool&)),
2117  this , SLOT( slotFunctionExists(QString,QString,bool&) ) ,Qt::DirectConnection );
2118  if ( checkSignal(plugin,"call(QString,QString,bool&)" ) )
2119  connect(plugin , SIGNAL(call(QString,QString,bool&)),
2120  this , SLOT(slotCall(QString,QString,bool&)) ,Qt::DirectConnection );
2121  if ( checkSignal(plugin,"call(QString,bool&)" ) )
2122  connect(plugin , SIGNAL(call(QString,bool&)),
2123  this , SLOT(slotCall(QString,bool&)) ,Qt::DirectConnection );
2124  if ( checkSignal(plugin,"getValue(QString,QVariant&)" ) )
2125  connect(plugin , SIGNAL(getValue(QString,QVariant&)),
2126  this , SLOT(slotGetValue(QString,QVariant&)) ,Qt::DirectConnection );
2127  }
2128 
2129  //Check if the plugin supports PluginConnectionInterface
2130  PluginConnectionInterface* interconnectionPlugin = qobject_cast< PluginConnectionInterface * >(plugin);
2131  if ( interconnectionPlugin ) {
2132  supported = supported + "Plugin Interconnection ";
2133 
2134  if ( checkSignal(plugin,"crossPluginConnect(QString,const char*,QString,const char*)" ) ) {
2135  connect(plugin , SIGNAL( crossPluginConnect(QString,const char*,QString,const char*) ),
2136  this , SLOT( slotCrossPluginConnect(QString,const char*,QString,const char*) ));
2137  }
2138 
2139  if ( checkSignal(plugin,"crossPluginConnectQueued(QString,const char*,QString,const char*)" ) ) {
2140  connect(plugin , SIGNAL( crossPluginConnectQueued(QString,const char*,QString,const char*) ),
2141  this , SLOT( slotCrossPluginConnectQueued(QString,const char*,QString,const char*) ));
2142  }
2143  }
2144 
2145  //Check if the plugin supports RenderInterface
2146  RenderInterface* renderPlugin = qobject_cast< RenderInterface * >(plugin);
2147  if ( renderPlugin ) {
2148  supported = supported + "Rendering ";
2149 
2150  if ( checkSlot( plugin , "rendererName()" ) ) {
2151  QString rendererNameString = "";
2152 
2153  // Get the name of the renderer
2154  QMetaObject::invokeMethod(plugin,"rendererName", Qt::DirectConnection, Q_RETURN_ARG(QString,rendererNameString) ) ;
2155 
2156  // Let the plugin check its OpenGL support requirements
2157  QString openGLCheck = "";
2158  QMetaObject::invokeMethod(plugin,"checkOpenGL", Qt::DirectConnection, Q_RETURN_ARG(QString,openGLCheck) ) ;
2159 
2160  if ( openGLCheck != "" ) {
2161  errors += tr("Error: Insufficient OpenGL capabilities in Renderer Plugin ") + rendererNameString + " !" + "\n";
2162  errors += openGLCheck + "\n";
2163 
2164  printPluginLoadLog(errors, warnings);
2165 
2166  info.errors = errors;
2167  info.warnings = warnings;
2168 
2169  PluginStorage::pluginsFailed().push_back(info);
2170 
2171  return;
2172  }
2173 
2174  // Check if it already exists and add it if not.
2175  RendererInfo* rendererInfo = 0;
2176  if ( ! renderManager().rendererExists(rendererNameString) ) {
2177  rendererInfo = renderManager().newRenderer(rendererNameString);
2178  } else {
2179  errors += tr("Error: Renderer Plugin %1 already exists") + "\n";
2180  }
2181 
2182  // Retrieve and store renderer information
2183  if ( rendererInfo != 0) {
2184  rendererInfo->plugin = renderPlugin;
2185  rendererInfo->name = basePlugin->name();
2186  rendererInfo->version = basePlugin->version();
2187  rendererInfo->description = basePlugin->description();
2188 
2189  ACG::SceneGraph::DrawModes::DrawMode supportedModes;
2190 
2191  // Get the supported draw modes of the renderer
2192  QMetaObject::invokeMethod(plugin,"supportedDrawModes", Q_ARG(ACG::SceneGraph::DrawModes::DrawMode& ,supportedModes) );
2193 
2194  rendererInfo->modes = supportedModes;
2195 
2196  if ( checkSlot( plugin , "optionsAction()" ) ) {
2197  //Get an action for the post processor options
2198  rendererInfo->optionsAction = renderPlugin->optionsAction();
2199 
2200  } else {
2201  rendererInfo->optionsAction = 0;
2202  }
2203  }
2204 
2205  } else {
2206  errors += tr("Error: Renderer Plugin without rendererName Function?!") + "\n";
2207  }
2208 
2209  }
2210 
2211  //Check if the plugin supports PostProcessorInterface
2212  PostProcessorInterface* postProcessorPlugin = qobject_cast< PostProcessorInterface * >(plugin);
2213  if ( postProcessorPlugin ) {
2214  supported = supported + "PostProcessor ";
2215 
2216  if ( checkSlot( plugin , "postProcessorName()" ) ) {
2217  QString postProcessorNameString = "";
2218 
2219  // Get the name of the PostProcessor
2220  QMetaObject::invokeMethod(plugin,"postProcessorName", Qt::DirectConnection, Q_RETURN_ARG(QString,postProcessorNameString) ) ;
2221 
2222  // Let the plugin check its OpenGL support requirements
2223  QString openGLCheck = "";
2224  QMetaObject::invokeMethod(plugin,"checkOpenGL", Qt::DirectConnection, Q_RETURN_ARG(QString,openGLCheck) ) ;
2225 
2226  if ( openGLCheck != "" ) {
2227  errors += tr("Error: Insufficient OpenGL capabilities in post processor Plugin ") + postProcessorNameString + " !" + "\n";
2228  errors += openGLCheck + "\n";
2229 
2230  info.errors = errors;
2231  info.warnings = warnings;
2232 
2233  PluginStorage::pluginsFailed().push_back(info);
2234 
2235  return;
2236  }
2237 
2238  // Check if it already exists and add it if not.
2239  PostProcessorInfo* postProcessorInfo = 0;
2240  if ( ! postProcessorManager().postProcessorExists(postProcessorNameString) ) {
2241  postProcessorInfo = postProcessorManager().newPostProcessor(postProcessorNameString);
2242  } else {
2243  errors += tr("Error: PostProcessor Plugin %1 already exists").arg(postProcessorNameString) + "\n";
2244  }
2245 
2246  // Retrieve and store PostProcessor information
2247  if ( postProcessorInfo != 0) {
2248  postProcessorInfo->plugin = postProcessorPlugin;
2249  postProcessorInfo->name = basePlugin->name();
2250  postProcessorInfo->version = basePlugin->version();
2251  postProcessorInfo->description = basePlugin->description();
2252 
2253  if ( checkSlot( plugin , "optionsAction()" ) ) {
2254  //Get an action for the post processor options
2255  postProcessorInfo->optionsAction = postProcessorPlugin->optionsAction();
2256 
2257  } else {
2258  postProcessorInfo->optionsAction = 0;
2259  }
2260  }
2261 
2262  } else {
2263  errors += tr("Error: PostProcessor Plugin without postProcessorName Function?!") + "\n";
2264  }
2265  }
2266 
2267  //Check if the plugin supports AboutInfo-Interface
2268  AboutInfoInterface* aboutInfoPlugin = qobject_cast< AboutInfoInterface * >(plugin);
2269  if ( aboutInfoPlugin && OpenFlipper::Options::gui() ) {
2270  supported = supported + "AboutInfo ";
2271 
2272  if ( checkSignal(plugin,"addAboutInfo(QString,QString)") )
2273  connect(plugin , SIGNAL(addAboutInfo(QString,QString)),
2274  coreWidget_ , SLOT(addAboutInfo(QString,QString)),Qt::DirectConnection);
2275  }
2276 
2277  //========================================================================================
2278  // === Collect Scripting Information for Plugin ============================
2279 
2280  QScriptValue scriptInstance = scriptEngine_.newQObject(plugin,
2281  QScriptEngine::QtOwnership,
2282  QScriptEngine::ExcludeChildObjects |
2283  QScriptEngine::ExcludeSuperClassMethods |
2284  QScriptEngine::ExcludeSuperClassProperties
2285  );
2286 
2287  // Make plugin available for scripting
2288  QString scriptingName = info.rpcName;
2289 
2290  scriptEngine_.globalObject().setProperty(scriptingName, scriptInstance);
2291 
2292  QScriptValueIterator it(scriptInstance);
2293  while (it.hasNext()) {
2294  it.next();
2295 
2297  if ( checkSignal( plugin, it.name().toLatin1() ) )
2298  continue;
2299 
2300  info.rpcFunctions.push_back( it.name() );
2301 
2302  scriptingFunctions_.push_back( scriptingName + "." + it.name() );
2303 
2304  }
2305 
2306  //Check if the plugin supports RPC-Interface
2307  ScriptInterface* scriptPlugin = qobject_cast< ScriptInterface * >(plugin);
2308  if ( scriptPlugin ) {
2309  supported = supported + "Scripting ";
2310 
2311  // Create intermediate wrapper class which will mangle the call information
2312  ScriptingWrapper* newScript = new ScriptingWrapper(info.rpcName);
2313  scriptingWrappers_.push_back(newScript);
2314 
2315  //========= Part one, Scriptinfos via wrapper to core and than to scipting Plugin ==========
2316 
2317  if ( checkSignal(plugin,"scriptInfo(QString)" ) ) {
2318 
2319  // Plugin to wrapper
2320  connect(plugin , SIGNAL( scriptInfo(QString) ),
2321  newScript , SLOT( slotScriptInfo(QString) ) ,Qt::DirectConnection );
2322 
2323  // wrapper to core
2324  connect(newScript , SIGNAL( scriptInfo(QString,QString) ),
2325  this , SLOT( slotScriptInfo(QString,QString) ));
2326  }
2327 
2328  // Core to plugins ( normally only one scripting plugin)
2329  if ( checkSlot(plugin,"slotScriptInfo(QString,QString)") ) {
2330  connect(this , SIGNAL(scriptInfo(QString,QString)),
2331  plugin , SLOT(slotScriptInfo(QString,QString)));
2332  }
2333 
2334  // Function descriptions
2335  if ( checkSignal(plugin,"getDescription(QString,QString&,QStringList&,QStringList&)") )
2336  connect(plugin , SIGNAL( getDescription(QString,QString&,QStringList&,QStringList&) ),
2337  this , SLOT( slotGetDescription(QString,QString&,QStringList&,QStringList&) ));
2338 
2339  //========= Script Execution ==========
2340 
2341  // Plugins to Core
2342  if ( checkSignal(plugin,"executeScript(QString)") )
2343  connect(plugin , SIGNAL(executeScript(QString)),
2344  this , SLOT(slotExecuteScript(QString)));
2345 
2346  // Plugins to Core
2347  if ( checkSignal(plugin,"executeFileScript(QString)") )
2348  connect(plugin , SIGNAL(executeFileScript(QString)),
2349  this , SLOT(slotExecuteFileScript(QString)));
2350 
2351  // Core to plugins ( normally only one scripting plugin)
2352  if ( checkSlot(plugin,"slotExecuteScript(QString)") )
2353  connect(this , SIGNAL(executeScript(QString)),
2354  plugin , SLOT(slotExecuteScript(QString)));
2355 
2356  // Core to plugins ( normally only one scripting plugin)
2357  if ( checkSlot(plugin,"slotExecuteFileScript(QString)") )
2358  connect(this , SIGNAL(executeFileScript(QString)),
2359  plugin , SLOT(slotExecuteFileScript(QString)));
2360 
2361  //========= Engine ==========
2362 
2363  // Plugins to Core
2364  if ( checkSignal(plugin,"getScriptingEngine(QScriptEngine*&)") )
2365  connect(plugin , SIGNAL(getScriptingEngine(QScriptEngine*&)),
2366  this , SLOT(slotGetScriptingEngine(QScriptEngine*&)));
2367 
2368  // Plugins to Core
2369  if ( checkSignal(plugin,"getAvailableFunctions(QStringList&)") )
2370  connect(plugin , SIGNAL(getAvailableFunctions(QStringList&)),
2371  this , SLOT(slotGetAllAvailableFunctions(QStringList&)));
2372 
2373  }
2374 
2375  //========================================================================================
2376 
2377  info.status = PluginInfo::LOADED;
2378  info.errors = errors;
2379  info.warnings = warnings;
2380 
2381  if (alreadyLoadedAt != -1) {
2382  plugins()[alreadyLoadedAt] = info;
2383  }
2384  else
2385  plugins().push_back(info);
2386 
2387  printPluginLoadLog(errors, warnings);
2388 
2389 
2390  // Initialize Plugin
2391  if ( basePlugin ) {
2392  if ( checkSlot(plugin,"initializePlugin()") )
2393  QMetaObject::invokeMethod(plugin, "initializePlugin", Qt::DirectConnection);
2394  }
2395 
2396 
2397  //Check if its a filePlugin
2398  FileInterface* filePlugin = qobject_cast< FileInterface * >(plugin);
2399  if ( filePlugin ){
2400  supported = supported + "File ";
2401 
2402  QStringList loadFilters = filePlugin->getLoadFilters().split(";;");
2403  QStringList saveFilters = filePlugin->getSaveFilters().split(";;");
2404 
2405  // Collect supported Data from file plugin
2406  for (int i = 0; i < loadFilters.size(); ++i) {
2407  fileTypes ft;
2408  ft.name = basePlugin->name();
2409  ft.type = filePlugin->supportedType();
2410  ft.loadFilters = loadFilters[i];
2411  ft.saveFilters = "";
2412  ft.plugin = filePlugin;
2413  ft.object = plugin;
2414  ft.saveMultipleObjects = checkSlot(plugin,"saveObjects(IdList,QString)");
2415 
2416  supportedTypes().push_back(ft);
2417  }
2418  for (int i = 0; i < saveFilters.size(); ++i) {
2419  fileTypes ft;
2420  ft.name = basePlugin->name();
2421  ft.type = filePlugin->supportedType();
2422  ft.loadFilters = "";
2423  ft.saveFilters = saveFilters[i];
2424  ft.plugin = filePlugin;
2425  ft.object = plugin;
2426  ft.saveMultipleObjects = checkSlot(plugin,"saveObjects(IdList,QString)");
2427 
2428  supportedTypes().push_back(ft);
2429  }
2430 
2431 
2432  if ( checkSignal(plugin,"openedFile(int)" ) )
2433  connect(plugin , SIGNAL( openedFile( int ) ) ,
2434  this , SLOT( slotFileOpened ( int ) ),Qt::DirectConnection);
2435  }
2436 
2437  //Check if it's a typePlugin
2438  TypeInterface* typePlugin = qobject_cast< TypeInterface * >(plugin);
2439  if ( typePlugin ){
2440  supported = supported + "Type ";
2441 
2442  // Call register type
2443  typePlugin->registerType();
2444 
2445  // Collect supported Data from type plugin
2446  dataTypes dt;
2447  dt.name = basePlugin->name();
2448  dt.type = typePlugin->supportedType();
2449  dt.plugin = typePlugin;
2450 
2451  // Add type info
2452  supportedDataTypes_.push_back(dt);
2453 
2454  // Connect signals ( But only if we not already connected in in the loadsave interface )
2455  if ( !LoadSavePlugin && checkSignal(plugin,"emptyObjectAdded(int)" ) )
2456  connect(plugin , SIGNAL( emptyObjectAdded( int ) ) ,
2457  this , SLOT( slotEmptyObjectAdded ( int ) ),Qt::DirectConnection);
2458  }
2459 
2460  MetadataInterface* metadataPlugin = qobject_cast< MetadataInterface * >(plugin);
2461  if ( metadataPlugin ) {
2462  if (checkSlot(plugin, "slotGenericMetadataDeserialized(QString,QString)")) {
2463  connect(this, SIGNAL(genericMetadataDeserialized(QString, QString)),
2464  plugin, SLOT(slotGenericMetadataDeserialized(QString, QString)));
2465  }
2466  if (checkSlot(plugin, "slotObjectMetadataDeserialized(QString,QString)")) {
2467  connect(this, SIGNAL(objectMetadataDeserialized(QString, QString)),
2468  plugin, SLOT(slotObjectMetadataDeserialized(QString, QString)));
2469  }
2470  if (checkSlot(plugin, "slotObjectMetadataDeserializedJson(QString,QJsonDocument)")) {
2471  connect(this, SIGNAL(objectMetadataDeserializedJson(QString, QJsonDocument)),
2472  plugin, SLOT(slotObjectMetadataDeserializedJson(QString, QJsonDocument)));
2473  }
2474  if (checkSignal(plugin, "metadataDeserialized(QVector<QPair<QString,QString> >)")) {
2475  connect(plugin, SIGNAL(metadataDeserialized(QVector<QPair<QString, QString> >)),
2476  this, SLOT(slotMetadataDeserialized(QVector<QPair<QString, QString> >)));
2477  }
2478  }
2479 
2480  //========================================================================================
2481 
2482 
2483 
2484 
2485 }
QWidget * optionsWidget
Pointer to plugins options widget (if available)
Definition: PluginInfo.hh:173
Interface class for Plugins which have to store information in ini files.
Definition: INIInterface.hh:60
DLLEXPORT OpenFlipperQSettings & OpenFlipperSettings()
QSettings object containing all program settings of OpenFlipper.
Interface class for adding copy protection and license management to a plugin.
Interface class for creating custom context menus.
QString name
Name of the plugin ( requested from the plugin on load)
Definition: RendererInfo.hh:67
Update type class.
Definition: UpdateType.hh:60
Interface to call functions across plugins.
Definition: RPCInterface.hh:61
About Info interface.
Interface class for Thread handling.
void slotLoadPlugin()
Load Plugins from menu.
QObject * plugin
Pointer to the loaded plugin (Already casted when loading it)
Definition: PluginInfo.hh:125
virtual QString version()
Return a version string for your plugin.
Logtype
Log types for Message Window.
QString version
Version of the plugin ( requested from the plugin on load)
Definition: RendererInfo.hh:70
QString path
Path to the plugin ( set on load )
Definition: PluginInfo.hh:137
QString name
Name of the plugin ( requested from the plugin on load)
Interface for all plugins which want to Load or Save files and create Objects.
Control OpenFlippers status bar.
virtual QString description()=0
Return a description of what the plugin is doing.
void slotUnBlockPlugin(const QString &_rpcName)
Function for UnBlocking Plugins. Plugins will not loaded automatically.
Interface class for providing information on objects.
bool checkSignal(QObject *_plugin, const char *_signalSignature)
Check if a plugin has a signal.
void slotShowPlugins()
Show Plugins Dialog.
Interface for all Plugins which provide scriptable Functions.
void run()
preload function
ACG::SceneGraph::DrawModes::DrawMode modes
Supported DrawModes.
Definition: RendererInfo.hh:76
bool buildIn
Indicates, if the plugin is a built in Plugin (in Plugin directory)
Definition: PluginInfo.hh:176
QString description
Description of the plugin ( requested from the plugin on load)
Definition: PluginInfo.hh:131
Interface class for type definitions.
virtual QString getSaveFilters()=0
void loadPlugin(const QString &_filename, const bool _silent, QString &_licenseErrors, QObject *_plugin=0)
Function for loading Plugins.
Provide texture support for a plugin.
QAction * optionsAction
Possible action to add an options action or menu to the system.
Definition: RendererInfo.hh:79
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
QString description
Description of the plugin ( requested from the plugin on load)
Definition: RendererInfo.hh:73
Interface class for receiving mouse events.
QPluginLoader * waitForNextLoader()
Interface class for adding view modes to the ui.
Interface for all Plugins which do logging to the logging window of the framework.
QStringList rpcFunctions
List of exported rpc slots.
Definition: PluginInfo.hh:149
void printPluginLoadLog(const QString &errors, const QString &warnings)
Print all info collected about plugin during loading.
QAction * optionsAction
Possible action to add an options action or menu to the system.
QString warnings
Store warnings encountered during plugin loading.
Definition: PluginInfo.hh:146
QString version
Version of the plugin.
Definition: PluginInfo.hh:134
QString rpcName
Clean rpc name of the plugin.
Definition: PluginInfo.hh:140
QString description
Description of the plugin.
Allow access to picking functions.
virtual QString name()=0
Return a name for the plugin.
void loaderReady(QPluginLoader *loader)
applicationStatus
Enum for the statusBar Status Icon.
PreloadThread(PreloadAggregator *aggregator)
Preload thread constructor.
Plugins can add its own toolbox to the main widget&#39;s toolbox area by using this interface.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Definition: DataTypes.hh:179
DLLEXPORT void registerTypes()
Definition: Types.cc:422
virtual DataType supportedType()=0
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Interface class from which all plugins have to be created.
virtual DataType supportedDataTypes()=0
Get data type for information requests.
Interface to add additional rendering functions from within plugins.
QString errors
Store errors encountered during plugin loading.
Definition: PluginInfo.hh:143
Enables implementers to react on deserialization of meta data.
Interface to add global image post processor functions from within plugins.
Add a toolbox to OpenFlipper.
QString name
Name of the plugin ( requested from the plugin on load)
Definition: PluginInfo.hh:128
PostProcessorInfo * newPostProcessor(QString _name)
Get a new post processor Instance.
virtual bool initializeOptionsWidget(QWidget *&_widget)=0
Initialize the Options Widget.
Keyboard Event Interface.
Definition: KeyInterface.hh:59
Interface for all plugins which want to use selection functions.
Predefined datatypes.
Definition: DataTypes.hh:83
Interface class for file handling.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
virtual QString getLoadFilters()=0
Options Dialog interface.
QString version
Version of the plugin.
Interface for all plugins which provide entries to the main menubar.
PostProcessorInterface * plugin
Pointer to the loaded plugin (Already casted when loading it)
void loadPlugins()
Load all plugins from default plugin directory and from INI-File.
virtual QAction * optionsAction()
Return options menu.
RenderInterface * plugin
Pointer to the loaded plugin (Already casted when loading it)
Definition: RendererInfo.hh:64
const QVector< QPair< QString, QString > > & pluginCommandLineOptions()
Get command line plugin settings as key-value pairs.
Allow to connect slots between plugins.
Defines the order in which plugins have to be loaded.
bool checkSlot(QObject *_plugin, const char *_slotSignature)
Check if a plugin has a slot.
RendererInfo * newRenderer(QString _name)
Get a new renderer Instance.
Definition: RendererInfo.cc:89
void expectLoaders(int count)
Interface class for backup handling.
void slotBlockPlugin(const QString &_rpcName)
Function for Blocking Plugins. Blocked plugins will unloaded and not loaded wthin the next starts...
Interface class for exporting functions to python.
virtual QAction * optionsAction()
Return options menu.
Class for the handling of simple configuration files.
Definition: INIFile.hh:99
virtual DataType supportedType()=0
Return your supported object type( e.g. DATA_TRIANGLE_MESH )