Commit 66f41dc2 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

EffectHelper: Let the EffectHelper know what it target is.

parent 12b8ef60
......@@ -25,7 +25,8 @@
EffectHelper::EffectHelper( EffectInstance *effectInstance, qint64 begin, qint64 end,
const QString &uuid ) :
Helper( begin, end, uuid ),
m_effectInstance( effectInstance )
m_effectInstance( effectInstance ),
m_target( NULL )
{
}
......@@ -40,3 +41,15 @@ EffectHelper::effectInstance() const
{
return m_effectInstance;
}
const EffectUser*
EffectHelper::target() const
{
return m_target;
}
void
EffectHelper::setTarget( const EffectUser *target )
{
m_target = target;
}
......@@ -24,6 +24,7 @@
#define EFFECTHELPER_H
class EffectInstance;
class EffectUser;
#include "Helper.h"
......@@ -41,9 +42,12 @@ class EffectHelper : public Workflow::Helper
EffectInstance *effectInstance();
const EffectInstance *effectInstance() const;
const EffectUser *target() const;
void setTarget( const EffectUser *target );
private:
EffectInstance *m_effectInstance;
const EffectUser *m_target;
};
Q_DECLARE_METATYPE( EffectHelper* );
......
......@@ -64,6 +64,7 @@ EffectUser::addEffect( EffectHelper *effectHelper )
m_filters.push_back( effectHelper );
else
m_mixers.push_back( effectHelper );
effectHelper->setTarget( this );
emit effectAdded( effectHelper, effectHelper->begin() );
}
......@@ -236,6 +237,7 @@ EffectUser::removeEffect( Effect::Type type, qint32 idx )
if ( idx < m_filters.size() )
{
EffectHelper *helper = m_filters.takeAt( idx );
helper->setTarget( NULL );
emit effectRemoved( helper->uuid() );
}
}
......@@ -244,6 +246,7 @@ EffectUser::removeEffect( Effect::Type type, qint32 idx )
if ( idx < m_mixers.size() )
{
EffectHelper *helper = m_mixers.takeAt( idx );
helper->setTarget( NULL );
emit effectRemoved( helper->uuid() );
}
}
......@@ -262,8 +265,10 @@ EffectUser::removeEffect(EffectHelper *helper)
{
if ( (*it)->uuid() == helper->uuid() )
{
EffectHelper *eh = *it;
eh->setTarget( NULL );
m_filters.erase( it );
emit effectRemoved( (*it)->uuid() );
emit effectRemoved( eh->uuid() );
return ;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment