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(); }
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(); }