From 6cd67bd387a727d47ff74c4fdb11904727d42bda Mon Sep 17 00:00:00 2001 From: Massimo Callegari Date: Thu, 24 Oct 2024 16:55:33 +0200 Subject: [PATCH] engine: add rgbMapGetColors to RGBAlgorithm In this way the UI can dinamycally load colors from scripts depending on presets (see updated plasma.js) Reviewed inefficient code blocks. On XML save "Color" tag + index attribute rather than changing tags (Color1, Color2, etc) --- engine/src/rgbalgorithm.h | 3 ++ engine/src/rgbaudio.cpp | 5 ++ engine/src/rgbaudio.h | 3 ++ engine/src/rgbimage.cpp | 5 ++ engine/src/rgbimage.h | 3 ++ engine/src/rgbmatrix.cpp | 74 +++++++++++++------------- engine/src/rgbplain.cpp | 5 ++ engine/src/rgbplain.h | 3 ++ engine/src/rgbscript.cpp | 28 ++++++++++ engine/src/rgbscript.h | 4 ++ engine/src/rgbscriptv4.cpp | 19 +++++++ engine/src/rgbscriptv4.h | 4 ++ engine/src/rgbtext.cpp | 5 ++ engine/src/rgbtext.h | 3 ++ resources/rgbscripts/plasma.js | 73 +++++++++++++++++++------- ui/src/rgbmatrixeditor.cpp | 95 +++++++--------------------------- ui/src/rgbmatrixeditor.h | 1 + 17 files changed, 201 insertions(+), 132 deletions(-) diff --git a/engine/src/rgbalgorithm.h b/engine/src/rgbalgorithm.h index 8bd10c6904..47214bdcfa 100644 --- a/engine/src/rgbalgorithm.h +++ b/engine/src/rgbalgorithm.h @@ -77,6 +77,9 @@ class RGBAlgorithm /** Set the colors for the RGBmap */ virtual void rgbMapSetColors(QVector &colors) = 0; + /** Get the colors from the RGB script */ + virtual QVector rgbMapGetColors() = 0; + /** Load a RGBMap for the given step. */ virtual void rgbMap(const QSize& size, uint rgb, int step, RGBMap &map) = 0; diff --git a/engine/src/rgbaudio.cpp b/engine/src/rgbaudio.cpp index d6548e8186..817b4be649 100644 --- a/engine/src/rgbaudio.cpp +++ b/engine/src/rgbaudio.cpp @@ -128,6 +128,11 @@ void RGBAudio::rgbMapSetColors(QVector &colors) Q_UNUSED(colors); } +QVector RGBAudio::rgbMapGetColors() +{ + return QVector(); +} + void RGBAudio::rgbMap(const QSize& size, uint rgb, int step, RGBMap &map) { Q_UNUSED(step); diff --git a/engine/src/rgbaudio.h b/engine/src/rgbaudio.h index 5769cc77b5..a8ea5742ae 100644 --- a/engine/src/rgbaudio.h +++ b/engine/src/rgbaudio.h @@ -73,6 +73,9 @@ protected slots: /** @reimp */ void rgbMapSetColors(QVector &colors); + /** @reimp */ + QVector rgbMapGetColors(); + /** @reimp */ void rgbMap(const QSize& size, uint rgb, int step, RGBMap &map); diff --git a/engine/src/rgbimage.cpp b/engine/src/rgbimage.cpp index a27e6318a3..114c0e62d5 100644 --- a/engine/src/rgbimage.cpp +++ b/engine/src/rgbimage.cpp @@ -240,6 +240,11 @@ void RGBImage::rgbMapSetColors(QVector &colors) Q_UNUSED(colors); } +QVector RGBImage::rgbMapGetColors() +{ + return QVector(); +} + void RGBImage::rgbMap(const QSize& size, uint rgb, int step, RGBMap &map) { Q_UNUSED(rgb); diff --git a/engine/src/rgbimage.h b/engine/src/rgbimage.h index d4c4a30f7a..96042e6186 100644 --- a/engine/src/rgbimage.h +++ b/engine/src/rgbimage.h @@ -105,6 +105,9 @@ class RGBImage : public RGBAlgorithm /** @reimp */ void rgbMapSetColors(QVector &colors); + /** @reimp */ + QVector rgbMapGetColors(); + /** @reimp */ void rgbMap(const QSize& size, uint rgb, int step, RGBMap &map); diff --git a/engine/src/rgbmatrix.cpp b/engine/src/rgbmatrix.cpp index 0873a77998..5919c8bfd6 100644 --- a/engine/src/rgbmatrix.cpp +++ b/engine/src/rgbmatrix.cpp @@ -36,7 +36,8 @@ #define KXMLQLCRGBMatrixStartColor QString("MonoColor") #define KXMLQLCRGBMatrixEndColor QString("EndColor") -#define KXMLQLCRGBMatrixColorBase QString("Color") +#define KXMLQLCRGBMatrixColor QString("Color") +#define KXMLQLCRGBMatrixColorIndex QString("Index") #define KXMLQLCRGBMatrixFixtureGroup QString("FixtureGroup") #define KXMLQLCRGBMatrixDimmerControl QString("DimmerControl") @@ -66,13 +67,6 @@ RGBMatrix::RGBMatrix(Doc* doc) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) , m_algorithmMutex(QMutex::Recursive) #endif - , m_rgbColors{ - Qt::red, - QColor(), - QColor(), - QColor(), - QColor() - } , m_stepHandler(new RGBMatrixStep()) , m_roundTime(new QElapsedTimer()) , m_stepsCount(0) @@ -82,6 +76,9 @@ RGBMatrix::RGBMatrix(Doc* doc) setName(tr("New RGB Matrix")); setDuration(500); + m_rgbColors.fill(QColor(), RGBAlgorithmColorDisplayCount); + setColor(0, Qt::red); + RGBScript scr = doc->rgbScriptsCache()->script("Stripes"); setAlgorithm(scr.clone()); } @@ -169,19 +166,14 @@ bool RGBMatrix::copyFrom(const Function* function) setDimmerControl(mtx->dimmerControl()); setFixtureGroup(mtx->fixtureGroup()); + foreach (QColor col, mtx->getColors()) + m_rgbColors.append(col); + if (mtx->algorithm() != NULL) setAlgorithm(mtx->algorithm()->clone()); else setAlgorithm(NULL); - QVectorIterator it(mtx->getColors()); - uint count = 0; - while (it.hasNext()) { - QColor color = it.next(); - setColor(count, color); - count ++; - } - setControlMode(mtx->controlMode()); return Function::copyFrom(function); @@ -303,8 +295,12 @@ void RGBMatrix::previewMap(int step, RGBMatrixStep *handler) void RGBMatrix::setColor(int i, QColor c) { + if (i < 0) + return; + if (i >= m_rgbColors.count()) m_rgbColors.resize(i + 1); + m_rgbColors.replace(i, c); { QMutexLocker algorithmLocker(&m_algorithmMutex); @@ -320,8 +316,9 @@ void RGBMatrix::setColor(int i, QColor c) QColor RGBMatrix::getColor(int i) const { - if (i >= m_rgbColors.count()) + if (i < 0 || i >= m_rgbColors.count()) return QColor(); + return m_rgbColors.at(i); } @@ -347,19 +344,17 @@ void RGBMatrix::setMapColors() if (m_group == NULL) m_group = doc()->fixtureGroup(fixtureGroup()); - if (m_group != NULL) { + if (m_group != NULL) + { QVector rawColors; - int accColors = m_algorithm->acceptColors(); - rawColors.resize(accColors); - QVectorIterator it(m_rgbColors); - int count = 0; - while (it.hasNext() && count < accColors) { - QColor color = it.next(); - rawColors.replace(count, color.isValid() ? color.rgb() : 0); - count ++; - }; + for (int i = 0; i < m_algorithm->acceptColors(); i++) + { + QColor col = m_rgbColors.at(i); + rawColors.append(col.isValid() ? col.rgb() : 0); + } + m_algorithm->rgbMapSetColors(rawColors); - }; + } } /************************************************************************ @@ -374,6 +369,10 @@ void RGBMatrix::setProperty(QString propName, QString value) { RGBScript *script = static_cast (m_algorithm); script->setProperty(propName, value); + + QVector colors = script->rgbMapGetColors(); + for (int i = 0; i < colors.count(); i++) + setColor(i, QColor::fromRgb(colors.at(i))); } m_stepsCount = stepsCount(); } @@ -446,11 +445,9 @@ bool RGBMatrix::loadXML(QXmlStreamReader &root) { setColor(1, QColor::fromRgb(QRgb(root.readElementText().toUInt()))); } - else if (root.name().startsWith(KXMLQLCRGBMatrixColorBase, Qt::CaseSensitive)) + else if (root.name() == KXMLQLCRGBMatrixColor) { - QString colorNumText = root.name().string()->right( - root.name().length() - KXMLQLCRGBMatrixColorBase.length()); - uint colorIdx = colorNumText.toUInt() - 1; + int colorIdx = root.attributes().value(KXMLQLCRGBMatrixColorIndex).toInt(); setColor(colorIdx, QColor::fromRgb(QRgb(root.readElementText().toUInt()))); } else if (root.name() == KXMLQLCRGBMatrixControlMode) @@ -506,13 +503,12 @@ bool RGBMatrix::saveXML(QXmlStreamWriter *doc) doc->writeTextElement(KXMLQLCRGBMatrixDimmerControl, QString::number(dimmerControl())); /* Colors */ - QVectorIterator colorIt(m_rgbColors); - uint count = 0; - while (colorIt.hasNext()) { - QColor color = colorIt.next(); - QString elementName = KXMLQLCRGBMatrixColorBase.append(QString::number(count + 1)); - doc->writeTextElement(elementName, QString::number(color.rgb())); - count ++; + for (int i = 0; i < m_rgbColors.count(); i++) + { + doc->writeStartElement(KXMLQLCRGBMatrixColor); + doc->writeAttribute(KXMLQLCRGBMatrixColorIndex, QString::number(i)); + doc->writeCharacters(QString::number(m_rgbColors.at(i).rgb())); + doc->writeEndElement(); } /* Control Mode */ diff --git a/engine/src/rgbplain.cpp b/engine/src/rgbplain.cpp index 17d2ae1a4d..5a43f630a8 100644 --- a/engine/src/rgbplain.cpp +++ b/engine/src/rgbplain.cpp @@ -60,6 +60,11 @@ void RGBPlain::rgbMapSetColors(QVector &colors) Q_UNUSED(colors); } +QVector RGBPlain::rgbMapGetColors() +{ + return QVector(); +} + void RGBPlain::rgbMap(const QSize& size, uint rgb, int step, RGBMap &map) { Q_UNUSED(step); diff --git a/engine/src/rgbplain.h b/engine/src/rgbplain.h index 526fccd0b5..1624b4193a 100644 --- a/engine/src/rgbplain.h +++ b/engine/src/rgbplain.h @@ -52,6 +52,9 @@ class RGBPlain : public QObject, public RGBAlgorithm /** @reimp */ void rgbMapSetColors(QVector &colors); + /** @reimp */ + QVector rgbMapGetColors(); + /** @reimp */ void rgbMap(const QSize& size, uint rgb, int step, RGBMap &map); diff --git a/engine/src/rgbscript.cpp b/engine/src/rgbscript.cpp index 0a12843be1..755bd7a382 100644 --- a/engine/src/rgbscript.cpp +++ b/engine/src/rgbscript.cpp @@ -194,6 +194,11 @@ bool RGBScript::evaluate() qWarning() << m_fileName << "is missing the rgbMapSetColors() function!"; return false; } + + // retrieve the non-mandatory get color function + m_rgbMapGetColors = m_script.property("rgbMapGetColors"); + if (m_rgbMapGetColors.isFunction() == false) + qWarning() << m_fileName << "is missing the rgbMapGetColors() function!"; } if (m_apiVersion >= 2) return loadProperties(); @@ -265,6 +270,7 @@ void RGBScript::rgbMapSetColors(QVector &colors) QMutexLocker engineLocker(s_engineMutex); if (m_apiVersion <= 2) return; + if (m_rgbMapSetColors.isValid() == false) return; @@ -282,6 +288,28 @@ void RGBScript::rgbMapSetColors(QVector &colors) displayError(value, m_fileName); } +QVector RGBScript::rgbMapGetColors() +{ + QMutexLocker engineLocker(s_engineMutex); + QVector colArray; + + if (m_apiVersion <= 2) + return colArray; + + if (m_rgbMapGetColors.isValid() == false) + return colArray; + + QScriptValue colors = m_rgbMapGetColors.call(); + if (colors.isValid() && colors.isArray()) + { + QVariantList arr = colors.toVariant().toList(); + foreach (QVariant color, arr) + colArray.append(color.toUInt()); + } + + return colArray; +} + void RGBScript::rgbMap(const QSize& size, uint rgb, int step, RGBMap &map) { QMutexLocker engineLocker(s_engineMutex); diff --git a/engine/src/rgbscript.h b/engine/src/rgbscript.h index 930c028a7e..b05c6e93b5 100644 --- a/engine/src/rgbscript.h +++ b/engine/src/rgbscript.h @@ -93,6 +93,9 @@ class RGBScript : public RGBAlgorithm /** @reimp */ void rgbMapSetColors(QVector &colors); + /** @reimp */ + QVector rgbMapGetColors(); + /** @reimp */ void rgbMap(const QSize& size, uint rgb, int step, RGBMap &map); @@ -123,6 +126,7 @@ class RGBScript : public RGBAlgorithm QScriptValue m_rgbMap; //! rgbMap() function QScriptValue m_rgbMapStepCount; //! rgbMapStepCount() function QScriptValue m_rgbMapSetColors; //! rgbMapSetColors() function + QScriptValue m_rgbMapGetColors; //! rgbMapSetColors() function /************************************************************************ * Properties diff --git a/engine/src/rgbscriptv4.cpp b/engine/src/rgbscriptv4.cpp index 1c41efa73a..93242b762e 100644 --- a/engine/src/rgbscriptv4.cpp +++ b/engine/src/rgbscriptv4.cpp @@ -268,6 +268,25 @@ void RGBScript::rgbMapSetColors(QVector &colors) displayError(value, m_fileName); } +QVector RGBScript::rgbMapGetColors() +{ + QMutexLocker engineLocker(s_engineMutex); + QVector colArray; + + if (m_rgbMap.isUndefined() == true) + return colArray; + + QJSValue colors = m_rgbMapGetColors.call(); + if (colors.isValid() && colors.isArray()) + { + QVariantList arr = colors.toVariant().toList(); + foreach (QVariant color, arr) + colArray.append(color.toUInt()); + } + + return colArray; +} + void RGBScript::rgbMap(const QSize& size, uint rgb, int step, RGBMap &map) { QMutexLocker engineLocker(s_engineMutex); diff --git a/engine/src/rgbscriptv4.h b/engine/src/rgbscriptv4.h index bdb189f67f..4e1fcee93a 100644 --- a/engine/src/rgbscriptv4.h +++ b/engine/src/rgbscriptv4.h @@ -94,6 +94,9 @@ class RGBScript : public RGBAlgorithm /** @reimp */ void rgbMapSetColors(QVector &colors); + /** @reimp */ + QVector rgbMapGetColors(); + /** @reimp */ void rgbMap(const QSize& size, uint rgb, int step, RGBMap &map); @@ -124,6 +127,7 @@ class RGBScript : public RGBAlgorithm QJSValue m_rgbMap; //! rgbMap() function QJSValue m_rgbMapStepCount; //! rgbMapStepCount() function QJSValue m_rgbMapSetColors; //! rgbMapSetColors() function + QJSValue m_rgbMapGetColors; //! rgbMapSetColors() function /************************************************************************ * Properties diff --git a/engine/src/rgbtext.cpp b/engine/src/rgbtext.cpp index 33b1ddd90a..d4d13f0fad 100644 --- a/engine/src/rgbtext.cpp +++ b/engine/src/rgbtext.cpp @@ -271,6 +271,11 @@ void RGBText::rgbMapSetColors(QVector &colors) Q_UNUSED(colors); } +QVector RGBText::rgbMapGetColors() +{ + return QVector(); +} + void RGBText::rgbMap(const QSize& size, uint rgb, int step, RGBMap &map) { if (animationStyle() == StaticLetters) diff --git a/engine/src/rgbtext.h b/engine/src/rgbtext.h index b49faeb100..2e4d5cafcc 100644 --- a/engine/src/rgbtext.h +++ b/engine/src/rgbtext.h @@ -101,6 +101,9 @@ class RGBText : public RGBAlgorithm /** @reimp */ void rgbMapSetColors(QVector &colors); + /** @reimp */ + QVector rgbMapGetColors(); + /** @reimp */ void rgbMap(const QSize& size, uint rgb, int step, RGBMap &map); diff --git a/resources/rgbscripts/plasma.js b/resources/rgbscripts/plasma.js index c2afb92c6a..ac9c0f994d 100644 --- a/resources/rgbscripts/plasma.js +++ b/resources/rgbscripts/plasma.js @@ -24,9 +24,9 @@ var testAlgo; function() { var algo = new Object; - algo.apiVersion = 2; + algo.apiVersion = 3; algo.name = "Plasma"; - algo.author = "Tim Cullingworth"; + algo.author = "Tim Cullingworth, Massimo Callegari"; algo.acceptColors = 0; algo.properties = new Array(); algo.rstepcount = 0; @@ -35,7 +35,7 @@ var testAlgo; algo.presetIndex = 0; algo.properties.push( "name:presetIndex|type:list|display:Preset|" + - "values:Rainbow,Fire,Abstract,Ocean|" + + "values:Rainbow,Fire,Abstract,Ocean,User Defined|" + "write:setPreset|read:getPreset"); algo.presetSize = 5; algo.properties.push( @@ -53,18 +53,37 @@ var testAlgo; var util = new Object; util.initialized = false; util.gradientData = new Array(); - util.presets = new Array(); - util.presets.push(new Array(0xFF0000, 0x00FF00, 0x0000FF)); - util.presets.push(new Array(0xFFFF00, 0xFF0000, 0x000040, 0xFF0000)); - util.presets.push(new Array(0x5571FF, 0x00FFFF, 0xFF00FF, 0xFFFF00)); - util.presets.push(new Array(0x003AB9, 0x02EAFF)); + util.colorArray = new Array(); algo.setPreset = function(_preset) { - if (_preset === "Rainbow") { algo.presetIndex = 0; } - else if (_preset === "Fire") { algo.presetIndex = 1; } - else if (_preset === "Abstract") { algo.presetIndex = 2; } - else if (_preset === "Ocean") { algo.presetIndex = 3; } + algo.acceptColors = 0; + if (_preset === "Rainbow") + { + algo.presetIndex = 0; + util.colorArray = [ 0xFF0000, 0x00FF00, 0x0000FF ]; + } + else if (_preset === "Fire") + { + algo.presetIndex = 1; + util.colorArray = [ 0xFFFF00, 0xFF0000, 0x000040, 0xFF0000 ]; + } + else if (_preset === "Abstract") + { + algo.presetIndex = 2; + util.colorArray = [ 0x5571FF, 0x00FFFF, 0xFF00FF, 0xFFFF00 ]; + } + else if (_preset === "Ocean") + { + algo.presetIndex = 3; + util.colorArray = [ 0x003AB9, 0x02EAFF ]; + } + else if (_preset === "User Defined") + { + algo.presetIndex = 4; + algo.acceptColors = 5; + util.colorArray = [ 0x00FF00, 0xFFAA00, 0x0000FF, 0xFFFF00, 0xFFFFFF ]; + } else { algo.presetIndex = 0; } util.initialized = false; }; @@ -75,6 +94,7 @@ var testAlgo; else if (algo.presetIndex === 1) { return "Fire"; } else if (algo.presetIndex === 2) { return "Abstract"; } else if (algo.presetIndex === 3) { return "Ocean"; } + else if (algo.presetIndex === 4) { return "User Defined"; } else { return "Rainbow"; } }; @@ -117,13 +137,10 @@ var testAlgo; // with the given width var gradIdx = 0; util.gradientData = new Array(); - for (var i = 0; i < util.presets[algo.presetIndex].length; i++) + for (var i = 0; i < util.colorArray.length; i++) { - var sColor = util.presets[algo.presetIndex][i]; - var eColor = util.presets[algo.presetIndex][0]; - if (i < util.presets.length - 1) { - eColor = util.presets[algo.presetIndex][i + 1]; - } + var sColor = util.colorArray[i]; + var eColor = util.colorArray[0]; util.gradientData[gradIdx++] = sColor; var sr = (sColor >> 16) & 0x00FF; var sg = (sColor >> 8) & 0x00FF; @@ -243,6 +260,26 @@ var testAlgo; return scaled; } + algo.rgbMapSetColors = function(rawColors) + { + if (! Array.isArray(rawColors)) + return; + for (var i = 0; i < algo.acceptColors; i++) { + if (i < rawColors.length) + { + util.colorArray[i] = rawColors[i]; + } else { + util.colorArray[i] = 0; + } + } + util.initialized = false; + } + + algo.rgbMapGetColors = function() + { + return util.colorArray; + } + algo.rgbMap = function(width, height, rgb, step) { if (util.initialized === false) diff --git a/ui/src/rgbmatrixeditor.cpp b/ui/src/rgbmatrixeditor.cpp index a6c35cc167..a151eeed65 100644 --- a/ui/src/rgbmatrixeditor.cpp +++ b/ui/src/rgbmatrixeditor.cpp @@ -394,85 +394,27 @@ void RGBMatrixEditor::updateExtraOptions() m_yOffsetSpin->setValue(text->yOffset()); } + updateColorOptions(); +} + +void RGBMatrixEditor::updateColorOptions() +{ if (m_matrix->algorithm() != NULL) { int accColors = m_matrix->algorithm()->acceptColors(); - if (accColors == 0) - { - m_mtxColor1Button->hide(); - m_mtxColor2Button->hide(); - m_resetMtxColor2Button->hide(); - m_mtxColor3Button->hide(); - m_resetMtxColor3Button->hide(); - m_mtxColor4Button->hide(); - m_resetMtxColor4Button->hide(); - m_mtxColor5Button->hide(); - m_resetMtxColor5Button->hide(); - m_blendModeLabel->hide(); - m_blendModeCombo->hide(); - } - else - { - m_mtxColor1Button->show(); - if (accColors == 1 || m_blendModeCombo->currentIndex() == Universe::MaskBlend) - { - m_mtxColor2Button->hide(); - m_resetMtxColor2Button->hide(); - m_mtxColor3Button->hide(); - m_resetMtxColor3Button->hide(); - m_mtxColor4Button->hide(); - m_resetMtxColor4Button->hide(); - m_mtxColor5Button->hide(); - m_resetMtxColor5Button->hide(); - } - else if (accColors == 2) - { - m_mtxColor2Button->show(); - m_resetMtxColor2Button->show(); - m_mtxColor3Button->hide(); - m_resetMtxColor3Button->hide(); - m_mtxColor4Button->hide(); - m_resetMtxColor4Button->hide(); - m_mtxColor5Button->hide(); - m_resetMtxColor5Button->hide(); - } - else if (accColors == 3) - { - m_mtxColor2Button->show(); - m_resetMtxColor2Button->show(); - m_mtxColor3Button->show(); - m_resetMtxColor3Button->show(); - m_mtxColor4Button->hide(); - m_resetMtxColor4Button->hide(); - m_mtxColor5Button->hide(); - m_resetMtxColor5Button->hide(); - } - else if (accColors == 4) - { - m_mtxColor2Button->show(); - m_resetMtxColor2Button->show(); - m_mtxColor3Button->show(); - m_resetMtxColor3Button->show(); - m_mtxColor4Button->show(); - m_resetMtxColor4Button->show(); - m_mtxColor5Button->hide(); - m_resetMtxColor5Button->hide(); - } - else - { - m_mtxColor2Button->show(); - m_resetMtxColor2Button->show(); - m_mtxColor3Button->show(); - m_resetMtxColor3Button->show(); - m_mtxColor4Button->show(); - m_resetMtxColor4Button->show(); - m_mtxColor5Button->show(); - m_resetMtxColor5Button->show(); - } - m_blendModeLabel->show(); - m_blendModeCombo->show(); - } + m_mtxColor1Button->setVisible(accColors == 0 ? false : true); + m_mtxColor2Button->setVisible(accColors > 1 ? true : false); + m_resetMtxColor2Button->setVisible(accColors > 1 ? true : false); + m_mtxColor3Button->setVisible(accColors > 2 ? true : false); + m_resetMtxColor3Button->setVisible(accColors > 2 ? true : false); + m_mtxColor4Button->setVisible(accColors > 3 ? true : false); + m_resetMtxColor4Button->setVisible(accColors > 3 ? true : false); + m_mtxColor5Button->setVisible(accColors > 4 ? true : false); + m_resetMtxColor5Button->setVisible(accColors > 4 ? true : false); + + m_blendModeLabel->setVisible(accColors == 0 ? false : true); + m_blendModeCombo->setVisible(accColors == 0 ? false : true); } } @@ -1524,6 +1466,9 @@ void RGBMatrixEditor::slotPropertyComboChanged(int index) QString pValue = combo->itemText(index); qDebug() << "Property combo changed to" << pValue; m_matrix->setProperty(pName, pValue); + + updateColorOptions(); + updateColors(); } } diff --git a/ui/src/rgbmatrixeditor.h b/ui/src/rgbmatrixeditor.h index 150bc70fc6..22ccb63531 100644 --- a/ui/src/rgbmatrixeditor.h +++ b/ui/src/rgbmatrixeditor.h @@ -63,6 +63,7 @@ public slots: void fillAnimationCombo(); void fillImageAnimationCombo(); void updateExtraOptions(); + void updateColorOptions(); void updateColors(); void resetProperties(QLayoutItem *item); void displayProperties(RGBScript *script);