Commit 5adb5d90 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Adding an EffectStack widget.

It shows the loaded effects list, and allow the parameters to be edited.
parent a921aeda
......@@ -158,8 +158,10 @@ ELSE(NOT WITH_GUI)
Gui/UndoStack.cpp
Gui/WorkflowFileRendererDialog.cpp
Gui/effectsengine/EffectInstanceWidget.cpp
Gui/effectsengine/EffectInstanceListModel.cpp
Gui/effectsengine/EffectsList.cpp
Gui/effectsengine/EffectsListView.cpp
Gui/effectsengine/EffectStack.cpp
Gui/export/RendererSettings.cpp
Gui/export/ShareOnInternet.cpp
Gui/import/ImportController.cpp
......@@ -224,8 +226,10 @@ ELSE(NOT WITH_GUI)
Gui/UndoStack.h
Gui/WorkflowFileRendererDialog.h
Gui/effectsengine/EffectInstanceWidget.h
Gui/effectsengine/EffectInstanceListModel.h
Gui/effectsengine/EffectsList.h
Gui/effectsengine/EffectsListView.h
Gui/effectsengine/EffectStack.h
Gui/export/RendererSettings.h
Gui/export/ShareOnInternet.h
Gui/import/ImportController.h
......@@ -284,6 +288,7 @@ ELSE(NOT WITH_GUI)
SET(VLMC_UIS
Gui/effectsengine/ui/EffectsList.ui
Gui/effectsengine/ui/EffectInstanceWidget.ui
Gui/effectsengine/ui/EffectStack.ui
Gui/export/RendererSettings.ui
Gui/export/ShareOnInternet.ui
Gui/import/ui/ImportController.ui
......
......@@ -40,7 +40,7 @@ class QXmlStreamWriter;
#include <QObject>
#include <QHash>
#include <QUuid>
#include <QMetaType>
class QSettings;
......@@ -68,6 +68,7 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
qint64 end;
QUuid uuid;
};
typedef QList<EffectHelper*> EffectList;
static const quint32 MaxFramesForMixer = 3;
......@@ -99,4 +100,6 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
friend class Singleton<EffectsEngine>;
};
Q_DECLARE_METATYPE(EffectsEngine::EffectHelper*)
#endif // EFFECTSENGINE_H
/*****************************************************************************
* EffectInstanceListModel.cpp: Handle the model part of displaying an effect instance list.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "EffectInstanceListModel.h"
#include "EffectInstance.h"
EffectInstanceListModel::EffectInstanceListModel( EffectsEngine::EffectList *list ) :
m_list( list )
{
}
qint32
EffectInstanceListModel::rowCount( const QModelIndex& ) const
{
return m_list->size();
}
QVariant
EffectInstanceListModel::data( const QModelIndex &index, int role ) const
{
switch ( role )
{
case Qt::DisplayRole:
return m_list->at( index.row() )->effect->effect()->name();
case Qt::ToolTipRole:
return m_list->at( index.row() )->effect->effect()->description();
case Qt::EditRole:
return QVariant::fromValue( m_list->at( index.row() ) );
default:
return QVariant();
}
}
/*****************************************************************************
* EffectInstanceListModel.cpp: Handle the model part of displaying an effect instance list.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EFFECTINSTANCELISTMODEL_H
#define EFFECTINSTANCELISTMODEL_H
#include "EffectsEngine.h"
#include <QAbstractListModel>
class EffectInstanceListModel : public QAbstractListModel
{
public:
EffectInstanceListModel( EffectsEngine::EffectList *list );
virtual qint32 rowCount( const QModelIndex &parent ) const;
virtual QVariant data( const QModelIndex &index, int role ) const;
private:
EffectsEngine::EffectList *m_list;
};
#endif // EFFECTINSTANCELISTMODEL_H
/*****************************************************************************
* EffectStack.cpp: Represent an effect stack, and allow parameters editing.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "EffectStack.h"
#include "ui_EffectStack.h"
#include "EffectInstanceListModel.h"
EffectStack::EffectStack( EffectsEngine::EffectList *list, QWidget *parent ):
QDialog( parent ),
m_ui( new Ui::EffectStack ),
m_list( list )
{
m_ui->setupUi( this );
m_model = new EffectInstanceListModel( list );
m_ui->list->setModel( m_model );
connect( m_ui->list, SIGNAL( clicked( QModelIndex ) ),
this, SLOT( selectedChanged( QModelIndex ) ) );
}
EffectStack::~EffectStack()
{
delete m_model;
delete m_ui;
}
void
EffectStack::selectedChanged( const QModelIndex &index )
{
m_ui->instanceWidget->setEffectInstance( m_model->data( index, Qt::EditRole ).value<EffectsEngine::EffectHelper*>()->effect );
}
/*****************************************************************************
* EffectStack.h: Represent an effect stack, and allow parameters editing.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef EFFECTSTACK_H
#define EFFECTSTACK_H
#include <QDialog>
#include "EffectsEngine.h"
#include <QStandardItemModel>
class EffectInstanceListModel;
namespace Ui
{
class EffectStack;
}
class EffectStack : public QDialog
{
Q_OBJECT
public:
explicit EffectStack( EffectsEngine::EffectList* list, QWidget *parent = 0 );
~EffectStack();
private slots:
void selectedChanged( const QModelIndex &index );
private:
Ui::EffectStack *m_ui;
EffectInstanceListModel *m_model;
EffectsEngine::EffectList *m_list;
};
#endif // EFFECTSTACK_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EffectStack</class>
<widget class="QDialog" name="EffectStack">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListView" name="list"/>
</item>
<item>
<widget class="EffectInstanceWidget" name="instanceWidget" native="true"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttons">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>EffectInstanceWidget</class>
<extends>QWidget</extends>
<header>EffectInstanceWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttons</sender>
<signal>accepted()</signal>
<receiver>EffectStack</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttons</sender>
<signal>rejected()</signal>
<receiver>EffectStack</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -21,7 +21,9 @@
*****************************************************************************/
#include "GraphicsTrack.h"
#include "EffectStack.h"
#include "TrackControls.h"
#include "TrackWorkflow.h"
#include "ui_TrackControls.h"
......@@ -49,6 +51,7 @@ TrackControls::TrackControls( GraphicsTrack* track, QWidget *parent ) :
this, SLOT( setTrackDisabled(bool) ) );
connect( m_ui->trackLabel, SIGNAL( doubleClicked() ),
this, SLOT( trackNameDoubleClicked() ) );
connect( m_ui->fxButton, SIGNAL( clicked() ), this, SLOT( fxButtonClicked() ) );
updateTextLabels();
}
......@@ -126,3 +129,10 @@ TrackControls::trackNameDoubleClicked()
updateTextLabels();
}
}
void
TrackControls::fxButtonClicked()
{
EffectStack *stack = new EffectStack( m_track->trackWorkflow()->filters() );
stack->show();
}
......@@ -44,6 +44,7 @@ protected:
private slots:
void setTrackDisabled( bool disable );
void trackNameDoubleClicked();
void fxButtonClicked();
private:
void updateTextLabels();
......
......@@ -632,3 +632,15 @@ TrackWorkflow::type() const
{
return m_trackType;
}
EffectsEngine::EffectList*
TrackWorkflow::filters()
{
return &m_filters;
}
EffectsEngine::EffectList*
TrackWorkflow::mixers()
{
return &m_mixers;
}
......@@ -99,6 +99,9 @@ class TrackWorkflow : public QObject
bool hasNoMoreFrameToRender( qint64 currentFrame ) const;
quint32 trackId() const;
Workflow::TrackType type() const;
//FIXME: this is not thread safe if the list gets modified (but it can't be const, as it is intended to be modified...)
EffectsEngine::EffectList *filters();
EffectsEngine::EffectList *mixers();
private:
void computeLength();
......
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