Commit a726e825 authored by luyikei's avatar luyikei

Move showEffectStack from Timeline to MainWorkflow

parent cd42e070
......@@ -369,7 +369,7 @@ Rectangle {
anchors.fill: parent
hoverEnabled: true
onClicked: {
timeline.showEffectStack( uuid );
workflow.showEffectStack( uuid );
}
}
......
......@@ -68,7 +68,7 @@ Menu {
text: "Effects"
onTriggered: {
timeline.showEffectStack( clip.uuid );
workflow.showEffectStack( clip.uuid );
}
}
}
......@@ -57,18 +57,3 @@ Timeline::container()
{
return m_container;
}
void
Timeline::showEffectStack( quint32 trackId )
{
auto w = new EffectStack( Core::instance()->workflow()->trackInput( trackId ) );
w->show();
}
void
Timeline::showEffectStack( const QString& uuid )
{
auto w = new EffectStack( Core::instance()->workflow()->clipInput( uuid ) );
connect( w, &EffectStack::finished, Core::instance()->workflow(), [uuid]{ emit Core::instance()->workflow()->effectsUpdated( uuid ); } );
w->show();
}
......@@ -45,10 +45,6 @@ public:
QWidget* container();
public slots:
void showEffectStack( quint32 trackId );
void showEffectStack( const QString& uuid );
/**
* \brief Change the currently selected tool.
*/
......
......@@ -394,7 +394,7 @@ Item {
onSelectedChanged: {
if ( selected === false ) {
timeline.showEffectStack( trackId );
workflow.showEffectStack( trackId );
selected = true;
}
}
......
......@@ -35,6 +35,7 @@
#include "Renderer/AbstractRenderer.h"
#ifdef HAVE_GUI
#include "EffectsEngine/EffectHelper.h"
#include "Gui/effectsengine/EffectStack.h"
#include "Gui/WorkflowFileRendererDialog.h"
#endif
#include "Project/Project.h"
......@@ -139,25 +140,29 @@ MainWorkflow::setFps( double fps )
emit fpsChanged( fps );
}
AbstractRenderer*
MainWorkflow::renderer()
void
MainWorkflow::showEffectStack( quint32 trackId )
{
return m_renderer;
#ifdef HAVE_GUI
auto w = new EffectStack( m_sequenceWorkflow->trackInput( trackId ) );
w->show();
#endif
}
Backend::IInput*
MainWorkflow::clipInput( const QString& uuid )
void
MainWorkflow::showEffectStack( const QString& uuid )
{
auto clip = m_sequenceWorkflow->clip( uuid );
if ( clip )
return clip->input();
return nullptr;
#ifdef HAVE_GUI
auto w = new EffectStack( m_sequenceWorkflow->clip( uuid )->input() );
connect( w, &EffectStack::finished, Core::instance()->workflow(), [uuid]{ emit Core::instance()->workflow()->effectsUpdated( uuid ); } );
w->show();
#endif
}
Backend::IInput*
MainWorkflow::trackInput( quint32 trackId )
AbstractRenderer*
MainWorkflow::renderer()
{
return m_sequenceWorkflow->trackInput( trackId );
return m_renderer;
}
Commands::AbstractUndoStack*
......@@ -273,10 +278,10 @@ MainWorkflow::addEffect( const QString &clipUuid, const QString &effectId )
return QStringLiteral( "" );
}
auto clipI = clipInput( clipUuid );
if ( clipI != nullptr )
auto clip = m_sequenceWorkflow->clip( clipUuid );
if ( clip && clip->input() )
{
trigger( new Commands::Effect::Add( newEffect, clipI ) );
trigger( new Commands::Effect::Add( newEffect, clip->input() ) );
emit effectsUpdated( clipUuid );
return newEffect->uuid().toString();
}
......
......@@ -25,6 +25,10 @@
#ifndef MAINWORKFLOW_H
#define MAINWORKFLOW_H
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "Types.h"
#include <QJsonObject>
......@@ -157,10 +161,6 @@ class MainWorkflow : public QObject
AbstractRenderer* renderer();
// Only for showEffectStack
Backend::IInput* clipInput( const QString& uuid );
Backend::IInput* trackInput( quint32 trackId );
Commands::AbstractUndoStack* undoStack();
private:
......@@ -206,6 +206,12 @@ class MainWorkflow : public QObject
void setFps( double fps );
// FIXME: We can't use #ifdef HAVE_GUI here because qml files can't find them
// You'll get:
// TypeError: Property 'showEffectStack' of object MainWorkflow is not a function
void showEffectStack( quint32 trackId );
void showEffectStack( const QString& uuid );
signals:
/**
* \brief Used to notify a change to the timeline and preview widget cursor
......
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