void VCMatrix::slotCustomControlClicked() { QPushButton *btn = qobject_cast<QPushButton*>(sender()); VCMatrixControl *control = m_controls[btn]; if (control != NULL) { RGBMatrix* matrix = qobject_cast<RGBMatrix*>(m_doc->function(m_matrixID)); if (matrix == NULL || mode() == Doc::Design) return; if (control->m_type == VCMatrixControl::StartColor) { QPixmap px(42, 42); px.fill(control->m_color); m_startColorButton->setIcon(px); matrix->setStartColor(control->m_color); matrix->calculateColorDelta(); } else if (control->m_type == VCMatrixControl::EndColor) { QPixmap px(42, 42); px.fill(control->m_color); m_endColorButton->setIcon(px); matrix->setEndColor(control->m_color); matrix->calculateColorDelta(); } else if (control->m_type == VCMatrixControl::Animation) { RGBAlgorithm* algo = RGBAlgorithm::algorithm(m_doc, control->m_resource); matrix->setAlgorithm(algo); if (instantChanges() == true) matrix->calculateColorDelta(); } else if (control->m_type == VCMatrixControl::Text) { RGBAlgorithm* algo = RGBAlgorithm::algorithm(m_doc, "Text"); RGBText* text = static_cast<RGBText*> (algo); text->setText(control->m_resource); matrix->setAlgorithm(algo); if (instantChanges() == true) matrix->calculateColorDelta(); } } }
void VCMatrix::slotAnimationChanged(QString name) { RGBMatrix* matrix = qobject_cast<RGBMatrix*>(m_doc->function(m_matrixID)); if (matrix == NULL || mode() == Doc::Design) return; RGBAlgorithm* algo = RGBAlgorithm::algorithm(m_doc, name); matrix->setAlgorithm(algo); if (instantChanges() == true) matrix->calculateColorDelta(); }
void VCMatrix::slotEndColorChanged(QRgb color) { QColor col(color); QPixmap px(42, 42); px.fill(col); m_endColorButton->setIcon(px); RGBMatrix* matrix = qobject_cast<RGBMatrix*>(m_doc->function(m_matrixID)); if (matrix == NULL || mode() == Doc::Design) return; matrix->setEndColor(col); if (instantChanges() == true) matrix->calculateColorDelta(); }
void VCMatrix::slotCustomControlClicked() { QPushButton *btn = qobject_cast<QPushButton*>(sender()); VCMatrixControl *control = m_controls[btn]; if (control != NULL) { RGBMatrix* matrix = qobject_cast<RGBMatrix*>(m_doc->function(m_matrixID)); if (matrix == NULL || mode() == Doc::Design) return; if (control->m_type == VCMatrixControl::StartColor) { QPixmap px(42, 42); px.fill(control->m_color); m_startColorButton->setIcon(px); matrix->setStartColor(control->m_color); matrix->calculateColorDelta(); } else if (control->m_type == VCMatrixControl::EndColor) { QPixmap px(42, 42); px.fill(control->m_color); m_endColorButton->setIcon(px); matrix->setEndColor(control->m_color); matrix->calculateColorDelta(); } else if (control->m_type == VCMatrixControl::Animation) { RGBAlgorithm* algo = RGBAlgorithm::algorithm(m_doc, control->m_resource); if (!control->m_properties.isEmpty()) { RGBScript *script = static_cast<RGBScript*> (algo); QHashIterator<QString, QString> it(control->m_properties); while(it.hasNext()) { it.next(); script->setProperty(it.key(), it.value()); } } matrix->setAlgorithm(algo); if (instantChanges() == true) matrix->calculateColorDelta(); m_presetCombo->blockSignals(true); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) m_presetCombo->setCurrentText(control->m_resource); #else m_presetCombo->setCurrentIndex(m_presetCombo->findText(control->m_resource)); #endif m_presetCombo->blockSignals(false); } else if (control->m_type == VCMatrixControl::Text) { RGBAlgorithm* algo = RGBAlgorithm::algorithm(m_doc, "Text"); RGBText* text = static_cast<RGBText*> (algo); text->setText(control->m_resource); matrix->setAlgorithm(algo); if (instantChanges() == true) matrix->calculateColorDelta(); } } }