void OutputMap::saveDefaults() { QSettings settings; QString key; QString str; for (quint32 i = 0; i < universes(); i++) { OutputPatch* outputPatch = patch(i); OutputPatch* fbPatch = feedbackPatch(i); Q_ASSERT(outputPatch != NULL); Q_ASSERT(fbPatch != 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())); /* Plugin name */ key = QString("/outputmap/universe%2/feedbackplugin/").arg(i); settings.setValue(key, fbPatch->pluginName()); /* Plugin output */ key = QString("/outputmap/universe%2/feedback/").arg(i); settings.setValue(key, str.setNum(fbPatch->output())); } }
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&))); }
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); }
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); }
void OutputMap::saveDefaults() { QSettings settings; QString key; QString str; for (int i = 0; i < KUniverseCount; i++) { OutputPatch* outputPatch = patch(i); Q_ASSERT(outputPatch != NULL); Q_ASSERT(outputPatch->plugin() != 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())); } }
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&))); }