Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 16 additions & 1 deletion src/skin/legacyskinparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,7 @@ void LegacySkinParser::setupConnections(QDomNode node, WBaseWidget* pWidget) {
directionOption |= ControlParameterWidgetConnection::DIR_DEFAULT;
}

bool emitOptionSet = false;
int emitOption =
ControlParameterWidgetConnection::EMIT_ON_PRESS;
if(m_pContext->hasNodeSelectBool(
Expand All @@ -1555,14 +1556,28 @@ void LegacySkinParser::setupConnections(QDomNode node, WBaseWidget* pWidget) {
} else {
emitOption = ControlParameterWidgetConnection::EMIT_ON_RELEASE;
}
emitOptionSet = true;
} else if(m_pContext->hasNodeSelectBool(
con, "EmitOnPressAndRelease", &nodeValue)) {
if (nodeValue) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should you set emitOptionSet = true in this branch as well? If not, please add a comment why not.

Also this pull request is against your own repo, not mixxxdj

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Hi @ywwg thank you for reviewing.
the option is set below, It looks a bit confusing due to the patch formating.

It was intended to do the diff against my own master, because this patch will only clutter the code, if we have no use for it. But maybe we need it later .. ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

oh ok, got it.

emitOption = ControlParameterWidgetConnection::EMIT_ON_PRESS_AND_RELEASE;
} else {
qWarning() << "LegacySkinParser::setupConnections(): EmitOnPressAndRelease must not set false";
}
} else {
emitOptionSet = true;
}

if(m_pContext->hasNodeSelectBool(
con, "EmitOnMove", &nodeValue)) {
if (nodeValue) {
emitOption |= ControlParameterWidgetConnection::EMIT_ON_MOVE;
} else {
emitOption &= ~ControlParameterWidgetConnection::EMIT_ON_MOVE;
}
emitOptionSet = true;
}

if (!emitOptionSet) {
// default:
// no emit option is set
// Allow to change the emitOption from Widget
Expand Down
27 changes: 15 additions & 12 deletions src/widget/controlwidgetconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,25 @@ class ControlParameterWidgetConnection : public ControlWidgetConnection {
EMIT_ON_PRESS = 0x01,
EMIT_ON_RELEASE = 0x02,
EMIT_ON_PRESS_AND_RELEASE = 0x03,
EMIT_DEFAULT = 0x04
EMIT_ON_MOVE = 0x08,
EMIT_DEFAULT = 0x80,
};

static QString emitOptionToString(EmitOption option) {
switch (option & EMIT_ON_PRESS_AND_RELEASE) {
case EMIT_NEVER:
return "NEVER";
case EMIT_ON_PRESS:
return "PRESS";
case EMIT_ON_RELEASE:
return "RELEASE";
case EMIT_ON_PRESS_AND_RELEASE:
return "PRESS_AND_RELEASE";
default:
return "UNKNOWN";
QStringList strOption;
if (option & EMIT_ON_PRESS) {
strOption << "PRESS";
}
if (option & EMIT_ON_MOVE) {
strOption << "MOVE";
}
if (option & EMIT_ON_RELEASE) {
strOption << "RELEASE";
}
if (strOption.isEmpty()) {
return "NEVER";
}
return strOption.join("_AND_");
}

enum DirectionOption {
Expand Down