Exemplo n.º 1
0
bool FixtureManager::addFixture(QString manuf, QString model, QString mode, QString name,
                                int uniIdx, int address, int channels, int quantity, quint32 gap,
                                qreal xPos, qreal yPos)
{
    qDebug() << Q_FUNC_INFO << manuf << model << quantity;

    QLCFixtureDef *fxiDef = m_doc->fixtureDefCache()->fixtureDef(manuf, model);
    Q_ASSERT(fxiDef != NULL);

    QLCFixtureMode *fxiMode = fxiDef->mode(mode);
    Q_ASSERT(fxiMode != NULL);

    for (int i = 0; i < quantity; i++)
    {
        Fixture *fxi = new Fixture(m_doc);

        /* If we're adding more than one fixture,
           append a number to the end of the name */
        if (quantity > 1)
            fxi->setName(QString("%1 #%2").arg(name).arg(i + 1));
        else
            fxi->setName(name);
        fxi->setAddress(address + (i * channels) + (i * gap));
        fxi->setUniverse(uniIdx);
        fxi->setFixtureDefinition(fxiDef, fxiMode);

        m_doc->addFixture(fxi);
        emit newFixtureCreated(fxi->id(), xPos, yPos);
    }
    m_fixtureList.clear();
    m_fixtureList = m_doc->fixtures();
    emit fixturesCountChanged();

    return true;
}
Exemplo n.º 2
0
ContextManager::ContextManager(QQuickView *view, Doc *doc,
                               FixtureManager *fxMgr, FunctionManager *funcMgr,
                               QObject *parent)
    : QObject(parent)
    , m_view(view)
    , m_doc(doc)
    , m_fixtureManager(fxMgr)
    , m_functionManager(funcMgr)
    , m_universeFilter(Universe::invalid())
    , m_prevRotation(0)
    , m_editingEnabled(false)
{
    m_source = new GenericDMXSource(m_doc);
    m_source->setOutputEnabled(true);

    m_2DView = new MainView2D(m_view, m_doc);
    m_view->rootContext()->setContextProperty("View2D", m_2DView);

    m_DMXView = new MainViewDMX(m_view, m_doc);

    connect(m_fixtureManager, SIGNAL(newFixtureCreated(quint32,qreal,qreal)),
            this, SLOT(slotNewFixtureCreated(quint32,qreal,qreal)));
    connect(m_fixtureManager, SIGNAL(channelValueChanged(quint32,quint32,quint8)),
            this, SLOT(slotChannelValueChanged(quint32,quint32,quint8)));
    connect(m_fixtureManager, SIGNAL(channelTypeValueChanged(int,quint8)),
            this, SLOT(slotChannelTypeValueChanged(int,quint8)));
    connect(m_fixtureManager, SIGNAL(colorChanged(QColor,QColor)),
            this, SLOT(slotColorChanged(QColor,QColor)));
    connect(m_fixtureManager, SIGNAL(positionTypeValueChanged(int,int)),
            this, SLOT(slotPositionChanged(int,int)));
    connect(m_fixtureManager, SIGNAL(presetChanged(const QLCChannel*,quint8)),
            this, SLOT(slotPresetChanged(const QLCChannel*,quint8)));
    connect(m_doc->inputOutputMap(), SIGNAL(universesWritten(int, const QByteArray&)),
            this, SLOT(slotUniversesWritten(int, const QByteArray&)));
    connect(m_functionManager, SIGNAL(functionEditingChanged(bool)),
            this, SLOT(slotFunctionEditingChanged(bool)));
}