Commit 034e5706 authored by Rémi Duraffort's avatar Rémi Duraffort

qt4: follow the recommendations about foreach loops.

parent 3396d9f3
...@@ -161,7 +161,7 @@ void FileOpenPanel::browseFileSub() ...@@ -161,7 +161,7 @@ void FileOpenPanel::browseFileSub()
void FileOpenPanel::updateMRL() void FileOpenPanel::updateMRL()
{ {
QString mrl = ""; QString mrl = "";
foreach( QString file, dialogBox->selectedFiles() ) { foreach( const QString &file, dialogBox->selectedFiles() ) {
mrl += "\"" + file + "\" "; mrl += "\"" + file + "\" ";
} }
......
...@@ -133,7 +133,7 @@ QMimeData *PLModel::mimeData( const QModelIndexList &indexes ) const ...@@ -133,7 +133,7 @@ QMimeData *PLModel::mimeData( const QModelIndexList &indexes ) const
QByteArray encodedData; QByteArray encodedData;
QDataStream stream( &encodedData, QIODevice::WriteOnly ); QDataStream stream( &encodedData, QIODevice::WriteOnly );
foreach( QModelIndex index, indexes ) { foreach( const QModelIndex &index, indexes ) {
if( index.isValid() && index.column() == 0 ) if( index.isValid() && index.column() == 0 )
stream << itemId( index ); stream << itemId( index );
} }
......
...@@ -65,7 +65,7 @@ PlaylistDialog::~PlaylistDialog() ...@@ -65,7 +65,7 @@ PlaylistDialog::~PlaylistDialog()
void PlaylistDialog::dropEvent( QDropEvent *event ) void PlaylistDialog::dropEvent( QDropEvent *event )
{ {
const QMimeData *mimeData = event->mimeData(); const QMimeData *mimeData = event->mimeData();
foreach( QUrl url, mimeData->urls() ) { foreach( const QUrl &url, mimeData->urls() ) {
QString s = toNativeSeparators( url.toString() ); QString s = toNativeSeparators( url.toString() );
if( s.length() > 0 ) { if( s.length() > 0 ) {
playlist_Add( THEPL, qtu(s), NULL, playlist_Add( THEPL, qtu(s), NULL,
......
...@@ -291,7 +291,7 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg ) ...@@ -291,7 +291,7 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
p_arg->i_results = files.count(); p_arg->i_results = files.count();
p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) ); p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
i = 0; i = 0;
foreach( QString file, files ) foreach( const QString &file, files )
p_arg->psz_results[i++] = strdup( qtu( toNativeSepNoSlash( file ) ) ); p_arg->psz_results[i++] = strdup( qtu( toNativeSepNoSlash( file ) ) );
} }
...@@ -395,7 +395,7 @@ void DialogsProvider::addFromSimple( bool pl, bool go) ...@@ -395,7 +395,7 @@ void DialogsProvider::addFromSimple( bool pl, bool go)
{ {
QStringList files = DialogsProvider::showSimpleOpen(); QStringList files = DialogsProvider::showSimpleOpen();
int i = 0; int i = 0;
foreach( QString file, files ) foreach( const QString &file, files )
{ {
playlist_Add( THEPL, qtu( toNativeSeparators( file ) ), NULL, playlist_Add( THEPL, qtu( toNativeSeparators( file ) ), NULL,
go ? ( PLAYLIST_APPEND | ( i ? 0 : PLAYLIST_GO ) | go ? ( PLAYLIST_APPEND | ( i ? 0 : PLAYLIST_GO ) |
...@@ -498,7 +498,7 @@ void DialogsProvider::openAPlaylist() ...@@ -498,7 +498,7 @@ void DialogsProvider::openAPlaylist()
{ {
QStringList files = showSimpleOpen( qtr( "Open playlist..." ), QStringList files = showSimpleOpen( qtr( "Open playlist..." ),
EXT_FILTER_PLAYLIST ); EXT_FILTER_PLAYLIST );
foreach( QString file, files ) foreach( const QString &file, files )
{ {
playlist_Import( THEPL, qtu( toNativeSeparators( file ) ) ); playlist_Import( THEPL, qtu( toNativeSeparators( file ) ) );
} }
...@@ -612,8 +612,7 @@ void DialogsProvider::loadSubtitlesFile() ...@@ -612,8 +612,7 @@ void DialogsProvider::loadSubtitlesFile()
EXT_FILTER_SUBTITLE, EXT_FILTER_SUBTITLE,
path ); path );
free( path ); free( path );
QString qsFile; foreach( const QString &qsFile, qsl )
foreach( qsFile, qsl )
{ {
if( input_AddSubtitle( p_input, qtu( toNativeSeparators( qsFile ) ), if( input_AddSubtitle( p_input, qtu( toNativeSeparators( qsFile ) ),
true ) ) true ) )
......
...@@ -995,7 +995,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play ) ...@@ -995,7 +995,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
} }
} }
bool first = b_play; bool first = b_play;
foreach( QUrl url, mimeData->urls() ) foreach( const QUrl &url, mimeData->urls() )
{ {
QString s = toNativeSeparators( url.toLocalFile() ); QString s = toNativeSeparators( url.toLocalFile() );
......
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