[vlmc-devel] commit: EffectStack: Allow effect addition. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Thu Sep 2 21:02:46 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Sep 2 10:27:35 2010 +0200| [230f5969a473f0861fbabea6e72f22b86d3ec722] | committer: Hugo Beauzée-Luyssen
EffectStack: Allow effect addition.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=230f5969a473f0861fbabea6e72f22b86d3ec722
---
src/Gui/effectsengine/EffectInstanceListModel.cpp | 13 ++++++
src/Gui/effectsengine/EffectInstanceListModel.h | 1 +
src/Gui/effectsengine/EffectStack.cpp | 9 ++++
src/Gui/effectsengine/EffectStack.h | 1 +
src/Gui/effectsengine/ui/EffectStack.ui | 48 ++++++++++++++++++--
5 files changed, 67 insertions(+), 5 deletions(-)
diff --git a/src/Gui/effectsengine/EffectInstanceListModel.cpp b/src/Gui/effectsengine/EffectInstanceListModel.cpp
index 00ef722..83ca865 100644
--- a/src/Gui/effectsengine/EffectInstanceListModel.cpp
+++ b/src/Gui/effectsengine/EffectInstanceListModel.cpp
@@ -92,3 +92,16 @@ EffectInstanceListModel::moveDown( const QModelIndex &index )
m_user->swapFilters( index.row(), index.row() + 1 );
emit layoutChanged();
}
+
+void
+EffectInstanceListModel::add( const QString &effectName )
+{
+ if ( effectName.isEmpty() == true )
+ return ;
+ Effect *effect = EffectsEngine::getInstance()->effect( effectName );
+ if ( effect == NULL )
+ return ;
+ beginInsertRows( QModelIndex(), m_user->count( Effect::Filter ), m_user->count( Effect::Filter ) );
+ m_user->addEffect( effect );
+ endInsertRows();
+}
diff --git a/src/Gui/effectsengine/EffectInstanceListModel.h b/src/Gui/effectsengine/EffectInstanceListModel.h
index eeb4dc1..363b5c7 100644
--- a/src/Gui/effectsengine/EffectInstanceListModel.h
+++ b/src/Gui/effectsengine/EffectInstanceListModel.h
@@ -38,6 +38,7 @@ class EffectInstanceListModel : public QAbstractListModel
virtual bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() );
void moveUp( const QModelIndex &index );
void moveDown( const QModelIndex &index );
+ void add( const QString &effectName );
private:
EffectUser *m_user;
diff --git a/src/Gui/effectsengine/EffectStack.cpp b/src/Gui/effectsengine/EffectStack.cpp
index 7db0197..0f64b64 100644
--- a/src/Gui/effectsengine/EffectStack.cpp
+++ b/src/Gui/effectsengine/EffectStack.cpp
@@ -39,6 +39,9 @@ EffectStack::EffectStack( EffectUser *user, QWidget *parent ):
connect( m_ui->upButton, SIGNAL( clicked() ), this, SLOT( moveUp() ) );
connect( m_ui->downButton, SIGNAL( clicked() ), this, SLOT( moveDown() ) );
connect( m_ui->removeButton, SIGNAL( clicked() ), this, SLOT( remove() ) );
+ connect( m_ui->addButton, SIGNAL( clicked() ), this, SLOT( add() ) );
+
+ m_ui->addComboBox->addItems( EffectsEngine::getInstance()->effects( Effect::Filter ) );
}
EffectStack::~EffectStack()
@@ -74,3 +77,9 @@ EffectStack::remove()
{
m_model->removeRow( m_ui->list->currentIndex().row() );
}
+
+void
+EffectStack::add()
+{
+ m_model->add( m_ui->addComboBox->currentText() );
+}
diff --git a/src/Gui/effectsengine/EffectStack.h b/src/Gui/effectsengine/EffectStack.h
index 0deca57..6be236a 100644
--- a/src/Gui/effectsengine/EffectStack.h
+++ b/src/Gui/effectsengine/EffectStack.h
@@ -49,6 +49,7 @@ class EffectStack : public QDialog
void moveUp();
void moveDown();
void remove();
+ void add();
private:
Ui::EffectStack *m_ui;
diff --git a/src/Gui/effectsengine/ui/EffectStack.ui b/src/Gui/effectsengine/ui/EffectStack.ui
index c0b54bd..dfa5551 100644
--- a/src/Gui/effectsengine/ui/EffectStack.ui
+++ b/src/Gui/effectsengine/ui/EffectStack.ui
@@ -76,11 +76,49 @@
</layout>
</item>
<item>
- <widget class="QListView" name="list">
- <property name="alternatingRowColors">
- <bool>true</bool>
- </property>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QComboBox" name="addComboBox"/>
+ </item>
+ <item>
+ <widget class="QToolButton" name="addButton">
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="icon">
+ <iconset resource="../../../../resources.qrc">
+ <normaloff>:/images/add</normaloff>:/images/add</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QListView" name="list">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<widget class="EffectInstanceWidget" name="instanceWidget" native="true"/>
More information about the Vlmc-devel
mailing list