Shuffle::Shuffle(QObject* parent) : Function(parent) { m_masterTimer = NULL; setName(tr("New Shuffle")); setBus(Bus::defaultHold()); /* initialize random seed: */ srand ( time(NULL) ); Doc* doc = qobject_cast <Doc*> (parent); if (doc != NULL) { /* Listen to function removals so that they can be removed from this chaser as well. Parent might not always be Doc, but an editor dialog, for example. Such chasers cannot be run, though. */ connect(doc, SIGNAL(functionRemoved(t_function_id)), this, SLOT(slotFunctionRemoved(t_function_id))); } //always add a blackout state to the start! BlackoutState *b = new BlackoutState(); m_steps.append(b); //setup m_filter QList<StateFilter *> *foo; foo = new QList<StateFilter *>(); m_filters = *foo; m_filters.append(new GoboFilter()); }
Collection::Collection(Doc* doc) : Function(doc, Function::Collection) { setName(tr("New Collection")); // Listen to member Function removals connect(doc, SIGNAL(functionRemoved(quint32)), this, SLOT(slotFunctionRemoved(quint32))); }
Collection::Collection(QObject* parent) : Function(parent) { setName(tr("New Collection")); Doc* doc = qobject_cast <Doc*> (parent); if (doc != NULL) { /* Listen to function removals so that they can be removed from this collection as well. Parent might not always be Doc, but an editor dialog, for example. Such collections cannot be run, though. */ connect(doc, SIGNAL(functionRemoved(t_function_id)), this, SLOT(slotFunctionRemoved(t_function_id))); } }
Chaser::Chaser(Doc* doc) : Function(doc) { m_runTimeDirection = Forward; m_runTimePosition = 0; m_runner = NULL; setName(tr("New Chaser")); setBus(Bus::defaultHold()); connect(Bus::instance(), SIGNAL(tapped(quint32)), this, SLOT(slotBusTapped(quint32))); // Listen to member Function removals connect(doc, SIGNAL(functionRemoved(t_function_id)), this, SLOT(slotFunctionRemoved(t_function_id))); }
Audio::Audio(Doc* doc) : Function(doc, Function::Audio) , m_doc(doc) , m_decoder(NULL) , m_audio_out(NULL) , m_audioDevice(QString()) , m_startTime(UINT_MAX) , m_color(96, 128, 83) , m_locked(false) , m_sourceFileName("") , m_audioDuration(0) { setName(tr("New Audio")); // Listen to member Function removals connect(doc, SIGNAL(functionRemoved(quint32)), this, SLOT(slotFunctionRemoved(quint32))); }
Video::Video(Doc* doc) : Function(doc, Function::Video) , m_doc(doc) , m_startTime(UINT_MAX) , m_color(147, 140, 20) , m_locked(false) , m_sourceUrl("") , m_videoDuration(0) , m_resolution(QSize(0,0)) , m_screen(0) , m_fullscreen(false) { setName(tr("New Video")); // Listen to member Function removals connect(doc, SIGNAL(functionRemoved(quint32)), this, SLOT(slotFunctionRemoved(quint32))); }
bool Doc::deleteFunction(quint32 id) { if (m_functions.contains(id) == true) { Function* func = m_functions.take(id); Q_ASSERT(func != NULL); emit functionRemoved(id); setModified(); delete func; return true; } else { qWarning() << Q_FUNC_INFO << "No function with id" << id; return false; } }
Chaser::Chaser(Doc* doc) : Function(doc, Function::Chaser) , m_legacyHoldBus(Bus::invalid()) , m_isSequence(false) , m_boundSceneID(-1) , m_startTime(UINT_MAX) , m_color(85, 107, 128) , m_fadeInMode(Default) , m_fadeOutMode(Default) , m_holdMode(Common) , m_startStepIndex(-1) , m_runner(NULL) { setName(tr("New Chaser")); // Listen to member Function removals connect(doc, SIGNAL(functionRemoved(quint32)), this, SLOT(slotFunctionRemoved(quint32))); }
Chaser::Chaser(Doc *doc) : Function(doc, Function::ChaserType) , m_legacyHoldBus(Bus::invalid()) , m_fadeInMode(Default) , m_fadeOutMode(Default) , m_holdMode(Common) , m_runnerMutex(QMutex::Recursive) , m_runner(NULL) { setName(tr("New Chaser")); // Listen to member Function removals connect(doc, SIGNAL(functionRemoved(quint32)), this, SLOT(slotFunctionRemoved(quint32))); m_startupAction.m_action = ChaserNoAction; m_startupAction.m_intensity = 1.0; m_startupAction.m_fadeMode = FromFunction; m_startupAction.m_stepIndex = -1; }
void Doc::clearContents() { emit clearing(); // Delete all function instances QListIterator <quint32> funcit(m_functions.keys()); while (funcit.hasNext() == true) { Function* func = m_functions.take(funcit.next()); emit functionRemoved(func->id()); delete func; } // Delete all fixture instances QListIterator <quint32> fxit(m_fixtures.keys()); while (fxit.hasNext() == true) { Fixture* fxi = m_fixtures.take(fxit.next()); emit fixtureRemoved(fxi->id()); delete fxi; } // Delete all fixture groups QListIterator <quint32> grpit(m_fixtureGroups.keys()); while (grpit.hasNext() == true) { FixtureGroup* grp = m_fixtureGroups.take(grpit.next()); emit fixtureGroupRemoved(grp->id()); delete grp; } m_latestFunctionId = 0; m_latestFixtureId = 0; m_latestFixtureGroupId = 0; m_addresses.clear(); emit cleared(); }
EFX::EFX(Doc* doc) : Function(doc) { pointFunc = NULL; m_width = 127; m_height = 127; m_xOffset = 127; m_yOffset = 127; m_rotation = 0; m_xFrequency = 2; m_yFrequency = 3; m_xPhase = M_PI / 2.0; m_yPhase = 0; m_propagationMode = Parallel; m_startSceneID = Function::invalidId(); m_startSceneEnabled = false; m_stopSceneID = Function::invalidId(); m_stopSceneEnabled = false; m_algorithm = KCircleAlgorithmName; m_stepSize = 0; setName(tr("New EFX")); /* Set Default Fade as the speed bus */ setBus(Bus::defaultFade()); connect(Bus::instance(), SIGNAL(valueChanged(quint32,quint32)), this, SLOT(slotBusValueChanged(quint32,quint32))); // Listen to start/stop scene removals connect(doc, SIGNAL(functionRemoved(t_function_id)), this, SLOT(slotFunctionRemoved(t_function_id))); }
Chaser::Chaser(QObject* parent) : Function(parent) { m_runTimeDirection = Forward; m_runTimePosition = 0; m_masterTimer = NULL; setName(tr("New Chaser")); setBus(Bus::defaultHold()); connect(Bus::instance(), SIGNAL(tapped(quint32)), this, SLOT(slotBusTapped(quint32))); Doc* doc = qobject_cast <Doc*> (parent); if (doc != NULL) { /* Listen to function removals so that they can be removed from this chaser as well. Parent might not always be Doc, but an editor dialog, for example. Such chasers cannot be run, though. */ connect(doc, SIGNAL(functionRemoved(t_function_id)), this, SLOT(slotFunctionRemoved(t_function_id))); } }
void Doc::clearContents() { emit clearing(); m_clipboard->resetContents(); if (m_monitorProps != NULL) m_monitorProps->reset(); destroyAudioCapture(); // Delete all function instances QListIterator <quint32> funcit(m_functions.keys()); while (funcit.hasNext() == true) { Function* func = m_functions.take(funcit.next()); if (func == NULL) continue; emit functionRemoved(func->id()); delete func; } // Delete all fixture groups QListIterator <quint32> grpit(m_fixtureGroups.keys()); while (grpit.hasNext() == true) { FixtureGroup* grp = m_fixtureGroups.take(grpit.next()); quint32 grpID = grp->id(); delete grp; emit fixtureGroupRemoved(grpID); } // Delete all fixture instances QListIterator <quint32> fxit(m_fixtures.keys()); while (fxit.hasNext() == true) { Fixture* fxi = m_fixtures.take(fxit.next()); quint32 fxID = fxi->id(); delete fxi; emit fixtureRemoved(fxID); } // Delete all channels groups QListIterator <quint32> grpchans(m_channelsGroups.keys()); while (grpchans.hasNext() == true) { ChannelsGroup* grp = m_channelsGroups.take(grpchans.next()); emit channelsGroupRemoved(grp->id()); delete grp; } m_orderedGroups.clear(); m_latestFunctionId = 0; m_latestFixtureId = 0; m_latestFixtureGroupId = 0; m_latestChannelsGroupId = 0; m_addresses.clear(); emit cleared(); }
VCCueList::VCCueList(QWidget* parent, Doc* doc) : VCWidget(parent, doc) , m_chaserID(Function::invalidId()) //, m_chaser(NULL) , m_timer(NULL) , m_primaryIndex(0) , m_secondaryIndex(0) , m_primaryLeft(true) { /* Set the class name "VCCueList" as the object name as well */ setObjectName(VCCueList::staticMetaObject.className()); /* Create a layout for this widget */ QGridLayout* grid = new QGridLayout(this); grid->setSpacing(2); m_linkCheck = new QCheckBox(tr("Link")); grid->addWidget(m_linkCheck, 0, 0, 1, 2, Qt::AlignVCenter | Qt::AlignCenter); m_sl1TopLabel = new QLabel("100%"); m_sl1TopLabel->setAlignment(Qt::AlignHCenter); grid->addWidget(m_sl1TopLabel, 1, 0, 1, 1); m_slider1 = new ClickAndGoSlider(); m_slider1->setSliderStyleSheet(CNG_DEFAULT_STYLE); m_slider1->setFixedWidth(32); m_slider1->setRange(0, 100); m_slider1->setValue(100); grid->addWidget(m_slider1, 2, 0, 1, 1); m_sl1BottomLabel = new QLabel(""); m_sl1BottomLabel->setStyleSheet(cfLabelNoStyle); m_sl1BottomLabel->setAlignment(Qt::AlignCenter); grid->addWidget(m_sl1BottomLabel, 3, 0, 1, 1); connect(m_slider1, SIGNAL(valueChanged(int)), this, SLOT(slotSlider1ValueChanged(int))); m_sl2TopLabel = new QLabel("0%"); m_sl2TopLabel->setAlignment(Qt::AlignHCenter); grid->addWidget(m_sl2TopLabel, 1, 1, 1, 1); m_slider2 = new ClickAndGoSlider(); m_slider2->setSliderStyleSheet(CNG_DEFAULT_STYLE); m_slider2->setFixedWidth(32); m_slider2->setRange(0, 100); m_slider2->setValue(0); m_slider2->setInvertedAppearance(true); grid->addWidget(m_slider2, 2, 1, 1, 1); m_sl2BottomLabel = new QLabel(""); m_sl2BottomLabel->setStyleSheet(cfLabelNoStyle); m_sl2BottomLabel->setAlignment(Qt::AlignCenter); grid->addWidget(m_sl2BottomLabel, 3, 1, 1, 1); connect(m_slider2, SIGNAL(valueChanged(int)), this, SLOT(slotSlider2ValueChanged(int))); slotShowCrossfadePanel(false); /* Create a list for scenes (cues) */ m_tree = new QTreeWidget(this); grid->addWidget(m_tree, 0, 2, 3, 1); m_tree->setSelectionMode(QAbstractItemView::SingleSelection); //m_tree->setAlternatingRowColors(true); m_tree->setAllColumnsShowFocus(true); m_tree->setRootIsDecorated(false); m_tree->setItemsExpandable(false); m_tree->header()->setSortIndicatorShown(false); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) m_tree->header()->setClickable(false); m_tree->header()->setMovable(false); #else m_tree->header()->setSectionsClickable(false); m_tree->header()->setSectionsMovable(false); #endif // Make only the notes column editable m_tree->setItemDelegateForColumn(COL_NUM, new NoEditDelegate(this)); m_tree->setItemDelegateForColumn(COL_NAME, new NoEditDelegate(this)); m_tree->setItemDelegateForColumn(COL_FADEIN, new NoEditDelegate(this)); m_tree->setItemDelegateForColumn(COL_FADEOUT, new NoEditDelegate(this)); m_tree->setItemDelegateForColumn(COL_DURATION, new NoEditDelegate(this)); connect(m_tree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(slotItemActivated(QTreeWidgetItem*))); connect(m_tree, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(slotItemChanged(QTreeWidgetItem*,int))); m_progress = new QProgressBar(this); m_progress->setOrientation(Qt::Horizontal); m_progress->setStyleSheet(progressDisabledStyle); m_progress->setProperty("status", 0); m_progress->setFixedHeight(20); grid->addWidget(m_progress, 3, 2); m_timer = new QTimer(this); connect(m_timer, SIGNAL(timeout()), this, SLOT(slotProgressTimeout())); m_updateTimer = new QTimer(this); connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateStepList())); m_updateTimer->setSingleShot(true); /* Create control buttons */ QHBoxLayout *hbox = new QHBoxLayout(); hbox->setSpacing(2); m_crossfadeButton = new QToolButton(this); m_crossfadeButton->setIcon(QIcon(":/slider.png")); m_crossfadeButton->setIconSize(QSize(24, 24)); m_crossfadeButton->setCheckable(true); m_crossfadeButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); m_crossfadeButton->setFixedHeight(32); m_crossfadeButton->setToolTip(tr("Show/Hide crossfade sliders")); connect(m_crossfadeButton, SIGNAL(toggled(bool)), this, SLOT(slotShowCrossfadePanel(bool))); hbox->addWidget(m_crossfadeButton); m_playbackButton = new QToolButton(this); m_playbackButton->setIcon(QIcon(":/player_play.png")); m_playbackButton->setIconSize(QSize(24, 24)); m_playbackButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_playbackButton->setFixedHeight(32); m_playbackButton->setToolTip(tr("Play/Stop Cue list")); connect(m_playbackButton, SIGNAL(clicked()), this, SLOT(slotPlayback())); hbox->addWidget(m_playbackButton); m_previousButton = new QToolButton(this); m_previousButton->setIcon(QIcon(":/back.png")); m_previousButton->setIconSize(QSize(24, 24)); m_previousButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_previousButton->setFixedHeight(32); m_previousButton->setToolTip(tr("Go to previous step in the list")); connect(m_previousButton, SIGNAL(clicked()), this, SLOT(slotPreviousCue())); hbox->addWidget(m_previousButton); m_nextButton = new QToolButton(this); m_nextButton->setIcon(QIcon(":/forward.png")); m_nextButton->setIconSize(QSize(24, 24)); m_nextButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_nextButton->setFixedHeight(32); m_nextButton->setToolTip(tr("Go to next step in the list")); connect(m_nextButton, SIGNAL(clicked()), this, SLOT(slotNextCue())); hbox->addWidget(m_nextButton); grid->addItem(hbox, 4, 2); setFrameStyle(KVCFrameStyleSunken); setType(VCWidget::CueListWidget); setCaption(tr("Cue list")); QSettings settings; QVariant var = settings.value(SETTINGS_CUELIST_SIZE); if (var.isValid() == true) resize(var.toSize()); else resize(QSize(300, 220)); slotModeChanged(m_doc->mode()); setLiveEdit(m_liveEdit); connect(m_doc, SIGNAL(functionRemoved(quint32)), this, SLOT(slotFunctionRemoved(quint32))); connect(m_doc, SIGNAL(functionChanged(quint32)), this, SLOT(slotFunctionChanged(quint32))); connect(m_doc, SIGNAL(functionNameChanged(quint32)), this, SLOT(slotFunctionNameChanged(quint32))); m_nextLatestValue = 0; m_previousLatestValue = 0; m_playbackLatestValue = 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(); }