FxMixerView: fix disappearing effects

This commit is contained in:
Vesa
2014-06-19 22:17:59 +03:00
parent 4bcbb1abcc
commit 83cc446807
4 changed files with 37 additions and 14 deletions

View File

@@ -58,6 +58,8 @@ public:
QBrush backgroundActive() const;
void setBackgroundActive( const QBrush & c );
static const int FxLineHeight;
private:
FxMixerView * m_mv;
LcdWidget* m_lcd;

View File

@@ -27,6 +27,7 @@
#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

View File

@@ -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>
@@ -76,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 );
@@ -124,10 +131,8 @@ FxMixerView::FxMixerView() :
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 );
@@ -169,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);
@@ -187,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();
@@ -196,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
@@ -269,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 );
}
@@ -276,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)
@@ -332,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)
{
@@ -375,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
@@ -448,8 +465,6 @@ void FxMixerView::setCurrentFxLine( int _line )
void FxMixerView::clear()
{
m_rackView->clearViews();
engine::fxMixer()->clear();
refreshDisplay();

View File

@@ -39,13 +39,14 @@
#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( 33, 287 );
setFixedSize( 33, FxLineHeight );
setAttribute( Qt::WA_OpaquePaintEvent, true );
setCursor( QCursor( embed::getIconPixmap( "hand" ), 0, 0 ) );