diff --git a/data/themes/default/style.css b/data/themes/default/style.css index 82e72ec6a..ccd666189 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -482,6 +482,19 @@ FxMixerView QPushButton, EffectRackView QPushButton, ControllerRackView QPushBut font-size: 10px; } +FxLine { + background: #5b6571; + color: #e0e0e0; + qproperty-backgroundActive: qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:0, + stop:0 #7b838d, stop:1 #6b7581 ); +} + +/* persistent peak markers for fx peak meters */ +fader { + qproperty-peakGreen: rgb( 74, 253, 133); + qproperty-peakRed: rgb( 255, 100, 100); +} + timeLine { font-size: 8px; } diff --git a/include/FxLine.h b/include/FxLine.h index 5ee4d2ec2..6fbe8161e 100644 --- a/include/FxLine.h +++ b/include/FxLine.h @@ -40,6 +40,7 @@ class FxLine : public QWidget { Q_OBJECT public: + Q_PROPERTY( QBrush backgroundActive READ backgroundActive WRITE setBackgroundActive ) FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex); ~FxLine(); @@ -54,10 +55,14 @@ public: knob * m_sendKnob; SendButtonIndicator * m_sendBtn; + QBrush backgroundActive() const; + void setBackgroundActive( const QBrush & c ); + private: FxMixerView * m_mv; LcdWidget* m_lcd; int m_channelIndex; + QBrush m_backgroundActive; private slots: void renameChannel(); diff --git a/include/FxMixerView.h b/include/FxMixerView.h index 6449a0306..c81d257d5 100644 --- a/include/FxMixerView.h +++ b/include/FxMixerView.h @@ -22,8 +22,8 @@ * */ -#ifndef _FX_MIXER_VIEW_H -#define _FX_MIXER_VIEW_H +#ifndef FX_MIXER_VIEW_H +#define FX_MIXER_VIEW_H #include #include diff --git a/include/SendButtonIndicator.h b/include/SendButtonIndicator.h index 2b0819791..8615bc392 100644 --- a/include/SendButtonIndicator.h +++ b/include/SendButtonIndicator.h @@ -11,22 +11,23 @@ class FxLine; class FxMixerView; -class SendButtonIndicator : public QLabel { - public: - SendButtonIndicator( QWidget * _parent, FxLine * _owner, - FxMixerView * _mv); +class SendButtonIndicator : public QLabel +{ +public: + SendButtonIndicator( QWidget * _parent, FxLine * _owner, + FxMixerView * _mv); - virtual void mousePressEvent( QMouseEvent * e ); - void updateLightStatus(); + virtual void mousePressEvent( QMouseEvent * e ); + void updateLightStatus(); - private: +private: - FxLine * m_parent; - FxMixerView * m_mv; - QPixmap qpmOn; - QPixmap qpmOff; + FxLine * m_parent; + FxMixerView * m_mv; + static QPixmap * s_qpmOn; + static QPixmap * s_qpmOff; - FloatModel * getSendModel(); + FloatModel * getSendModel(); }; #endif // SENDBUTTONINDICATOR_H diff --git a/include/fader.h b/include/fader.h index 02bc475c2..500c5e49d 100644 --- a/include/fader.h +++ b/include/fader.h @@ -45,8 +45,8 @@ */ -#ifndef _FADER_H -#define _FADER_H +#ifndef FADER_H +#define FADER_H #include #include @@ -61,6 +61,8 @@ class fader : public QWidget, public FloatModelView { Q_OBJECT public: + Q_PROPERTY( QColor peakGreen READ peakGreen WRITE setPeakGreen ) + Q_PROPERTY( QColor peakRed READ peakRed WRITE setPeakRed ) fader( FloatModel * _model, const QString & _name, QWidget * _parent ); virtual ~fader(); @@ -70,6 +72,10 @@ public: void setPeak_R( float fPeak ); float getPeak_R() { return m_fPeakValue_R; } + QColor peakGreen() const; + QColor peakRed() const; + void setPeakGreen( const QColor & c ); + void setPeakRed( const QColor & c ); private: virtual void contextMenuEvent( QContextMenuEvent * _me ); @@ -85,7 +91,7 @@ private: float fRange = m_model->maxValue() - m_model->minValue(); float realVal = m_model->value() - m_model->minValue(); - return height() - ( ( height() - m_knob.height() ) * ( realVal / fRange ) ); + return height() - ( ( height() - ( *s_knob ).height() ) * ( realVal / fRange ) ); } FloatModel * m_model; @@ -103,9 +109,9 @@ private: QTime m_lastPeakTime_L; QTime m_lastPeakTime_R; - QPixmap m_back; - QPixmap m_leds; - QPixmap m_knob; + static QPixmap * s_back; + static QPixmap * s_leds; + static QPixmap * s_knob; int m_moveStartPoint; float m_startValue; @@ -113,6 +119,8 @@ private: static textFloat * s_textFloat; void updateTextFloat(); + QColor m_peakGreen; + QColor m_peakRed; } ; diff --git a/src/gui/FxMixerView.cpp b/src/gui/FxMixerView.cpp index 466807c4b..25332a64d 100644 --- a/src/gui/FxMixerView.cpp +++ b/src/gui/FxMixerView.cpp @@ -48,7 +48,6 @@ #include "song.h" #include "bb_track_container.h" - FxMixerView::FxMixerView() : QWidget(), ModelView( NULL, this ), @@ -118,10 +117,10 @@ FxMixerView::FxMixerView() : ml->addWidget(channelArea); // show the add new effect channel button - QPushButton * newChannelBtn = new QPushButton("new", this ); - newChannelBtn->setFont(QFont("sans-serif", 10, 1, false)); - newChannelBtn->setFixedSize(fxLineSize); - connect( newChannelBtn, SIGNAL(clicked()), this, SLOT(addNewChannel())); + QPushButton * newChannelBtn = new QPushButton( embed::getIconPixmap( "new_channel" ), QString::null, this ); + newChannelBtn->setObjectName( "newChannelBtn" ); + newChannelBtn->setFixedSize( fxLineSize ); + connect( newChannelBtn, SIGNAL( clicked() ), this, SLOT( addNewChannel() ) ); ml->addWidget( newChannelBtn, 0, Qt::AlignTop ); @@ -257,7 +256,7 @@ FxMixerView::FxChannelView::FxChannelView(QWidget * _parent, FxMixerView * _mv, FxMixer * m = engine::fxMixer(); m_fader = new fader( &m->effectChannel(_chIndex)->m_volumeModel, tr( "FX Fader %1" ).arg( _chIndex ), m_fxLine ); - m_fader->move( 15-m_fader->width()/2, + m_fader->move( 16-m_fader->width()/2, m_fxLine->height()- m_fader->height()-5 ); diff --git a/src/gui/widgets/FxLine.cpp b/src/gui/widgets/FxLine.cpp index c200c1001..a8e30f45e 100644 --- a/src/gui/widgets/FxLine.cpp +++ b/src/gui/widgets/FxLine.cpp @@ -45,19 +45,18 @@ FxLine::FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex) : m_mv( _mv ), m_channelIndex( _channelIndex ) { - setFixedSize( 32, 287 ); + setFixedSize( 33, 287 ); setAttribute( Qt::WA_OpaquePaintEvent, true ); setCursor( QCursor( embed::getIconPixmap( "hand" ), 0, 0 ) ); // mixer sends knob m_sendKnob = new knob( knobBright_26, this, tr("Channel send amount") ); - m_sendKnob->move(3, 22); + m_sendKnob->move( 3, 22 ); m_sendKnob->setVisible(false); // send button indicator - m_sendBtn = new SendButtonIndicator(this, this, m_mv); - m_sendBtn->setPixmap(embed::getIconPixmap("mixer_send_off", 23, 16)); - m_sendBtn->move(4,4); + m_sendBtn = new SendButtonIndicator( this, this, m_mv ); + m_sendBtn->move( 2, 2 ); // channel number m_lcd = new LcdWidget( 2, this ); @@ -97,37 +96,34 @@ void FxLine::setChannelIndex(int index) { } -static void drawFxLine( QPainter* p, const QWidget *fxLine, const QString& name, bool isActive, bool sendToThis ) +static void drawFxLine( QPainter* p, const FxLine *fxLine, const QString& name, bool isActive, bool sendToThis ) { int width = fxLine->rect().width(); int height = fxLine->rect().height(); - QColor bg_color = QApplication::palette().color( QPalette::Active, - QPalette::Background ); QColor sh_color = QApplication::palette().color( QPalette::Active, QPalette::Shadow ); - QColor te_color = QApplication::palette().color( QPalette::Active, - QPalette::Text ); + QColor te_color = p->pen().brush().color(); QColor bt_color = QApplication::palette().color( QPalette::Active, QPalette::BrightText ); - p->fillRect( fxLine->rect(), isActive ? bg_color.lighter(130) : bg_color ); + p->fillRect( fxLine->rect(), isActive ? fxLine->backgroundActive() : p->background() ); - p->setPen( bg_color.darker(130) ); + p->setPen( QColor( 0, 0, 0, 75 ) ); p->drawRect( 0, 0, width-2, height-2 ); - p->setPen( bg_color.lighter(150) ); - p->drawRect( 1, 1, width-2, height-2 ); + p->setPen( QColor( 255, 255, 255, 75 ) ); + p->drawRect( 1, 1, width-3, height-3 ); - p->setPen( isActive ? sh_color : bg_color.darker(130) ); + p->setPen( isActive ? sh_color : QColor( 0, 0, 0, 50 ) ); p->drawRect( 0, 0, width-1, height-1 ); // draw the mixer send background if( sendToThis ) { - p->drawPixmap(2, 0, 28, 56, - embed::getIconPixmap("send_bg_arrow", 28, 56)); + p->drawPixmap( 3, 0, 28, 56, + embed::getIconPixmap("send_bg_arrow", 28, 56 ) ); } // draw the channel name @@ -241,5 +237,15 @@ void FxLine::displayHelp() whatsThis() ); } +QBrush FxLine::backgroundActive() const +{ + return m_backgroundActive; +} + +void FxLine::setBackgroundActive( const QBrush & c ) +{ + m_backgroundActive = c; +} + #include "moc_FxLine.cxx" diff --git a/src/gui/widgets/SendButtonIndicator.cpp b/src/gui/widgets/SendButtonIndicator.cpp index a932f136a..e77c0e965 100644 --- a/src/gui/widgets/SendButtonIndicator.cpp +++ b/src/gui/widgets/SendButtonIndicator.cpp @@ -4,19 +4,29 @@ #include "FxMixer.h" #include "Model.h" +QPixmap * SendButtonIndicator::s_qpmOff = NULL; +QPixmap * SendButtonIndicator::s_qpmOn = NULL; + SendButtonIndicator:: SendButtonIndicator( QWidget * _parent, FxLine * _owner, FxMixerView * _mv) : QLabel( _parent ), m_parent( _owner ), m_mv( _mv ) { - qpmOff = embed::getIconPixmap("mixer_send_off", 23, 16); - qpmOn = embed::getIconPixmap("mixer_send_on", 23, 16); - + if( ! s_qpmOff ) + { + s_qpmOff = new QPixmap( embed::getIconPixmap( "mixer_send_off", 29, 20 ) ); + } + + if( ! s_qpmOn ) + { + s_qpmOn = new QPixmap( embed::getIconPixmap( "mixer_send_on", 29, 20 ) ); + } + // don't do any initializing yet, because the FxMixerView and FxLine // that were passed to this constructor are not done with their constructors // yet. - + setPixmap( *s_qpmOff ); } void SendButtonIndicator::mousePressEvent( QMouseEvent * e ) @@ -49,5 +59,5 @@ FloatModel * SendButtonIndicator::getSendModel() void SendButtonIndicator::updateLightStatus() { - setPixmap( getSendModel() == NULL ? qpmOff : qpmOn ); + setPixmap( getSendModel() == NULL ? *s_qpmOff : *s_qpmOn ); } diff --git a/src/gui/widgets/fader.cpp b/src/gui/widgets/fader.cpp index f2dc4c5fd..d12112f82 100644 --- a/src/gui/widgets/fader.cpp +++ b/src/gui/widgets/fader.cpp @@ -60,7 +60,9 @@ textFloat * fader::s_textFloat = NULL; - +QPixmap * fader::s_back = NULL; +QPixmap * fader::s_leds = NULL; +QPixmap * fader::s_knob = NULL; fader::fader( FloatModel * _model, const QString & _name, QWidget * _parent ) : QWidget( _parent ), @@ -72,18 +74,30 @@ fader::fader( FloatModel * _model, const QString & _name, QWidget * _parent ) : m_persistentPeak_R( 0.0 ), m_fMinPeak( 0.01f ), m_fMaxPeak( 1.1 ), - m_back( embed::getIconPixmap( "fader_background" ) ), - m_leds( embed::getIconPixmap( "fader_leds" ) ), - m_knob( embed::getIconPixmap( "fader_knob" ) ), m_moveStartPoint( -1 ), - m_startValue( 0 ) + m_startValue( 0 ), + m_peakGreen( 0, 0, 0 ), + m_peakRed( 0, 0, 0 ) { if( s_textFloat == NULL ) { s_textFloat = new textFloat; } + if( ! s_back ) + { + s_back = new QPixmap( embed::getIconPixmap( "fader_background" ) ); + } + if( ! s_leds ) + { + s_leds = new QPixmap( embed::getIconPixmap( "fader_leds" ) ); + } + if( ! s_knob ) + { + s_knob = new QPixmap( embed::getIconPixmap( "fader_knob" ) ); + } + setWindowTitle( _name ); - setAttribute( Qt::WA_OpaquePaintEvent, true ); + setAttribute( Qt::WA_OpaquePaintEvent, false ); setMinimumSize( 23, 116 ); setMaximumSize( 23, 116); resize( 23, 116 ); @@ -116,7 +130,7 @@ void fader::mouseMoveEvent( QMouseEvent *mouseEvent ) { int dy = m_moveStartPoint - mouseEvent->globalY(); - float delta = dy * ( m_model->maxValue() - m_model->minValue() ) / (float) ( height() - m_knob.height() ); + float delta = dy * ( m_model->maxValue() - m_model->minValue() ) / (float) ( height() - ( *s_knob ).height() ); model()->setValue( m_startValue + delta ); @@ -132,7 +146,7 @@ void fader::mousePressEvent( QMouseEvent* mouseEvent ) if( mouseEvent->button() == Qt::LeftButton && ! ( mouseEvent->modifiers() & Qt::ControlModifier ) ) { - if( mouseEvent->y() >= knobPosY() - m_knob.height() && mouseEvent->y() < knobPosY() ) + if( mouseEvent->y() >= knobPosY() - ( *s_knob ).height() && mouseEvent->y() < knobPosY() ) { updateTextFloat(); s_textFloat->show(); @@ -260,7 +274,7 @@ void fader::updateTextFloat() { s_textFloat->setText( QString("Volume: %1 %").arg( m_model->value() * 100 ) ); } - s_textFloat->moveGlobal( this, QPoint( width() - m_knob.width() - 5, knobPosY() - 46 ) ); + s_textFloat->moveGlobal( this, QPoint( width() - ( *s_knob ).width() - 5, knobPosY() - 46 ) ); } @@ -277,8 +291,7 @@ void fader::paintEvent( QPaintEvent * ev) QPainter painter(this); // background -// painter.drawPixmap( rect(), m_back, QRect( 0, 0, 23, 116 ) ); - painter.drawPixmap( ev->rect(), m_back, ev->rect() ); + painter.drawPixmap( ev->rect(), *s_back, ev->rect() ); // peak leds @@ -286,28 +299,50 @@ void fader::paintEvent( QPaintEvent * ev) int peak_L = calculateDisplayPeak( m_fPeakValue_L - m_fMinPeak ); int persistentPeak_L = qMax( 3, calculateDisplayPeak( m_persistentPeak_L - m_fMinPeak ) ); - painter.drawPixmap( QRect( 0, peak_L, 11, 116 - peak_L ), m_leds, QRect( 0, peak_L, 11, 116 - peak_L ) ); + painter.drawPixmap( QRect( 0, peak_L, 11, 116 - peak_L ), *s_leds, QRect( 0, peak_L, 11, 116 - peak_L ) ); if( m_persistentPeak_L > 0.05 ) { - painter.fillRect( QRect( 2, persistentPeak_L, 7, 1 ), (m_persistentPeak_L < 1.0 )? QColor( 74, 253, 133) : QColor( 255, 100, 100)); + painter.fillRect( QRect( 2, persistentPeak_L, 7, 1 ), ( m_persistentPeak_L < 1.0 ) + ? peakGreen() + : peakRed() ); } int peak_R = calculateDisplayPeak( m_fPeakValue_R - m_fMinPeak ); int persistentPeak_R = qMax( 3, calculateDisplayPeak( m_persistentPeak_R - m_fMinPeak ) ); - painter.drawPixmap( QRect( 11, peak_R, 11, 116 - peak_R ), m_leds, QRect( 11, peak_R, 11, 116 - peak_R ) ); + painter.drawPixmap( QRect( 11, peak_R, 11, 116 - peak_R ), *s_leds, QRect( 11, peak_R, 11, 116 - peak_R ) ); if( m_persistentPeak_R > 0.05 ) { - painter.fillRect( QRect( 14, persistentPeak_R, 7, 1 ), (m_persistentPeak_R < 1.0 )? QColor( 74, 253, 133) : QColor( 255, 100, 100)); + painter.fillRect( QRect( 14, persistentPeak_R, 7, 1 ), ( m_persistentPeak_R < 1.0 ) + ? peakGreen() + : peakRed() ); } // knob - painter.drawPixmap( 0, knobPosY() - m_knob.height(), m_knob ); + painter.drawPixmap( 0, knobPosY() - ( *s_knob ).height(), *s_knob ); } +QColor fader::peakGreen() const +{ + return m_peakGreen; +} +QColor fader::peakRed() const +{ + return m_peakRed; +} + +void fader::setPeakGreen( const QColor & c ) +{ + m_peakGreen = c; +} + +void fader::setPeakRed( const QColor & c ) +{ + m_peakRed = c; +} #include "moc_fader.cxx"