[vlmc-devel] commit: EffectStack: Allow effect removal. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Wed Sep 1 00:47:17 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Aug 31 00:42:08 2010 +0200| [fd026a12b929663717ca6870a657bc4fc4cfe061] | committer: Hugo Beauzée-Luyssen
EffectStack: Allow effect removal.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=fd026a12b929663717ca6870a657bc4fc4cfe061
---
src/Gui/effectsengine/EffectInstanceListModel.cpp | 13 +++++++++++++
src/Gui/effectsengine/EffectInstanceListModel.h | 1 +
src/Gui/effectsengine/EffectStack.cpp | 7 +++++++
src/Gui/effectsengine/EffectStack.h | 1 +
src/Gui/effectsengine/ui/EffectStack.ui | 11 +++++++++++
5 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/src/Gui/effectsengine/EffectInstanceListModel.cpp b/src/Gui/effectsengine/EffectInstanceListModel.cpp
index 660034c..2c5c851 100644
--- a/src/Gui/effectsengine/EffectInstanceListModel.cpp
+++ b/src/Gui/effectsengine/EffectInstanceListModel.cpp
@@ -61,6 +61,19 @@ EffectInstanceListModel::data( const QModelIndex &index, int role ) const
}
}
+bool
+EffectInstanceListModel::removeRows( int row, int count, const QModelIndex& index /*= QModelIndex()*/ )
+{
+ if ( count != 1 )
+ return false;
+ if ( row < 0 || row >= m_list->size() )
+ return false;
+ beginRemoveRows( index, row, row );
+ m_list->removeAt( row );
+ endRemoveRows();
+ return true;
+}
+
void
EffectInstanceListModel::moveUp( const QModelIndex &index )
{
diff --git a/src/Gui/effectsengine/EffectInstanceListModel.h b/src/Gui/effectsengine/EffectInstanceListModel.h
index 140ef89..75bcc9e 100644
--- a/src/Gui/effectsengine/EffectInstanceListModel.h
+++ b/src/Gui/effectsengine/EffectInstanceListModel.h
@@ -33,6 +33,7 @@ class EffectInstanceListModel : public QAbstractListModel
EffectInstanceListModel( EffectsEngine::EffectList *list );
virtual qint32 rowCount( const QModelIndex &parent ) const;
virtual QVariant data( const QModelIndex &index, int role ) const;
+ virtual bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() );
void moveUp( const QModelIndex &index );
void moveDown( const QModelIndex &index );
diff --git a/src/Gui/effectsengine/EffectStack.cpp b/src/Gui/effectsengine/EffectStack.cpp
index 3a06175..d328149 100644
--- a/src/Gui/effectsengine/EffectStack.cpp
+++ b/src/Gui/effectsengine/EffectStack.cpp
@@ -38,6 +38,7 @@ EffectStack::EffectStack( EffectsEngine::EffectList *list, QWidget *parent ):
this, SLOT( selectedChanged( QModelIndex ) ) );
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() ) );
}
EffectStack::~EffectStack()
@@ -67,3 +68,9 @@ EffectStack::moveDown()
if ( m_ui->list->currentIndex().row() < m_model->rowCount( QModelIndex() ) - 1 )
m_ui->list->setCurrentIndex( m_ui->list->currentIndex().sibling( m_ui->list->currentIndex().row() + 1, 0 ) );
}
+
+void
+EffectStack::remove()
+{
+ m_model->removeRow( m_ui->list->currentIndex().row() );
+}
diff --git a/src/Gui/effectsengine/EffectStack.h b/src/Gui/effectsengine/EffectStack.h
index 942e4af..7964ae3 100644
--- a/src/Gui/effectsengine/EffectStack.h
+++ b/src/Gui/effectsengine/EffectStack.h
@@ -48,6 +48,7 @@ class EffectStack : public QDialog
void selectedChanged( const QModelIndex &index );
void moveUp();
void moveDown();
+ void remove();
private:
Ui::EffectStack *m_ui;
diff --git a/src/Gui/effectsengine/ui/EffectStack.ui b/src/Gui/effectsengine/ui/EffectStack.ui
index 0bda7d5..c0b54bd 100644
--- a/src/Gui/effectsengine/ui/EffectStack.ui
+++ b/src/Gui/effectsengine/ui/EffectStack.ui
@@ -50,6 +50,17 @@
</widget>
</item>
<item>
+ <widget class="QToolButton" name="removeButton">
+ <property name="text">
+ <string>...</string>
+ </property>
+ <property name="icon">
+ <iconset resource="../../../../resources.qrc">
+ <normaloff>:/images/remove</normaloff>:/images/remove</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
More information about the Vlmc-devel
mailing list