summaryrefslogtreecommitdiffstats
path: root/src/widget
diff options
context:
space:
mode:
authorRJ Ryan <rryan@mixxx.org>2014-01-09 15:18:34 -0500
committerRJ Ryan <rryan@mixxx.org>2014-01-10 13:25:53 -0500
commit0a4d97b7cafb9ca92798f3b53165359f5055c220 (patch)
treecd4ec52d58f4d369d994fd0b8eaeb7e499377c2a /src/widget
parentd5f838d156504c12496dc05ee42bcda8c4349b61 (diff)
Expose widget connections directly to WBaseWidget rather than using Qt signals.
This paves the way for getting rid of widget values and adding the concept of a display value vs. a left/right connected widget value. An added benefit is that ControlObjectThreadWidget is now nothing more than a parameter-space translator on top of ControlObjectThreadMain.
Diffstat (limited to 'src/widget')
-rw-r--r--src/widget/knobeventhandler.h10
-rw-r--r--src/widget/wbasewidget.cpp150
-rw-r--r--src/widget/wbasewidget.h97
-rw-r--r--src/widget/wkey.cpp4
-rw-r--r--src/widget/wkey.h2
-rw-r--r--src/widget/wnumber.cpp4
-rw-r--r--src/widget/wnumber.h2
-rw-r--r--src/widget/woverview.cpp8
-rw-r--r--src/widget/woverview.h2
-rw-r--r--src/widget/wpushbutton.cpp18
-rw-r--r--src/widget/wpushbutton.h2
-rw-r--r--src/widget/wslidercomposed.cpp14
-rw-r--r--src/widget/wslidercomposed.h2
-rw-r--r--src/widget/wstatuslight.cpp2
-rw-r--r--src/widget/wstatuslight.h2
-rw-r--r--src/widget/wvumeter.cpp2
-rw-r--r--src/widget/wvumeter.h2
-rw-r--r--src/widget/wwaveformviewer.cpp8
-rw-r--r--src/widget/wwaveformviewer.h1
-rw-r--r--src/widget/wwidget.cpp27
-rw-r--r--src/widget/wwidget.h17
21 files changed, 302 insertions, 74 deletions
diff --git a/src/widget/knobeventhandler.h b/src/widget/knobeventhandler.h
index 4a47d69ecc..b67aab9eb1 100644
--- a/src/widget/knobeventhandler.h
+++ b/src/widget/knobeventhandler.h
@@ -38,8 +38,8 @@ class KnobEventHandler {
// Clamp to [0.0, 1.0]
value = math_max(0.0, math_min(1.0, value));
- pWidget->slotConnectedValueChanged(value);
- emit(pWidget->valueChangedLeftDown(value));
+ pWidget->onConnectedControlValueChanged(value);
+ pWidget->setConnectedControlLeftDown(value);
pWidget->update();
}
}
@@ -47,7 +47,7 @@ class KnobEventHandler {
void mousePressEvent(T* pWidget, QMouseEvent* e) {
switch (e->button()) {
case Qt::RightButton:
- emit(pWidget->valueReset());
+ pWidget->resetConnectedControls();
m_bRightButtonPressed = true;
break;
case Qt::LeftButton:
@@ -66,11 +66,11 @@ class KnobEventHandler {
case Qt::MidButton:
QCursor::setPos(m_startPos);
QApplication::restoreOverrideCursor();
- emit(pWidget->valueChangedLeftUp(pWidget->getValue()));
+ pWidget->setConnectedControlLeftUp(pWidget->getValue());
break;
case Qt::RightButton:
m_bRightButtonPressed = false;
- //emit(pWidget->valueChangedRightUp(m_fValue));
+ //pWidget->setConnectedControlRightUp(pWidget->getValue());
break;
default:
break;
diff --git a/src/widget/wbasewidget.cpp b/src/widget/wbasewidget.cpp
index 24ce9f4d0b..27c372ce4c 100644
--- a/src/widget/wbasewidget.cpp
+++ b/src/widget/wbasewidget.cpp
@@ -1,5 +1,91 @@
+#include <QtDebug>
+
#include "widget/wbasewidget.h"
+#include "controlobjectthreadwidget.h"
+
+ControlWidgetConnection::ControlWidgetConnection(WBaseWidget* pBaseWidget,
+ ControlObjectThreadWidget* pControl)
+ : m_pWidget(pBaseWidget),
+ m_pControl(pControl) {
+ connect(pControl, SIGNAL(valueChanged(double)),
+ this, SLOT(slotControlValueChanged(double)));
+}
+
+ControlWidgetConnection::~ControlWidgetConnection() {
+}
+
+ValueControlWidgetConnection::ValueControlWidgetConnection(WBaseWidget* pBaseWidget,
+ ControlObjectThreadWidget* pControl,
+ bool connectValueFromWidget,
+ bool connectValueToWidget,
+ EmitOption emitOption)
+ : ControlWidgetConnection(pBaseWidget, pControl),
+ m_bConnectValueFromWidget(connectValueFromWidget),
+ m_bConnectValueToWidget(connectValueToWidget),
+ m_emitOption(emitOption) {
+ if (m_bConnectValueToWidget) {
+ slotControlValueChanged(m_pControl->get());
+ }
+}
+
+ValueControlWidgetConnection::~ValueControlWidgetConnection() {
+}
+
+void ValueControlWidgetConnection::slotControlValueChanged(double v) {
+ if (m_bConnectValueToWidget) {
+ m_pWidget->onConnectedControlValueChanged(v);
+ // TODO(rryan): copied from WWidget. Keep?
+ //m_pWidget->toQWidget()->update();
+ }
+}
+
+void ValueControlWidgetConnection::reset() {
+ if (m_bConnectValueFromWidget) {
+ m_pControl->reset();
+ }
+}
+
+void ValueControlWidgetConnection::setDown(double v) {
+ if (m_bConnectValueFromWidget && m_emitOption & EMIT_ON_PRESS) {
+ m_pControl->slotSet(v);
+ }
+}
+
+void ValueControlWidgetConnection::setUp(double v) {
+ if (m_bConnectValueFromWidget && m_emitOption & EMIT_ON_RELEASE) {
+ m_pControl->slotSet(v);
+ }
+}
+
+DisabledControlWidgetConnection::DisabledControlWidgetConnection(WBaseWidget* pBaseWidget,
+ ControlObjectThreadWidget* pControl)
+ : ControlWidgetConnection(pBaseWidget, pControl) {
+ slotControlValueChanged(m_pControl->get());
+}
+
+DisabledControlWidgetConnection::~DisabledControlWidgetConnection() {
+}
+
+void DisabledControlWidgetConnection::slotControlValueChanged(double v) {
+ m_pWidget->setControlDisabled(v != 0.0);
+ m_pWidget->toQWidget()->update();
+}
+
+void DisabledControlWidgetConnection::reset() {
+ // Do nothing.
+}
+
+void DisabledControlWidgetConnection::setDown(double v) {
+ // Do nothing.
+ Q_UNUSED(v);
+}
+
+void DisabledControlWidgetConnection::setUp(double v) {
+ // Do nothing.
+ Q_UNUSED(v);
+}
+
WBaseWidget::WBaseWidget(QWidget* pWidget)
: m_pWidget(pWidget),
m_bDisabled(false) {
@@ -7,3 +93,67 @@ WBaseWidget::WBaseWidget(QWidget* pWidget)
WBaseWidget::~WBaseWidget() {
}
+
+void WBaseWidget::addConnection(ControlWidgetConnection* pConnection) {
+ m_connections.append(pConnection);
+}
+
+void WBaseWidget::addLeftConnection(ControlWidgetConnection* pConnection) {
+ m_leftConnections.append(pConnection);
+}
+
+void WBaseWidget::addRightConnection(ControlWidgetConnection* pConnection) {
+ m_rightConnections.append(pConnection);
+}
+
+void WBaseWidget::resetConnectedControls() {
+ foreach (ControlWidgetConnection* pControlConnection, m_leftConnections) {
+ pControlConnection->reset();
+ }
+ foreach (ControlWidgetConnection* pControlConnection, m_rightConnections) {
+ pControlConnection->reset();
+ }
+ foreach (ControlWidgetConnection* pControlConnection, m_connections) {
+ pControlConnection->reset();
+ }
+}
+
+void WBaseWidget::setConnectedControlDown(double v) {
+ foreach (ControlWidgetConnection* pControlConnection, m_connections) {
+ pControlConnection->setDown(v);
+ }
+}
+
+void WBaseWidget::setConnectedControlUp(double v) {
+ foreach (ControlWidgetConnection* pControlConnection, m_connections) {
+ pControlConnection->setUp(v);
+ }
+}
+
+void WBaseWidget::setConnectedControlLeftDown(double v) {
+ foreach (ControlWidgetConnection* pControlConnection, m_leftConnections) {
+ pControlConnection->setDown(v);
+ }
+ setConnectedControlDown(v);
+}
+
+void WBaseWidget::setConnectedControlLeftUp(double v) {
+ foreach (ControlWidgetConnection* pControlConnection, m_leftConnections) {
+ pControlConnection->setUp(v);
+ }
+ setConnectedControlUp(v);
+}
+
+void WBaseWidget::setConnectedControlRightDown(double v) {
+ foreach (ControlWidgetConnection* pControlConnection, m_rightConnections) {
+ pControlConnection->setDown(v);
+ }
+ setConnectedControlDown(v);
+}
+
+void WBaseWidget::setConnectedControlRightUp(double v) {
+ foreach (ControlWidgetConnection* pControlConnection, m_rightConnections) {
+ pControlConnection->setUp(v);
+ }
+ setConnectedControlUp(v);
+}
diff --git a/src/widget/wbasewidget.h b/src/widget/wbasewidget.h
index faa06cde8b..a29cb98922 100644
--- a/src/widget/wbasewidget.h
+++ b/src/widget/wbasewidget.h
@@ -3,6 +3,80 @@
#include <QString>
#include <QWidget>
+#include <QList>
+#include <QObject>
+#include <QScopedPointer>
+#include <QDomNode>
+
+class ControlObjectThreadWidget;
+
+class WBaseWidget;
+class ControlWidgetConnection : public QObject {
+ Q_OBJECT
+ public:
+ enum EmitOption {
+ EMIT_NEVER = 0x00,
+ EMIT_ON_PRESS = 0x01,
+ EMIT_ON_RELEASE = 0x02,
+ EMIT_ON_PRESS_AND_RELEASE = 0x03
+ };
+
+ // Takes ownership of pControl.
+ ControlWidgetConnection(WBaseWidget* pBaseWidget,
+ ControlObjectThreadWidget* pControl);
+ virtual ~ControlWidgetConnection();
+
+ virtual void reset() = 0;
+ virtual void setDown(double v) = 0;
+ virtual void setUp(double v) = 0;
+
+ protected slots:
+ virtual void slotControlValueChanged(double v) = 0;
+
+ protected:
+ WBaseWidget* m_pWidget;
+ QScopedPointer<ControlObjectThreadWidget> m_pControl;
+};
+
+class ValueControlWidgetConnection : public ControlWidgetConnection {
+ Q_OBJECT
+ public:
+ ValueControlWidgetConnection(WBaseWidget* pBaseWidget,
+ ControlObjectThreadWidget* pControl,
+ bool connectValueFromWidget,
+ bool connectValueToWidget,
+ EmitOption emitOption);
+ virtual ~ValueControlWidgetConnection();
+
+ protected:
+ void reset();
+ void setDown(double v);
+ void setUp(double v);
+
+ protected slots:
+ void slotControlValueChanged(double v);
+
+ private:
+ bool m_bConnectValueFromWidget;
+ bool m_bConnectValueToWidget;
+ EmitOption m_emitOption;
+};
+
+class DisabledControlWidgetConnection : public ControlWidgetConnection {
+ Q_OBJECT
+ public:
+ DisabledControlWidgetConnection(WBaseWidget* pBaseWidget,
+ ControlObjectThreadWidget* pControl);
+ virtual ~DisabledControlWidgetConnection();
+
+ protected:
+ void reset();
+ void setDown(double v);
+ void setUp(double v);
+
+ protected slots:
+ void slotControlValueChanged(double v);
+};
class WBaseWidget {
public:
@@ -30,10 +104,33 @@ class WBaseWidget {
return m_bDisabled;
}
+ void addLeftConnection(ControlWidgetConnection* pConnection);
+ void addRightConnection(ControlWidgetConnection* pConnection);
+ void addConnection(ControlWidgetConnection* pConnection);
+
+ protected:
+ virtual void onConnectedControlValueChanged(double v) {
+ Q_UNUSED(v);
+ }
+
+ void resetConnectedControls();
+ void setConnectedControlDown(double v);
+ void setConnectedControlUp(double v);
+ void setConnectedControlLeftDown(double v);
+ void setConnectedControlLeftUp(double v);
+ void setConnectedControlRightDown(double v);
+ void setConnectedControlRightUp(double v);
+
private:
QWidget* m_pWidget;
bool m_bDisabled;
QString m_baseTooltip;
+ QList<ControlWidgetConnection*> m_connections;
+ QList<ControlWidgetConnection*> m_leftConnections;
+ QList<ControlWidgetConnection*> m_rightConnections;
+
+ friend class ValueControlWidgetConnection;
+ friend class DisabledControlWidgetConnection;
};
#endif /* WBASEWIDGET_H */
diff --git a/src/widget/wkey.cpp b/src/widget/wkey.cpp
index 84fc6ab99d..b271e08283 100644
--- a/src/widget/wkey.cpp
+++ b/src/widget/wkey.cpp
@@ -15,6 +15,10 @@ WKey::WKey(QWidget* pParent)
WKey::~WKey() {
}
+void WKey::onConnectedControlValueChanged(double v) {
+ setValue(v);
+}
+
void WKey::setValue(double dValue) {
m_dOldValue = dValue;
mixxx::track::io::key::ChromaticKey key =
diff --git a/src/widget/wkey.h b/src/widget/wkey.h
index 88c828e9d8..5e58a01cae 100644
--- a/src/widget/wkey.h
+++ b/src/widget/wkey.h
@@ -12,6 +12,8 @@ class WKey : public WLabel {
WKey(QWidget* pParent=NULL);
virtual ~WKey();
+ virtual void onConnectedControlValueChanged(double v);
+
private slots:
void setValue(double dValue);
void preferencesUpdated(double dValue);
diff --git a/src/widget/wnumber.cpp b/src/widget/wnumber.cpp
index a3a862ab5b..45c4f34c02 100644
--- a/src/widget/wnumber.cpp
+++ b/src/widget/wnumber.cpp
@@ -47,6 +47,10 @@ void WNumber::setup(QDomNode node, const SkinContext& context) {
setValue(0.);
}
+void WNumber::onConnectedControlValueChanged(double v) {
+ setValue(v);
+}
+
void WNumber::setValue(double dValue) {
double v = dValue + m_dConstFactor;
int d1 = (int)floor((v-floor(v))*10.);
diff --git a/src/widget/wnumber.h b/src/widget/wnumber.h
index f3d7504342..c542473c83 100644
--- a/src/widget/wnumber.h
+++ b/src/widget/wnumber.h
@@ -31,6 +31,8 @@ class WNumber : public WLabel {
virtual void setup(QDomNode node, const SkinContext& context);
+ virtual void onConnectedControlValueChanged(double v);
+
public slots:
virtual void setValue(double dValue);
diff --git a/src/widget/woverview.cpp b/src/widget/woverview.cpp
index 4bb06f2529..5ece68ce72 100644
--- a/src/widget/woverview.cpp
+++ b/src/widget/woverview.cpp
@@ -120,14 +120,14 @@ void WOverview::setup(QDomNode node, const SkinContext& context) {
//qDebug() << "WOverview : m_markRanges" << m_markRanges.size();
}
-void WOverview::slotConnectedValueChanged(double dValue) {
+void WOverview::onConnectedControlValueChanged(double dValue) {
if (!m_bDrag)
{
// Calculate handle position
int iPos = valueToPosition(dValue);
if (iPos != m_iPos) {
m_iPos = iPos;
- //qDebug() << "WOverview::slotConnectedValueChanged" << dValue << ">>" << m_iPos;
+ //qDebug() << "WOverview::onConnectedControlValueChanged" << dValue << ">>" << m_iPos;
update();
}
}
@@ -252,9 +252,9 @@ void WOverview::mouseReleaseEvent(QMouseEvent* e) {
//qDebug() << "WOverview::mouseReleaseEvent" << e->pos() << m_iPos << ">>" << dValue;
if (e->button() == Qt::RightButton) {
- emit(valueChangedRightUp(dValue));
+ setConnectedControlRightUp(dValue);
} else {
- emit(valueChangedLeftUp(dValue));
+ setConnectedControlLeftUp(dValue);
}
m_bDrag = false;
}
diff --git a/src/widget/woverview.h b/src/widget/woverview.h
index 9ebe8b5b77..5ec505bf8c 100644
--- a/src/widget/woverview.h
+++ b/src/widget/woverview.h
@@ -40,7 +40,7 @@ class WOverview : public WWidget {
void setup(QDomNode node, const SkinContext& context);
public slots:
- void slotConnectedValueChanged(double);
+ void onConnectedControlValueChanged(double);
void slotLoadNewTrack(TrackPointer pTrack);
void slotTrackLoaded(TrackPointer pTrack);
void slotUnloadTrack(TrackPointer pTrack);
diff --git a/src/widget/wpushbutton.cpp b/src/widget/wpushbutton.cpp
index 566b26ac4e..7ca392f4ae 100644
--- a/src/widget/wpushbutton.cpp
+++ b/src/widget/wpushbutton.cpp
@@ -172,7 +172,7 @@ void WPushButton::setPixmapBackground(const QString &filename) {
}
}
-void WPushButton::slotConnectedValueChanged(double v) {
+void WPushButton::onConnectedControlValueChanged(double v) {
setValue(v);
if (m_iNoStates == 1) {
@@ -236,7 +236,7 @@ void WPushButton::mousePressEvent(QMouseEvent * e) {
}
setValue(1.0);
m_bPressed = true;
- emit(valueChangedLeftDown(1.0f));
+ setConnectedControlLeftDown(1.0);
update();
}
// discharge right clicks here, because is used for latching in POWERWINDOW mode
@@ -248,13 +248,13 @@ void WPushButton::mousePressEvent(QMouseEvent * e) {
// due the leak of visual feedback we do not allow a toggle function
if (m_bRightClickForcePush) {
m_bPressed = true;
- emit(valueChangedRightDown(1.0f));
+ setConnectedControlRightDown(1.0);
update();
} else if (m_iNoStates == 1) {
// This is a Pushbutton
setValue(1.0);
m_bPressed = true;
- emit(valueChangedRightDown(1.0f));
+ setConnectedControlRightDown(1.0);
update();
}
@@ -288,7 +288,7 @@ void WPushButton::mousePressEvent(QMouseEvent * e) {
}
}
m_bPressed = true;
- emit(valueChangedLeftDown(emitValue));
+ setConnectedControlLeftDown(emitValue);
update();
}
}
@@ -311,7 +311,7 @@ void WPushButton::mouseReleaseEvent(QMouseEvent * e) {
if (m_bPressed && !m_clickTimer.isActive() && !rightButtonDown) {
// Release button after timer, but not if right button is clicked
setValue(0.0);
- emit(valueChangedLeftUp(0.0f));
+ setConnectedControlLeftUp(0.0);
}
m_bPressed = false;
} else if (rightClick) {
@@ -327,11 +327,11 @@ void WPushButton::mouseReleaseEvent(QMouseEvent * e) {
// function
if (m_bRightClickForcePush) {
m_bPressed = false;
- emit(valueChangedRightUp(0.0f));
+ setConnectedControlRightUp(0.0);
update();
} else if (m_iNoStates == 1) {
m_bPressed = false;
- emit(valueChangedRightUp(0.0f));
+ setConnectedControlRightUp(0.0);
update();
}
return;
@@ -357,7 +357,7 @@ void WPushButton::mouseReleaseEvent(QMouseEvent * e) {
}
}
m_bPressed = false;
- emit(valueChangedLeftUp(emitValue));
+ setConnectedControlLeftUp(emitValue);
update();
}
}
diff --git a/src/widget/wpushbutton.h b/src/widget/wpushbutton.h
index 65bdd020a4..868c29e90f 100644
--- a/src/widget/wpushbutton.h
+++ b/src/widget/wpushbutton.h
@@ -54,7 +54,7 @@ class WPushButton : public WWidget {
void setStates(int iStatesW);
public slots:
- void slotConnectedValueChanged(double);
+ void onConnectedControlValueChanged(double);
protected:
virtual void paintEvent(QPaintEvent *);
diff --git a/src/widget/wslidercomposed.cpp b/src/widget/wslidercomposed.cpp
index fe31366556..515170feec 100644
--- a/src/widget/wslidercomposed.cpp
+++ b/src/widget/wslidercomposed.cpp
@@ -81,7 +81,7 @@ void WSliderComposed::setHandlePixmap(bool bHorizontal, const QString& filenameH
m_iHandleLength = m_bHorizontal ?
m_pHandle->width() : m_pHandle->height();
- slotConnectedValueChanged(getValue());
+ onConnectedControlValueChanged(getValue());
update();
}
}
@@ -123,9 +123,9 @@ void WSliderComposed::mouseMoveEvent(QMouseEvent * e) {
// Emit valueChanged signal
if (m_bEventWhileDrag) {
if (e->button() == Qt::RightButton) {
- emit(valueChangedRightUp(newValue));
+ setConnectedControlRightUp(newValue);
} else {
- emit(valueChangedLeftUp(newValue));
+ setConnectedControlLeftUp(newValue);
}
}
@@ -154,9 +154,9 @@ void WSliderComposed::mouseReleaseEvent(QMouseEvent * e) {
mouseMoveEvent(e);
if (e->button() == Qt::RightButton) {
- emit(valueChangedRightUp(getValue()));
+ setConnectedControlRightUp(getValue());
} else {
- emit(valueChangedLeftUp(getValue()));
+ setConnectedControlLeftUp(getValue());
}
m_bDrag = false;
@@ -174,7 +174,7 @@ void WSliderComposed::mousePressEvent(QMouseEvent * e) {
m_bDrag = true;
} else {
if (e->button() == Qt::RightButton) {
- emit(valueReset());
+ resetConnectedControls();
m_bRightButtonPressed = true;
} else {
if (m_bHorizontal) {
@@ -204,7 +204,7 @@ void WSliderComposed::paintEvent(QPaintEvent *) {
}
}
-void WSliderComposed::slotConnectedValueChanged(double dValue) {
+void WSliderComposed::onConnectedControlValueChanged(double dValue) {
if (!m_bDrag && getValue() != dValue) {
// Set value without emitting a valueChanged signal
// and force display update
diff --git a/src/widget/wslidercomposed.h b/src/widget/wslidercomposed.h
index f17ad2337d..86ce224184 100644
--- a/src/widget/wslidercomposed.h
+++ b/src/widget/wslidercomposed.h
@@ -51,7 +51,7 @@ class WSliderComposed : public WWidget {
void wheelEvent(QWheelEvent *e);
inline bool isHorizontal() const { return m_bHorizontal; };
public slots:
- void slotConnectedValueChanged(double);
+ void onConnectedControlValueChanged(double);
private:
void unsetPixmaps();
diff --git a/src/widget/wstatuslight.cpp b/src/widget/wstatuslight.cpp
index 7bf5a814cc..44f3128c87 100644
--- a/src/widget/wstatuslight.cpp
+++ b/src/widget/wstatuslight.cpp
@@ -86,7 +86,7 @@ void WStatusLight::setPixmap(int iState, const QString& filename) {
}
}
-void WStatusLight::slotConnectedValueChanged(double v) {
+void WStatusLight::onConnectedControlValueChanged(double v) {
int val = static_cast<int>(v);
if (m_iPos == val) {
return;
diff --git a/src/widget/wstatuslight.h b/src/widget/wstatuslight.h
index 0f42f0fbce..721dd1a520 100644
--- a/src/widget/wstatuslight.h
+++ b/src/widget/wstatuslight.h
@@ -40,7 +40,7 @@ class WStatusLight : public WWidget {
void setup(QDomNode node, const SkinContext& context);
public slots:
- void slotConnectedValueChanged(double v);
+ void onConnectedControlValueChanged(double v);
protected:
void paintEvent(QPaintEvent *);
diff --git a/src/widget/wvumeter.cpp b/src/widget/wvumeter.cpp
index d2ac72ed26..f3dab29e8c 100644
--- a/src/widget/wvumeter.cpp
+++ b/src/widget/wvumeter.cpp
@@ -103,7 +103,7 @@ void WVuMeter::setPixmaps(const QString &vuFilename,
}
}
-void WVuMeter::slotConnectedValueChanged(double dValue) {
+void WVuMeter::onConnectedControlValueChanged(double dValue) {
int idx = static_cast<int>(dValue * m_iNoPos);
// Range check
if (idx > m_iNoPos)
diff --git a/src/widget/wvumeter.h b/src/widget/wvumeter.h
index bab5bca9b0..44e94319ed 100644
--- a/src/widget/wvumeter.h
+++ b/src/widget/wvumeter.h
@@ -39,7 +39,7 @@ class WVuMeter : public WWidget {
void setPixmapBackground(const QString& filename);
void setPixmaps(const QString &vuFilename,
bool bHorizontal=false);
- void slotConnectedValueChanged(double fValue);
+ void onConnectedControlValueChanged(double fValue);
protected slots:
void updateState(int msecsElapsed);
diff --git a/src/widget/wwaveformviewer.cpp b/src/widget/wwaveformviewer.cpp
index 764e3c80ef..543636c681 100644
--- a/src/widget/wwaveformviewer.cpp
+++ b/src/widget/wwaveformviewer.cpp
@@ -68,7 +68,7 @@ void WWaveformViewer::mousePressEvent(QMouseEvent* event) {
// If we are pitch-bending then disable and reset because the two
// shouldn't be used at once.
if (m_bBending) {
- emit(valueChangedRightDown(0.5));
+ setConnectedControlRightDown(0.5);
m_bBending = false;
}
m_bScratching = true;
@@ -83,7 +83,7 @@ void WWaveformViewer::mousePressEvent(QMouseEvent* event) {
m_pScratchPositionEnable->slotSet(0.0f);
m_bScratching = false;
}
- emit(valueChangedRightDown(0.5));
+ setConnectedControlRightDown(0.5);
m_bBending = true;
}
@@ -111,7 +111,7 @@ void WWaveformViewer::mouseMoveEvent(QMouseEvent* event) {
double v = 0.5 + (diff.x() / 1270.0);
// clamp to [0.0, 1.0]
v = math_min(1.0, math_max(0.0, v));
- emit(valueChangedRightDown(v));
+ setConnectedControlRightDown(v);
}
}
@@ -121,7 +121,7 @@ void WWaveformViewer::mouseReleaseEvent(QMouseEvent* /*event*/) {
m_bScratching = false;
}
if (m_bBending) {
- emit(valueChangedRightDown(0.5));
+ setConnectedControlRightDown(0.5);
m_bBending = false;
}
m_mouseAnchor = QPoint();
diff --git a/src/widget/wwaveformviewer.h b/src/widget/wwaveformviewer.h
index bb2dadd53c..1a7a2821fa 100644
--- a/src/widget/wwaveformviewer.h
+++ b/src/widget/wwaveformviewer.h
@@ -35,7 +35,6 @@ class WWaveformViewer : public WWidget {
signals:
void trackDropped(QString filename, QString group);
- void valueReset();
public slots:
void onTrackLoaded( TrackPointer track);
diff --git a/src/widget/wwidget.cpp b/src/widget/wwidget.cpp
index 6cbd15392d..bed27531b1 100644
--- a/src/widget/wwidget.cpp
+++ b/src/widget/wwidget.cpp
@@ -25,11 +25,6 @@ WWidget::WWidget(QWidget* parent, Qt::WindowFlags flags)
: QWidget(parent, flags),
WBaseWidget(this),
m_value(0.0) {
- connect(this, SIGNAL(valueChangedLeftDown(double)), this, SLOT(slotReEmitValueDown(double)));
- connect(this, SIGNAL(valueChangedRightDown(double)), this, SLOT(slotReEmitValueDown(double)));
- connect(this, SIGNAL(valueChangedLeftUp(double)), this, SLOT(slotReEmitValueUp(double)));
- connect(this, SIGNAL(valueChangedRightUp(double)), this, SLOT(slotReEmitValueUp(double)));
-
setAttribute(Qt::WA_StaticContents);
setFocusPolicy(Qt::ClickFocus);
}
@@ -37,26 +32,14 @@ WWidget::WWidget(QWidget* parent, Qt::WindowFlags flags)
WWidget::~WWidget() {
}
-void WWidget::slotConnectedValueChanged(double value) {
+void WWidget::onConnectedControlValueChanged(double value) {
m_value = value;
update();
}
-void WWidget::setOnOff(double d) {
- setDisabled(d != 0.0);
- update();
-}
-
-void WWidget::slotReEmitValueDown(double value) {
- emit(valueChangedDown(value));
-}
-
-void WWidget::slotReEmitValueUp(double value) {
- emit(valueChangedUp(value));
-}
-
void WWidget::updateValue(double value) {
- slotConnectedValueChanged(value);
- emit(valueChangedUp(value));
- emit(valueChangedDown(value));
+ onConnectedControlValueChanged(value);
+ // TODO(rryan): Why is this up then down versus down then up?
+ setConnectedControlUp(value);
+ setConnectedControlDown(value);
}
diff --git a/src/widget/wwidget.h b/src/widget/wwidget.h
index ffb8021383..05169bd762 100644
--- a/src/widget/wwidget.h
+++ b/src/widget/wwidget.h
@@ -52,23 +52,10 @@ public:
m_value = value;
}
+ virtual void onConnectedControlValueChanged(double value);
+
public slots:
- virtual void slotConnectedValueChanged(double value);
void updateValue(double value);
- void setOnOff(double);
-
- private slots:
- void slotReEmitValueDown(double);
- void slotReEmitValueUp(double);
-
- signals:
- void valueReset();
- void valueChangedDown(double);
- void valueChangedUp(double);
- void valueChangedLeftDown(double);
- void valueChangedLeftUp(double);
- void valueChangedRightDown(double);
- void valueChangedRightUp(double);
private:
// Value/state of widget