예제 #1
0
void OutputPatch_Test::dump()
{
    QByteArray uni(513, char(0));
    uni[0] = 100;
    uni[169] = 50;
    uni[511] = 25;

    OutputMap om(m_doc, 4);
    OutputPatch* op = new OutputPatch(this);

    OutputPluginStub* stub = static_cast<OutputPluginStub*>
                                (m_doc->ioPluginCache()->plugins().at(0));
    QVERIFY(stub != NULL);

    op->set(stub, 0);
    QVERIFY(stub->m_universe[0] == (char) 0);
    QVERIFY(stub->m_universe[169] == (char) 0);
    QVERIFY(stub->m_universe[511] == (char) 0);

    op->dump(uni);
    QVERIFY(stub->m_universe[0] == (char) 100);
    QVERIFY(stub->m_universe[169] == (char) 50);
    QVERIFY(stub->m_universe[511] == (char) 25);

    delete op;
}
예제 #2
0
void OutputMap::slotPluginConfigurationChanged(QLCIOPlugin* plugin)
{
    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());
}
예제 #3
0
bool OutputMap::feedBack(quint32 universe, quint32 channel, uchar value, const QString& key)
{
    if (universe >= quint32(m_fb_patch.size()))
        return false;

    OutputPatch* patch = m_fb_patch[universe];
    Q_ASSERT(patch != NULL);

    if (patch->plugin() != NULL && patch->output() != QLCIOPlugin::invalidLine())
    {
        patch->plugin()->sendFeedBack(patch->output(), channel, value, key);
        return true;
    }
    else
    {
        return false;
    }
}
예제 #4
0
파일: outputmap.cpp 프로젝트: speakman/qlc
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);
	}
}
예제 #5
0
void OutputMap::saveDefaults()
{
    QSettings settings;
    QString key;
    QString str;

    for (quint32 i = 0; i < universes(); i++)
    {
        OutputPatch* outputPatch = patch(i);
        Q_ASSERT(outputPatch != NULL);

        /* Plugin name */
        key = QString("/outputmap/universe%2/plugin/").arg(i);
        settings.setValue(key, outputPatch->pluginName());

        /* Plugin output */
        key = QString("/outputmap/universe%2/output/").arg(i);
        settings.setValue(key, str.setNum(outputPatch->output()));
    }
}
예제 #6
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());
}
예제 #7
0
void OutputPatch_Test::patch()
{
    OutputMap om(m_doc, 4);

    OutputPluginStub* stub = static_cast<OutputPluginStub*>
                                (m_doc->ioPluginCache()->plugins().at(0));
    QVERIFY(stub != NULL);

    OutputPatch* op = new OutputPatch(this);
    op->set(stub, 0);
    QVERIFY(op->m_plugin == stub);
    QVERIFY(op->m_output == 0);
    QVERIFY(op->pluginName() == stub->name());
    QVERIFY(op->outputName() == stub->outputs()[0]);
    QVERIFY(stub->m_openOutputs.size() == 1);
    QVERIFY(stub->m_openOutputs.at(0) == 0);

    op->set(stub, 3);
    QVERIFY(op->m_plugin == stub);
    QVERIFY(op->m_output == 3);
    QVERIFY(op->pluginName() == stub->name());
    QVERIFY(op->outputName() == stub->outputs()[3]);
    QVERIFY(stub->m_openOutputs.size() == 1);
    QVERIFY(stub->m_openOutputs.at(0) == 3);

    op->reconnect();
    QVERIFY(op->m_plugin == stub);
    QVERIFY(op->m_output == 3);
    QVERIFY(op->pluginName() == stub->name());
    QVERIFY(op->outputName() == stub->outputs()[3]);
    QVERIFY(stub->m_openOutputs.size() == 1);
    QVERIFY(stub->m_openOutputs.at(0) == 3);

    delete op;
    QVERIFY(stub->m_openOutputs.size() == 0);
}
예제 #8
0
InputOutputPatchEditor::InputOutputPatchEditor(QWidget* parent, quint32 universe, InputMap* inputMap, OutputMap* outputMap)
    : QWidget(parent)
    , m_inputMap(inputMap)
    , m_outputMap(outputMap)
    , m_universe(universe)
{
    Q_ASSERT(universe < m_inputMap->universes());
    Q_ASSERT(inputMap != NULL);
    Q_ASSERT(outputMap != NULL);

    setupUi(this);

    m_infoBrowser->setOpenExternalLinks(true);
    m_infoBrowser->setFixedHeight(250);

    InputPatch* inputPatch = m_inputMap->patch(universe);
    OutputPatch* outputPatch = m_outputMap->patch(universe);
    OutputPatch* feedbackPatch = m_outputMap->feedbackPatch(universe);

    Q_ASSERT(inputPatch != NULL);
    Q_ASSERT(outputPatch != NULL);

    /* Copy these so they can be applied if the user cancels */
    m_currentInputPluginName = inputPatch->pluginName();
    m_currentInput = inputPatch->input();
    m_currentProfileName = inputPatch->profileName();
    //m_currentFeedbackEnabled = inputPatch->feedbackEnabled();

    m_currentOutputPluginName = outputPatch->pluginName();
    m_currentOutput = outputPatch->output();

    m_currentFeedbackPluginName = feedbackPatch->pluginName();
    m_currentFeedback = feedbackPatch->output();

    m_mapTree->header()->setResizeMode(QHeaderView::ResizeToContents);
    m_mapTree->setSortingEnabled(true);
    m_mapTree->sortByColumn(KMapColumnPluginName, Qt::AscendingOrder);

    /* Setup UI controls */
    setupMappingPage();
    setupProfilePage();

    /* Select the top-most "None" item */
    m_mapTree->setCurrentItem(m_mapTree->topLevelItem(0));

    /* Listen to plugin configuration changes */
    connect(m_inputMap, SIGNAL(pluginConfigurationChanged(const QString&)),
            this, SLOT(slotPluginConfigurationChanged(const QString&)));
    /* Listen to plugin configuration changes */
    connect(m_outputMap, SIGNAL(pluginConfigurationChanged(const QString&)),
            this, SLOT(slotPluginConfigurationChanged(const QString&)));
}
예제 #9
0
void InputOutputManager::updateItem(QTreeWidgetItem* item, quint32 universe)
{
    Q_ASSERT(item != NULL);

    InputPatch* ip = m_inputMap->patch(universe);
    OutputPatch* op = m_outputMap->patch(universe);
    OutputPatch* fp = m_outputMap->feedbackPatch(universe);
    Q_ASSERT(ip != NULL);

    item->setText(KColumnUniverse, QString::number(universe + 1));
    item->setText(KColumnInput, QString("[%1] %2").arg(ip->pluginName()).arg(ip->inputName()));
    item->setText(KColumnOutput, QString("[%1] %2").arg(op->pluginName()).arg(op->outputName()));
    item->setText(KColumnFeedback, QString("[%1] %2").arg(fp->pluginName()).arg(fp->outputName()));
    item->setText(KColumnProfile, ip->profileName());
    item->setText(KColumnInputNum, QString::number(ip->input() + 1));
    item->setText(KColumnOutputNum, QString::number(op->output() + 1));

    m_tree->resizeColumnToContents(KColumnUniverse);
    m_tree->resizeColumnToContents(KColumnInput);
    m_tree->resizeColumnToContents(KColumnOutput);
    m_tree->resizeColumnToContents(KColumnProfile);
}
예제 #10
0
InputOutputPatchEditor::InputOutputPatchEditor(QWidget* parent, quint32 universe, InputOutputMap *ioMap, Doc *doc)
    : QWidget(parent)
    , m_ioMap(ioMap)
    , m_doc(doc)
    , m_universe(universe)
    , m_currentInputPluginName(KInputNone)
    , m_currentInput(QLCIOPlugin::invalidLine())
    , m_currentOutputPluginName(KOutputNone)
    , m_currentOutput(QLCIOPlugin::invalidLine())
    , m_currentProfileName(KInputNone)
    , m_currentFeedbackPluginName(KOutputNone)
    , m_currentFeedback(QLCIOPlugin::invalidLine())
{
    Q_ASSERT(universe < m_ioMap->universes());
    Q_ASSERT(ioMap != NULL);

    setupUi(this);

    m_infoBrowser->setOpenExternalLinks(true);
    m_infoBrowser->setFixedHeight(250);

    InputPatch* inputPatch = m_ioMap->inputPatch(universe);
    OutputPatch* outputPatch = m_ioMap->outputPatch(universe);
    OutputPatch* feedbackPatch = m_ioMap->feedbackPatch(universe);

    /* Copy these so they can be applied if the user cancels */
    if (inputPatch != NULL)
    {
        m_currentInputPluginName = inputPatch->pluginName();
        m_currentInput = inputPatch->input();
        m_currentProfileName = inputPatch->profileName();
    }

    if (outputPatch != NULL)
    {
        m_currentOutputPluginName = outputPatch->pluginName();
        m_currentOutput = outputPatch->output();
    }

    if (feedbackPatch != NULL)
    {
        m_currentFeedbackPluginName = feedbackPatch->pluginName();
        m_currentFeedback = feedbackPatch->output();
    }

    m_mapTree->setSortingEnabled(true);
    m_mapTree->sortByColumn(KMapColumnPluginName, Qt::AscendingOrder);

    /* Setup UI controls */
    setupMappingPage();
    setupProfilePage();

    fillAudioTree();

    /* Listen to itemChanged() signals to catch check state changes */
    connect(m_audioMapTree, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
            this, SLOT(slotAudioDeviceItemChanged(QTreeWidgetItem*, int)));

    /* Select the top-most "None" item */
    m_mapTree->setCurrentItem(m_mapTree->topLevelItem(0));

    /* Listen to plugin configuration changes */
    connect(m_ioMap, SIGNAL(pluginConfigurationChanged(const QString&)),
            this, SLOT(slotPluginConfigurationChanged(const QString&)));
    /* Listen to plugin configuration changes */
    connect(m_ioMap, SIGNAL(pluginConfigurationChanged(const QString&)),
            this, SLOT(slotPluginConfigurationChanged(const QString&)));
}