FadeButtons now remain partially lit as a note plays out (#4969)

This commit is contained in:
Noah Brecht
2019-06-25 07:26:57 -04:00
committed by Hyunjin Song
parent a0c2a62c27
commit 7834e10bc7
4 changed files with 104 additions and 42 deletions

View File

@@ -35,8 +35,10 @@ class FadeButton : public QAbstractButton
{
Q_OBJECT
public:
FadeButton( const QColor & _normal_color, const QColor &
_activated_color, QWidget * _parent );
FadeButton( const QColor & _normal_color,
const QColor & _activated_color,
const QColor & _hold_color,
QWidget * _parent );
virtual ~FadeButton();
void setActiveColor( const QColor & activated_color );
@@ -44,6 +46,7 @@ public:
public slots:
void activate();
void noteEnd();
protected:
@@ -53,13 +56,20 @@ protected:
private:
QTime m_stateTimer;
QTime m_releaseTimer;
// the default color of the widget
QColor m_normalColor;
// the color on note play
QColor m_activatedColor;
// the color after the "play" fade is done but a note is still playing
QColor m_holdColor;
int activeNotes;
void signalUpdate();
QColor fadeToColor(QColor, QColor, QTime, float);
} ;
#endif

View File

@@ -221,6 +221,7 @@ signals:
void midiNoteOff( const Note& );
void nameChanged();
void newNote();
void endNote();
protected: