Skip to content

Commit

Permalink
Merge pull request #2560 from daschuer/hotcue-rgb-colors
Browse files Browse the repository at this point in the history
Hotcue Buttons, Context Menu + Skin Improvements.
  • Loading branch information
Holzhaus authored Mar 24, 2020
2 parents e598614 + ddc96b9 commit 041222c
Show file tree
Hide file tree
Showing 48 changed files with 286 additions and 217 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/widget/weffectparameterknobcomposed.cpp
src/widget/weffectpushbutton.cpp
src/widget/weffectselector.cpp
src/widget/whotcuebutton.cpp
src/widget/wimagestore.cpp
src/widget/wkey.cpp
src/widget/wknob.cpp
Expand Down
1 change: 1 addition & 0 deletions build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ def sources(self, build):
"src/widget/wvumeter.cpp",
"src/widget/wpushbutton.cpp",
"src/widget/weffectpushbutton.cpp",
"src/widget/whotcuebutton.cpp",
"src/widget/wslidercomposed.cpp",
"src/widget/wstatuslight.cpp",
"src/widget/woverview.cpp",
Expand Down
33 changes: 5 additions & 28 deletions res/skins/Deere/hotcue_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,23 @@
SmallSquareButtonSize: the button size
-->
<Template>
<PushButton>
<HotcueButton>
<TooltipId>hotcue</TooltipId>
<ObjectName>HotcueButton</ObjectName>
<MinimumSize>18,22</MinimumSize>
<MaximumSize>22,22</MaximumSize>
<SizePolicy>me,f</SizePolicy>
<Group><Variable name="group"/></Group>
<Hotcue><Variable name="hotcue"/></Hotcue>
<Hover>true</Hover>
<NumberStates>2</NumberStates>
<LeftClickIsPushButton><Variable name="LeftClickIsPushButton"/></LeftClickIsPushButton>
<RightClickIsPushButton><Variable name="RightClickIsPushButton"/></RightClickIsPushButton>
<State>
<Number>0</Number>
<Text><Variable name="hotcue"/></Text>
<Pressed scalemode="STRETCH_ASPECT"></Pressed>
<Unpressed scalemode="STRETCH_ASPECT"></Unpressed>
</State>
<State>
<Number>1</Number>
<Text><Variable name="hotcue"/></Text>
<Pressed scalemode="STRETCH_ASPECT"></Pressed>
<Unpressed scalemode="STRETCH_ASPECT"></Unpressed>
</State>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="hotcue"/>_activate</ConfigKey>
<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
<ButtonState>LeftButton</ButtonState>
<ConnectValueToWidget>false</ConnectValueToWidget>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="hotcue"/>_clear</ConfigKey>
<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
<ButtonState>RightButton</ButtonState>
<ConnectValueToWidget>false</ConnectValueToWidget>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="hotcue"/>_enabled</ConfigKey>
<ConnectValueFromWidget>false</ConnectValueFromWidget>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="hotcue"/>_color</ConfigKey>
<BindProperty>backgroundColorRgba</BindProperty>
</Connection>
</PushButton>
</HotcueButton>
</Template>
10 changes: 1 addition & 9 deletions res/skins/Deere/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1544,15 +1544,7 @@ WPushButton[value="2"]:hover {
border: 1px solid #0080BE;
}

#HotcueButton {
qproperty-shouldHighlightBackgroundOnHover: true;
}

#HotcueButton[backgroundIsDark=true][hasBackgroundColor=true] {
color: #FDFDFD;
}

#HotcueButton[backgroundIsDark=false][hasBackgroundColor=true] {
#HotcueButton[light="true"] {
color: #1f1e1e;
}

Expand Down
22 changes: 4 additions & 18 deletions res/skins/LateNight/button_hotcue.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
<SizePolicy>me,f</SizePolicy>
<Layout>horizontal</Layout>
<Children>
<PushButton>
<HotcueButton>
<TooltipId>hotcue</TooltipId>
<ObjectName>HotcueButton</ObjectName>
<MinimumSize>26,26</MinimumSize>
<MaximumSize>26,26</MaximumSize>
<SizePolicy>me,f</SizePolicy>
<Group><Variable name="group"/></Group>
<Hotcue><Variable name="number"/></Hotcue>
<NumberStates>2</NumberStates>
<State>
<Number>0</Number>
Expand All @@ -24,23 +26,7 @@
<Unpressed scalemode="STRETCH">skin:/buttons_<Variable name="btn_scheme"/>/btn_<Variable name="btn_type"/>_square_set.svg</Unpressed>
<Pressed scalemode="STRETCH">skin:/buttons_<Variable name="btn_scheme"/>/btn_<Variable name="btn_type"/>_square_active.svg</Pressed>
</State>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="number"/>_activate</ConfigKey>
<ButtonState>LeftButton</ButtonState>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="number"/>_clear</ConfigKey>
<ButtonState>RightButton</ButtonState>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="number"/>_enabled</ConfigKey>
<ConnectValueFromWidget>false</ConnectValueFromWidget>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="number"/>_color</ConfigKey>
<BindProperty>backgroundColorRgba</BindProperty>
</Connection>
</PushButton>
</HotcueButton>
</Children>
</WidgetGroup>
</Template>
15 changes: 7 additions & 8 deletions res/skins/LateNight/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ QPushButton#pushButtonAutoDJ:enabled:!checked,
brighter bg color to enhance contrast in darker containers
and with small size respectively */
#DeckRow_5_LoopCuesTransport WPushButton[value="0"],
#HotcueButton[displayValue="0"],
#HotcueButton,
#FxAssignButton[displayValue="0"], #FxFocusButton[displayValue="0"],
#FxToggleButton[displayValue="0"], #FxParameterButton[displayValue="0"],
#SplitCueButton[value="0"],
Expand Down Expand Up @@ -684,11 +684,8 @@ QPushButton#pushButtonRecording:checked,
#RecFeedback[displayValue="2"],
#BeatgridButtons WPushButton[value="1"],
#KeyMatchButton[displayValue="1"],
#KeyUpButton[displayValue="1"], #KeyDownButton[displayValue="1"],
#HotcueButton[displayValue="1"][highlight="0"],
#HotcueButton[displayValue="2"][highlight="0"],
#HotcueButton[displayValue="1"][highlight="1"],
#HotcueButton[displayValue="2"][highlight="1"] {
#KeyUpButton[displayValue="1"],
#KeyDownButton[displayValue="1"] {
background-color: #db0000;
}

Expand All @@ -714,8 +711,10 @@ QPushButton#pushButtonAutoDJ:checked,
#MicDuckingButton[value="2"] {
background-color: #d09300;
}
/* ToDo
* orange Play button when playing from Cue / Hotcue */

#SpecialCueButton[value="1"] {
background-color: #0044ff;
}


/************** Button icons **************************************************/
Expand Down
2 changes: 1 addition & 1 deletion res/skins/LateNight/style_flip.qss
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ WSearchLineEdit {
#GuiToggleButton[displayValue="0"], #RecFeedback[displayValue="0"],
#BroadcastButton[displayValue="0"], #SettingsButton[displayValue="0"],
#DeckRow_5_LoopCuesTransport WPushButton[value="0"],
#HotcueButton[displayValue="0"],
#HotcueButton,
#FxAssignButton[displayValue="0"], #FxFocusButton[displayValue="0"],
#FxToggleButton[displayValue="0"], #FxParameterButton[displayValue="0"],
#SplitCueButton[value="0"],
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 added res/skins/Shade/btn/btn_hotcue_1_over.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 added res/skins/Shade/btn/btn_hotcue_1_overdown.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 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 added res/skins/Shade/btn/btn_hotcue_2_over.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 added res/skins/Shade/btn/btn_hotcue_2_overdown.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 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 added res/skins/Shade/btn/btn_hotcue_3_over.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 added res/skins/Shade/btn/btn_hotcue_3_overdown.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 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 added res/skins/Shade/btn/btn_hotcue_4_over.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 added res/skins/Shade/btn/btn_hotcue_4_overdown.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 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 added res/skins/Shade/btn/btn_hotcue_5_over.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 added res/skins/Shade/btn/btn_hotcue_5_overdown.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 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 added res/skins/Shade/btn/btn_hotcue_6_over.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 added res/skins/Shade/btn/btn_hotcue_6_overdown.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 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 added res/skins/Shade/btn/btn_hotcue_7_over.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 added res/skins/Shade/btn/btn_hotcue_7_overdown.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 modified res/skins/Shade/btn/btn_hotcue_8.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 added res/skins/Shade/btn/btn_hotcue_8_over.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 added res/skins/Shade/btn/btn_hotcue_8_overdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 6 additions & 20 deletions res/skins/Shade/hotcue_button.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<Template>
<PushButton>
<HotcueButton>
<TooltipId>hotcue</TooltipId>
<ObjectName>HotcueButton</ObjectName>
<Pos><Variable name="pos"/></Pos>
<Group><Variable name="group"/></Group>
<Hotcue><Variable name="hotcue"/></Hotcue>
<NumberStates>2</NumberStates>
<State>
<Number>0</Number>
Expand All @@ -11,24 +13,8 @@
</State>
<State>
<Number>1</Number>
<Pressed>skin:/btn/btn_hotcue_<Variable name="hotcue"/>.png</Pressed>
<Unpressed>skin:/btn/btn_hotcue_<Variable name="hotcue"/>.png</Unpressed>
<Pressed>skin:/btn/btn_hotcue_<Variable name="hotcue"/>_overdown.png</Pressed>
<Unpressed>skin:/btn/btn_hotcue_<Variable name="hotcue"/>_over.png</Unpressed>
</State>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="hotcue"/>_activate</ConfigKey>
<ButtonState>LeftButton</ButtonState>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="hotcue"/>_clear</ConfigKey>
<ButtonState>RightButton</ButtonState>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="hotcue"/>_enabled</ConfigKey>
<ConnectValueFromWidget>false</ConnectValueFromWidget>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="hotcue"/>_color</ConfigKey>
<BindProperty>backgroundColorRgba</BindProperty>
</Connection>
</PushButton>
</HotcueButton>
</Template>
22 changes: 4 additions & 18 deletions res/skins/Tango/button_hotcue_deck.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ Variables:
HotCue: hotcue number
-->
<Template>
<PushButton>
<HotcueButton>
<TooltipId>hotcue</TooltipId>
<ObjectName>HotcueButton</ObjectName>
<MinimumSize>15,24</MinimumSize>
<MaximumSize>23,24</MaximumSize>
<SizePolicy>me,f</SizePolicy>
<Group><Variable name="group"/></Group>
<Hotcue><Variable name="HotCue"/></Hotcue>
<NumberStates>2</NumberStates>
<State>
<Number>0</Number>
Expand All @@ -25,21 +27,5 @@ Variables:
<Text><Variable name="HotCue"/></Text>
<Alignment>center</Alignment>
</State>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="HotCue"/>_activate</ConfigKey>
<ButtonState>LeftButton</ButtonState>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="HotCue"/>_clear</ConfigKey>
<ButtonState>RightButton</ButtonState>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="HotCue"/>_enabled</ConfigKey>
<ConnectValueFromWidget>false</ConnectValueFromWidget>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="HotCue"/>_color</ConfigKey>
<BindProperty>backgroundColorRgba</BindProperty>
</Connection>
</PushButton>
</HotcueButton>
</Template>
18 changes: 4 additions & 14 deletions res/skins/Tango/button_hotcue_sam_pre.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ Variables:
HotCue: hotcue number
-->
<Template>
<PushButton>
<HotcueButton>
<TooltipId>hotcue</TooltipId>
<ObjectName>HotcueButton</ObjectName>
<MinimumSize>14,18</MinimumSize>
<MaximumSize>20,18</MaximumSize>
<SizePolicy>me,f</SizePolicy>
<Group><Variable name="group"/></Group>
<Hotcue><Variable name="HotCue"/></Hotcue>
<NumberStates>2</NumberStates>
<State>
<Number>0</Number>
Expand All @@ -26,17 +28,5 @@ Variables:
<Text><Variable name="HotCue"/></Text>
<Alignment>center</Alignment>
</State>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="HotCue"/>_activate</ConfigKey>
<ButtonState>LeftButton</ButtonState>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="HotCue"/>_clear</ConfigKey>
<ButtonState>RightButton</ButtonState>
</Connection>
<Connection>
<ConfigKey><Variable name="group"/>,hotcue_<Variable name="HotCue"/>_enabled</ConfigKey>
<ConnectValueFromWidget>false</ConnectValueFromWidget>
</Connection>
</PushButton>
</HotcueButton>
</Template>
8 changes: 4 additions & 4 deletions res/skins/Tango/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1009,12 +1009,12 @@ WLabel#TrackComment {
border: 1px solid #eeeeee;
}

#HotcueButton[backgroundIsDark=true][hasBackgroundColor=true] {
color: #eeeeee;
#HotcueButton[light="true"] {
color: #0f0f0f;
}

#HotcueButton[backgroundIsDark=false][hasBackgroundColor=true] {
color: #0f0f0f;
#HotcueButton[light="true"]:hover {
border: 1px solid #808080;
}

#CueButton {
Expand Down
21 changes: 13 additions & 8 deletions src/engine/controls/cuecontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ static const double CUE_MODE_NUMARK = 3.0;
static const double CUE_MODE_MIXXX_NO_BLINK = 4.0;
static const double CUE_MODE_CUP = 5.0;

constexpr double kNoColorControlValue = -1;

namespace {

// Helper function to convert control values (i.e. doubles) into RgbColor
Expand Down Expand Up @@ -336,7 +334,6 @@ void CueControl::detachCue(HotcueControl* pControl) {
}
disconnect(pCue.get(), 0, this, 0);
pControl->resetCue();
pControl->setColor(std::nullopt);
}

void CueControl::trackLoaded(TrackPointer pNewTrack) {
Expand Down Expand Up @@ -1780,7 +1777,10 @@ HotcueControl::HotcueControl(QString group, int i)

// The rgba value of the color assigned to this color.
m_hotcueColor = new ControlObject(keyForControl(i, "color"));
m_hotcueColor->set(kNoColorControlValue);
m_hotcueColor->connectValueChangeRequest(
this,
&HotcueControl::slotHotcueColorChangeRequest,
Qt::DirectConnection);
connect(m_hotcueColor,
&ControlObject::valueChanged,
this,
Expand Down Expand Up @@ -1869,14 +1869,21 @@ void HotcueControl::slotHotcuePositionChanged(double newPosition) {
emit hotcuePositionChanged(this, newPosition);
}

void HotcueControl::slotHotcueColorChangeRequest(double color) {
if (color < 0 || color > 0xFFFFFF) {
qWarning() << "slotHotcueColorChanged got invalid value:" << color;
return;
}
m_hotcueColor->setAndConfirm(color);
}

void HotcueControl::slotHotcueColorChanged(double newColor) {
if (!m_pCue) {
return;
}

mixxx::RgbColor::optional_t color = doubleToRgbColor(newColor);
if (!color) {
qWarning() << "slotHotcueColorChanged got invalid value:" << newColor;
VERIFY_OR_DEBUG_ASSERT(color) {
return;
}

Expand All @@ -1902,8 +1909,6 @@ mixxx::RgbColor::optional_t HotcueControl::getColor() const {
void HotcueControl::setColor(mixxx::RgbColor::optional_t newColor) {
if (newColor) {
m_hotcueColor->set(*newColor);
} else {
m_hotcueColor->set(kNoColorControlValue);
}
}
void HotcueControl::resetCue() {
Expand Down
1 change: 1 addition & 0 deletions src/engine/controls/cuecontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class HotcueControl : public QObject {
void slotHotcueActivatePreview(double v);
void slotHotcueClear(double v);
void slotHotcuePositionChanged(double newPosition);
void slotHotcueColorChangeRequest(double newColor);
void slotHotcueColorChanged(double newColor);

signals:
Expand Down
Loading

0 comments on commit 041222c

Please sign in to comment.