diff options
author | Daniel Schürmann <daschuer@mixxx.org> | 2014-01-27 21:36:11 +0100 |
---|---|---|
committer | Daniel Schürmann <daschuer@mixxx.org> | 2014-01-27 21:36:11 +0100 |
commit | 4b2e7e4bd68f5be46fae9ea4e3d7a445635cb4ff (patch) | |
tree | abe31e99775f24dc8e3470e6dd77dc023d8117c7 /src/widget | |
parent | 0c7da351342bf396679c9db0f37e00890a93d547 (diff) |
calculating default direction is now working with developer_skins
Diffstat (limited to 'src/widget')
-rw-r--r-- | src/widget/wpushbutton.cpp | 27 | ||||
-rw-r--r-- | src/widget/wpushbutton.h | 1 |
2 files changed, 25 insertions, 3 deletions
diff --git a/src/widget/wpushbutton.cpp b/src/widget/wpushbutton.cpp index ad13e83cff..642a87e661 100644 --- a/src/widget/wpushbutton.cpp +++ b/src/widget/wpushbutton.cpp @@ -44,7 +44,8 @@ WPushButton::WPushButton(QWidget* pParent, ControlPushButton::ButtonMode leftBut ControlPushButton::ButtonMode rightButtonMode) : WWidget(pParent), m_leftButtonMode(leftButtonMode), - m_rightButtonMode(rightButtonMode) { + m_rightButtonMode(rightButtonMode), + m_hasDisplayConnection(false) { setStates(0); } @@ -141,11 +142,18 @@ void WPushButton::setup(QDomNode node, const SkinContext& context) { } else { m_leftButtonMode = p->getButtonMode(); } + } else { + m_hasDisplayConnection = true; } } } else { // No ControlPushButton Connection Probably a display connection //qDebug() << "WPushButton::setup: Connected a non push button" << configKey.group << configKey.item; + if (isLeftButton) { + explicitLeftFound = true; + } else if (!isRightButton && explicitLeftFound) { + m_hasDisplayConnection = true; + } } con = con.nextSibling(); } @@ -179,8 +187,21 @@ ControlWidgetConnection::DirectionOption WPushButton::getDefaultDirectionOption( // Only a Left or NoButton Connection -> FROM_AND_TO_WIDGET // In case of Left And NoButton Connection -> Left: FROM_WIDGET NoButton: TO_WIDGET // Right Button connection -> FROM_WIDGET - - return ControlWidgetConnection::DIR_FROM_AND_TO_WIDGET; + if (state == Qt::LeftButton) { + if (m_hasDisplayConnection) { + return ControlWidgetConnection::DIR_FROM_WIDGET; + } else { + return ControlWidgetConnection::DIR_FROM_AND_TO_WIDGET; + } + } else if (state == Qt::RightButton) { + return ControlWidgetConnection::DIR_FROM_WIDGET; + } else { + if (m_hasDisplayConnection) { + return ControlWidgetConnection::DIR_TO_WIDGET; + } else { + return ControlWidgetConnection::DIR_FROM_AND_TO_WIDGET; + } + } } void WPushButton::setStates(int iStates) { diff --git a/src/widget/wpushbutton.h b/src/widget/wpushbutton.h index 887ab01189..2b1a37ae66 100644 --- a/src/widget/wpushbutton.h +++ b/src/widget/wpushbutton.h @@ -92,6 +92,7 @@ class WPushButton : public WWidget { // short click toggle button long click push button ControlPushButton::ButtonMode m_leftButtonMode; ControlPushButton::ButtonMode m_rightButtonMode; + bool m_hasDisplayConnection; QTimer m_clickTimer; }; |