int OutputMap_Test::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: initial(); break; case 1: appendPlugin(); break; case 2: notOutputPlugin(); break; case 3: setPatch(); break; case 4: claimReleaseDumpReset(); break; case 5: blackout(); break; case 6: pluginNames(); break; case 7: pluginOutputs(); break; case 8: universeNames(); break; case 9: configure(); break; case 10: slotConfigurationChanged(); break; case 11: mapping(); break; case 12: pluginStatus(); break; default: ; } _id -= 13; } return _id; }
void InputMap::loadPlugins() { QString path; #ifdef __APPLE__ path = QString("%1/../%2").arg(QApplication::applicationDirPath()) .arg(INPUTPLUGINDIR); #else path = QString(INPUTPLUGINDIR); #endif /* Find plugins from input plugin dir, sort by name, get regular files */ QDir dir(path, QString("*%1").arg(PLUGINEXT), QDir::Name, QDir::Files); /* Check that we can access the directory */ if (dir.exists() == false || dir.isReadable() == false) { qWarning() << "Unable to load input plugins from" << dir.absolutePath(); return; } /* Loop thru all files in the directory */ QStringListIterator it(dir.entryList()); while (it.hasNext() == true) { QLCInPlugin* p; QString path; /* Attempt to load a plugin from the path */ path = dir.absoluteFilePath(it.next()); QPluginLoader loader(path, this); p = qobject_cast<QLCInPlugin*> (loader.instance()); if (p != NULL) { /* Check for duplicates */ if (plugin(p->name()) == NULL) { /* New plugin. Append and init. */ p->init(); appendPlugin(p); p->connectInputData(this); } else { /* Duplicate plugin. Unload it. */ qWarning() << "Discarded duplicate plugin" << path; loader.unload(); } } else { qWarning() << "Unable to load an input plugin from" << path << "because:" << loader.errorString(); } } }
void OutputMap::initPatch() { /* Create a dummy output plugin and put it to the plugins list */ m_dummyOut = new DummyOutPlugin(); m_dummyOut->init(); appendPlugin(m_dummyOut); for (int i = 0; i < m_universes; i++) { OutputPatch* outputPatch; /* The dummy output plugin provides always as many outputs as QLC has supported universes. So, assign each of these outputs, by default, to each universe */ outputPatch = new OutputPatch(this); outputPatch->set(m_dummyOut, i); m_patch.insert(i, outputPatch); } }
void OutputMap::loadPlugins(const QDir& dir) { /* Check that we can access the directory */ if (dir.exists() == false || dir.isReadable() == false) return; /* Loop thru all files in the directory */ QStringListIterator it(dir.entryList()); while (it.hasNext() == true) { /* Attempt to load a plugin from the path */ QString fileName(it.next()); QString path = dir.absoluteFilePath(fileName); QPluginLoader loader(path, this); QLCOutPlugin* p = qobject_cast<QLCOutPlugin*> (loader.instance()); if (p != NULL) { /* Check for duplicates */ if (plugin(p->name()) == NULL) { /* New plugin. Append and init. */ qDebug() << "Output plugin" << p->name() << "from" << fileName; p->init(); appendPlugin(p); QLCi18n::loadTranslation(p->name().replace(" ", "_")); } else { /* Duplicate plugin. Unload it. */ qWarning() << Q_FUNC_INFO << "Discarded duplicate output plugin" << path; loader.unload(); } } else { qWarning() << Q_FUNC_INFO << fileName << "doesn't contain a QLC output plugin:" << loader.errorString(); loader.unload(); } } }