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

EffectInstanceWidget: Improving GUI and cleaning code.

parent dfd68c24
......@@ -284,6 +284,7 @@ ELSE(NOT WITH_GUI)
SET(VLMC_UIS
Gui/effectsengine/ui/EffectsList.ui
Gui/effectsengine/ui/EffectInstanceWidget.ui
Gui/export/RendererSettings.ui
Gui/export/ShareOnYoutube.ui
Gui/import/ui/ImportController.ui
......
......@@ -30,17 +30,18 @@
#include "EffectSettingValue.h"
#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
#include <QVBoxLayout>
EffectInstanceWidget::EffectInstanceWidget( EffectInstance *effect, QWidget *parent ) :
QDialog( parent )
QDialog( parent ),
m_ui( new Ui::EffectSettingWidget )
{
QFormLayout *layout = new QFormLayout( this );
layout->setFieldGrowthPolicy( QFormLayout::AllNonFixedFieldsGrow );
layout->addRow( tr( "Name" ), new QLabel( effect->effect()->name(), this ) );
layout->addRow( tr( "Description" ), new QLabel( effect->effect()->description(), this ) );
layout->addRow( tr( "Type" ), new QLabel( nameFromType( effect->effect()->type() ), this ) );
m_ui->setupUi( this );
m_ui->nameValueLabel->setText( effect->effect()->name() );
m_ui->descValueLabel->setText( effect->effect()->description() );
m_ui->typeValueLabel->setText( nameFromType( effect->effect()->type() ) );
EffectInstance::ParamList::iterator it = effect->params().begin();
EffectInstance::ParamList::iterator ite = effect->params().end();
......@@ -50,10 +51,12 @@ EffectInstanceWidget::EffectInstanceWidget( EffectInstance *effect, QWidget *par
ISettingsCategoryWidget *widget = widgetFactory( s );
QLabel *label = new QLabel( tr( s->name() ), this );
widget->widget()->setToolTip( s->description() );
layout->addRow( label , widget->widget() );
m_settings.push_back( s );
m_ui->settingsLayout->addRow( label , widget->widget() );
m_settings.push_back( widget );
++it;
}
connect( m_ui->buttons, SIGNAL( clicked( QAbstractButton* ) ),
this, SLOT( buttonsClicked( QAbstractButton* ) ) );
}
QString
......@@ -89,3 +92,23 @@ EffectInstanceWidget::widgetFactory( EffectSettingValue *s )
return NULL;
}
}
void
EffectInstanceWidget::save()
{
foreach ( ISettingsCategoryWidget* val, m_settings )
val->save();
}
void
EffectInstanceWidget::buttonsClicked( QAbstractButton *button )
{
switch ( m_ui->buttons->standardButton( button ) )
{
case QDialogButtonBox::Ok:
case QDialogButtonBox::Apply:
save();
default:
break ;
}
}
......@@ -29,6 +29,7 @@ class EffectInstance;
class EffectSettingValue;
#include "Effect.h"
#include "ui_EffectInstanceWidget.h"
class ISettingsCategoryWidget;
......@@ -42,9 +43,14 @@ class EffectInstanceWidget : public QDialog
private:
static QString nameFromType( Effect::Type type );
ISettingsCategoryWidget *widgetFactory( EffectSettingValue *s );
void save();
private:
EffectInstance *m_effect;
QList<EffectSettingValue*> m_settings;
QList<ISettingsCategoryWidget*> m_settings;
Ui::EffectSettingWidget *m_ui;
private slots:
void buttonsClicked( QAbstractButton* button );
};
#endif // EFFECTINSTANCEWIDGET_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EffectSettingWidget</class>
<widget class="QDialog" name="EffectSettingWidget">
<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>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Overview</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nameValueLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="descLabel">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="descValueLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="typeLabel">
<property name="text">
<string>Type</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="typeValueLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>386</width>
<height>159</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QFormLayout" name="settingsLayout"/>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttons">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttons</sender>
<signal>accepted()</signal>
<receiver>EffectSettingWidget</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>EffectSettingWidget</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>
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