Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use QColor for cue colors (rebased) #2399

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4cb3746
Create HotcueColorPalette class
ferranpujolcamins Oct 27, 2019
e36643b
Add methods to store QColor in the config
ferranpujolcamins Oct 27, 2019
86bf988
Add class to store HotcueColorPalette in userconfig
ferranpujolcamins Oct 27, 2019
3663eb3
Add tests for color config methods
ferranpujolcamins Nov 1, 2019
4dda672
Make Cue related code use QColor instead of PredefinedColorPointer
ferranpujolcamins Nov 2, 2019
09b4b86
Migrate hotcue color id to RGBA in DB
ferranpujolcamins Nov 2, 2019
e88c0c9
Remove PredefinedColorRepresentation
ferranpujolcamins Nov 2, 2019
2845888
Make UserSettings available in ControllerEngine
ferranpujolcamins Nov 3, 2019
4b2b78e
Remove PredefinedColors from controller scripts
ferranpujolcamins Nov 3, 2019
41a130d
Remove PredefinedColor
ferranpujolcamins Nov 3, 2019
e30bfda
Update midi-components library
ferranpujolcamins Nov 3, 2019
e2b0630
Avoid constructing HotcueColorPaletteSettings every time its used
ferranpujolcamins Nov 3, 2019
92ad543
Change test names
ferranpujolcamins Nov 4, 2019
56f5637
Reorder constructor parameters
ferranpujolcamins Nov 4, 2019
8f95149
Rename member variable
ferranpujolcamins Nov 4, 2019
e115fdd
Rename some color related classes
ferranpujolcamins Nov 4, 2019
92d11cf
Remove cues tab on TrackInfo
ferranpujolcamins Nov 4, 2019
fa2c0ff
Set hotcue color to the first predefined color
ferranpujolcamins Nov 11, 2019
a80a2f6
Set hotcue color CO to -1 when no hotcue is loaded
ferranpujolcamins Nov 11, 2019
95f7c01
Make hotcue skin buttons use the cue color
ferranpujolcamins Nov 11, 2019
e3b33a9
Allow skins to configure text color depending on background
ferranpujolcamins Nov 11, 2019
c0e6d43
Highlight hotcue buttons when hovered
ferranpujolcamins Nov 11, 2019
0e5d768
Fix Shade hotcue buttons color
ferranpujolcamins Nov 12, 2019
169bd95
Make hotcue button hover highlighting configurable
ferranpujolcamins Nov 12, 2019
07460c0
Fix auto_hotcue_colors not assigning first color
ferranpujolcamins Nov 17, 2019
ada3c85
Merge remote-tracking branch 'upstream/master' into hotcue_qcolor
Be-ing Dec 14, 2019
8bce62f
WIP
Be-ing Jan 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ def sources(self, build):
"src/preferences/effectsettingsmodel.cpp",
"src/preferences/broadcastprofile.cpp",
"src/preferences/upgrade.cpp",
"src/preferences/hotcuecolorpalettesettings.cpp",
"src/preferences/dlgpreferencepage.cpp",

"src/effects/effectmanifest.cpp",
Expand Down Expand Up @@ -1262,6 +1263,7 @@ def sources(self, build):
"src/util/movinginterquartilemean.cpp",
"src/util/console.cpp",
"src/util/color/color.cpp",
"src/util/color/colorpalette.cpp",
"src/util/db/dbconnection.cpp",
"src/util/db/dbconnectionpool.cpp",
"src/util/db/dbconnectionpooler.cpp",
Expand All @@ -1288,8 +1290,7 @@ def sources(self, build):
"src/util/desktophelper.cpp",
"src/util/widgetrendertimer.cpp",
"src/util/workerthread.cpp",
"src/util/workerthreadscheduler.cpp",
"src/util/color/predefinedcolor.cpp"
"src/util/workerthreadscheduler.cpp"
]

proto_args = {
Expand Down
12 changes: 6 additions & 6 deletions res/controllers/Roland_DJ-505-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,7 @@ DJ505.PitchPlayMode = function (deck, offset) {
this.number = n + 1;
this.on = this.color + DJ505.PadColor.DIM_MODIFIER;
this.colors = pitchplayColors;
this.colorIdKey = 'hotcue_' + this.number + '_color_id';
this.colorKey = 'hotcue_' + this.number + '_color';
components.Button.call(this);
};
this.PerformancePad.prototype = new components.Button({
Expand Down Expand Up @@ -1561,8 +1561,8 @@ DJ505.PitchPlayMode = function (deck, offset) {
this.outKey = "hotcue_" + this.number + "_enabled";
this.output = function (value, group, control) {
var outval = this.outValueScale(value);
if (this.colorIdKey !== undefined && outval !== this.off) {
this.outputColor(engine.getValue(this.group, this.colorIdKey));
if (this.colorKey !== undefined && outval !== this.off) {
this.outputColor(engine.getValue(this.group, this.colorKey));
} else {
this.send(DJ505.PadColor.OFF);
}
Expand All @@ -1572,13 +1572,13 @@ DJ505.PitchPlayMode = function (deck, offset) {
var previous_cuepoint = this.mode.cuepoint;
this.mode.cuepoint = this.number;
this.mode.pads[previous_cuepoint - 1].trigger();
this.outputColor(engine.getValue(this.group, this.colorIdKey));
this.outputColor(engine.getValue(this.group, this.colorKey));
}
};
this.connect = function() {
components.Button.prototype.connect.call(this); // call parent connect
if (undefined !== this.group && this.colorIdKey !== undefined) {
this.connections[1] = engine.makeConnection(this.group, this.colorIdKey, function (id) {
if (undefined !== this.group && this.colorKey !== undefined) {
this.connections[1] = engine.makeConnection(this.group, this.colorKey, function (id) {
if (engine.getValue(this.group, this.outKey)) {
this.outputColor(id);
}
Expand Down
16 changes: 8 additions & 8 deletions res/controllers/midi-components-0.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@
return;
}
if (options.colors !== undefined || options.sendRGB !== undefined) {
this.colorIdKey = 'hotcue_' + options.number + '_color_id';
this.colorKey = 'hotcue_' + options.number + '_color';
if (options.colors === undefined) {
options.colors = color.predefinedColorsList();
options.colors = color.hotcueColorPalette();
}
}
this.number = options.number;
Expand All @@ -312,8 +312,8 @@
this.inKey = 'hotcue_' + this.number + '_clear';
},
getColor: function() {
if (this.colorIdKey !== undefined) {
return color.predefinedColorFromId(engine.getValue(this.group,this.colorIdKey));
if (this.colorKey !== undefined) {
return color.colorFromHexCode(engine.getValue(this.group,this.colorKey));
} else {
return null;
}
Expand All @@ -324,8 +324,8 @@
// and there is no hotcueColor for turning the LED
// off. So the `send()` function is responsible for turning the
// actual LED off.
if (this.colorIdKey !== undefined && outval !== this.off) {
this.outputColor(engine.getValue(this.group, this.colorIdKey));
if (this.colorKey !== undefined && outval !== this.off) {
this.outputColor(engine.getValue(this.group, this.colorKey));
} else {
this.send(outval);
}
Expand All @@ -348,8 +348,8 @@
},
connect: function() {
Button.prototype.connect.call(this); // call parent connect
if (undefined !== this.group && this.colorIdKey !== undefined) {
this.connections[1] = engine.makeConnection(this.group, this.colorIdKey, function (id) {
if (undefined !== this.group && this.colorKey !== undefined) {
this.connections[1] = engine.makeConnection(this.group, this.colorKey, function (id) {
if (engine.getValue(this.group,this.outKey)) {
this.outputColor(id);
}
Expand Down
27 changes: 26 additions & 1 deletion res/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -480,5 +480,30 @@ METADATA
position INTEGER
);
</sql>
</revision>
</revision>
<revision version="31" min_compatible="3">
<description>
Convert the PredefinedColor id to the actual RGBA value.
</description>
<sql>
<!-- No Color becomes red-->
UPDATE cues SET color=4291103240 WHERE color=0;
<!-- Red -->
UPDATE cues SET color=4291103240 WHERE color=1;
<!-- Green -->
UPDATE cues SET color=4281515588 WHERE color=2;
<!-- Blue -->
UPDATE cues SET color=4278207743 WHERE color=3;
<!-- Yellow -->
UPDATE cues SET color=4294496768 WHERE color=4;
<!-- Celeste -->
UPDATE cues SET color=4282569972 WHERE color=5;
<!-- Magenta -->
UPDATE cues SET color=4289659084 WHERE color=6;
<!-- Pink -->
UPDATE cues SET color=4294747863 WHERE color=7;
<!-- White -->
UPDATE cues SET color=4294111999 WHERE color=8;
</sql>
</revision>
</schema>
4 changes: 2 additions & 2 deletions res/skins/Deere/hotcue_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<ConnectValueFromWidget>false</ConnectValueFromWidget>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="hotcue"/>_color_id</ConfigKey>
<BindProperty>highlight</BindProperty>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="hotcue"/>_color</ConfigKey>
<BindProperty>backgroundColorRgba</BindProperty>
</Connection>
</PushButton>
</Template>
123 changes: 5 additions & 118 deletions res/skins/Deere/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,6 @@ WPushButton:hover {
/*"Pressed" state*/
WPushButton[value="1"],
WPushButton[value="2"] {
/*color: #FDFDFD;*/
color: #FDFDFD;
background-color: #006596;
border: 0px solid #006596;
Expand All @@ -1596,129 +1595,17 @@ WPushButton[value="2"]:hover {
border: 0px solid #0080BE;
}

/* Hotcue Color: No Color */
#HotcueButton[value="1"][highlight="0"],
#HotcueButton[value="2"][highlight="0"] {
background-color: #006596;
}

#HotcueButton[value="1"][highlight="0"]:hover,
#HotcueButton[value="2"][highlight="0"]:hover {
background-color: #0080BE;
}

/* Hotcue Color: Red */
#HotcueButton[value="1"][highlight="1"],
#HotcueButton[value="2"][highlight="1"] {
background-color: #c50a08;
}

#HotcueButton[value="1"][highlight="1"]:hover,
#HotcueButton[value="2"][highlight="1"]:hover {
background-color: #e50c08;
}

/* Hotcue Color: Green */
#HotcueButton[value="1"][highlight="2"],
#HotcueButton[value="2"][highlight="2"] {
background-color: #32be44;
}

#HotcueButton[value="1"][highlight="2"]:hover,
#HotcueButton[value="2"][highlight="2"]:hover {
background-color: #52de64;
}

/* Hotcue Color: Blue */
#HotcueButton[value="1"][highlight="3"],
#HotcueButton[value="2"][highlight="3"] {
background-color: #0044ff;
}

#HotcueButton[value="1"][highlight="3"]:hover,
#HotcueButton[value="2"][highlight="3"]:hover {
background-color: #0064ff;
}

/* Hotcue Color: Yellow */
#HotcueButton[value="1"][highlight="4"],
#HotcueButton[value="2"][highlight="4"] {
color: #4B4B4B;
background-color: #f8d200;
}

#HotcueButton[value="1"][highlight="4"]:hover,
#HotcueButton[value="2"][highlight="4"]:hover {
color: #4B4B4B;
background-color: #f8f200;
}

/* Hotcue Color: Celeste */
#HotcueButton[value="1"][highlight="5"],
#HotcueButton[value="2"][highlight="5"] {
color: #4B4B4B;
background-color: #42d4f4;
#HotcueButton {
qproperty-shouldHighlightBackgroundOnHover: true;
}

#HotcueButton[value="1"][highlight="5"]:hover,
#HotcueButton[value="2"][highlight="5"]:hover {
color: #4B4B4B;
background-color: #62f4f4;
}

/* Hotcue Color: Purple */
#HotcueButton[value="1"][highlight="6"],
#HotcueButton[value="2"][highlight="6"] {
background-color: #af00cc;
}

#HotcueButton[value="1"][highlight="6"]:hover,
#HotcueButton[value="2"][highlight="6"]:hover {
background-color: #cf00ec;
}

/* Hotcue Color: Pink */
#HotcueButton[value="1"][highlight="7"],
#HotcueButton[value="2"][highlight="7"] {
color: #4B4B4B;
background-color: #fca6d7;
}

#HotcueButton[value="1"][highlight="7"]:hover,
#HotcueButton[value="2"][highlight="7"]:hover {
color: #4B4B4B;
background-color: #fcc6f7;
}

/* Hotcue Color: White */
#HotcueButton[value="1"][highlight="8"],
#HotcueButton[value="2"][highlight="8"] {
color: #4B4B4B;
background-color: #f2f2ff;
}

#HotcueButton[value="1"][highlight="8"]:hover,
#HotcueButton[value="2"][highlight="8"]:hover {
color: #4B4B4B;
background-color: #ffffff;
}

/*"Enabled" state, e.g. for recording status
0 -- disconnected / off
1 -- connecting / enabling
2 -- connected / enabled
WPushButton[value="2"] {
#HotcueButton[backgroundIsDark=true][hasBackgroundColor=true] {
color: #FDFDFD;
background-color: #4B4B4B;
border: 0px solid #006596;
}

WPushButton[value="2"]:hover {
color: #FDFDFD;
background-color: #4B4B4B;
border: 0px solid #0080BE;
#HotcueButton[backgroundIsDark=false][hasBackgroundColor=true] {
color: #1f1e1e;
}
*/

#PlayToggle[value="0"] {
image: url(skin:/icon/ic_play_48px.svg) no-repeat center center;
Expand Down
4 changes: 2 additions & 2 deletions res/skins/LateNight/button_hotcue.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
<ConnectValueFromWidget>false</ConnectValueFromWidget>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="number"/>_color_id</ConfigKey>
<BindProperty>highlight</BindProperty>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="number"/>_color</ConfigKey>
<BindProperty>backgroundColorRgba</BindProperty>
</Connection>
</PushButton>
</Children>
Expand Down
38 changes: 0 additions & 38 deletions res/skins/LateNight/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -700,44 +700,6 @@ QPushButton#pushButtonAutoDJ:checked,
}
/* ToDo
* orange Play button when playing from Cue / Hotcue */
/* Hotcue Color: Green */
#HotcueButton[displayValue="1"][highlight="2"],
#HotcueButton[displayValue="2"][highlight="2"] {
background-color: #32be44;
}
/* Hotcue Color: Blue */
#HotcueButton[displayValue="1"][highlight="3"],
#HotcueButton[displayValue="2"][highlight="3"],
#SpecialCueButton[value="1"] {
background-color: #0044ff;
}
/* Hotcue Color: Yellow */
#HotcueButton[displayValue="1"][highlight="4"],
#HotcueButton[displayValue="2"][highlight="4"] {
background-color: #f8d200;
}
/* Hotcue Color: Celeste */
#HotcueButton[displayValue="1"][highlight="5"],
#HotcueButton[displayValue="2"][highlight="5"] {
background-color: #42d4f4;
}
/* Hotcue Color: Purple */
#HotcueButton[displayValue="1"][highlight="6"],
#HotcueButton[displayValue="2"][highlight="6"] {
background-color: #af00cc;
}
/* Hotcue Color: Pink */
#HotcueButton[displayValue="1"][highlight="7"],
#HotcueButton[displayValue="2"][highlight="7"] {
background-color: #fca6d7;
}
/* Hotcue Color: White */
#HotcueButton[displayValue="1"][highlight="8"],
#HotcueButton[displayValue="2"][highlight="8"] {
background-color: #f2f2ff;
}
/************** Button borders & backgrounds **********************************/



/************** Button icons **************************************************/
Expand Down
Binary file modified res/skins/Shade/btn/btn_hotcue_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/skins/Shade/btn/btn_hotcue_1_down.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_1_over.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_1_overdown.png
Binary file not shown.
Binary file modified res/skins/Shade/btn/btn_hotcue_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/skins/Shade/btn/btn_hotcue_2_down.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_2_over.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_2_overdown.png
Binary file not shown.
Binary file modified res/skins/Shade/btn/btn_hotcue_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/skins/Shade/btn/btn_hotcue_3_down.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_3_over.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_3_overdown.png
Binary file not shown.
Binary file modified res/skins/Shade/btn/btn_hotcue_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/skins/Shade/btn/btn_hotcue_4_down.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_4_over.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_4_overdown.png
Binary file not shown.
Binary file modified res/skins/Shade/btn/btn_hotcue_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/skins/Shade/btn/btn_hotcue_5_down.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_5_over.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_5_overdown.png
Binary file not shown.
Binary file modified res/skins/Shade/btn/btn_hotcue_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/skins/Shade/btn/btn_hotcue_6_down.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_6_over.png
Binary file not shown.
Binary file removed res/skins/Shade/btn/btn_hotcue_6_overdown.png
Binary file not shown.
Binary file modified res/skins/Shade/btn/btn_hotcue_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed res/skins/Shade/btn/btn_hotcue_7_down.png
Diff not rendered.
Binary file removed res/skins/Shade/btn/btn_hotcue_7_over.png
Diff not rendered.
Binary file removed res/skins/Shade/btn/btn_hotcue_7_overdown.png
Diff not rendered.
Binary file modified res/skins/Shade/btn/btn_hotcue_8.png
Binary file removed res/skins/Shade/btn/btn_hotcue_8_down.png
Diff not rendered.
Binary file removed res/skins/Shade/btn/btn_hotcue_8_over.png
Diff not rendered.
Binary file removed res/skins/Shade/btn/btn_hotcue_8_overdown.png
Diff not rendered.
10 changes: 5 additions & 5 deletions res/skins/Shade/deck_hotcue_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<RightClickIsPushButton>true</RightClickIsPushButton>
<State>
<Number>0</Number>
<Pressed>skin:/btn/btn_hotcue_<Variable name="hotcue"/>_down.png</Pressed>
<Pressed>skin:/btn/btn_hotcue_<Variable name="hotcue"/>.png</Pressed>
<Unpressed>skin:/btn/btn_hotcue_<Variable name="hotcue"/>.png</Unpressed>
</State>
<State>
<Number>1</Number>
<Pressed>skin:/btn/btn_hotcue_<Variable name="hotcue"/>_overdown.png</Pressed>
<Unpressed>skin:/btn/btn_hotcue_<Variable name="hotcue"/>_over.png</Unpressed>
<Pressed>skin:/btn/btn_hotcue_<Variable name="hotcue"/>.png</Pressed>
<Unpressed>skin:/btn/btn_hotcue_<Variable name="hotcue"/>.png</Unpressed>
</State>
<Connection>
<ConfigKey>[Channel<Variable name="channum"/>],hotcue_<Variable name="hotcue"/>_activate</ConfigKey>
Expand All @@ -33,8 +33,8 @@
<ConnectValueFromWidget>false</ConnectValueFromWidget>
</Connection>
<Connection>
<ConfigKey>[Channel<Variable name="channum"/>],hotcue_<Variable name="hotcue"/>_color_id</ConfigKey>
<BindProperty>highlight</BindProperty>
<ConfigKey>[Channel<Variable name="channum"/>],hotcue_<Variable name="hotcue"/>_color</ConfigKey>
<BindProperty>backgroundColorRgba</BindProperty>
</Connection>
</PushButton>
</Template>
Loading