[vlc-devel] commit: qt4: follow the recommendations about foreach loops. ( Rémi Duraffort )

git version control git at videolan.org
Fri Jan 23 17:26:45 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Jan 23 17:26:20 2009 +0100| [034e5706cebd9331903ea1d22cfcc9b655ed8a1c] | committer: Rémi Duraffort 

qt4: follow the recommendations about foreach loops.

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

 modules/gui/qt4/components/open_panels.cpp         |    2 +-
 .../gui/qt4/components/playlist/playlist_model.cpp |    2 +-
 modules/gui/qt4/dialogs/playlist.cpp               |    2 +-
 modules/gui/qt4/dialogs_provider.cpp               |    9 ++++-----
 modules/gui/qt4/main_interface.cpp                 |    2 +-
 5 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp
index 1ea3c58..848429e 100644
--- a/modules/gui/qt4/components/open_panels.cpp
+++ b/modules/gui/qt4/components/open_panels.cpp
@@ -161,7 +161,7 @@ void FileOpenPanel::browseFileSub()
 void FileOpenPanel::updateMRL()
 {
     QString mrl = "";
-    foreach( QString file, dialogBox->selectedFiles() ) {
+    foreach( const QString &file, dialogBox->selectedFiles() ) {
          mrl += "\"" + file + "\" ";
     }
 
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 3cb6fe4..44fc181 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -133,7 +133,7 @@ QMimeData *PLModel::mimeData( const QModelIndexList &indexes ) const
     QByteArray encodedData;
     QDataStream stream( &encodedData, QIODevice::WriteOnly );
 
-    foreach( QModelIndex index, indexes ) {
+    foreach( const QModelIndex &index, indexes ) {
         if( index.isValid() && index.column() == 0 )
             stream << itemId( index );
     }
diff --git a/modules/gui/qt4/dialogs/playlist.cpp b/modules/gui/qt4/dialogs/playlist.cpp
index c652396..2736e52 100644
--- a/modules/gui/qt4/dialogs/playlist.cpp
+++ b/modules/gui/qt4/dialogs/playlist.cpp
@@ -65,7 +65,7 @@ PlaylistDialog::~PlaylistDialog()
 void PlaylistDialog::dropEvent( QDropEvent *event )
 {
      const QMimeData *mimeData = event->mimeData();
-     foreach( QUrl url, mimeData->urls() ) {
+     foreach( const QUrl &url, mimeData->urls() ) {
         QString s = toNativeSeparators( url.toString() );
         if( s.length() > 0 ) {
             playlist_Add( THEPL, qtu(s), NULL,
diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp
index 6ead882..241c59f 100644
--- a/modules/gui/qt4/dialogs_provider.cpp
+++ b/modules/gui/qt4/dialogs_provider.cpp
@@ -291,7 +291,7 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
         p_arg->i_results = files.count();
         p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
         i = 0;
-        foreach( QString file, files )
+        foreach( const QString &file, files )
             p_arg->psz_results[i++] = strdup( qtu( toNativeSepNoSlash( file ) ) );
     }
 
@@ -395,7 +395,7 @@ void DialogsProvider::addFromSimple( bool pl, bool go)
 {
     QStringList files = DialogsProvider::showSimpleOpen();
     int i = 0;
-    foreach( QString file, files )
+    foreach( const QString &file, files )
     {
         playlist_Add( THEPL, qtu( toNativeSeparators( file ) ), NULL,
                       go ? ( PLAYLIST_APPEND | ( i ? 0 : PLAYLIST_GO ) |
@@ -498,7 +498,7 @@ void DialogsProvider::openAPlaylist()
 {
     QStringList files = showSimpleOpen( qtr( "Open playlist..." ),
                                         EXT_FILTER_PLAYLIST );
-    foreach( QString file, files )
+    foreach( const QString &file, files )
     {
         playlist_Import( THEPL, qtu( toNativeSeparators( file ) ) );
     }
@@ -612,8 +612,7 @@ void DialogsProvider::loadSubtitlesFile()
                                       EXT_FILTER_SUBTITLE,
                                       path );
     free( path );
-    QString qsFile;
-    foreach( qsFile, qsl )
+    foreach( const QString &qsFile, qsl )
     {
         if( input_AddSubtitle( p_input, qtu( toNativeSeparators( qsFile ) ),
                     true ) )
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 980e8c6..b2faf05 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -995,7 +995,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
         }
      }
      bool first = b_play;
-     foreach( QUrl url, mimeData->urls() )
+     foreach( const QUrl &url, mimeData->urls() )
      {
         QString s = toNativeSeparators( url.toLocalFile() );
 




More information about the vlc-devel mailing list