VCMatrix::VCMatrix(QWidget *parent, Doc *doc) : VCWidget(parent, doc) , m_matrixID(Function::invalidId()) , m_instantApply(true) { /* Set the class name "VCLabel" as the object name as well */ setObjectName(VCMatrix::staticMetaObject.className()); setFrameStyle(KVCFrameStyleSunken); QHBoxLayout *hBox = new QHBoxLayout(this); //hBox->setContentsMargins(3, 3, 3, 10); //hBox->setSpacing(5); m_slider = new ClickAndGoSlider(); m_slider->setStyleSheet(CNG_DEFAULT_STYLE); m_slider->setFixedWidth(32); m_slider->setRange(0, 255); m_slider->setPageStep(1); m_slider->setInvertedAppearance(false); hBox->addWidget(m_slider); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); QVBoxLayout *vbox = new QVBoxLayout(this); m_startColorButton = new QToolButton(this); m_startColorButton->setFixedSize(48, 48); m_startColorButton->setIconSize(QSize(42, 42)); QWidgetAction* scAction = new QWidgetAction(this); m_scCnGWidget = new ClickAndGoWidget(); m_scCnGWidget->setType(ClickAndGoWidget::RGB, NULL); scAction->setDefaultWidget(m_scCnGWidget); QMenu *startColorMenu = new QMenu(); startColorMenu->addAction(scAction); m_startColorButton->setMenu(startColorMenu); m_startColorButton->setPopupMode(QToolButton::InstantPopup); connect(m_scCnGWidget, SIGNAL(colorChanged(QRgb)), this, SLOT(slotStartColorChanged(QRgb))); m_endColorButton = new QToolButton(this); m_endColorButton->setFixedSize(48, 48); m_endColorButton->setIconSize(QSize(42, 42)); QWidgetAction* ecAction = new QWidgetAction(this); m_ecCnGWidget = new ClickAndGoWidget(); m_ecCnGWidget->setType(ClickAndGoWidget::RGB, NULL); ecAction->setDefaultWidget(m_ecCnGWidget); QMenu *endColorMenu = new QMenu(); endColorMenu->addAction(ecAction); m_endColorButton->setMenu(endColorMenu); m_endColorButton->setPopupMode(QToolButton::InstantPopup); connect(m_ecCnGWidget, SIGNAL(colorChanged(QRgb)), this, SLOT(slotEndColorChanged(QRgb))); m_label = new QLabel(this); m_label->setAlignment(Qt::AlignCenter); m_label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); vbox->addWidget(m_label); QHBoxLayout *btnHbox = new QHBoxLayout(this); btnHbox->addWidget(m_startColorButton); btnHbox->addWidget(m_endColorButton); vbox->addLayout(btnHbox); m_presetCombo = new QComboBox(this); //m_presetCombo->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); m_presetCombo->addItems(doc->rgbScriptsCache()->names()); connect(m_presetCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotAnimationChanged(QString))); vbox->addWidget(m_presetCombo); hBox->addLayout(vbox); m_controlsLayout = new FlowLayout(); vbox->addLayout(m_controlsLayout); setType(VCWidget::AnimationWidget); setCaption(QString()); /* Initial size */ QSettings settings; QVariant var = settings.value(SETTINGS_RGBMATRIX_SIZE); if (var.isValid() == true) resize(var.toSize()); else resize(defaultSize); /* Update the slider according to current mode */ slotModeChanged(m_doc->mode()); setLiveEdit(m_liveEdit); }
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; }
VCSlider::VCSlider(QWidget* parent, Doc* doc) : VCWidget(parent, doc) { /* Set the class name "VCSlider" as the object name as well */ setObjectName(VCSlider::staticMetaObject.className()); m_hbox = NULL; m_topLabel = NULL; m_slider = NULL; m_bottomLabel = NULL; m_valueDisplayStyle = ExactValue; m_levelLowLimit = 0; m_levelHighLimit = UCHAR_MAX; m_levelValue = 0; m_levelValueChanged = false; m_monitorEnabled = false; m_monitorValue = 0; m_playbackFunction = Function::invalidId(); m_playbackValue = 0; m_playbackValueChanged = false; m_widgetMode = WSlider; setType(VCWidget::SliderWidget); setCaption(QString()); setFrameStyle(KVCFrameStyleSunken); /* Main VBox */ new QVBoxLayout(this); /* Top label */ m_topLabel = new QLabel(this); m_topLabel->setAlignment(Qt::AlignHCenter); layout()->addWidget(m_topLabel); /* Slider's HBox |stretch|slider|stretch| */ m_hbox = new QHBoxLayout(); /* Put stretchable space before the slider (to its left side) */ m_hbox->addStretch(); /* The slider */ m_slider = new ClickAndGoSlider(this); m_hbox->addWidget(m_slider); m_slider->setRange(0, 255); m_slider->setPageStep(1); m_slider->setInvertedAppearance(false); m_slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); m_slider->setMinimumWidth(32); m_slider->setMaximumWidth(80); m_slider->setStyleSheet(CNG_DEFAULT_STYLE); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); m_externalMovement = false; /* Put stretchable space after the slider (to its right side) */ m_hbox->addStretch(); layout()->addItem(m_hbox); /* Click & Go button */ m_cngType = ClickAndGoWidget::None; m_cngButton = new QToolButton(this); m_cngButton->setFixedSize(48, 48); m_cngButton->setIconSize(QSize(42, 42)); m_menu = new QMenu(this); QWidgetAction* action = new QWidgetAction(this); m_cngWidget = new ClickAndGoWidget(); action->setDefaultWidget(m_cngWidget); m_menu->addAction(action); m_cngButton->setMenu(m_menu); m_cngButton->setPopupMode(QToolButton::InstantPopup); layout()->addWidget(m_cngButton); layout()->setAlignment(m_cngButton, Qt::AlignHCenter); m_cngButton->hide(); connect(m_cngWidget, SIGNAL(levelChanged(uchar)), this, SLOT(slotClickAndGoLevelChanged(uchar))); connect(m_cngWidget, SIGNAL(colorChanged(QRgb)), this, SLOT(slotClickAndGoColorChanged(QRgb))); connect(m_cngWidget, SIGNAL(levelAndPresetChanged(uchar,QImage)), this, SLOT(slotClickAndGoLevelAndPresetChanged(uchar, QImage))); connect(this, SIGNAL(monitorDMXValueChanged(int)), this, SLOT(slotMonitorDMXValueChanged(int))); /* Bottom label */ m_bottomLabel = new QLabel(this); layout()->addWidget(m_bottomLabel); m_bottomLabel->setAlignment(Qt::AlignCenter); m_bottomLabel->setWordWrap(true); m_bottomLabel->hide(); setMinimumSize(20, 20); QSettings settings; QVariant var = settings.value(SETTINGS_SLIDER_SIZE); if (var.isValid() == true) resize(var.toSize()); else resize(VCSlider::defaultSize); /* Initialize to playback mode by default */ setInvertedAppearance(false); m_sliderMode = SliderMode(-1); // avoid use of uninitialized value setSliderMode(Playback); /* Update the slider according to current mode */ slotModeChanged(m_doc->mode()); setLiveEdit(m_liveEdit); /* Listen to fixture removals so that LevelChannels can be removed when they no longer point to an existing fixture->channel */ connect(m_doc, SIGNAL(fixtureRemoved(quint32)), this, SLOT(slotFixtureRemoved(quint32))); }
VCSpeedDial::VCSpeedDial(QWidget* parent, Doc* doc) : VCWidget(parent, doc) , m_currentFactor(1) , m_resetFactorOnDialChange(false) , m_absoluteValueMin(0) , m_absoluteValueMax(1000 * 10) { setFrameStyle(KVCFrameStyleSunken); QVBoxLayout* vBox = new QVBoxLayout(this); vBox->setMargin(0); QHBoxLayout* speedDialHBox = new QHBoxLayout(); vBox->addLayout(speedDialHBox); m_dial = new SpeedDial(this); speedDialHBox->addWidget(m_dial); connect(m_dial, SIGNAL(valueChanged(int)), this, SLOT(slotDialValueChanged())); connect(m_dial, SIGNAL(tapped()), this, SLOT(slotDialTapped())); m_factoredValue = m_dial->value(); setType(VCWidget::SpeedDialWidget); setCaption(tr("Duration")); QSettings settings; QVariant var = settings.value(SETTINGS_SPEEDDIAL_SIZE); if (var.isValid() == true) resize(var.toSize()); else resize(VCSpeedDial::defaultSize); var = settings.value(SETTINGS_SPEEDDIAL_VALUE); if (var.isValid() == true) m_dial->setValue(var.toUInt()); // Multiplier, factor, divider and reset box QHBoxLayout* multFactorDivHBox = new QHBoxLayout(); m_divButton = new QToolButton(); m_divButton->setIconSize(QSize(32, 32)); m_divButton->setIcon(QIcon(":/back.png")); m_divButton->setToolTip(tr("Divide the current time by 2")); connect(m_divButton, SIGNAL(clicked()), this, SLOT(slotDiv())); multFactorDivHBox->addWidget(m_divButton, Qt::AlignVCenter | Qt::AlignLeft); QVBoxLayout* labelsVboxBox = new QVBoxLayout(); m_multDivLabel = new QLabel(); m_multDivLabel->setAlignment(Qt::AlignCenter); m_multDivLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); labelsVboxBox->addWidget(m_multDivLabel, Qt::AlignVCenter | Qt::AlignLeft); m_multDivResultLabel = new QLabel(); m_multDivResultLabel->setAlignment(Qt::AlignCenter); m_multDivResultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_multDivResultLabel->setBackgroundRole(QPalette::BrightText); labelsVboxBox->addWidget(m_multDivResultLabel); multFactorDivHBox->addLayout(labelsVboxBox); m_multButton = new QToolButton(); m_multButton->setIconSize(QSize(32, 32)); m_multButton->setIcon(QIcon(":/forward.png")); m_multButton->setToolTip(tr("Multiply the current time by 2")); connect(m_multButton, SIGNAL(clicked()), this, SLOT(slotMult())); multFactorDivHBox->addWidget(m_multButton, Qt::AlignVCenter | Qt::AlignLeft); m_multDivResetButton = new QToolButton(); m_multDivResetButton->setIconSize(QSize(32, 32)); m_multDivResetButton->setIcon(QIcon(":/fileclose.png")); m_multDivResetButton->setToolTip(tr("Reset the current factor to 1x")); connect(m_multDivResetButton, SIGNAL(clicked()), this, SLOT(slotMultDivReset())); multFactorDivHBox->addWidget(m_multDivResetButton); vBox->addLayout(multFactorDivHBox); // Update labels slotMultDivChanged(); // Apply button m_applyButton = new QPushButton(); m_applyButton->setStyleSheet(presetBtnSS.arg("#DDDDDD")); m_applyButton->setText(tr("Apply")); m_applyButton->setToolTip(tr("Send the current value to the function now")); connect(m_applyButton, SIGNAL(clicked()), this, SLOT(slotFactoredValueChanged())); vBox->addWidget(m_applyButton); // Presets m_presetsLayout = new FlowLayout(3); vBox->addLayout(m_presetsLayout); // Don't show Infinite button: it's handled by presets setVisibilityMask(SpeedDial::defaultVisibilityMask() & ~SpeedDial::Infinite); /* Update timer */ m_updateTimer = new QTimer(this); connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(slotUpdate())); m_updateTimer->setSingleShot(true); slotModeChanged(m_doc->mode()); setLiveEdit(m_liveEdit); }