Commit 74dc0de1 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

MainWorkflow: Provide an unlink action & the associated command

parent e5d6bf87
......@@ -380,6 +380,37 @@ Commands::Clip::Link::internalUndo()
invalidate();
}
Commands::Clip::Unlink::Unlink( std::shared_ptr<SequenceWorkflow> const& workflow,
const QUuid& clipA, const QUuid& clipB )
: m_workflow( workflow )
, m_clipA( clipA )
, m_clipB( clipB )
{
retranslate();
}
void
Commands::Clip::Unlink::retranslate()
{
setText( tr( "Unlinking clips" ) );
}
void
Commands::Clip::Unlink::internalRedo()
{
auto ret = m_workflow->unlinkClips( m_clipA, m_clipB );
if ( ret == false )
invalidate();
}
void
Commands::Clip::Unlink::internalUndo()
{
auto ret = m_workflow->linkClips( m_clipA, m_clipB );
if ( ret == false )
invalidate();
}
Commands::Effect::Add::Add( std::shared_ptr<EffectHelper> const& helper, Backend::IInput* target )
: m_helper( helper )
, m_target( target )
......
......@@ -197,6 +197,20 @@ namespace Commands
QUuid m_clipA;
QUuid m_clipB;
};
class Unlink : public Generic
{
public:
Unlink( std::shared_ptr<SequenceWorkflow> const& workflow,
const QUuid& clipA, const QUuid& clipB );
virtual void internalRedo();
virtual void internalUndo();
virtual void retranslate();
private:
std::shared_ptr<SequenceWorkflow> m_workflow;
QUuid m_clipA;
QUuid m_clipB;
};
}
namespace Effect
{
......
......@@ -281,6 +281,12 @@ MainWorkflow::linkClips( const QString& uuidA, const QString& uuidB )
trigger( new Commands::Clip::Link( m_sequenceWorkflow, uuidA, uuidB ) );
}
void
MainWorkflow::unlinkClips( const QString& uuidA, const QString& uuidB )
{
trigger( new Commands::Clip::Unlink( m_sequenceWorkflow, uuidA, uuidB ) );
}
QString
MainWorkflow::addEffect( const QString &clipUuid, const QString &effectId )
{
......
......@@ -152,6 +152,9 @@ class MainWorkflow : public QObject
Q_INVOKABLE
void linkClips( const QString& uuidA, const QString& uuidB );
Q_INVOKABLE
void unlinkClips( const QString& uuidA, const QString& uuidB );
Q_INVOKABLE
QString addEffect( const QString& clipUuid, const QString& effectId );
......
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