示例#1
0
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));
}
示例#2
0
void FixtureConsole::setOutputDMX(bool state)
{
    /* All of this' children are ConsoleChannel objects, except layout */
    QListIterator <QObject*> it(children());
    while (it.hasNext() == true)
    {
        ConsoleChannel* cc = qobject_cast<ConsoleChannel*> (it.next());
        if (cc != NULL)
            cc->setOutputDMX(state);
    }
}
示例#3
0
ConsoleChannel* FixtureConsole::channel(quint32 ch)
{
    QListIterator <QObject*> it(children());
    while (it.hasNext() == true)
    {
        ConsoleChannel* cc;
        cc = qobject_cast<ConsoleChannel*> (it.next());
        if (cc != NULL && cc->channel() == ch)
            return cc;
    }

    return NULL;
}
示例#4
0
void FixtureConsole::setSceneValue(const SceneValue& scv)
{
    Q_ASSERT(scv.fxi == m_fixture);

    QListIterator <QObject*> it(children());
    while (it.hasNext() == true)
    {
        ConsoleChannel* cc = qobject_cast<ConsoleChannel*> (it.next());
        if (cc != NULL && cc->channel() == scv.channel)
        {
            cc->enable(true);
            cc->setValue(scv.value);
        }
    }
}
示例#5
0
void FixtureConsole::slotInputValueChanged(quint32 uni,
        quint32 ch,
        uchar value)
{
    if (uni == _app->inputMap()->editorUniverse())
    {
        ConsoleChannel* cc;

        cc = channel(ch);
        if (cc != NULL)
        {
            cc->setValue(value);
            cc->setChecked(true);
        }
    }
}
示例#6
0
void FixtureConsole::setValues(const QList <SceneValue>& list)
{
    enableAllChannels(false);

    QListIterator <SceneValue> it(list);
    while (it.hasNext() == true)
    {
        SceneValue val(it.next());
        if (val.channel < quint32(children().size()))
        {
            ConsoleChannel* cc = channel(val.channel);
            if (cc != NULL)
            {
                cc->enable(true);
                cc->setValue(val.value);
            }
        }
    }
}
示例#7
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;
}
示例#8
0
void GroupsConsole::init()
{
    int idx = 0;
    foreach(quint32 id, m_ids)
    {
        ChannelsGroup *grp = m_doc->channelsGroup(id);
        SceneValue scv = grp->getChannels().at(0);

        ConsoleChannel* cc = new ConsoleChannel(this, m_doc, scv.fxi, scv.channel, false);
        cc->setLabel(grp->name());
        cc->setChannelsGroup(id);
        if (idx < m_levels.count())
            cc->setValue(m_levels.at(idx));
        layout()->addWidget(cc);
        m_groups.append(cc);

        connect(cc, SIGNAL(groupValueChanged(quint32, uchar)),
                this, SIGNAL(groupValueChanged(quint32, uchar)));
        idx++;
    }
示例#9
0
void SimpleDesk::slotUniversesWritten(const QByteArray& ua)
{
    quint32 start = (m_universePageSpin->value() - 1) * m_channelsPerPage;
    // add the universe bits to retrieve the absolute address (0 - 2048)
    start = start | (m_currentUniverse << 9);

    for (quint32 i = 0; i < (quint32)ua.length(); i++)
    {
        //m_engine->setValue(i, ua.at(i));
        // update current page sliders
        if (i >= start && i < start + (quint32)m_channelsPerPage)
        {
            const Fixture* fx = m_doc->fixture(m_doc->fixtureForAddress(i));
            if (fx != NULL)
            {
                ConsoleChannel *cc = m_universeSliders[i - start];
                cc->setValue(ua.at(i), false);
            }
        }
    }
}
示例#10
0
void SequenceEditor::setDevice(t_device_id id)
{
  Device* device = _app->doc()->device(id);
  assert(device);

  m_channels = device->deviceClass()->channels()->count();

  if (m_tempValues) delete [] m_tempValues;
  m_tempValues = new SceneValue[m_channels];

  QHBoxLayout* hbl = new QHBoxLayout(m_sliderContainer);

  ConsoleChannel* unit = NULL;
  for (t_channel ch = 0; ch < m_channels; ch++)
    {
      // Set current values to noset
      m_tempValues[ch].value = 0;
      m_tempValues[ch].type = Scene::NoSet;

      QString s;

      s.sprintf("%.3d", ch + 1);
      m_list->addColumn(s);

      unit = new ConsoleChannel(m_sliderContainer);
      unit->setDevice(id);
      unit->setChannel(ch);
      unit->setFadeStatusEnabled(false);
      m_unitList.append(unit);
      unit->update();
      
      // Channel updates to scene editor
      connect(unit, SIGNAL(changed(t_channel, t_value, Scene::ValueType)),
	      this, SLOT(slotChannelChanged(t_channel, t_value, 
					    Scene::ValueType)));

      connect(this, SIGNAL(sceneActivated(SceneValue*, t_channel)),
	      unit, SLOT(slotSceneActivated(SceneValue*, t_channel)));

      // Add the unit to the layout
      hbl->addWidget(unit);
      
      // Add a spacer between all consolechannel units
      // QT deletes spacers automagically
      QSpacerItem* sp = new QSpacerItem(m_list->header()->sectionSize(ch) 
					- 35, 0, QSizePolicy::Minimum);
      hbl->addItem(sp);
      m_spacerList.append(sp);
      
    }

  // Add a spacer that has the size of the listview's scrollbar
  QSpacerItem* sp = new QSpacerItem(m_list->verticalScrollBar()->width(), 
				    0, QSizePolicy::Fixed);
  hbl->addItem(sp);

  m_list->setResizeMode(QListView::AllColumns);
  m_list->setSorting(-1);

  m_sliderContainer->hide();
}
示例#11
0
void FixtureConsole::setFixture(t_fixture_id id)
{
	unsigned int i = 0;
	Fixture* fxi = NULL;
	ConsoleChannel* unit = NULL;
	
	m_fixture = id;

	fxi = _app->doc()->fixture(m_fixture);
	assert(fxi);

	// Set an icon
	setIcon(QPixmap(PIXMAPS + QString("/console.png")));

	// Set the main horizontal layout
	m_layout = new QHBoxLayout(this);
	m_layout->setAutoAdd(true);

	// Create scene editor widget
	if (m_sceneEditor) delete m_sceneEditor;
	m_sceneEditor = new SceneEditor(this);
	m_sceneEditor->setFixture(m_fixture);
	m_sceneEditor->show();

	// Catch function add signals
	connect(_app->doc(), SIGNAL(functionAdded(t_function_id)),
		m_sceneEditor, SLOT(slotFunctionAdded(t_function_id)));

	// Catch function remove signals
	connect(_app->doc(), SIGNAL(functionRemoved(t_function_id)),
		m_sceneEditor, SLOT(slotFunctionRemoved(t_function_id)));

	// Catch function change signals
	connect(_app->doc(), SIGNAL(functionChanged(t_function_id)),
		m_sceneEditor, SLOT(slotFunctionChanged(t_function_id)));

	// Create channel units
	for (i = 0; i < fxi->channels(); i++)
	{
		unit = new ConsoleChannel(this, m_fixture, i);
		unit->init();
		unit->update();

		// Channel updates to scene editor
		connect(unit, 
			SIGNAL(changed(t_channel, t_value, Scene::ValueType)),
			m_sceneEditor,
			SLOT(slotChannelChanged(t_channel, t_value, Scene::ValueType)));

		// Scene editor updates to channels
		connect(m_sceneEditor,
			SIGNAL(sceneActivated(SceneValue*, t_channel)),
			unit, 
			SLOT(slotSceneActivated(SceneValue*, t_channel)));

		m_unitList.append(unit);
	}

	/* Resize the console to some sensible proportions if at least
	   one channel unit was inserted */
	if (unit != NULL)
		resize(m_sceneEditor->width() + 
		       (fxi->channels() * unit->width()), 250);

	// Update scene editor (also causes an update to channelunits)
	m_sceneEditor->update();
}
示例#12
0
void SimpleDesk::slotUniversePageChanged(int page)
{
    qDebug() << Q_FUNC_INFO;
    quint32 start = (page - 1) * m_channelsPerPage;
    QString ssEven =  "QGroupBox { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #C3D1C9, stop: 1 #AFBBB4); "
                     " border: 1px solid gray; border-radius: 4px; }";
    QString ssOdd = "QGroupBox { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D6D2D0, stop: 1 #AFACAB); "
                     " border: 1px solid gray; border-radius: 4px; }";
    QString ssNone = "QGroupBox { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D6D5E0, stop: 1 #A7A6AF); "
                     " border: 1px solid gray; border-radius: 4px; }";

    /* now, calculate the absolute address including current universe (0 - 2048) */
    quint32 absoluteAddr = start | (m_currentUniverse << 9);

    /* Set the new page for this universe */
    m_universesPage.replace(m_currentUniverse, page);

    //qDebug() << "[slotUniversePageChanged] start: " << start << ", absoluteAddr: " << absoluteAddr;

    for (quint32 i = 0; i < m_channelsPerPage; i++)
    {
        ConsoleChannel* slider = m_universeSliders[i];
        if (slider != NULL)
        {
            m_universeGroup->layout()->removeWidget(slider);
            disconnect(slider, SIGNAL(valueChanged(quint32,quint32,uchar)),
                   this, SLOT(slotUniverseSliderValueChanged(quint32,quint32,uchar)));
            delete slider;
        }
        const Fixture* fx = m_doc->fixture(m_doc->fixtureForAddress(absoluteAddr + i));
        if (fx == NULL)
        {
            slider = new ConsoleChannel(this, m_doc, Fixture::invalidId(), start + i, false);
            slider->setStyleSheet(ssNone);
        }
        else
        {
            uint ch = (absoluteAddr + i) - fx->universeAddress();
            slider = new ConsoleChannel(this, m_doc, fx->id(), ch, false);
            if (fx->id() % 2 == 0)
                slider->setStyleSheet(ssOdd);
            else
                slider->setStyleSheet(ssEven);
        }

        if ((start + i) < 512)
        {
            slider->setEnabled(true);
            slider->setProperty(PROP_ADDRESS, absoluteAddr + i);
            slider->setLabel(QString::number(start + i + 1));
            //qDebug() << "Set slider value[" << (absoluteAddr + i) << "] = " << m_engine->value(absoluteAddr + i);
            slider->setValue(m_engine->value(absoluteAddr + i), false);
            connect(slider, SIGNAL(valueChanged(quint32,quint32,uchar)),
                    this, SLOT(slotUniverseSliderValueChanged(quint32,quint32,uchar)));
        }
        else
        {
            slider->setEnabled(false);
            slider->setProperty(PROP_ADDRESS, QVariant());
            slider->setValue(0);
            slider->setLabel("---");
            slider->setPalette(this->palette());
        }

        m_universeGroup->layout()->addWidget(slider);
        m_universeSliders[i] = slider;
    }
}