Esempio n. 1
0
bool OutputMap::canConfigurePlugin(const QString& pluginName)
{
    QLCOutPlugin* outputPlugin = plugin(pluginName);
    if (outputPlugin != NULL)
        return outputPlugin->canConfigure();
    else
        return false;
}
Esempio n. 2
0
void OutputMap::configurePlugin(const QString& pluginName)
{
	QLCOutPlugin* outputPlugin = plugin(pluginName);
	if (outputPlugin == NULL)
		QMessageBox::warning(_app, tr("Unable to configure plugin"),
				     tr("%1 not found").arg(pluginName));
	else
		outputPlugin->configure();
}
Esempio n. 3
0
void OutputMap::loadPlugins()
{
	QString path;

#ifdef __APPLE__
	path = QString("%1/../%2").arg(QCoreApplication::applicationDirPath())
				  .arg(OUTPUTPLUGINDIR);
#else
	path = QString(OUTPUTPLUGINDIR);
#endif

	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 output plugins from" << path;
		return;
	}

	/* Loop thru all files in the directory */
	QStringListIterator it(dir.entryList());
	while (it.hasNext() == true)
	{
		QLCOutPlugin* p;
		QString path;

		/* Attempt to load a plugin from the path */
		path = dir.absoluteFilePath(it.next());
		QPluginLoader loader(path, this);
		p = qobject_cast<QLCOutPlugin*> (loader.instance());
		if (p != NULL)
		{
			/* Check for duplicates */
			if (plugin(p->name()) == NULL)
			{
				/* New plugin. Append and init. */
				p->init();
				appendPlugin(p);
			}
			else
			{
				/* Duplicate plugin. Unload it. */
				qWarning() << "Discarded duplicate plugin"
					   << path;
				loader.unload();
			}
		}
		else
		{
			qWarning() << "Unable to load an output plugin from" 
				   << path << "because:"
				   << loader.errorString();
		}
	}
}
Esempio n. 4
0
QStringList OutputMap::pluginOutputs(const QString& pluginName)
{
	QLCOutPlugin* op = NULL;

	op = plugin(pluginName);
	if (op == NULL)
		return QStringList();
	else
		return op->outputs();
}
Esempio n. 5
0
QLCOutPlugin* OutputMap::plugin(const QString& name)
{
	QListIterator <QLCOutPlugin*> it(m_plugins);

	while (it.hasNext() == true)
	{
		QLCOutPlugin* plugin = it.next();
		if (plugin->name() == name)
			return plugin;
	}

	return NULL;
}
Esempio n. 6
0
QString OutputMap::pluginStatus(const QString& pluginName, t_output output)
{
	QLCOutPlugin* outputPlugin = NULL;
	QString info;

	if (pluginName != QString::null)
		outputPlugin = plugin(pluginName);

	if (outputPlugin != NULL)
		info = outputPlugin->infoText(output);
	else
		info = tr("No information");

	return info;
}
Esempio n. 7
0
QString OutputMap::pluginStatus(const QString& pluginName, quint32 output)
{
    QLCOutPlugin* outputPlugin = plugin(pluginName);
    if (outputPlugin != NULL)
    {
        return outputPlugin->infoText(output);
    }
    else
    {
        QString info;
        info += QString("<HTML><HEAD></HEAD><BODY>");
        info += QString("<H3>%1</H3>").arg(tr("Nothing selected"));
        info += QString("</BODY></HTML>");
        return info;
    }
}
Esempio n. 8
0
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();
        }
    }
}
Esempio n. 9
0
void OutputMap::slotConfigurationChanged()
{
    QLCOutPlugin* plugin = qobject_cast<QLCOutPlugin*> (QObject::sender());
    if (plugin == NULL) // The signal comes from a plugin that isn't guaranteed to behave
        return;

    for (quint32 i = 0; i < universes(); i++)
    {
        OutputPatch* op = patch(i);
        Q_ASSERT(op != NULL);
        if (op->plugin() == plugin)
        {
            m_universeMutex.lock();
            op->reconnect();
            m_universeMutex.unlock();
        }
    }

    emit pluginConfigurationChanged(plugin->name());
}
Esempio n. 10
0
void OutputMap::configurePlugin(const QString& pluginName)
{
	QLCOutPlugin* outputPlugin = plugin(pluginName);
	if (outputPlugin != NULL)
		outputPlugin->configure();
}