void GrandMasterSlider::sendFeedback() { quint32 universe = VirtualConsole::instance()->properties().grandMasterInputUniverse(); quint32 channel = VirtualConsole::instance()->properties().grandMasterInputChannel(); QString chName; if (universe == InputOutputMap::invalidUniverse() || channel == QLCChannel::invalid()) return; InputPatch* pat = m_ioMap->inputPatch(universe); if (pat != NULL) { QLCInputProfile* profile = pat->profile(); if (profile != NULL) { QLCInputChannel* ich = profile->channel(channel); if (ich != NULL) chName = ich->name(); } } if (m_slider->invertedAppearance()) m_ioMap->sendFeedBack(universe, channel, UCHAR_MAX - m_slider->value(), chName); else m_ioMap->sendFeedBack(universe, channel, m_slider->value(), chName); }
void SelectInputChannel::fillTree() { QLCInputChannel* channel; QTreeWidgetItem* uniItem; QTreeWidgetItem* chItem; QLCInputProfile* profile; quint32 uni; InputPatch* patch; /* Add an option to select no input at all */ chItem = new QTreeWidgetItem(m_tree); chItem->setText(KColumnName, KInputNone); chItem->setText(KColumnUniverse, QString("%1") .arg(InputMap::invalidUniverse())); chItem->setText(KColumnChannel, QString("%1") .arg(KInputChannelInvalid)); for (uni = 0; uni < _app->inputMap()->universes(); uni++) { /* Get the patch associated to the current universe */ patch = _app->inputMap()->patch(uni); Q_ASSERT(patch != NULL); /* Make an item for each universe */ uniItem = new QTreeWidgetItem(m_tree); updateUniverseItem(uniItem, uni, patch); if (patch->plugin() != NULL && patch->input() != KInputInvalid) { /* Add a manual option to each patched universe */ chItem = new QTreeWidgetItem(uniItem); updateChannelItem(chItem, uni, NULL, NULL); } /* Add known channels from profile (if any) */ profile = patch->profile(); if (profile != NULL) { QMapIterator <quint32, QLCInputChannel*> it(profile->channels()); while (it.hasNext() == true) { channel = it.next().value(); Q_ASSERT(channel != NULL); chItem = new QTreeWidgetItem(uniItem); updateChannelItem(chItem, uni, channel, profile); } } } /* Listen to item changed signals so that we can catch user's manual input for <...> nodes. Connect AFTER filling the tree so all the initial item->setText()'s won't get caught here. */ connect(m_tree, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(slotItemChanged(QTreeWidgetItem*,int))); }
void InputSelectionWidget::updateInputSource() { QString uniName; QString chName; if (!m_inputSource || m_doc->inputOutputMap()->inputSourceNames(m_inputSource, uniName, chName) == false) { uniName = KInputNone; chName = KInputNone; m_lowerSpin->setEnabled(false); m_upperSpin->setEnabled(false); } else { m_lowerSpin->blockSignals(true); m_upperSpin->blockSignals(true); uchar min = 0, max = UCHAR_MAX; InputPatch *ip = m_doc->inputOutputMap()->inputPatch(m_inputSource->universe()); if (ip != NULL && ip->profile() != NULL) { QLCInputChannel *ich = ip->profile()->channel(m_inputSource->channel()); if (ich != NULL && ich->type() == QLCInputChannel::Button) { min = ich->lowerValue(); max = ich->upperValue(); } } m_lowerSpin->setValue((m_inputSource->lowerValue() != 0) ? m_inputSource->lowerValue() : min); m_upperSpin->setValue((m_inputSource->upperValue() != UCHAR_MAX) ? m_inputSource->upperValue() : max); if (m_lowerSpin->value() != 0 || m_upperSpin->value() != UCHAR_MAX) m_customFbButton->setChecked(true); m_lowerSpin->blockSignals(false); m_upperSpin->blockSignals(false); m_lowerSpin->setEnabled(true); m_upperSpin->setEnabled(true); } m_inputUniverseEdit->setText(uniName); m_inputChannelEdit->setText(chName); }
bool VCPropertiesEditor::inputSourceNames(quint32 universe, quint32 channel, QString& uniName, QString& chName) const { if (universe == InputMap::invalidUniverse() || channel == InputMap::invalidChannel()) { /* Nothing selected for input universe and/or channel */ return false; } InputPatch* patch = m_inputMap->patch(universe); if (patch == NULL || patch->plugin() == NULL) { /* There is no patch for the given universe */ return false; } QLCInputProfile* profile = patch->profile(); if (profile == NULL) { /* There is no profile. Display plugin name and channel number. Boring. */ uniName = patch->plugin()->name(); chName = tr("%1: Unknown").arg(channel + 1); } else { QLCInputChannel* ich; QString name; /* Display profile name for universe */ uniName = QString("%1: %2").arg(universe + 1).arg(profile->name()); /* User can input the channel number by hand, so put something rational to the channel name in those cases as well. */ ich = profile->channel(channel); if (ich != NULL) name = ich->name(); else name = tr("Unknown"); /* Display channel name */ chName = QString("%1: %2").arg(channel + 1).arg(name); } return true; }
bool InputMap::inputSourceNames(const QLCInputSource& src, QString& uniName, QString& chName) const { if (src.isValid() == false) return false; InputPatch* pat = this->patch(src.universe()); if (pat == NULL) { /* There is no patch for the given universe */ return false; } QLCInputProfile* profile = pat->profile(); if (profile == NULL) { /* There is no profile. Display plugin name and channel number. */ if (pat->plugin() != NULL) uniName = QString("%1: %2").arg(src.universe() + 1).arg(pat->plugin()->name()); else uniName = QString("%1: ??").arg(src.universe() + 1); chName = QString("%1: ?").arg(src.channel() + 1); } else { QLCInputChannel* ich; QString name; /* Display profile name for universe */ uniName = QString("%1: %2").arg(src.universe() + 1).arg(profile->name()); /* User can input the channel number by hand, so put something rational to the channel name in those cases as well. */ ich = profile->channel(src.channel()); if (ich != NULL) name = ich->name(); else name = QString("?"); /* Display channel name */ chName = QString("%1: %2").arg(src.channel() + 1).arg(name); } return true; }
bool InputOutputMap::setInputPatch(quint32 universe, const QString &pluginName, quint32 input, const QString &profileName) { /* Check that the universe that we're doing mapping for is valid */ if (universe >= universes()) { qWarning() << Q_FUNC_INFO << "Universe" << universe << "out of bounds."; return false; } QMutexLocker locker(&m_universeMutex); InputPatch *currInPatch = m_universeArray.at(universe)->inputPatch(); QLCInputProfile *currProfile = NULL; if (currInPatch != NULL) { currProfile = currInPatch->profile(); disconnect(currInPatch, SIGNAL(inputValueChanged(quint32,quint32,uchar,const QString&)), this, SIGNAL(inputValueChanged(quint32,quint32,uchar,const QString&))); }
bool VCSlider::isButton(quint32 universe, quint32 channel) { InputPatch* patch = NULL; QLCInputProfile* profile = NULL; QLCInputChannel* ch = NULL; patch = m_doc->inputMap()->patch(universe); if (patch != NULL) { profile = patch->profile(); if (profile != NULL) { ch = profile->channels()[channel]; if (ch != NULL) { return (ch->type() == QLCInputChannel::Button); } } } return false; }
void VCSliderProperties::updateInputSource() { QLCInputProfile* profile; InputPatch* patch; QString uniName; QString chName; if (m_inputUniverse == InputMap::invalidUniverse() || m_inputChannel == InputMap::invalidChannel()) { /* Nothing selected for input universe and/or channel */ uniName = KInputNone; chName = KInputNone; } else { patch = m_inputMap->patch(m_inputUniverse); if (patch == NULL || patch->plugin() == NULL) { /* There is no patch for the given universe */ uniName = KInputNone; chName = KInputNone; } else { profile = patch->profile(); if (profile == NULL) { /* There is no profile. Display plugin name and channel number. Boring. */ uniName = patch->plugin()->name(); chName = tr("%1: Unknown") .arg(m_inputChannel + 1); } else { QLCInputChannel* ich; QString name; /* Display profile name for universe */ uniName = QString("%1: %2") .arg(m_inputUniverse + 1) .arg(profile->name()); /* User can input the channel number by hand, so put something rational to the channel name in those cases as well. */ ich = profile->channel(m_inputChannel); if (ich != NULL) name = ich->name(); else name = tr("Unknown"); /* Display channel name */ chName = QString("%1: %2") .arg(m_inputChannel + 1).arg(name); } } } /* Display the gathered information */ m_inputUniverseEdit->setText(uniName); m_inputChannelEdit->setText(chName); }
void VCPropertiesEditor::updateHoldInputSource() { QLCInputProfile* profile; InputPatch* patch; QString uniName; QString chName; if (m_properties.holdInputUniverse() == KInputUniverseInvalid || m_properties.holdInputChannel() == KInputChannelInvalid) { /* Nothing selected for input universe and/or channel */ uniName = KInputNone; chName = KInputNone; /* Display the gathered information */ m_holdInputUniverseEdit->setText(uniName); m_holdInputChannelEdit->setText(chName); return; } patch = _app->inputMap()->patch(m_properties.holdInputUniverse()); if (patch == NULL || patch->plugin() == NULL) { /* There is no patch for the given universe */ uniName = KInputNone; chName = KInputNone; /* Display the gathered information */ m_holdInputUniverseEdit->setText(uniName); m_holdInputChannelEdit->setText(chName); return; } profile = patch->profile(); if (profile == NULL) { /* There is no profile. Display plugin name and channel number. Boring. */ uniName = patch->plugin()->name(); chName = tr("%1: Unknown") .arg(m_properties.holdInputChannel() + 1); } else { QString name; /* Display profile name for universe */ uniName = QString("%1: %2") .arg(m_properties.holdInputUniverse() + 1) .arg(profile->name()); /* User can input the channel number by hand, so put something rational to the channel name in those cases as well. */ name = profile->channelName(m_properties.holdInputChannel()); if (name == QString::null) name = tr("Unknown"); /* Display channel name */ chName = QString("%1: %2") .arg(m_properties.holdInputChannel() + 1).arg(name); } /* Display the gathered information */ m_holdInputUniverseEdit->setText(uniName); m_holdInputChannelEdit->setText(chName); }