Merge pull request #868 from diizy/gfx
FxMixer GUI updates, fix disappearing effects
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 916 B After Width: | Height: | Size: 1022 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.5 KiB |
BIN
data/themes/default/new_channel.png
Normal file
|
After Width: | Height: | Size: 479 B |
@@ -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;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -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,16 @@ public:
|
||||
knob * m_sendKnob;
|
||||
SendButtonIndicator * m_sendBtn;
|
||||
|
||||
QBrush backgroundActive() const;
|
||||
void setBackgroundActive( const QBrush & c );
|
||||
|
||||
static const int FxLineHeight;
|
||||
|
||||
private:
|
||||
FxMixerView * m_mv;
|
||||
LcdWidget* m_lcd;
|
||||
int m_channelIndex;
|
||||
QBrush m_backgroundActive;
|
||||
|
||||
private slots:
|
||||
void renameChannel();
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _FX_MIXER_VIEW_H
|
||||
#define _FX_MIXER_VIEW_H
|
||||
#ifndef FX_MIXER_VIEW_H
|
||||
#define FX_MIXER_VIEW_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QStackedLayout>
|
||||
#include <QtGui/QScrollArea>
|
||||
|
||||
#include "FxLine.h"
|
||||
@@ -54,6 +55,7 @@ public:
|
||||
FxLine * m_fxLine;
|
||||
pixmapButton * m_muteBtn;
|
||||
fader * m_fader;
|
||||
EffectRackView * m_rackView;
|
||||
};
|
||||
|
||||
|
||||
@@ -94,7 +96,7 @@ public:
|
||||
// make sure the display syncs up with the fx mixer.
|
||||
// useful for loading projects
|
||||
void refreshDisplay();
|
||||
|
||||
|
||||
private slots:
|
||||
void updateFaders();
|
||||
void addNewChannel();
|
||||
@@ -108,9 +110,12 @@ private:
|
||||
QScrollArea * channelArea;
|
||||
QHBoxLayout * chLayout;
|
||||
QWidget * m_channelAreaWidget;
|
||||
EffectRackView * m_rackView;
|
||||
QStackedLayout * m_racksLayout;
|
||||
QWidget * m_racksWidget;
|
||||
|
||||
void updateMaxChannelSelector();
|
||||
|
||||
friend class FxChannelView;
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _FADER_H
|
||||
#define _FADER_H
|
||||
#ifndef FADER_H
|
||||
#define FADER_H
|
||||
|
||||
#include <QtCore/QTime>
|
||||
#include <QtGui/QWidget>
|
||||
@@ -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;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QStackedLayout>
|
||||
#include <QtGui/QScrollArea>
|
||||
#include <QtGui/QStyle>
|
||||
#include <QtGui/QKeyEvent>
|
||||
@@ -48,7 +47,6 @@
|
||||
#include "song.h"
|
||||
#include "bb_track_container.h"
|
||||
|
||||
|
||||
FxMixerView::FxMixerView() :
|
||||
QWidget(),
|
||||
ModelView( NULL, this ),
|
||||
@@ -77,10 +75,18 @@ FxMixerView::FxMixerView() :
|
||||
chLayout->setMargin( 0 );
|
||||
m_channelAreaWidget->setLayout(chLayout);
|
||||
|
||||
// create rack layout before creating the first channel
|
||||
m_racksWidget = new QWidget;
|
||||
m_racksLayout = new QStackedLayout( m_racksWidget );
|
||||
m_racksLayout->setContentsMargins( 0, 0, 0, 0 );
|
||||
m_racksWidget->setLayout( m_racksLayout );
|
||||
|
||||
// add master channel
|
||||
m_fxChannelViews.resize( m->numChannels() );
|
||||
m_fxChannelViews[0] = new FxChannelView( this, this, 0 );
|
||||
|
||||
m_racksLayout->addWidget( m_fxChannelViews[0]->m_rackView );
|
||||
|
||||
FxChannelView * masterView = m_fxChannelViews[0];
|
||||
ml->addWidget( masterView->m_fxLine, 0, Qt::AlignTop );
|
||||
|
||||
@@ -118,17 +124,15 @@ 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 );
|
||||
|
||||
|
||||
// Create EffectRack and set initial index to master channel
|
||||
m_rackView = new EffectRackView( &m->m_fxChannels[0]->m_fxChain, this );
|
||||
m_rackView->setFixedSize( 245, fxLineSize.height() );
|
||||
ml->addWidget( m_rackView, 0, Qt::AlignTop );
|
||||
// add the stacked layout for the effect racks of fx channels
|
||||
ml->addWidget( m_racksWidget, 0, Qt::AlignTop );
|
||||
|
||||
setCurrentFxLine( m_fxChannelViews[0]->m_fxLine );
|
||||
|
||||
@@ -170,7 +174,8 @@ void FxMixerView::addNewChannel()
|
||||
int newChannelIndex = mix->createChannel();
|
||||
m_fxChannelViews.push_back(new FxChannelView(m_channelAreaWidget, this,
|
||||
newChannelIndex));
|
||||
chLayout->addWidget(m_fxChannelViews[newChannelIndex]->m_fxLine);
|
||||
chLayout->addWidget( m_fxChannelViews[newChannelIndex]->m_fxLine );
|
||||
m_racksLayout->addWidget( m_fxChannelViews[newChannelIndex]->m_rackView );
|
||||
|
||||
updateFxLine(newChannelIndex);
|
||||
|
||||
@@ -188,6 +193,7 @@ void FxMixerView::refreshDisplay()
|
||||
delete m_fxChannelViews[i]->m_muteBtn;
|
||||
delete m_fxChannelViews[i]->m_fxLine;
|
||||
delete m_fxChannelViews[i];
|
||||
m_racksLayout->removeWidget( m_fxChannelViews[i]->m_rackView );
|
||||
}
|
||||
m_channelAreaWidget->adjustSize();
|
||||
|
||||
@@ -197,6 +203,7 @@ void FxMixerView::refreshDisplay()
|
||||
{
|
||||
m_fxChannelViews[i] = new FxChannelView(m_channelAreaWidget, this, i);
|
||||
chLayout->addWidget(m_fxChannelViews[i]->m_fxLine);
|
||||
m_racksLayout->addWidget( m_fxChannelViews[i]->m_rackView );
|
||||
}
|
||||
|
||||
// set selected fx line to 0
|
||||
@@ -257,7 +264,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 );
|
||||
|
||||
@@ -270,6 +277,10 @@ FxMixerView::FxChannelView::FxChannelView(QWidget * _parent, FxMixerView * _mv,
|
||||
m_muteBtn->setCheckable( true );
|
||||
m_muteBtn->move( 9, m_fader->y()-16);
|
||||
toolTip::add( m_muteBtn, tr( "Mute this FX channel" ) );
|
||||
|
||||
// Create EffectRack for the channel
|
||||
m_rackView = new EffectRackView( &m->effectChannel(_chIndex)->m_fxChain, _mv->m_racksWidget );
|
||||
m_rackView->setFixedSize( 245, FxLine::FxLineHeight );
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +288,7 @@ void FxMixerView::setCurrentFxLine( FxLine * _line )
|
||||
{
|
||||
// select
|
||||
m_currentFxLine = _line;
|
||||
m_rackView->setModel( &engine::fxMixer()->m_fxChannels[_line->channelIndex()]->m_fxChain );
|
||||
m_racksLayout->setCurrentWidget( m_fxChannelViews[ _line->channelIndex() ]->m_rackView );
|
||||
|
||||
// set up send knob
|
||||
for(int i = 0; i < m_fxChannelViews.size(); ++i)
|
||||
@@ -333,6 +344,9 @@ void FxMixerView::deleteChannel(int index)
|
||||
delete m_fxChannelViews[index];
|
||||
m_channelAreaWidget->adjustSize();
|
||||
|
||||
// delete the fx rack
|
||||
m_racksLayout->removeWidget( m_fxChannelViews[index]->m_rackView );
|
||||
|
||||
// make sure every channel knows what index it is
|
||||
for(int i=0; i<m_fxChannelViews.size(); ++i)
|
||||
{
|
||||
@@ -376,10 +390,12 @@ void FxMixerView::moveChannelLeft(int index)
|
||||
delete m_fxChannelViews[i]->m_muteBtn;
|
||||
delete m_fxChannelViews[i]->m_fxLine;
|
||||
delete m_fxChannelViews[i];
|
||||
m_racksLayout->removeWidget( m_fxChannelViews[i]->m_rackView );
|
||||
|
||||
// add it again
|
||||
m_fxChannelViews[i] = new FxChannelView(m_channelAreaWidget, this, i);
|
||||
chLayout->insertWidget(replaceIndex, m_fxChannelViews[i]->m_fxLine);
|
||||
m_fxChannelViews[i] = new FxChannelView( m_channelAreaWidget, this, i );
|
||||
chLayout->insertWidget( replaceIndex, m_fxChannelViews[i]->m_fxLine );
|
||||
m_racksLayout->insertWidget( replaceIndex, m_fxChannelViews[i]->m_rackView );
|
||||
}
|
||||
|
||||
// keep selected channel
|
||||
@@ -449,8 +465,6 @@ void FxMixerView::setCurrentFxLine( int _line )
|
||||
|
||||
void FxMixerView::clear()
|
||||
{
|
||||
m_rackView->clearViews();
|
||||
|
||||
engine::fxMixer()->clear();
|
||||
|
||||
refreshDisplay();
|
||||
|
||||
@@ -39,25 +39,25 @@
|
||||
#include "gui_templates.h"
|
||||
#include "caption_menu.h"
|
||||
|
||||
const int FxLine::FxLineHeight = 287;
|
||||
|
||||
FxLine::FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex) :
|
||||
QWidget( _parent ),
|
||||
m_mv( _mv ),
|
||||
m_channelIndex( _channelIndex )
|
||||
{
|
||||
setFixedSize( 32, 287 );
|
||||
setFixedSize( 33, FxLineHeight );
|
||||
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 +97,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 +238,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"
|
||||
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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<int>( 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<int>( 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"
|
||||
|
||||
|
||||