[vlc-commits] qt4: preferences_widgets: Simplifications

Hugo Beauzée-Luyssen git at videolan.org
Fri Apr 15 17:31:41 CEST 2011


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Fri Apr 15 16:31:37 2011 +0200| [b2d37426843ce68f36b0883e676249e364dfd3ac] | committer: Jean-Baptiste Kempf

qt4: preferences_widgets: Simplifications

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b2d37426843ce68f36b0883e676249e364dfd3ac
---

 modules/gui/qt4/components/preferences_widgets.cpp |   37 ++++++-------------
 1 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp
index 84cc19a..cd85008 100644
--- a/modules/gui/qt4/components/preferences_widgets.cpp
+++ b/modules/gui/qt4/components/preferences_widgets.cpp
@@ -707,11 +707,8 @@ ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this,
     finish( bycat );
 
     int boxline = 0;
-    for( QVector<checkBoxListItem*>::iterator it = modules.begin();
-            it != modules.end(); ++it )
-    {
-        layoutGroupBox->addWidget( (*it)->checkBox, boxline++, 0 );
-    }
+    foreach ( checkBoxListItem *it, modules )
+        layoutGroupBox->addWidget( it->checkBox, boxline++, 0 );
     layoutGroupBox->addWidget( text, boxline, 0 );
 
     if( !l )
@@ -731,11 +728,8 @@ ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this,
 
 ModuleListConfigControl::~ModuleListConfigControl()
 {
-    for( QVector<checkBoxListItem*>::iterator it = modules.begin();
-            it != modules.end(); ++it )
-    {
-        delete *it;
-    }
+    qDeleteAll( modules );
+    modules.clear();
     delete groupBox;
 }
 
@@ -811,21 +805,15 @@ QString ModuleListConfigControl::getValue() const
 
 void ModuleListConfigControl::hide()
 {
-    for( QVector<checkBoxListItem*>::iterator it = modules.begin();
-         it != modules.end(); ++it )
-    {
-        (*it)->checkBox->hide();
-    }
+    foreach ( checkBoxListItem *it, modules )
+        it->checkBox->hide();
     groupBox->hide();
 }
 
 void ModuleListConfigControl::show()
 {
-    for( QVector<checkBoxListItem*>::iterator it = modules.begin();
-         it != modules.end(); ++it )
-    {
-        (*it)->checkBox->show();
-    }
+    foreach ( checkBoxListItem *it, modules )
+        it->checkBox->show();
     groupBox->show();
 }
 
@@ -835,19 +823,18 @@ void ModuleListConfigControl::onUpdate()
     text->clear();
     bool first = true;
 
-    for( QVector<checkBoxListItem*>::iterator it = modules.begin();
-         it != modules.end(); ++it )
+    foreach ( checkBoxListItem *it, modules )
     {
-        if( (*it)->checkBox->isChecked() )
+        if( it->checkBox->isChecked() )
         {
             if( first )
             {
-                text->setText( text->text() + (*it)->psz_module );
+                text->setText( text->text() + it->psz_module );
                 first = false;
             }
             else
             {
-                text->setText( text->text() + ":" + (*it)->psz_module );
+                text->setText( text->text() + ":" + it->psz_module );
             }
         }
     }



More information about the vlc-commits mailing list