[vlmc-devel] commit: EffectInstanceWidget: clear before setting a new effect instance. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Tue Aug 31 00:12:16 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Aug 30 01:15:25 2010 +0200| [7020e58ea1a89d7b925d8a6901ed7a14a01a1792] | committer: Hugo Beauzée-Luyssen 

EffectInstanceWidget: clear before setting a new effect instance.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=7020e58ea1a89d7b925d8a6901ed7a14a01a1792
---

 src/Gui/effectsengine/EffectInstanceWidget.cpp |   18 ++++++++++++++++++
 src/Gui/effectsengine/EffectInstanceWidget.h   |    2 ++
 src/Gui/settings/ISettingsCategoryWidget.h     |    1 +
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/Gui/effectsengine/EffectInstanceWidget.cpp b/src/Gui/effectsengine/EffectInstanceWidget.cpp
index dcbd3a2..2e0df8b 100644
--- a/src/Gui/effectsengine/EffectInstanceWidget.cpp
+++ b/src/Gui/effectsengine/EffectInstanceWidget.cpp
@@ -39,11 +39,13 @@ EffectInstanceWidget::EffectInstanceWidget( QWidget *parent ) :
     m_ui( new Ui::EffectSettingWidget )
 {
     m_ui->setupUi( this );
+    clear();
 }
 
 void
 EffectInstanceWidget::setEffectInstance( EffectInstance *instance )
 {
+    clear();
     m_effect = instance;
     m_ui->nameValueLabel->setText( instance->effect()->name() );
     m_ui->descValueLabel->setText( instance->effect()->description() );
@@ -59,6 +61,8 @@ EffectInstanceWidget::setEffectInstance( EffectInstance *instance )
         EffectSettingValue          *s = it.value();
         ISettingsCategoryWidget     *widget = widgetFactory( s );
         QLabel                      *label = new QLabel( tr( s->name() ), this );
+        m_widgets.push_back( label );
+        m_widgets.push_back( widget->widget() );
         widget->widget()->setToolTip( s->description() );
         m_ui->settingsLayout->addRow( label , widget->widget() );
         m_settings.push_back( widget );
@@ -68,6 +72,20 @@ EffectInstanceWidget::setEffectInstance( EffectInstance *instance )
              this, SLOT( save() ) );
 }
 
+void
+EffectInstanceWidget::clear()
+{
+    m_ui->nameValueLabel->setText( "" );
+    m_ui->descValueLabel->setText( "" );
+    m_ui->typeValueLabel->setText( "" );
+    m_ui->authorValueLabel->setText( "" );
+    m_ui->versionValueLabel->setText( "" );
+    qDeleteAll( m_settings );
+    m_settings.clear();
+    qDeleteAll( m_widgets );
+    m_widgets.clear();
+}
+
 QString
 EffectInstanceWidget::nameFromType( Effect::Type type )
 {
diff --git a/src/Gui/effectsengine/EffectInstanceWidget.h b/src/Gui/effectsengine/EffectInstanceWidget.h
index fb5cbad..0b6b9cb 100644
--- a/src/Gui/effectsengine/EffectInstanceWidget.h
+++ b/src/Gui/effectsengine/EffectInstanceWidget.h
@@ -43,9 +43,11 @@ class EffectInstanceWidget : public QWidget
     private:
         static QString                      nameFromType( Effect::Type type );
         ISettingsCategoryWidget             *widgetFactory( EffectSettingValue *s );
+        void                                clear();
     private:
         EffectInstance                      *m_effect;
         QList<ISettingsCategoryWidget*>     m_settings;
+        QList<QWidget*>                     m_widgets;
         Ui::EffectSettingWidget             *m_ui;
 
     public slots:
diff --git a/src/Gui/settings/ISettingsCategoryWidget.h b/src/Gui/settings/ISettingsCategoryWidget.h
index 4cc43d1..9064da8 100644
--- a/src/Gui/settings/ISettingsCategoryWidget.h
+++ b/src/Gui/settings/ISettingsCategoryWidget.h
@@ -36,6 +36,7 @@ class   ISettingsCategoryWidget : public QObject
     Q_OBJECT
 
     public:
+        virtual ~ISettingsCategoryWidget(){}
         virtual SettingValue    *setting() { return m_setting; }
         virtual QWidget*        widget() = 0;
         virtual void            save() = 0;



More information about the Vlmc-devel mailing list