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 rgb presentation for cue colors with "no color" migration #2398

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
be0f798
Create HotcueColorPalette class
ferranpujolcamins Oct 27, 2019
ff6602c
Add methods to store QColor in the config
ferranpujolcamins Oct 27, 2019
594e091
Add class to store HotcueColorPalette in userconfig
ferranpujolcamins Oct 27, 2019
746a2d0
Add tests for color config methods
ferranpujolcamins Nov 1, 2019
6816b04
Make Cue related code use QColor
ferranpujolcamins Nov 2, 2019
5d05386
Migrate hotcue color id to RGBA in DB
ferranpujolcamins Nov 2, 2019
1263a48
Remove PredefinedColorRepresentation
ferranpujolcamins Nov 2, 2019
1243b80
Make UserSettings available in ControllerEngine
ferranpujolcamins Nov 3, 2019
6c45087
Remove PredefinedColors from controller scripts
ferranpujolcamins Nov 3, 2019
c1ecfe1
Remove PredefinedColor
ferranpujolcamins Nov 3, 2019
81db977
Update midi-components library
ferranpujolcamins Nov 3, 2019
d58fadb
Avoid constructing HotcueColorPaletteSettings every time its used
ferranpujolcamins Nov 3, 2019
cfd7b15
Change test names
ferranpujolcamins Nov 4, 2019
6447375
Reorder constructor parameters
ferranpujolcamins Nov 4, 2019
4f1e138
Rename member variable
ferranpujolcamins Nov 4, 2019
db0d7fe
Rename some color related classes
ferranpujolcamins Nov 4, 2019
7d4f254
Remove cues tab on TrackInfo
ferranpujolcamins Nov 4, 2019
2572916
Add QColorDialog to ColorMenu
ferranpujolcamins Nov 4, 2019
46c02fd
Set hotcue color to the first predefined color
ferranpujolcamins Nov 11, 2019
06f6750
Set hotcue color CO to -1 when no hotcue is loaded
ferranpujolcamins Nov 11, 2019
e67a6ed
Make hotcue skin buttons use the cue color
ferranpujolcamins Nov 11, 2019
cdc40f4
Pass UserSettings to Controller constructor
ferranpujolcamins Nov 11, 2019
23caf07
Format code
ferranpujolcamins Nov 11, 2019
5b9f08b
Rename members
ferranpujolcamins Nov 11, 2019
2120185
Change string literal
ferranpujolcamins Nov 11, 2019
374e779
Allow skins to configure text color depending on background
ferranpujolcamins Nov 11, 2019
a5ee198
Highlight hotcue buttons when hovered
ferranpujolcamins Nov 11, 2019
a0646fa
Fix Shade hotcue buttons color
ferranpujolcamins Nov 12, 2019
2688916
Make hotcue button hover highlighting configurable
ferranpujolcamins Nov 12, 2019
844ab4c
Fix auto_hotcue_colors not assigning first color
ferranpujolcamins Nov 17, 2019
c96bc32
Use orange as default Cue color, keep Black as default in database an…
daschuer Nov 22, 2019
c64ff42
Respect auto_hotcue_colors when loading cues from database
daschuer Nov 22, 2019
73339cf
Move getDefaultColor() to HotcueColorPaletteSettings
daschuer Nov 23, 2019
c70b66c
Merge remote-tracking branch 'upstream/master' into new_colors_impl2
daschuer Dec 14, 2019
ba0e9b3
Merge remote-tracking branch 'upstream/master' into new_colors_impl2
daschuer Jan 1, 2020
d314ac3
Mask alpha channel and use light weight QRgb where possible
daschuer Jan 1, 2020
8cdf264
Allow to select a default color
daschuer Jan 2, 2020
227b702
Use Skin default hot cue color by default
daschuer Jan 4, 2020
f07ff0d
Fix merge issues with LatNight skin
daschuer Jan 4, 2020
11421fc
Store selected default color as cue color
daschuer Jan 4, 2020
86b1fcc
Show message box that explains storing the default Hotcue color
daschuer Jan 5, 2020
4818acf
Show colors in hotcue default color combobox
daschuer Jan 5, 2020
42c6c01
Merge remote-tracking branch 'upstream/master' into new_colors_impl2
daschuer Jan 18, 2020
06014b1
Added colorconfig_test to CMakeList.txt and fix it
daschuer Jan 18, 2020
ddfbf1b
define the off palette default color at a single place
daschuer Jan 18, 2020
3d96a85
Added HotcueColorPaletteSettings::PaletteIndex
daschuer Jan 18, 2020
098fdcf
Improve default cue explaination text.
daschuer Jan 21, 2020
5405487
Merge remote-tracking branch 'upstream/master' into new_colors_impl2
daschuer Jan 21, 2020
5b589cf
Fix readability and other minor changes
daschuer Jan 21, 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: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/preferences/replaygainsettings.cpp
src/preferences/settingsmanager.cpp
src/preferences/upgrade.cpp
src/preferences/hotcuecolorpalettesettings.cpp
src/recording/recordingmanager.cpp
src/skin/colorschemeparser.cpp
src/skin/imgcolor.cpp
Expand Down Expand Up @@ -524,7 +525,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/util/battery/battery.cpp
src/util/cmdlineargs.cpp
src/util/color/color.cpp
src/util/color/predefinedcolor.cpp
src/util/color/colorpalette.cpp
src/util/console.cpp
src/util/db/dbconnection.cpp
src/util/db/dbconnectionpool.cpp
Expand Down Expand Up @@ -907,6 +908,7 @@ add_executable(mixxx-test
src/test/broadcastprofile_test.cpp
src/test/broadcastsettings_test.cpp
src/test/channelhandle_test.cpp
src/test/colorconfig_test.cpp
src/test/configobject_test.cpp
src/test/controller_preset_validation_test.cpp
src/test/controllerengine_test.cpp
Expand Down Expand Up @@ -2101,3 +2103,4 @@ if(NOT OPTIMIZE STREQUAL "off")
endif()
endif()
endif()

5 changes: 3 additions & 2 deletions build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,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 @@ -1271,6 +1272,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 @@ -1297,8 +1299,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 @@ -1574,7 +1574,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 @@ -1636,8 +1636,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 @@ -1647,13 +1647,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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RGB

</description>
<sql>
<!-- No Color becomes black 0x000000 -->
UPDATE cues SET color=0 WHERE color=0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SQLite understands hex numbers and we should use this notation here:
https://www.sqlite.org/syntax/numeric-literal.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I was not aware of this.

<!-- Red 0xC50A08 -->
UPDATE cues SET color=12913160 WHERE color=1;
<!-- Green 0x32BE44 -->
UPDATE cues SET color=3325508 WHERE color=2;
<!-- Blue 0x0044FF-->
UPDATE cues SET color=17663 WHERE color=3;
<!-- Yellow 0xF8D200 -->
UPDATE cues SET color=16306688 WHERE color=4;
<!-- Celeste 0x42D4F4-->
UPDATE cues SET color=4379892 WHERE color=5;
<!-- Magenta 0xAF00CC -->
UPDATE cues SET color=11469004 WHERE color=6;
<!-- Pink 0xFCA6D7 -->
UPDATE cues SET color=16557783 WHERE color=7;
<!-- White 0xF2F2FF -->
UPDATE cues SET color=15921919 WHERE color=8;
</sql>
</revision>
</schema>
2 changes: 2 additions & 0 deletions res/skins/Deere (64 Samplers)/skin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
<SetVariable name="VerticalStretchButtonMaximumSize">22,-1</SetVariable>
<SetVariable name="VerticalStretchButtonSizePolicy">f,me</SetVariable>

<SetVariable name="HotcueSkinDefaultColor">#4487d9</SetVariable>

<!-- The waveforms (zoomed and overview) use a lot of memory. They appear in multiple places in
main_decks.xml, left_deck.xml, and right_deck.xml, so define them in singletons. This makes
toggling between 2/4 decks and stacked/split waveforms slower, but it makes Mixxx startup
Expand Down
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>backgroundColorRgb</BindProperty>
</Connection>
</PushButton>
</Template>
2 changes: 2 additions & 0 deletions res/skins/Deere/skin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
<SetVariable name="VerticalStretchButtonMaximumSize">22,-1</SetVariable>
<SetVariable name="VerticalStretchButtonSizePolicy">f,me</SetVariable>

<SetVariable name="HotcueSkinDefaultColor">#0080be</SetVariable>

<!-- The waveforms (zoomed and overview) use a lot of memory. They appear in multiple places in
main_decks.xml, left_deck.xml, and right_deck.xml, so define them in singletons. This makes
toggling between 2/4 decks and stacked/split waveforms slower, but it makes Mixxx startup
Expand Down
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>backgroundColorRgb</BindProperty>
</Connection>
</PushButton>
</Children>
Expand Down
4 changes: 2 additions & 2 deletions res/skins/LateNight/skin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
<SetVariable name="PlayPosColor">#00FF00</SetVariable>
<SetVariable name="PlayedOverlayColor">#bb000000</SetVariable>
<SetVariable name="EndOfTrackColor">#F856E7</SetVariable>

<SetVariable name="HotcueSkinDefaultColor">#ff0909</SetVariable>
</Scheme>

<Scheme>
Expand Down Expand Up @@ -201,7 +201,7 @@
<SetVariable name="PlayPosColor">#00ff00</SetVariable>
<SetVariable name="PlayedOverlayColor">#bb000000</SetVariable>
<SetVariable name="EndOfTrackColor">#ff00ff</SetVariable>

<SetVariable name="HotcueSkinDefaultColor">#ff0909</SetVariable>
</Scheme>
</Schemes>

Expand Down
Loading