void EFXEditor::slotAddFixtureClicked() { /* Put all fixtures already present into a list of fixtures that will be disabled in the fixture selection dialog */ QList <t_fixture_id> disabled; QTreeWidgetItemIterator twit(m_tree); while (*twit != NULL) { EFXFixture* ef = reinterpret_cast <EFXFixture*> ((*twit)->data(0, Qt::UserRole).toULongLong()); Q_ASSERT(ef != NULL); disabled.append(ef->fixture()); twit++; } /* Disable all fixtures that don't have pan OR tilt channels */ for (t_fixture_id fxi_id = 0; fxi_id < KFixtureArraySize; fxi_id++) { Fixture* fixture = _app->doc()->fixture(fxi_id); if (fixture == NULL) continue; // If a channel with pan group exists, don't disable this fixture if (fixture->channel("", Qt::CaseSensitive, KQLCChannelGroupPan) != Fixture::invalidChannel()) { continue; } // If a channel with tilt group exists, don't disable this fixture if (fixture->channel("", Qt::CaseSensitive, KQLCChannelGroupTilt) != Fixture::invalidChannel()) { continue; } // Disable all fixtures without pan or tilt channels disabled << fxi_id; } /* Get a list of new fixtures to add to the scene */ FixtureSelection fs(this, _app->doc(), true, disabled); if (fs.exec() == QDialog::Accepted) { QListIterator <t_fixture_id> it(fs.selection); while (it.hasNext() == true) { EFXFixture* ef = new EFXFixture(m_efx); ef->setFixture(it.next()); if (m_efx->addFixture(ef) == true) addFixtureItem(ef); else delete ef; } } }
void VCXYPadProperties::slotAddClicked() { /* Put all fixtures already present into a list of fixtures that will be disabled in the fixture selection dialog */ QList <t_fixture_id> disabled; QTreeWidgetItemIterator twit(m_tree); while (*twit != NULL) { QVariant var((*twit)->data(KColumnFixture, Qt::UserRole)); VCXYPadFixture fxi(var); disabled << fxi.fixture(); ++twit; } /* Disable all fixtures that don't have pan OR tilt channels */ for (t_fixture_id fxi_id = 0; fxi_id < KFixtureArraySize; fxi_id++) { Fixture* fixture = _app->doc()->fixture(fxi_id); if (fixture == NULL) continue; // If a channel with pan group exists, don't disable this fixture if (fixture->channel("", Qt::CaseSensitive, QLCChannel::Pan) != QLCChannel::invalid()) { continue; } // If a channel with tilt group exists, don't disable this fixture if (fixture->channel("", Qt::CaseSensitive, QLCChannel::Tilt) != QLCChannel::invalid()) { continue; } // Disable all fixtures without pan or tilt channels disabled << fxi_id; } /* Get a list of new fixtures to add to the pad */ QTreeWidgetItem* item = NULL; FixtureSelection fs(this, _app->doc(), true, disabled); if (fs.exec() == QDialog::Accepted) { QListIterator <t_fixture_id> it(fs.selection); while (it.hasNext() == true) { VCXYPadFixture fxi; fxi.setFixture(it.next()); item = new QTreeWidgetItem(m_tree); updateFixtureItem(item, fxi); } } if (item != NULL) m_tree->setCurrentItem(item); }
void VCSlider::writeDMXLevel(MasterTimer* timer, UniverseArray* universes) { Q_UNUSED(timer); m_levelValueMutex.lock(); QListIterator <LevelChannel> it(m_levelChannels); while (it.hasNext() == true) { LevelChannel lch(it.next()); Fixture* fxi = m_doc->fixture(lch.fixture); if (fxi != NULL) { const QLCChannel* qlcch = fxi->channel(lch.channel); if (qlcch == NULL) continue; if (qlcch->group() != QLCChannel::Intensity && m_levelValueChanged == false) { /* Value has not changed and this is not an intensity channel. LTP in effect. */ continue; } quint32 dmx_ch = fxi->channelAddress(lch.channel); universes->write(dmx_ch, m_levelValue, qlcch->group()); } } m_levelValueChanged = false; m_levelValueMutex.unlock(); }
quint32 FunctionManager::getChannelTypeMask(quint32 fxID, quint32 channel) { Fixture *fixture = m_doc->fixture(fxID); if (fixture == NULL) return 0; const QLCChannel *ch = fixture->channel(channel); if (ch == NULL) return 0; quint32 chTypeBit = 0; if (ch->group() == QLCChannel::Intensity) { if (ch->colour() == QLCChannel::NoColour) chTypeBit |= ContextManager::DimmerType; else chTypeBit |= ContextManager::ColorType; } else { chTypeBit |= (1 << ch->group()); } return chTypeBit; }
void FixtureConsole::setFixture(t_fixture_id id) { ConsoleChannel* cc = NULL; Fixture* fxi = NULL; /* Get rid of any previous channels */ while (m_channels.isEmpty() == false) delete m_channels.takeFirst(); m_fixture = id; fxi = _app->doc()->fixture(m_fixture); Q_ASSERT(fxi != NULL); /* Create channel units */ for (unsigned int i = 0; i < fxi->channels(); i++) { const QLCChannel* ch = fxi->channel(i); Q_ASSERT(ch != NULL); if (ch->group() == QLCChannel::NoGroup) continue; cc = new ConsoleChannel(this, m_fixture, i); cc->setCheckable(m_channelsCheckable); layout()->addWidget(cc); connect(cc, SIGNAL(valueChanged(quint32,uchar,bool)), this, SLOT(slotValueChanged(quint32,uchar,bool))); m_channels.append(cc); } /* Make a spacer item eat excess space to justify channels left */ layout()->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding)); }
QString FixtureManager::channelIcon(quint32 fxID, quint32 chIdx) { Fixture *fixture = m_doc->fixture(fxID); if (fixture == NULL) return QString(); const QLCChannel *channel = fixture->channel(chIdx); if (channel == NULL) return QString(); QString chIcon = channel->getIconNameFromGroup(channel->group()); if (chIcon.startsWith("#")) { if (chIcon == "#FF0000") return "qrc:/red.svg"; else if (chIcon == "#00FF00") return "qrc:/green.svg"; else if (chIcon == "#0000FF") return "qrc:/blue.svg"; else if (chIcon == "#00FFFF") return "qrc:/cyan.svg"; else if (chIcon == "#FF00FF") return "qrc:/magenta.svg"; else if (chIcon == "#FFFF00") return "qrc:/yellow.svg"; else if (chIcon == "#FF7E00") return "qrc:/amber.svg"; else if (chIcon == "#FFFFFF") return "qrc:/white.svg"; else if (chIcon == "#9400D3") return "qrc:/uv.svg"; } else chIcon.replace(".png", ".svg"); return "qrc" + chIcon; }
void FixtureList::init() { QTreeWidgetItem* item; m_listView->clear(); connect(m_listView, SIGNAL(itemSelectionChanged()), this, SLOT(slotSelectionChanged())); connect(m_listView, SIGNAL(itemDoubleClicked(QTreeWidgetItem*)), this, SLOT(slotItemDoubleClicked())); for (t_fixture_id fxi_id = 0; fxi_id < KFixtureArraySize; fxi_id++) { Fixture* fxi = _app->doc()->fixture(fxi_id); if (fxi == NULL) continue; for (unsigned int n = 0; n < fxi->channels(); n++) { QLCChannel* channel; QString s; // Create a new item for a channel item = new QTreeWidgetItem(m_listView); // Fixture name item->setText(KColumnFixtureName, fxi->name()); // Channel name channel = fxi->channel(n); if (channel != NULL) { s.sprintf("%.3d: ", n + 1); s += channel->name(); item->setText(KColumnChannelName, s); } else { delete item; break; } // Relative channel number (not shown) s.sprintf("%.3d", n); item->setText(KColumnChannelNum, s); // Fixture ID (not shown) item->setText(KColumnFixtureID, QString("%1").arg(fxi_id)); } } /* Select the first item */ item = m_listView->topLevelItem(0); if (item != NULL) item->setSelected(true); }
void FixtureList::init() { QListViewItem* item = NULL; QLCChannel* channel = NULL; Fixture* fxi = NULL; unsigned int n = 0; QString fxi_id; QString s; m_listView->clear(); for (t_fixture_id i = 0; i < KFixtureArraySize; i++) { fxi = _app->doc()->fixture(i); if (fxi == NULL) continue; fxi_id.setNum(fxi->id()); for (n = 0; n < fxi->channels(); n++) { // Create a new item for a channel item = new QListViewItem(m_listView); // Fixture name item->setText(KColumnFixtureName, fxi->name()); // Channel name channel = fxi->channel(n); if (channel != NULL) { s.sprintf("%.3d: ", n + 1); s += channel->name(); item->setText(KColumnChannelName, s); } else { delete item; break; } // Relative channel number (not shown) s.sprintf("%.3d", n); item->setText(KColumnChannelNum, s); // Fixture ID (not shown) item->setText(KColumnFixtureID, fxi_id); } } m_listView->setSelected(m_listView->firstChild(), true); }
void FixtureManager::slotAutoFunction() { #if 0 QTreeWidgetItem* item; t_fixture_id fxi_id; Fixture* fxi; item = m_tree->currentItem(); if (item == NULL) return; fxi_id = item->text(KColumnID).toInt(); fxi = _app->doc()->fixture(fxi_id); Q_ASSERT(fxi != NULL); // Loop over all channels for (int i = 0; i < fxi->channels(); i++) { QLCChannel* channel = fxi->channel(i); Q_ASSERT(channel != NULL); QListIterator <QLCCapability*> cap_it(*channel->capabilities()); // Loop over all capabilities while (cap_it.hasNext() == true) { QLCCapability* cap = cap_it.next(); Q_ASSERT(cap != NULL); Scene* sc = static_cast<Scene*> (_app->doc()->newFunction(Function::Scene, fxi_id)); sc->setName(channel->name() + " - " + cap->name()); // Set the unused channels to NoSet and zero. for (int j = 0; j < fxi->channels(); j++) sc->set(j, 0, Scene::NoSet); // Set only the capability sc->set(i, (t_value) ((cap->min() + cap->max()) / 2), Scene::Set); } } #endif }
void VCSlider::setupClickAndGoWidget() { if (m_cngWidget != NULL) { qDebug() << Q_FUNC_INFO << "Level channel: " << m_levelChannels.size() << "type: " << m_cngType; if (m_cngType == ClickAndGoWidget::Preset && m_levelChannels.size() > 0) { LevelChannel lChan = m_levelChannels.first(); Fixture *fxi = m_doc->fixture(lChan.fixture); if (fxi != NULL) { const QLCChannel *chan = fxi->channel(lChan.channel); m_cngWidget->setType(m_cngType, chan); } } else m_cngWidget->setType(m_cngType, NULL); } }
QLCChannel::Group FadeChannel::group(const Doc* doc) const { uint chnum = QLCChannel::invalid(); Fixture* fxi = NULL; if (fixture() == Fixture::invalidId()) { // Do a reverse lookup; which fixture occupies channel() // which is now treated as an absolute DMX address. quint32 id = doc->fixtureForAddress(channel()); if (id == Fixture::invalidId()) return QLCChannel::Intensity; fxi = doc->fixture(id); if (fxi == NULL) return QLCChannel::Intensity; // Convert channel() to a relative channel number chnum = channel() - fxi->universeAddress(); } else { // This FadeChannel contains a valid fixture ID fxi = doc->fixture(fixture()); if (fxi == NULL) return QLCChannel::Intensity; // channel() is already a relative channel number chnum = channel(); } const QLCChannel* ch = fxi->channel(chnum); if (ch == NULL) return QLCChannel::Intensity; else return ch->group(); }
bool SceneEditor::isColorToolAvailable() { FixtureConsole* fc; Fixture* fxi; QColor color; quint32 cyan, magenta, yellow; quint32 red, green, blue; /* QObject cast fails unless the widget is a FixtureConsole */ fc = qobject_cast<FixtureConsole*> (m_tab->currentWidget()); if (fc == NULL) return false; fxi = _app->doc()->fixture(fc->fixture()); Q_ASSERT(fxi != NULL); cyan = fxi->channel("cyan", Qt::CaseInsensitive, QLCChannel::Colour); magenta = fxi->channel("magenta", Qt::CaseInsensitive, QLCChannel::Colour); yellow = fxi->channel("yellow", Qt::CaseInsensitive, QLCChannel::Colour); red = fxi->channel("red", Qt::CaseInsensitive, QLCChannel::Colour); green = fxi->channel("green", Qt::CaseInsensitive, QLCChannel::Colour); blue = fxi->channel("blue", Qt::CaseInsensitive, QLCChannel::Colour); if (cyan != QLCChannel::invalid() && magenta != QLCChannel::invalid() && yellow != QLCChannel::invalid()) { return true; } else if (red != QLCChannel::invalid() && green != QLCChannel::invalid() && blue != QLCChannel::invalid()) { return true; } else { return false; } }
QMap <quint32,FadeChannel> ChaserRunner::createFadeChannels(const UniverseArray* universes, QMap <quint32,FadeChannel>& zeroChannels) const { QMap <quint32,FadeChannel> map; if (m_currentStep >= m_steps.size() || m_currentStep < 0) return map; Scene* scene = qobject_cast<Scene*> (m_steps.at(m_currentStep)); Q_ASSERT(scene != NULL); // Put all current channels to a map of channels that will be faded to zero. // If the same channels are added to the new channel map, they are removed // from this zero map. zeroChannels = m_channelMap; QListIterator <SceneValue> it(scene->values()); while (it.hasNext() == true) { SceneValue value(it.next()); Fixture* fxi = m_doc->fixture(value.fxi); if (fxi == NULL || fxi->channel(value.channel) == NULL) continue; FadeChannel channel; channel.setAddress(fxi->universeAddress() + value.channel); channel.setGroup(fxi->channel(value.channel)->group()); channel.setTarget(value.value); // Get starting value from universes. For HTP channels it's always 0. channel.setStart(uchar(universes->preGMValues()[channel.address()])); // Transfer last step's current value to current step's starting value. if (m_channelMap.contains(channel.address()) == true) channel.setStart(m_channelMap[channel.address()].current()); channel.setCurrent(channel.start()); // Append the channel to the channel map map[channel.address()] = channel; // Remove the channel from a map of to-be-zeroed channels since now it // has a new value to fade to. zeroChannels.remove(channel.address()); } // All channels that were present in the previous step but are not present // in the current step will go through this zeroing process. QMutableMapIterator <quint32,FadeChannel> zit(zeroChannels); while (zit.hasNext() == true) { zit.next(); FadeChannel& channel(zit.value()); if (channel.current() == 0 || channel.group() != QLCChannel::Intensity) { // Remove all non-HTP channels and such HTP channels that are // already at zero. There's nothing to do for them. zit.remove(); } else { // This HTP channel was present in the previous step, but is absent // in the current. It's nicer that we fade it back to zero, rather // than just let it drop straight to zero. channel.setStart(channel.current()); channel.setTarget(0); } } return map; }
void SceneEditor::slotColorTool() { FixtureConsole* fc; Fixture* fxi; QColor color; quint32 cyan, magenta, yellow; quint32 red, green, blue; /* QObject cast fails unless the widget is a FixtureConsole */ fc = qobject_cast<FixtureConsole*> (m_tab->currentWidget()); if (fc == NULL) return; fxi = _app->doc()->fixture(fc->fixture()); Q_ASSERT(fxi != NULL); cyan = fxi->channel("cyan", Qt::CaseInsensitive, QLCChannel::Colour); magenta = fxi->channel("magenta", Qt::CaseInsensitive, QLCChannel::Colour); yellow = fxi->channel("yellow", Qt::CaseInsensitive, QLCChannel::Colour); red = fxi->channel("red", Qt::CaseInsensitive, QLCChannel::Colour); green = fxi->channel("green", Qt::CaseInsensitive, QLCChannel::Colour); blue = fxi->channel("blue", Qt::CaseInsensitive, QLCChannel::Colour); if (cyan != QLCChannel::invalid() && magenta != QLCChannel::invalid() && yellow != QLCChannel::invalid()) { color.setCmyk(fc->channel(cyan)->sliderValue(), fc->channel(magenta)->sliderValue(), fc->channel(yellow)->sliderValue(), 0); color = QColorDialog::getColor(color); if (color.isValid() == true) { fc->channel(cyan)->setValue(color.cyan()); fc->channel(magenta)->setValue(color.magenta()); fc->channel(yellow)->setValue(color.yellow()); fc->channel(cyan)->enable(true); fc->channel(magenta)->enable(true); fc->channel(yellow)->enable(true); } } else if (red != QLCChannel::invalid() && green != QLCChannel::invalid() && blue != QLCChannel::invalid()) { color.setRgb(fc->channel(red)->sliderValue(), fc->channel(green)->sliderValue(), fc->channel(blue)->sliderValue(), 0); color = QColorDialog::getColor(color); if (color.isValid() == true) { fc->channel(red)->setValue(color.red()); fc->channel(green)->setValue(color.green()); fc->channel(blue)->setValue(color.blue()); fc->channel(red)->enable(true); fc->channel(green)->enable(true); fc->channel(blue)->enable(true); } } }
void ConsoleChannel::init() { Fixture* fxi = m_doc->fixture(m_fixture); //Q_ASSERT(fxi != NULL); new QVBoxLayout(this); layout()->setSpacing(0); layout()->setContentsMargins(0, 2, 0, 2); if (fxi != NULL) { m_presetButton = new QToolButton(this); m_presetButton->setStyle(AppUtil::saneStyle()); layout()->addWidget(m_presetButton); layout()->setAlignment(m_presetButton, Qt::AlignHCenter); m_presetButton->setIconSize(QSize(32, 32)); m_presetButton->setMinimumSize(QSize(32, 32)); m_presetButton->setMaximumSize(QSize(32, 32)); m_presetButton->setFocusPolicy(Qt::NoFocus); /* Create a menu only if channel has sophisticated contents */ if (fxi->fixtureDef() != NULL && fxi->fixtureMode() != NULL) initMenu(); else m_presetButton->setStyleSheet("QToolButton { border-image: url(:/intensity.png) 0 0 0 0 stretch stretch; }"); } /* Value edit */ m_spin = new QSpinBox(this); m_spin->setRange(0, UCHAR_MAX); m_spin->setValue(0); m_spin->setMinimumWidth(25); m_spin->setButtonSymbols(QAbstractSpinBox::NoButtons); m_spin->setStyle(AppUtil::saneStyle()); layout()->addWidget(m_spin); m_spin->setAlignment(Qt::AlignCenter); m_spin->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); layout()->setAlignment(m_spin, Qt::AlignHCenter); /* Value slider */ m_slider = new ClickAndGoSlider(this); m_slider->setInvertedAppearance(false); m_slider->setRange(0, UCHAR_MAX); m_slider->setPageStep(1); m_slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); m_slider->setFocusPolicy(Qt::NoFocus); connect(m_slider, SIGNAL(controlClicked()), this, SLOT(slotControlClicked())); m_slider->setMinimumWidth(25); m_slider->setMaximumWidth(40); m_slider->setStyleSheet( "QSlider::groove:vertical { background: transparent; width: 32px; } " "QSlider::handle:vertical { " "background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #ddd, stop:0.45 #888, stop:0.50 #000, stop:0.55 #888, stop:1 #999);" "border: 1px solid #5c5c5c;" "border-radius: 4px; margin: 0 -1px; height: 20px; }" "QSlider::handle:vertical:hover {" "background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #eee, stop:0.45 #999, stop:0.50 #ff0000, stop:0.55 #999, stop:1 #ccc);" "border: 1px solid #000; }" "QSlider::add-page:vertical { background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #78d, stop: 1 #97CDEC );" "border: 1px solid #5288A7; margin: 0 13px; }" "QSlider::sub-page:vertical { background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #888, stop: 1 #ddd );" "border: 1px solid #8E8A86; margin: 0 13px; }" "QSlider::handle:vertical:disabled { background: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #ddd, stop:0.45 #888, stop:0.50 #444, stop:0.55 #888, stop:1 #999);" "border: 1px solid #666; }" ); layout()->addWidget(m_slider); //layout()->setAlignment(m_slider, Qt::AlignHCenter); /* Channel number label */ m_label = new QLabel(this); m_label->setMinimumWidth(25); m_label->setMaximumWidth(80); layout()->addWidget(m_label); m_label->setAlignment(Qt::AlignCenter); m_label->setText(QString::number(m_channel + 1)); m_label->setFocusPolicy(Qt::NoFocus); m_label->setWordWrap(true); /* Set tooltip */ if (fxi == NULL || fxi->isDimmer() == true) { setToolTip(tr("Intensity")); } else { const QLCChannel* ch = fxi->channel(m_channel); Q_ASSERT(ch != NULL); setToolTip(QString("%1").arg(ch->name())); } connect(m_spin, SIGNAL(valueChanged(int)), this, SLOT(slotSpinChanged(int))); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderChanged(int))); connect(this, SIGNAL(toggled(bool)), this, SLOT(slotChecked(bool))); }
void IntensityGenerator::createScenes() { m_odd = new Scene(m_doc); m_odd->setName("Intensity - Odd"); m_even = new Scene(m_doc); m_even->setName("Intensity - Even"); m_full = new Scene(m_doc); m_full->setName("Intensity - Full"); m_zero = new Scene(m_doc); m_zero->setName("Intensity - Zero"); // Create sequence & random scene lists int i = 0; QListIterator <Fixture*> it(m_fixtures); while (it.hasNext() == true) { Fixture* fxi(it.next()); Q_ASSERT(fxi != NULL); Scene* sq = new Scene(m_doc); sq->setName(QString("Intensity - ") + fxi->name()); m_sequence << sq; sq = new Scene(m_doc); sq->setName(QString("Intensity - Random - %1").arg(++i)); m_random << sq; } // Go thru all fixtures for (int i = 0; i < m_fixtures.size(); i++) { Fixture* fxi = m_fixtures[i]; Q_ASSERT(fxi != NULL); // Find such channels from the fixture that belong to the // given channel group. QList <quint32> channels = findChannels(fxi, QLCChannel::Intensity); // Insert values to member scenes for each found channel for (int j = 0; j < channels.size(); j++) { quint32 ch = channels.at(j); const QLCChannel* channel = fxi->channel(ch); Q_ASSERT(channel != NULL); uchar min = 0; uchar max = UCHAR_MAX; int modulo = i; // Find the minimum and maximum intensity values for // the current channel findMinMax(channel, &min, &max); // Set all intensity channels to max in the $full scene m_full->setValue(fxi->id(), ch, max); // Set all intensity channels to min in the $zero scene m_zero->setValue(fxi->id(), ch, min); // Create even & odd values if (fxi->isDimmer() == false) modulo = i; // For each intelligent fixture else modulo = j; // For each dimmer channel if ((modulo % 2) == 0) { m_even->setValue(fxi->id(), ch, max); m_odd->setValue(fxi->id(), ch, min); } else { m_even->setValue(fxi->id(), ch, min); m_odd->setValue(fxi->id(), ch, max); } // Create sequence and random values for (int s = 0; s < m_sequence.size(); s++) { if (s == i) m_sequence[s]->setValue(fxi->id(), ch, max); else m_sequence[s]->setValue(fxi->id(), ch, min); if ((rand() % 2) == 0) m_random[s]->setValue(fxi->id(), ch, max); else m_random[s]->setValue(fxi->id(), ch, min); } } } }
QMultiHash<int, SceneValue> FixtureManager::setFixtureCapabilities(quint32 fxID, bool enable) { int capDelta = 1; bool hasDimmer = false, hasColor = false, hasPosition = false; QMultiHash<int, SceneValue> channelsMap; Fixture *fixture = m_doc->fixture(fxID); if (fixture == NULL) return channelsMap; if (enable == false) capDelta = -1; for (quint32 ch = 0; ch < fixture->channels(); ch++) { const QLCChannel* channel(fixture->channel(ch)); if(channel == NULL) continue; int chType = channel->group(); switch (channel->group()) { case QLCChannel::Intensity: { QLCChannel::PrimaryColour col = channel->colour(); switch (col) { case QLCChannel::NoColour: hasDimmer = true; break; case QLCChannel::Red: case QLCChannel::Green: case QLCChannel::Blue: case QLCChannel::Cyan: case QLCChannel::Magenta: case QLCChannel::Yellow: case QLCChannel::White: hasColor = true; break; default: break; } chType = col; } break; case QLCChannel::Pan: case QLCChannel::Tilt: hasPosition = true; break; default: break; } if (hasDimmer) { QQuickItem *dimmerCapItem = qobject_cast<QQuickItem*>(m_view->rootObject()->findChild<QObject *>("capIntensity")); dimmerCapItem->setProperty("counter", dimmerCapItem->property("counter").toInt() + capDelta); } if (hasColor) { QQuickItem *colorCapItem = qobject_cast<QQuickItem*>(m_view->rootObject()->findChild<QObject *>("capColor")); colorCapItem->setProperty("counter", colorCapItem->property("counter").toInt() + capDelta); } if (hasPosition) { QQuickItem *positionCapItem = qobject_cast<QQuickItem*>(m_view->rootObject()->findChild<QObject *>("capPosition")); positionCapItem->setProperty("counter", positionCapItem->property("counter").toInt() + capDelta); } channelsMap.insert(chType, SceneValue(fxID, ch)); } return channelsMap; }
void ConsoleChannel::initMenu() { Fixture* fxi = m_doc->fixture(fixture()); Q_ASSERT(fxi != NULL); const QLCChannel* ch = fxi->channel(m_channel); Q_ASSERT(ch != NULL); // Get rid of a possible previous menu if (m_menu != NULL) { delete m_menu; m_menu = NULL; } // Create a popup menu and set the channel name as its title m_menu = new QMenu(this); m_presetButton->setMenu(m_menu); m_presetButton->setPopupMode(QToolButton::InstantPopup); QString btnIconStr = ch->getIconNameFromGroup(ch->group()); if (btnIconStr.startsWith(":")) m_presetButton->setStyleSheet("QToolButton { border-image: url(" + btnIconStr + ") 0 0 0 0 stretch stretch; }"); else { m_presetButton->setStyleSheet("QToolButton { background: " + btnIconStr + "; }"); setIntensityButton(ch); } switch(ch->group()) { case QLCChannel::Colour: m_cngWidget = new ClickAndGoWidget(); m_cngWidget->setType(ClickAndGoWidget::Preset, ch); break; case QLCChannel::Effect: m_cngWidget = new ClickAndGoWidget(); m_cngWidget->setType(ClickAndGoWidget::Preset, ch); break; case QLCChannel::Gobo: m_cngWidget = new ClickAndGoWidget(); m_cngWidget->setType(ClickAndGoWidget::Preset, ch); break; default: break; } if (m_cngWidget != NULL) { QWidgetAction* action = new QWidgetAction(this); action->setDefaultWidget(m_cngWidget); m_menu->addAction(action); connect(m_cngWidget, SIGNAL(levelChanged(uchar)), this, SLOT(slotClickAndGoLevelChanged(uchar))); connect(m_cngWidget, SIGNAL(levelAndPresetChanged(uchar,QImage)), this, SLOT(slotClickAndGoLevelAndPresetChanged(uchar, QImage))); } else { QAction* action = m_menu->addAction(m_presetButton->icon(), ch->name()); m_menu->setTitle(ch->name()); action->setEnabled(false); m_menu->addSeparator(); // Initialize the preset menu only for intelligent fixtures if (fxi->isDimmer() == false) initCapabilityMenu(ch); } }
void VCSlider::writeDMXLevel(MasterTimer* timer, UniverseArray* universes) { Q_UNUSED(timer); m_levelValueMutex.lock(); uchar modLevel = m_levelValue; int r = 0, g = 0, b = 0, c = 0, m = 0, y = 0; if (m_cngType == ClickAndGoWidget::RGB) { float f = 0; if (m_slider) f = SCALE(float(m_levelValue), float(m_slider->minimum()), float(m_slider->maximum()), float(0), float(200)); if ((uchar)f != 0) { QColor modColor = m_cngRGBvalue.lighter((uchar)f); r = modColor.red(); g = modColor.green(); b = modColor.blue(); } } else if (m_cngType == ClickAndGoWidget::CMY) { float f = 0; if (m_slider) f = SCALE(float(m_levelValue), float(m_slider->minimum()), float(m_slider->maximum()), float(0), float(200)); if ((uchar)f != 0) { QColor modColor = m_cngRGBvalue.lighter((uchar)f); c = modColor.cyan(); m = modColor.magenta(); y = modColor.yellow(); } } QListIterator <LevelChannel> it(m_levelChannels); while (it.hasNext() == true) { LevelChannel lch(it.next()); Fixture* fxi = m_doc->fixture(lch.fixture); if (fxi != NULL) { const QLCChannel* qlcch = fxi->channel(lch.channel); if (qlcch == NULL) continue; if (qlcch->group() != QLCChannel::Intensity && m_levelValueChanged == false) { /* Value has not changed and this is not an intensity channel. LTP in effect. */ continue; } if (qlcch->group() == QLCChannel::Intensity) { if (m_cngType == ClickAndGoWidget::RGB) { if (qlcch->colour() == QLCChannel::Red) modLevel = (uchar)r; else if (qlcch->colour() == QLCChannel::Green) modLevel = (uchar)g; else if (qlcch->colour() == QLCChannel::Blue) modLevel = (uchar)b; } else if (m_cngType == ClickAndGoWidget::CMY) { if (qlcch->colour() == QLCChannel::Cyan) modLevel = (uchar)c; else if (qlcch->colour() == QLCChannel::Magenta) modLevel = (uchar)m; else if (qlcch->colour() == QLCChannel::Yellow) modLevel = (uchar)y; } } quint32 dmx_ch = fxi->channelAddress(lch.channel); universes->write(dmx_ch, modLevel, qlcch->group()); } } m_levelValueChanged = false; m_levelValueMutex.unlock(); }