-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add PlayButton: drop previewing HotcueButton onto it to latch
play
- Loading branch information
Showing
11 changed files
with
160 additions
and
10 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
59 changes: 59 additions & 0 deletions
59
res/skins/LateNight/controls/button_play_2state_right_display.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!-- | ||
Description: | ||
A button that has click or display controls. | ||
Left-click control is one of the play controls. | ||
HotcueButtons of the same player (engine, not necessarily same player in skin) | ||
can be dropped onto it in order to latch play when previewing from hotcue. | ||
Make sure to use one of the 'play' ToolTipIDs so the dnd behavior is discoverable. | ||
Variables: | ||
ObjectName : object name | ||
ToolTipID : standard Tooltip from mixxx db | ||
see: https://github.com/mixxxdj/mixxx/blob/main/src/skin/legacy/tooltips.cpp | ||
Group : BasePlayer group | ||
Size : button size | ||
state_X_text : label text for state X | ||
state_X_pressed : background graphic for pressed state X | ||
state_X_unpressed : background graphic for unpressed state X | ||
Align : alignment of text | ||
ConfigKey : left-click control | ||
ConfigKeyRight : right-click control | ||
ConfigKeyDisp : display control | ||
--> | ||
<Template> | ||
<PlayButton> | ||
<TooltipId><Variable name="TooltipId"/></TooltipId> | ||
<ObjectName><Variable name="ObjectName"/></ObjectName> | ||
<Size><Variable name="Size"/></Size> | ||
<NumberStates>2</NumberStates> | ||
<RightClickIsPushButton>true</RightClickIsPushButton> | ||
<Group><Variable name="Group"/></Group> | ||
<State> | ||
<Number>0</Number> | ||
<Text><Variable name="state_0_text"/></Text> | ||
<Alignment><Variable name="Align"/></Alignment> | ||
<Unpressed scalemode="STRETCH">skins:LateNight/<Variable name="BtnScheme"/>/buttons/btn_<Variable name="BtnType"/>_<Variable name="BtnSize"/>.svg</Unpressed> | ||
<Pressed scalemode="STRETCH">skins:LateNight/<Variable name="BtnScheme"/>/buttons/btn_<Variable name="BtnType"/>_<Variable name="BtnSize"/>_active.svg</Pressed> | ||
</State> | ||
<State> | ||
<Number>1</Number> | ||
<Text><Variable name="state_1_text"/></Text> | ||
<Alignment><Variable name="Align"/></Alignment> | ||
<Unpressed scalemode="STRETCH">skins:LateNight/<Variable name="BtnScheme"/>/buttons/btn_<Variable name="BtnType"/>_<Variable name="BtnSize"/>_active.svg</Unpressed> | ||
<Pressed scalemode="STRETCH">skins:LateNight/<Variable name="BtnScheme"/>/buttons/btn_<Variable name="BtnType"/>_<Variable name="BtnSize"/>_active.svg</Pressed> | ||
</State> | ||
<Connection> | ||
<ConfigKey><Variable name="ConfigKey"/></ConfigKey> | ||
<ButtonState>LeftButton</ButtonState> | ||
</Connection> | ||
<Connection> | ||
<ConfigKey><Variable name="ConfigKeyRight"/></ConfigKey> | ||
<ButtonState>RightButton</ButtonState> | ||
</Connection> | ||
<Connection> | ||
<ConfigKey><Variable name="ConfigKeyDisp"/></ConfigKey> | ||
<ConnectValueFromWidget>false</ConnectValueFromWidget> | ||
</Connection> | ||
</PlayButton> | ||
</Template> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "widget/wplaybutton.h" | ||
|
||
#include <QMouseEvent> | ||
|
||
#include "control/controlobject.h" | ||
#include "moc_wplaybutton.cpp" | ||
#include "widget/hotcuedrag.h" | ||
|
||
using namespace mixxx::hotcuedrag; | ||
|
||
WPlayButton::WPlayButton(QWidget* pParent, const QString& group) | ||
: WPushButton(pParent), | ||
m_group(group) { | ||
setAcceptDrops(true); | ||
} | ||
|
||
void WPlayButton::dragEnterEvent(QDragEnterEvent* pEvent) { | ||
if (isValidHotcueDragOrDropEvent<QDragEnterEvent>( | ||
pEvent, | ||
this, | ||
m_group)) { | ||
pEvent->acceptProposedAction(); | ||
} else { | ||
pEvent->ignore(); | ||
} | ||
} | ||
|
||
void WPlayButton::dropEvent(QDropEvent* pEvent) { | ||
// Enable 'play' if we drop a hotcue here while we're | ||
// previewing it but NOT playing. | ||
// If not previewing this is no-op. | ||
if (ControlObject::get(ConfigKey(m_group, QStringLiteral("play_latched"))) <= 0 && | ||
isValidHotcueDragOrDropEvent<QDropEvent>( | ||
pEvent, | ||
this, | ||
m_group)) { | ||
// This seems counterintuitive but it's the same action that | ||
// allows to latch `play` with keyboard or controllers while | ||
// previewing a hotcue. | ||
// See EngineBuffer::slotControlPlayRequest() | ||
ControlObject::set(ConfigKey(m_group, QStringLiteral("play")), 0.0); | ||
pEvent->accept(); | ||
} else { | ||
pEvent->ignore(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
|
||
#include "widget/wpushbutton.h" | ||
|
||
struct HotcueDragInfo; | ||
|
||
class WPlayButton : public WPushButton { | ||
Q_OBJECT | ||
public: | ||
WPlayButton(QWidget* pParent, const QString& group); | ||
|
||
private: | ||
void dragEnterEvent(QDragEnterEvent* pEvent) override; | ||
void dropEvent(QDropEvent* pEvent) override; | ||
|
||
QString m_group; | ||
}; |