Commit c745ebb5 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: use count() iso size() on Qt Containers

parent b7cf7dda
......@@ -112,10 +112,10 @@ void AbstractController::parseAndCreate( const QString& config,
QBoxLayout *controlLayout )
{
QStringList list = config.split( ";", QString::SkipEmptyParts ) ;
for( int i = 0; i < list.size(); i++ )
for( int i = 0; i < list.count(); i++ )
{
QStringList list2 = list.at( i ).split( "-" );
if( list2.size() < 1 )
if( list2.count() < 1 )
{
msg_Warn( p_intf, "Parsing error 1. Please, report this." );
continue;
......@@ -130,7 +130,7 @@ void AbstractController::parseAndCreate( const QString& config,
continue;
}
if( list2.size() > 1 )
if( list2.count() > 1 )
{
i_option = list2.at( 1 ).toInt( &ok );
if( !ok )
......@@ -471,7 +471,7 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
if( frame )
{
QList<QToolButton *> allTButtons = frame->findChildren<QToolButton *>();
for( int i = 0; i < allTButtons.size(); i++ )
for( int i = 0; i < allTButtons.count(); i++ )
applyAttributes( allTButtons[i], b_flat, b_big );
}
else
......
......@@ -596,7 +596,7 @@ NetOpenPanel::~NetOpenPanel()
if( !mrlList ) return;
QStringList tempL = mrlList->stringList();
while( tempL.size() > 8 ) tempL.removeFirst();
while( tempL.count() > 8 ) tempL.removeFirst();
getSettings()->setValue( "Open/netMRL", tempL );
......@@ -1303,7 +1303,7 @@ void CaptureOpenPanel::advancedDialog()
if( adv->exec() )
{
QString tempMRL = "";
for( int i = 0; i < controls.size(); i++ )
for( int i = 0; i < controls.count(); i++ )
{
ConfigControl *control = controls[i];
......
......@@ -124,14 +124,14 @@ MLItem* MLItem::child( int row ) const
void MLItem::addChild( MLItem *child, int row )
{
assert( child );
children.insert( row==-1 ? children.size() : row, child );
children.insert( row==-1 ? children.count() : row, child );
}
void MLItem::delChild( int row )
{
if( !childCount() ) return; // assert ?
MLItem *item =
children.takeAt( ( row!=-1 ) ? row : ( children.size()-1 ) );
children.takeAt( ( row!=-1 ) ? row : ( children.count()-1 ) );
assert( item );
delete item;
}
......@@ -143,7 +143,7 @@ int MLItem::rowOfChild( MLItem *item ) const
int MLItem::childCount() const
{
return children.size();
return children.count();
}
MLItem* MLItem::parent() const
......
......@@ -235,7 +235,7 @@ void MLModel::remove( MLItem *item )
void MLModel::doDelete( QModelIndexList list )
{
for (int i = 0; i < list.size(); ++i)
for (int i = 0; i < list.count(); ++i)
{
int id = getId( list.at(i) );
ml_DeleteSimple( p_ml, id );
......@@ -562,7 +562,7 @@ void MLModel::popupInfo()
QStringList MLModel::selectedURIs()
{
QStringList list;
for( int i = 0; i < current_selection.size(); i++ )
for( int i = 0; i < current_selection.count(); i++ )
{
QModelIndex idx = current_selection.value(i);
MLItem *item = static_cast< MLItem* >( idx.internalPointer() );
......
......@@ -232,7 +232,7 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
{
QList<input_item_t*> inputItems = plMimeData->inputItems();
QList<PLItem*> model_items;
playlist_item_t *pp_items[inputItems.size()];
playlist_item_t *pp_items[inputItems.count()];
PL_LOCK;
......@@ -510,7 +510,7 @@ int PLModel::rowCount( const QModelIndex &parent ) const
QStringList PLModel::selectedURIs()
{
QStringList lst;
for( int i = 0; i < current_selection.size(); i++ )
for( int i = 0; i < current_selection.count(); i++ )
{
const PLItem *item = getItem( current_selection[i] );
if( item )
......@@ -690,7 +690,7 @@ void PLModel::takeItem( PLItem *item )
void PLModel::insertChildren( PLItem *node, QList<PLItem*>& items, int i_pos )
{
assert( node );
int count = items.size();
int count = items.count();
if( !count ) return;
printf( "Here I am\n");
beginInsertRows( index( node, 0 ), i_pos, i_pos + count - 1 );
......@@ -783,7 +783,7 @@ void PLModel::doDelete( QModelIndexList selected )
void PLModel::recurseDelete( QList<PLItem*> children, QModelIndexList *fullList )
{
for( int i = children.size() - 1; i >= 0 ; i-- )
for( int i = children.count() - 1; i >= 0 ; i-- )
{
PLItem *item = children[i];
if( item->childCount() )
......
......@@ -1450,7 +1450,7 @@ void KeyInputDialog::checkForConflicts( int i_vlckey )
table->findItems( VLCKeyToString( i_vlckey ), Qt::MatchExactly,
b_global ? 2 : 1 );
if( conflictList.size() &&
if( conflictList.count() &&
conflictList[0]->data( b_global ? 2 : 1, Qt::UserRole ).toInt() > 1 )
/* Avoid 0 or -1 that are the "Unset" states */
{
......
......@@ -168,7 +168,7 @@ void VLCProfileSelector::saveProfiles()
void VLCProfileSelector::updateOptions( int i )
{
QStringList options = profileBox->itemData( i ).toString().split( ";" );
if( options.size() < 16 )
if( options.count() < 16 )
return;
mux = options[0];
......@@ -317,7 +317,7 @@ inline void VLCProfileEditor::registerCodecs()
void VLCProfileEditor::fillProfile( const QString& qs )
{
QStringList options = qs.split( ";" );
if( options.size() < 16 )
if( options.count() < 16 )
return;
const QString mux = options[0];
......
......@@ -218,11 +218,11 @@ void BookmarksDialog::edit( QTreeWidgetItem *item, int column )
else if( column == 2 )
{
fields = item->text( column ).split( ":", QString::SkipEmptyParts );
if( fields.size() == 1 )
if( fields.count() == 1 )
p_seekpoint->i_time_offset = 1000000 * ( fields[0].toInt() );
else if( fields.size() == 2 )
else if( fields.count() == 2 )
p_seekpoint->i_time_offset = 1000000 * ( fields[0].toInt() * 60 + fields[1].toInt() );
else if( fields.size() == 3 )
else if( fields.count() == 3 )
p_seekpoint->i_time_offset = 1000000 * ( fields[0].toInt() * 3600 + fields[1].toInt() * 60 + fields[2].toInt() );
else
{
......
......@@ -49,7 +49,7 @@ Qt::ItemFlags MLDirModel::flags( const QModelIndex &index ) const
flags |= Qt::ItemIsUserCheckable;
if( b_recursive )
{
for( int i = 0; i < monitoredDirs.size(); i++ )
for( int i = 0; i < monitoredDirs.count(); i++ )
{
if( filePath( index ).startsWith( monitoredDirs.at( i ) ) )
{
......@@ -70,7 +70,7 @@ QVariant MLDirModel::data( const QModelIndex &index, int role ) const
return itemCheckState.value( filePath( index ) );
else if( b_recursive )
{
for( int i = 0; i < monitoredDirs.size(); i++ )
for( int i = 0; i < monitoredDirs.count(); i++ )
{
if( filePath( index ).startsWith( monitoredDirs.at( i ) ) )
return Qt::Checked;
......@@ -108,7 +108,7 @@ bool MLDirModel::setData( const QModelIndex &index, const QVariant &value,
in recursive mode */
if( b_recursive )
{
for( int i = 0; i < monitoredDirs.size()-1; i++ )
for( int i = 0; i < monitoredDirs.count()-1; i++ )
{
if( monitoredDirs.at( i ).startsWith( filePath( index ) ) )
{
......@@ -126,13 +126,13 @@ bool MLDirModel::setData( const QModelIndex &index, const QVariant &value,
if index is his only child */
for( idx = index.parent(); idx != QModelIndex(); idx = idx.parent() )
{
if( monitoredDirs.size() == 0 )
if( monitoredDirs.count() == 0 )
{
itemCheckState.take( filePath(idx) );
topLeft = idx;
continue;
}
for( int i = 0; i < monitoredDirs.size(); i++ )
for( int i = 0; i < monitoredDirs.count(); i++ )
{
if( monitoredDirs.at( i ).startsWith( filePath( idx ) ) )
break;
......@@ -173,9 +173,9 @@ void MLDirModel::setRecursivity( bool _b_recursive )
monitoredDirs some directories */
if( !b_recursive && _b_recursive )
{
for( int i = 0; i < monitoredDirs.size(); i++ )
for( int i = 0; i < monitoredDirs.count(); i++ )
{
for( int j = i+1; j < monitoredDirs.size(); j++ )
for( int j = i+1; j < monitoredDirs.count(); j++ )
{
if( monitoredDirs.at( i ).startsWith( monitoredDirs.at( j ) ) )
{
......@@ -271,11 +271,11 @@ void MLConfDialog::save()
}
}
for( int i = 0; i < toDelete.size(); i++ )
for( int i = 0; i < toDelete.count(); i++ )
{
ml_Control( p_ml, ML_DEL_MONITORED, qtu( toDelete.at( i ) ) );
}
for( int i = 0; i < newDirs.size(); i++ )
for( int i = 0; i < newDirs.count(); i++ )
{
ml_Control( p_ml, ML_ADD_MONITORED, qtu( newDirs.at( i ) ) );
}
......
......@@ -198,7 +198,7 @@ OpenDialog::~OpenDialog()
/* Used by VLM dialog and inputSlave selection */
QString OpenDialog::getMRL( bool b_all )
{
if( itemsMRL.size() == 0 ) return "";
if( itemsMRL.count() == 0 ) return "";
return b_all ? itemsMRL[0] + ui.advancedLineInput->text()
: itemsMRL[0];
}
......@@ -359,7 +359,7 @@ void OpenDialog::finish( bool b_enqueue = false )
itemsMRL.sort();
/* Go through the item list */
for( int i = 0; i < itemsMRL.size(); i++ )
for( int i = 0; i < itemsMRL.count(); i++ )
{
bool b_start = !i && !b_enqueue;
......@@ -374,7 +374,7 @@ void OpenDialog::finish( bool b_enqueue = false )
QStringList optionsList = ui.advancedLineInput->text().split( " :" );
/* Insert options */
for( int j = 0; j < optionsList.size(); j++ )
for( int j = 0; j < optionsList.count(); j++ )
{
QString qs = colon_unescape( optionsList[j] );
if( !qs.isEmpty() )
......@@ -461,10 +461,10 @@ QStringList OpenDialog::SeparateEntries( const QString& entries )
QString entry;
int index = 0;
while( index < entries.size() )
while( index < entries.count() )
{
int delim_pos = entries.indexOf( QRegExp( "\\s+|\"" ), index );
if( delim_pos < 0 ) delim_pos = entries.size() - 1;
if( delim_pos < 0 ) delim_pos = entries.count() - 1;
entry += entries.mid( index, delim_pos - index + 1 );
index = delim_pos + 1;
......@@ -473,22 +473,22 @@ QStringList OpenDialog::SeparateEntries( const QString& entries )
if( !b_quotes_mode && entry.endsWith( "\"" ) )
{
/* Enters quotes mode */
entry.truncate( entry.size() - 1 );
entry.truncate( entry.count() - 1 );
b_quotes_mode = true;
}
else if( b_quotes_mode && entry.endsWith( "\"" ) )
{
/* Finished the quotes mode */
entry.truncate( entry.size() - 1 );
entry.truncate( entry.count() - 1 );
b_quotes_mode = false;
}
else if( !b_quotes_mode && !entry.endsWith( "\"" ) )
{
/* we found a non-quoted standalone string */
if( index < entries.size() ||
if( index < entries.count() ||
entry.endsWith( " " ) || entry.endsWith( "\t" ) ||
entry.endsWith( "\r" ) || entry.endsWith( "\n" ) )
entry.truncate( entry.size() - 1 );
entry.truncate( entry.count() - 1 );
if( !entry.isEmpty() ) entries_array.append( entry );
entry.clear();
}
......
......@@ -380,7 +380,7 @@ QModelIndex ExtensionListModel::index( int row, int column,
{
if( column != 0 )
return QModelIndex();
if( row < 0 || row >= extensions.size() )
if( row < 0 || row >= extensions.count() )
return QModelIndex();
return createIndex( row, 0, extensions.at( row ) );
......
......@@ -186,7 +186,7 @@ void VLMDialog::selectVLMItem( int i )
bool VLMDialog::isNameGenuine( const QString& name )
{
for( int i = 0; i < vlmItems.size(); i++ )
for( int i = 0; i < vlmItems.count(); i++ )
{
if( vlmItems.at( i )->name == name )
return false;
......@@ -196,7 +196,7 @@ bool VLMDialog::isNameGenuine( const QString& name )
void VLMDialog::addVLMItem()
{
int vlmItemCount = vlmItems.size();
int vlmItemCount = vlmItems.count();
/* Take the name and Check it */
QString name = ui.nameLedit->text();
......@@ -295,7 +295,7 @@ void VLMDialog::mediasPopulator()
for( int i = 0; i < i_nMedias; i++ )
{
VLMAWidget * vlmAwidget;
vlmItemCount = vlmItems.size();
vlmItemCount = vlmItems.count();
QString mediaName = qfu( (*ppp_dsc)[i]->psz_name );
/* It may have several inputs, we take the first one by default
......@@ -694,7 +694,7 @@ void VLMWrapper::EditBroadcast( const QString& name, const QString& input,
vlm_MessageDelete( message );
QStringList options = inputOptions.split( " :", QString::SkipEmptyParts );
for( int i = 0; i < options.size(); i++ )
for( int i = 0; i < options.count(); i++ )
{
command = "setup \"" + name + "\" option \"" + options[i].trimmed() + "\"";
vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
......@@ -781,7 +781,7 @@ void VLMWrapper::EditVod( const QString& name, const QString& input,
vlm_MessageDelete( message );
QStringList options = inputOptions.split( " :", QString::SkipEmptyParts );
for( int i = 0; i < options.size(); i++ )
for( int i = 0; i < options.count(); i++ )
{
command = "setup \"" + name + "\" option \"" + options[i].trimmed() + "\"";
vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
......@@ -840,7 +840,7 @@ void VLMWrapper::EditSchedule( const QString& name, const QString& input,
vlm_MessageDelete( message );
QStringList options = inputOptions.split( " :", QString::SkipEmptyParts );
for( int i = 0; i < options.size(); i++ )
for( int i = 0; i < options.count(); i++ )
{
command = "setup \"" + name + "\" option \"" + options[i].trimmed() + "\"";
vlm_ExecuteCommand( p_vlm, qtu( command ), &message );
......
......@@ -640,7 +640,7 @@ void DialogsProvider::streamingDialog( QWidget *parent,
p_input = input_item_New( qtu( mrl ), _("Streaming") );
/* Add normal Options */
for( int j = 0; j < options.size(); j++ )
for( int j = 0; j < options.count(); j++ )
{
QString qs = colon_unescape( options[j] );
if( !qs.isEmpty() )
......
......@@ -1160,7 +1160,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
const QMimeData *mimeData = event->mimeData();
/* D&D of a subtitles file, add it on the fly */
if( mimeData->urls().size() == 1 && THEMIM->getIM()->hasInput() )
if( mimeData->urls().count() == 1 && THEMIM->getIM()->hasInput() )
{
if( !input_AddSubtitle( THEMIM->getInput(),
qtu( toNativeSeparators( mimeData->urls()[0].toLocalFile() ) ),
......
......@@ -154,7 +154,7 @@ void EnableStaticEntries( QMenu *menu, bool enable = true )
if( !menu ) return;
QList< QAction* > actions = menu->actions();
for( int i = 0; i < actions.size(); ++i )
for( int i = 0; i < actions.count(); ++i )
{
actions[i]->setEnabled( actions[i]->data().toString()
== ENTRY_ALWAYS_ENABLED ||
......@@ -173,7 +173,7 @@ inline int DeleteNonStaticEntries( QMenu *menu )
int i_ret = 0;
QList< QAction* > actions = menu->actions();
for( int i = 0; i < actions.size(); ++i )
for( int i = 0; i < actions.count(); ++i )
{
if( actions[i]->data().toString() != STATIC_ENTRY )
delete actions[i];
......@@ -189,7 +189,7 @@ inline int DeleteNonStaticEntries( QMenu *menu )
static QAction * FindActionWithVar( QMenu *menu, const char *psz_var )
{
QList< QAction* > actions = menu->actions();
for( int i = 0; i < actions.size(); ++i )
for( int i = 0; i < actions.count(); ++i )
{
if( actions[i]->data().toString() == psz_var )
return actions[i];
......@@ -1113,7 +1113,7 @@ QMenu * QVLCMenu::Populate( intf_thread_t *p_intf,
currentGroup = NULL;
for( int i = 0; i < (int)objects.size() ; i++ )
for( int i = 0; i < (int)objects.count() ; i++ )
{
if( !varnames[i] || !*varnames[i] )
{
......@@ -1478,14 +1478,14 @@ void QVLCMenu::updateRecents( intf_thread_t *p_intf )
recentsMenu->clear();
if( !l.size() )
if( !l.count() )
{
action = recentsMenu->addAction( qtr(" - Empty - ") );
action->setEnabled( false );
}
else
{
for( int i = 0; i < l.size(); ++i )
for( int i = 0; i < l.count(); ++i )
{
char *psz_temp = decode_URI_duplicate( qtu( l.at( i ) ) );
......
......@@ -100,7 +100,7 @@ void RecentsMRL::addRecent( const QString &mrl )
else
{
stack->prepend( mrl );
if( stack->size() > RECENTS_LIST_SIZE )
if( stack->count() > RECENTS_LIST_SIZE )
stack->takeLast();
}
QVLCMenu::updateRecents( p_intf );
......@@ -128,7 +128,7 @@ void RecentsMRL::load()
QStringList list = getSettings()->value( "RecentsMRL/list" ).toStringList();
/* And filter the regexp on the list */
for( int i = 0; i < list.size(); ++i )
for( int i = 0; i < list.count(); ++i )
{
if ( !filter || filter->indexIn( list.at(i) ) == -1 )
stack->append( list.at(i) );
......
......@@ -327,7 +327,7 @@ void AnimatedIcon::addFrame( const QPixmap &pxm, int index )
return;
}
QPixmap *copy = new QPixmap( pxm );
mFrames.insert( ( index < 0 || index > mFrames.size() ) ? mFrames.size() :
mFrames.insert( ( index < 0 || index > mFrames.count() ) ? mFrames.count() :
index, copy );
if( !pixmap() )
setPixmap( *copy );
......@@ -374,7 +374,7 @@ void AnimatedIcon::play( int loops, int interval )
void AnimatedIcon::onTimerTick()
{
//assert( !mFrames.empty() );
if( ++mCurrentFrame > mFrames.size() )
if( ++mCurrentFrame > mFrames.count() )
{
if( mRemainingLoops != -1 )
{
......@@ -387,7 +387,7 @@ void AnimatedIcon::onTimerTick()
}
mCurrentFrame = 1;
}
//assert( mCurrentFrame >= 1 && mCurrentFrame <= mFrames.size() );
//assert( mCurrentFrame >= 1 && mCurrentFrame <= mFrames.count() );
setPixmap( *mFrames.at( mCurrentFrame - 1 ) );
}
......
......@@ -504,8 +504,8 @@ SoundSlider::SoundSlider( QWidget *_parent, int _i_step, bool b_hard,
free( psz_colors );
/* Fill with 255 if the list is too short */
if( colorList.size() < 12 )
for( int i = colorList.size(); i < 12; i++)
if( colorList.count() < 12 )
for( int i = colorList.count(); i < 12; i++)
colorList.append( "255" );
/* Regular colors */
......
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