Commit 230f5969 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

EffectStack: Allow effect addition.

parent 653f3156
......@@ -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();
}
......@@ -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;
......
......@@ -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() );
}
......@@ -49,6 +49,7 @@ class EffectStack : public QDialog
void moveUp();
void moveDown();
void remove();
void add();
private:
Ui::EffectStack *m_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"/>
......
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