Commit 0c34c9be authored by luyikei's avatar luyikei

Timeline: Implement adding/showing effects

parent 8b6524ed
......@@ -287,12 +287,28 @@ Rectangle {
]
}
DropArea {
id: effectDropArea
anchors.fill: parent
keys: ["vlmc/effect_name"]
onDropped: {
workflow.addEffect( uuid, drop.getDataAsString( "vlmc/effect_name" ) );
}
}
ClipContextMenu {
id: clipContextMenu
clip: clip
}
states: [
State {
name: "EffectDrop"
when: effectDropArea.containsDrag
PropertyChanges { target: gStop1; color: "#427080" }
PropertyChanges { target: gStop2; color: "#225060" }
},
State {
name: "Selected"
when: selected
......
......@@ -61,4 +61,14 @@ Menu {
onAboutToShow: {
grouped = findGroup( clip.uuid );
}
MenuSeparator { }
MenuItem {
text: "Effects"
onTriggered: {
timeline.showEffectStack( clip.uuid );
}
}
}
......@@ -23,8 +23,10 @@
#include "Timeline.h"
#include "Main/Core.h"
#include "Workflow/TrackWorkflow.h"
#include "Workflow/MainWorkflow.h"
#include "Gui/MainWindow.h"
#include "Gui/effectsengine/EffectStack.h"
#include <QtQuick/QQuickView>
#include <QtQml/QQmlContext>
#include <QUrl>
......@@ -36,6 +38,7 @@ Timeline::Timeline( MainWindow* parent )
{
m_container->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_container->setFocusPolicy( Qt::TabFocus );
m_view->rootContext()->setContextProperty( "timeline", this );
m_view->rootContext()->setContextProperty( "mainwindow", parent );
m_view->rootContext()->setContextProperty( "workflow", Core::instance()->workflow() );
m_view->setSource( QUrl( QStringLiteral( "qrc:/QML/main.qml" ) ) );
......@@ -51,3 +54,17 @@ Timeline::container()
{
return m_container;
}
void
Timeline::showEffectStack( quint32 trackId )
{
auto w = new EffectStack( Core::instance()->workflow()->track( trackId )->input() );
w->show();
}
void
Timeline::showEffectStack( const QString& uuid )
{
auto w = new EffectStack( Core::instance()->workflow()->clip( uuid )->input() );
w->show();
}
......@@ -45,20 +45,10 @@ public:
QWidget* container();
public slots:
/**
* \brief Asks the workflow to clear itself.
*/
void clear() {}
/**
* \brief Change the zoom level for all widgets of the timeline.
* \param factor The zoom factor.
*/
void changeZoom( int factor ) { Q_UNUSED( factor ) }
/**
* \brief Change the duration of the project.
* \param duration Duration in frames.
*/
void setDuration( int duration ) { Q_UNUSED( duration ) }
void showEffectStack( quint32 trackId );
void showEffectStack( const QString& uuid );
/**
* \brief Change the currently selected tool.
*/
......
......@@ -387,12 +387,29 @@ Item {
color: "#111111"
}
Text {
text: type + " " + ( trackId + 1 )
anchors.right: parent.right
anchors.rightMargin: 10
color: "white"
font.pointSize: trackHeight / 3
Row {
spacing: 4
anchors.centerIn: parent
Text {
id: trackText
text: type + " " + ( trackId + 1 )
color: "white"
font.pointSize: trackHeight / 3
}
PropertyButton {
id: fxButton
text: "Fx"
selected: true
onSelectedChanged: {
if ( selected === false ) {
timeline.showEffectStack( trackId );
selected = true;
}
}
}
}
}
}
......
......@@ -167,6 +167,16 @@ MainWorkflow::trackCount() const
return m_trackCount;
}
std::shared_ptr<Clip>
MainWorkflow::clip( const QUuid& uuid )
{
for ( auto it = m_clips.begin(); it != m_clips.end(); ++it )
if ( it.value()->uuid() == uuid )
return it.value();
return std::shared_ptr<Clip>( nullptr );
}
std::shared_ptr<Clip>
MainWorkflow::createClip( const QUuid& uuid, quint32 trackId )
{
......
......@@ -132,6 +132,8 @@ class MainWorkflow : public QObject
*/
quint32 trackCount() const;
std::shared_ptr<Clip> clip( const QUuid& uuid );
/**
* \brief Create a clip from a parent clip's uuid.
*
......
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