-
-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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)
- Loading branch information
1 parent
98c4a98
commit 6cd67bd
Showing
17 changed files
with
201 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
6cd67bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hjtappe please review this commit. I have optimized a few code blocks that were inefficient and redundant.
Also, please see the update plasma.js script. It's backward compatible and it also handles user defined colors by changing acceptColors upon preset change. Afterward, the UI will retrieve the color set from the script.
IMHO this gives further flexibility to color handling.
If you're OK with these changes, can you please help to review the other RGB scripts, dev tools, test units?
I think in this way we don't need "direct" versions of the scripts, right?
6cd67bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also check if RGBAlgorithmColorDisplayCount could be removed. I had used that also as a marker towards the areas which require attention regarding the static 5 entries in UI/QMLUI. The one in ui/ might remain, but then, the #define should be moved there.
ui/src/rgbmatrixeditor.cpp:832:#if (5 != RGBAlgorithmColorDisplayCount)
engine/src/rgbalgorithm.h:43:#define RGBAlgorithmColorDisplayCount 5
engine/src/rgbmatrix.cpp:79: m_rgbColors.fill(QColor(), RGBAlgorithmColorDisplayCount);
qmlui/rgbmatrixeditor.cpp:137: Q_ASSERT(5 == RGBAlgorithmColorDisplayCount);
6cd67bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While testing, I found an index overrun in ballscolors.js.
Would you just apply that or should I open a pull request?
--- a/resources/rgbscripts/ballscolors.js
+++ b/resources/rgbscripts/ballscolors.js
@@ -207,7 +207,7 @@ var testAlgo;
var yDirection = (Math.random() * 2) - 1; // and random directions
var xDirection = (Math.random() * 2) - 1;
algo.direction[i] = [yDirection, xDirection];
- algo.colour[i] = colorPalette.collection[algo.colorIndex[i]][1];
+ algo.colour[i] = colorPalette.collection[algo.colorIndex[i % algo.colorIndex.length]][1];
}
algo.initialized = true;
return;
6cd67bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the stagecolors branch is still a work in progress, please do open a new pull request with your findings.
I guess there will be many more changes to be applied there.
In this way we can comment on a proper PR rather than a past commit 😉
Thanks!
6cd67bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plasma script does not seem right in the devtools, the color transitions are not smooth. I'll take a deeper look next week.
6cd67bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I have covered the scripts, devscript and QLC functionality through review.
Let me know if I can assist with anything else.
6cd67bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hjtappe thanks!
Will you send a new PR with some fixes for the stagecolor branch? Thank you
6cd67bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll create a PR.
6cd67bd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please
Yes, please make the basic "balls.js" script backward compatible with color support. Basically I would not add the "direct" version
To be honest I would overwrite the existing and even remove redundant scripts like plasmacolors.
I can add a warning in the next release notes to review a project if it uses those scripts.
As I mentioned before, less scripts, less confusion among users.
In any case users can use old scripts from previous QLC+ versions.