Пример #1
0
void FunctionManager::dumpOnScene(QList<SceneValue> dumpValues, QList<quint32> selectedFixtures,
                                  quint32 channelMask, quint32 sceneID)
{
    if (selectedFixtures.isEmpty() || dumpValues.isEmpty() || channelMask == 0)
        return;

    Scene *scene = qobject_cast<Scene *>(m_doc->function(sceneID));

    if (scene == NULL)
        return;

    for (SceneValue sv : dumpValues)
    {
        if (selectedFixtures.contains(sv.fxi) == false)
            continue;

        quint32 chTypeBit = getChannelTypeMask(sv.fxi, sv.channel);

        if (channelMask & chTypeBit)
        {
            QVariant currentVal, newVal;
            uchar currDmxValue = scene->value(sv.fxi, sv.channel);
            currentVal.setValue(SceneValue(sv.fxi, sv.channel, currDmxValue));
            newVal.setValue(sv);
            if (currentVal != newVal || sv.value != currDmxValue)
            {
                Tardis::instance()->enqueueAction(SceneSetChannelValue, scene->id(), currentVal, newVal);
                scene->setValue(sv);
            }
        }
    }
}
Пример #2
0
void Scene::unsetValue(quint32 fxi, quint32 ch)
{
    m_valueListMutex.lock();
    m_values.removeAll(SceneValue(fxi, ch, 0));
    m_valueListMutex.unlock();

    emit changed(this->id());
}
Пример #3
0
bool ChannelsGroup::addChannel(quint32 fxid, quint32 channel)
{
    if (fxid == invalidId())
        return false;

    m_channels.append(SceneValue(fxid, channel, 0));

    return true;
}
Пример #4
0
void FunctionManager::setChannelValue(quint32 fxID, quint32 channel, uchar value)
{
    FunctionEditor *editor = m_currentEditor;

    if (editor != NULL && editor->functionType() == Function::SequenceType)
        editor = m_sceneEditor;

    if (editor != NULL && editor->functionType() == Function::SceneType)
    {
        Scene *scene = qobject_cast<Scene *>(m_doc->function(editor->functionID()));
        if (scene == NULL)
            return;

        QVariant currentVal, newVal;
        uchar currDmxValue = scene->value(fxID, channel);
        currentVal.setValue(SceneValue(fxID, channel, currDmxValue));
        newVal.setValue(SceneValue(fxID, channel, value));
        if (currentVal != newVal || value != currDmxValue)
        {
            Tardis::instance()->enqueueAction(SceneSetChannelValue, scene->id(), currentVal, newVal);
            scene->setValue(fxID, channel, value);
        }
    }
}
Пример #5
0
QList <SceneValue> FixtureConsole::values() const
{
    QList <SceneValue> list;

    QListIterator <QObject*> it(children());
    while (it.hasNext() == true)
    {
        ConsoleChannel* cc;

        cc = qobject_cast<ConsoleChannel*> (it.next());
        if (cc != NULL && cc->isEnabled() == true)
        {
            list.append(SceneValue(m_fixture, cc->channel(),
                                   cc->sliderValue()));
        }
    }

    return list;
}
Пример #6
0
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;
}
Пример #7
0
bool ChaserStep::loadXML(const QDomElement& root, int& stepNumber)
{
    bool holdFound = false;
    if (root.tagName() != KXMLQLCFunctionStep)
    {
        qWarning() << Q_FUNC_INFO << "ChaserStep node not found";
        return false;
    }

    if (root.hasAttribute(KXMLQLCFunctionSpeedFadeIn) == true)
        fadeIn = root.attribute(KXMLQLCFunctionSpeedFadeIn).toUInt();
    if (root.hasAttribute(KXMLQLCFunctionSpeedHold) == true)
    {
        hold = root.attribute(KXMLQLCFunctionSpeedHold).toUInt();
        holdFound = true;
    }
    if (root.hasAttribute(KXMLQLCFunctionSpeedFadeOut) == true)
        fadeOut = root.attribute(KXMLQLCFunctionSpeedFadeOut).toUInt();
    if (root.hasAttribute(KXMLQLCFunctionSpeedDuration) == true)
        duration = root.attribute(KXMLQLCFunctionSpeedDuration).toUInt();
    if (root.hasAttribute(KXMLQLCFunctionNumber) == true)
        stepNumber = root.attribute(KXMLQLCFunctionNumber).toInt();
    if (root.hasAttribute(KXMLQLCStepNote) == true)
        note = root.attribute(KXMLQLCStepNote);

    if (root.hasAttribute(KXMLQLCSequenceSceneValues) == true)
    {
        QString stepValues = root.text();
        if (stepValues.isEmpty() == false)
        {
            QStringList varray = stepValues.split(",");
            for (int i = 0; i < varray.count(); i+=3)
            {
                values.append(SceneValue(QString(varray.at(i)).toUInt(),
                                         QString(varray.at(i + 1)).toUInt(),
                                         uchar(QString(varray.at(i + 2)).toInt())));
            }
        }
    }
    else
    {
        if (root.text().isEmpty() == false)
            fid = root.text().toUInt();
    }

    if (holdFound == true)
    {
        if ((int)hold < 0)
            duration = hold;
        else
            duration = fadeIn + hold;
    }
    else
    {
        if ((int)duration < 0)
            hold = duration;
        else
            hold = duration - fadeIn;
    }

    return true;
}
Пример #8
0
void Scene::unsetValue(t_fixture_id fxi, t_channel ch)
{
	m_values.removeAll(SceneValue(fxi, ch, 0));
	emit changed(m_id);
}
Пример #9
0
void Scene::setValue(t_fixture_id fxi, t_channel ch, t_value value)
{
	setValue(SceneValue(fxi, ch, value));
}
Пример #10
0
void Scene::setValue(quint32 fxi, quint32 ch, uchar value)
{
    setValue(SceneValue(fxi, ch, value));
}