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