void InputMap::saveDefaults() { QSettings settings; QString key; QString str; for (quint32 i = 0; i < m_universes; i++) { InputPatch* pat = patch(i); Q_ASSERT(pat != NULL); /* Editor universe */ key = QString("/inputmap/editoruniverse/"); settings.setValue(key, m_editorUniverse); /* Plugin name */ key = QString("/inputmap/universe%2/plugin/").arg(i); if (pat->plugin() != NULL) settings.setValue(key, pat->plugin()->name()); else settings.setValue(key, "None"); /* Plugin input */ key = QString("/inputmap/universe%2/input/").arg(i); settings.setValue(key, str.setNum(pat->input())); /* Input profile */ key = QString("/inputmap/universe%2/profile/").arg(i); settings.setValue(key, pat->profileName()); } }
void InputMap::saveDefaults() { QSettings settings; QString key; QString str; for (t_input_universe i = 0; i < m_universes; i++) { InputPatch* pat = patch(i); Q_ASSERT(pat != NULL); /* Editor universe */ key = QString("/inputmap/editoruniverse/"); settings.setValue(key, m_editorUniverse); if (pat->plugin() != NULL) { /* Plugin name */ key = QString("/inputmap/universe%2/plugin/").arg(i); settings.setValue(key, pat->plugin()->name()); /* Plugin input */ key = QString("/inputmap/universe%2/input/").arg(i); settings.setValue(key, str.setNum(pat->input())); /* Input profile */ key = QString("/inputmap/universe%2/profile/").arg(i); settings.setValue(key, pat->profileName()); /* Feedback enable */ key = QString("/inputmap/universe%2/feedbackEnabled/").arg(i); settings.setValue(key, pat->feedbackEnabled()); } else { /* Plugin name */ key = QString("/inputmap/universe%2/plugin/").arg(i); settings.setValue(key, ""); /* Plugin input */ key = QString("/inputmap/universe%2/input/").arg(i); settings.setValue(key, ""); /* Input profile */ key = QString("/inputmap/universe%2/profile/").arg(i); settings.setValue(key, ""); /* Feedback enable */ key = QString("/inputmap/universe%2/feedbackEnabled/").arg(i); settings.setValue(key, true); } } }
void InputMap::feedBack(t_input_universe universe, t_input_channel channel, t_input_value value) { InputPatch* patch; Q_ASSERT(universe < m_patch.size()); patch = m_patch[universe]; Q_ASSERT(patch != NULL); if (patch->plugin() != NULL) patch->plugin()->feedBack(patch->input(), channel, value); }
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; }
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))); }
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 InputMap::feedBack(quint32 universe, quint32 channel, uchar value) { if (universe >= quint32(m_patch.size())) return false; InputPatch* patch = m_patch[universe]; Q_ASSERT(patch != NULL); if (patch->plugin() != NULL && patch->feedbackEnabled() == true) { patch->plugin()->feedBack(patch->input(), channel, value); return true; } else { return false; } }
bool InputMap::feedBack(t_input_universe universe, t_input_channel channel, t_input_value value) { if (universe >= m_patch.size()) return false; InputPatch* patch = m_patch[universe]; Q_ASSERT(patch != NULL); if (patch->plugin() != NULL && patch->feedbackEnabled() == true) { patch->plugin()->feedBack(patch->input(), channel, value); return true; } else { return false; } }
/***************************************************************************** * Input data *****************************************************************************/ void InputMap::slotPluginConfigurationChanged(QLCIOPlugin* plugin) { for (quint32 i = 0; i < universes(); i++) { InputPatch* ip = patch(i); Q_ASSERT(ip != NULL); if (ip->plugin() == plugin) ip->reconnect(); } emit pluginConfigurationChanged(plugin->name()); }
void InputMap::slotConfigurationChanged() { QLCInPlugin* plugin = qobject_cast<QLCInPlugin*> (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++) { InputPatch* ip = patch(i); Q_ASSERT(ip != NULL); if (ip->plugin() == plugin) ip->reconnect(); } emit pluginConfigurationChanged(plugin->name()); }
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); }