From 748e4e54e719dfea88fbae29b694aa1275bc53a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 25 Feb 2014 21:37:18 +0100 Subject: [PATCH] Introduce a new EmitOption EMIT_ON_MOVE --- src/skin/legacyskinparser.cpp | 17 ++++++++++++++++- src/widget/controlwidgetconnection.h | 27 +++++++++++++++------------ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/skin/legacyskinparser.cpp b/src/skin/legacyskinparser.cpp index 305b4b9c486..0efa8faa8e5 100644 --- a/src/skin/legacyskinparser.cpp +++ b/src/skin/legacyskinparser.cpp @@ -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( @@ -1555,6 +1556,7 @@ 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) { @@ -1562,7 +1564,20 @@ void LegacySkinParser::setupConnections(QDomNode node, WBaseWidget* pWidget) { } 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 diff --git a/src/widget/controlwidgetconnection.h b/src/widget/controlwidgetconnection.h index 4ae74601c44..a634869021a 100644 --- a/src/widget/controlwidgetconnection.h +++ b/src/widget/controlwidgetconnection.h @@ -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 {