1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-11 16:44:05 +02:00

Don't count items when we really just need to know if a list is empty or not.

This commit is contained in:
Christian Muehlhaeuser
2015-04-05 03:25:08 +02:00
parent 6e53c1a361
commit 35ab3f4502
34 changed files with 95 additions and 95 deletions

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2013, Uwe L. Korn <uwelk@xhochy.com>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -58,7 +58,7 @@ public slots:
void resolved( QHostInfo i )
{
qDebug() << Q_FUNC_INFO << "zeroconf-derived IP has resolved to name " << i.hostName();
if ( i.hostName().length() )
if ( !i.hostName().isEmpty() )
emit tomahawkHostFound( ip, port, i.hostName(), nid );
else
emit tomahawkHostFound( ip, port, "Unknown", nid );

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -332,7 +332,7 @@ Album::infoSystemInfo( const Tomahawk::InfoSystem::InfoRequestData& requestData,
{
QVariantMap returnedData = output.value< QVariantMap >();
const QByteArray ba = returnedData["imgbytes"].toByteArray();
if ( ba.length() )
if ( !ba.isEmpty() )
{
d->coverBuffer = ba;
}

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
*
@@ -500,7 +500,7 @@ Artist::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVari
}
m_albumsLoaded.insert( InfoSystemMode, true );
if ( m_officialAlbums.count() )
if ( !m_officialAlbums.isEmpty() )
emit albumsAdded( albums, InfoSystemMode );
break;
@@ -515,7 +515,7 @@ Artist::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVari
else if ( output.isValid() )
{
const QByteArray ba = returnedData["imgbytes"].toByteArray();
if ( ba.length() )
if ( !ba.isEmpty() )
{
m_coverBuffer = ba;
}

View File

@@ -591,7 +591,7 @@ AtticaManager::resolverDownloadFinished ( QNetworkReply *j )
doc.setContent( j );
const QDomNodeList nodes = doc.documentElement().elementsByTagName( "downloadlink" );
if ( nodes.length() < 1 )
if ( nodes.isEmpty() )
{
tLog() << "Found no download link for resolver:" << doc.toString();
return;

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -419,15 +419,15 @@ ContextMenu::addToQueue()
void
ContextMenu::copyLink()
{
if ( m_queries.count() )
if ( !m_queries.isEmpty() )
{
Utils::LinkGenerator::instance()->copyOpenLink( m_queries.first() );
}
else if ( m_albums.count() )
else if ( !m_albums.isEmpty() )
{
Utils::LinkGenerator::instance()->copyOpenLink( m_albums.first() );
}
else if ( m_artists.count() )
else if ( !m_artists.isEmpty() )
{
Utils::LinkGenerator::instance()->copyOpenLink( m_artists.first() );
}
@@ -437,7 +437,7 @@ ContextMenu::copyLink()
void
ContextMenu::openPage( MenuActions action )
{
if ( m_queries.count() )
if ( !m_queries.isEmpty() )
{
if ( action == ActionTrackPage )
{
@@ -455,7 +455,7 @@ ContextMenu::openPage( MenuActions action )
}
}
}
else if ( m_albums.count() )
else if ( !m_albums.isEmpty() )
{
if ( action == ActionArtistPage )
{
@@ -466,7 +466,7 @@ ContextMenu::openPage( MenuActions action )
ViewManager::instance()->show( m_albums.first() );
}
}
else if ( m_artists.count() )
else if ( !m_artists.isEmpty() )
{
ViewManager::instance()->show( m_artists.first() );
}

View File

@@ -194,15 +194,15 @@ downloadjob_ptr
DownloadManager::currentJob() const
{
QList<downloadjob_ptr> j = jobs( DownloadJob::Running );
if ( j.count() )
if ( !j.isEmpty() )
return j.first();
j = jobs( DownloadJob::Paused );
if ( j.count() )
if ( !j.isEmpty() )
return j.first();
j = jobs( DownloadJob::Waiting );
if ( j.count() )
if ( !j.isEmpty() )
return j.first();
return downloadjob_ptr();
@@ -282,7 +282,7 @@ DownloadManager::resume()
m_globalState = true;
if ( jobs( DownloadJob::Paused ).count() )
if ( !jobs( DownloadJob::Paused ).isEmpty() )
{
foreach ( const downloadjob_ptr& job, jobs( DownloadJob::Paused ) )
{

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2012-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@ MetaPlaylistInterface::removeChildInterface( const Tomahawk::playlistinterface_p
QList< Tomahawk::query_ptr >
MetaPlaylistInterface::tracks() const
{
if ( m_childInterfaces.count() )
if ( !m_childInterfaces.isEmpty() )
return m_childInterfaces.first()->tracks();
else
return QList< Tomahawk::query_ptr >();
@@ -72,7 +72,7 @@ MetaPlaylistInterface::tracks() const
int
MetaPlaylistInterface::trackCount() const
{
if ( m_childInterfaces.count() )
if ( !m_childInterfaces.isEmpty() )
return m_childInterfaces.first()->trackCount();
else
return 0;
@@ -82,7 +82,7 @@ MetaPlaylistInterface::trackCount() const
result_ptr
MetaPlaylistInterface::currentItem() const
{
if ( m_childInterfaces.count() && m_childInterfaces.first() )
if ( !m_childInterfaces.isEmpty() && m_childInterfaces.first() )
return m_childInterfaces.first()->currentItem();
else
return Tomahawk::result_ptr();
@@ -92,7 +92,7 @@ MetaPlaylistInterface::currentItem() const
qint64
MetaPlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
{
if ( m_childInterfaces.count() )
if ( !m_childInterfaces.isEmpty() )
return m_childInterfaces.first()->siblingIndex( itemsAway, rootIndex );
else
return -1;
@@ -102,7 +102,7 @@ MetaPlaylistInterface::siblingIndex( int itemsAway, qint64 rootIndex ) const
Tomahawk::query_ptr
MetaPlaylistInterface::queryAt( qint64 index ) const
{
if ( m_childInterfaces.count() )
if ( !m_childInterfaces.isEmpty() )
return m_childInterfaces.first()->queryAt( index );
else
return Tomahawk::query_ptr();
@@ -112,7 +112,7 @@ MetaPlaylistInterface::queryAt( qint64 index ) const
Tomahawk::result_ptr
MetaPlaylistInterface::resultAt( qint64 index ) const
{
if ( m_childInterfaces.count() )
if ( !m_childInterfaces.isEmpty() )
return m_childInterfaces.first()->resultAt( index );
else
return Tomahawk::result_ptr();
@@ -122,7 +122,7 @@ MetaPlaylistInterface::resultAt( qint64 index ) const
qint64
MetaPlaylistInterface::indexOfResult( const Tomahawk::result_ptr& result ) const
{
if ( m_childInterfaces.count() )
if ( !m_childInterfaces.isEmpty() )
return m_childInterfaces.first()->indexOfResult( result );
else
return -1;
@@ -132,7 +132,7 @@ MetaPlaylistInterface::indexOfResult( const Tomahawk::result_ptr& result ) const
qint64
MetaPlaylistInterface::indexOfQuery( const Tomahawk::query_ptr& query ) const
{
if ( m_childInterfaces.count() )
if ( !m_childInterfaces.isEmpty() )
return m_childInterfaces.first()->indexOfQuery( query );
else
return -1;
@@ -142,7 +142,7 @@ MetaPlaylistInterface::indexOfQuery( const Tomahawk::query_ptr& query ) const
PlaylistModes::RepeatMode
MetaPlaylistInterface::repeatMode() const
{
if ( m_childInterfaces.count() )
if ( !m_childInterfaces.isEmpty() )
return m_childInterfaces.first()->repeatMode();
else
return PlaylistModes::NoRepeat;
@@ -152,7 +152,7 @@ MetaPlaylistInterface::repeatMode() const
bool
MetaPlaylistInterface::shuffled() const
{
if ( m_childInterfaces.count() )
if ( !m_childInterfaces.isEmpty() )
return m_childInterfaces.first()->shuffled();
else
return false;
@@ -175,7 +175,7 @@ MetaPlaylistInterface::hasChildInterface( const Tomahawk::playlistinterface_ptr&
void
MetaPlaylistInterface::setRepeatMode( PlaylistModes::RepeatMode mode )
{
if ( m_childInterfaces.count() )
if ( !m_childInterfaces.isEmpty() )
return m_childInterfaces.first()->setRepeatMode( mode );
}
@@ -183,6 +183,6 @@ MetaPlaylistInterface::setRepeatMode( PlaylistModes::RepeatMode mode )
void
MetaPlaylistInterface::setShuffled( bool enabled )
{
if ( m_childInterfaces.count() )
if ( !m_childInterfaces.isEmpty() )
return m_childInterfaces.first()->setShuffled( enabled );
}

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2013, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
*
@@ -455,7 +455,7 @@ Playlist::setRevision( const QString& rev,
setBusy( false );
setLoaded( true );
if ( d->initEntries.count() && currentrevision().isEmpty() )
if ( !d->initEntries.isEmpty() && currentrevision().isEmpty() )
{
// add initial tracks
createNewRevision( uuid(), currentrevision(), d->initEntries );

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2013, Uwe L. Korn <uwelk@xhochy.com>
*

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2013, Uwe L. Korn <uwelk@xhochy.com>
*
@@ -151,7 +151,7 @@ collection_ptr
Source::dbCollection() const
{
Q_D( const Source );
if ( d->collections.length() )
if ( !d->collections.isEmpty() )
{
foreach ( const collection_ptr& collection, d->collections )
{
@@ -722,7 +722,7 @@ Source::executeCommands()
// return here when the last command finished
connect( cmd.data(), SIGNAL( finished() ), SLOT( executeCommands() ) );
if ( cmdGroup.count() )
if ( !cmdGroup.isEmpty() )
{
Database::instance()->enqueue( cmdGroup );
}

View File

@@ -817,7 +817,7 @@ QString
TomahawkSettings::downloadsPath() const
{
QString musicLocation;
if ( scannerPaths().count() )
if ( !scannerPaths().isEmpty() )
musicLocation = scannerPaths().first();
return value( "downloadmanager/path", musicLocation ).toString();

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2010-2012, Leo Franchi <lfranchi@kde.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
@@ -348,7 +348,7 @@ ViewManager::showInboxPage()
void
ViewManager::historyBack()
{
if ( !m_pageHistoryBack.count() )
if ( m_pageHistoryBack.isEmpty() )
return;
ViewPage* page = m_pageHistoryBack.takeLast();
@@ -367,7 +367,7 @@ ViewManager::historyBack()
void
ViewManager::historyForward()
{
if ( !m_pageHistoryFwd.count() )
if ( m_pageHistoryFwd.isEmpty() )
return;
ViewPage* page = m_pageHistoryFwd.takeLast();
@@ -413,8 +413,8 @@ ViewManager::destroyPage( ViewPage* page )
m_pageHistoryBack.removeAll( page );
m_pageHistoryFwd.removeAll( page );
emit historyBackAvailable( m_pageHistoryBack.count() );
emit historyForwardAvailable( m_pageHistoryFwd.count() );
emit historyBackAvailable( !m_pageHistoryBack.isEmpty() );
emit historyForwardAvailable( !m_pageHistoryFwd.isEmpty() );
}
if ( m_currentPage == page )

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Leo Franchi <lfranchi@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -809,7 +809,7 @@ LastFmInfoPlugin::coverArtReturned()
Tomahawk::InfoSystem::InfoStringHash origData = requestData.input.value< Tomahawk::InfoSystem::InfoStringHash>();
QByteArray ba = reply->readAll();
if ( ba.isNull() || !ba.length() )
if ( ba.isNull() || ba.isEmpty() )
{
tLog() << Q_FUNC_INFO << "Null byte array for cover of" << origData["artist"] << origData["album"];
emit info( requestData, QVariant() );

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
*
@@ -942,7 +942,7 @@ AudioEngine::playItem( const Tomahawk::artist_ptr& artist )
playlistinterface_ptr pli = artist->playlistInterface( Mixed );
if ( pli->isFinished() )
{
if ( !pli->tracks().count() )
if ( pli->tracks().isEmpty() )
{
JobStatusView::instance()->model()->addJob(
new ErrorStatusMessage( tr( "Sorry, Tomahawk couldn't find the artist '%1'" ).arg( artist->name() ), 15 ) );
@@ -968,7 +968,7 @@ AudioEngine::playItem( const Tomahawk::album_ptr& album )
playlistinterface_ptr pli = album->playlistInterface( Mixed );
if ( pli->isFinished() )
{
if ( !pli->tracks().count() )
if ( pli->tracks().isEmpty() )
{
JobStatusView::instance()->model()->addJob(
new ErrorStatusMessage( tr( "Sorry, Tomahawk couldn't find the album '%1' by %2" ).arg( album->name() ).arg( album->artist()->name() ), 15 ) );

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -40,7 +40,7 @@ using namespace Tomahawk;
void
DatabaseCommand_DeleteFiles::postCommitHook()
{
if ( !m_idList.count() )
if ( m_idList.isEmpty() )
return;
// make the collection object emit its tracksAdded signal, so the
@@ -135,7 +135,7 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
delquery.exec();
}
if ( m_idList.count() )
if ( !m_idList.isEmpty() )
source()->updateIndexWhenSynced();
emit done( m_idList, source()->dbCollection() );

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -104,7 +104,7 @@ DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
// qDebug() << "Playlist has no current revision data";
}
if ( prevrev.length() )
if ( !prevrev.isEmpty() )
{
TomahawkSqlQuery query_entries_old = dbi->newquery();
query_entries_old.prepare( "SELECT entries, "

View File

@@ -1,7 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2012, Christopher Reichert <creichert07@gmail.com>
* Copyright 2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2012-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -186,7 +186,7 @@ MetadataEditor::writeMetadata( bool closeDlg )
}
else if ( closeDlg )
{
if ( m_editFiles.count() )
if ( !m_editFiles.isEmpty() )
ScanManager::instance()->runFileScan( m_editFiles, false );
close();

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -274,7 +274,7 @@ MusicScanner::postOps()
foreach ( const QString& s, m_skippedFiles )
tDebug( LOGEXTRA ) << s;
if ( m_filesToDelete.length() || m_scannedfiles.length() )
if ( !m_filesToDelete.isEmpty() || !m_scannedfiles.isEmpty() )
{
if ( !m_dryRun )
{
@@ -312,13 +312,13 @@ MusicScanner::cleanup()
void
MusicScanner::commitBatch( const QVariantList& tracks, const QVariantList& deletethese )
{
if ( deletethese.length() )
if ( !deletethese.isEmpty() )
{
tDebug( LOGINFO ) << Q_FUNC_INFO << "deleting" << deletethese.length() << "tracks";
executeCommand( dbcmd_ptr( new DatabaseCommand_DeleteFiles( deletethese, SourceList::instance()->getLocal() ) ) );
}
if ( tracks.length() )
if ( !tracks.isEmpty() )
{
tDebug( LOGINFO ) << Q_FUNC_INFO << "adding" << tracks.length() << "tracks";
executeCommand( dbcmd_ptr( new DatabaseCommand_AddFiles( tracks, SourceList::instance()->getLocal() ) ) );

View File

@@ -203,9 +203,9 @@ ConnectionManager::newControlConnection( const Tomahawk::peerinfo_ptr& peerInfo
d->controlConnection->addPeerInfo( peerInfo );
d->controlConnection->setFirstMessage( m );
if ( peerInfo->id().length() )
if ( !peerInfo->id().isEmpty() )
d->controlConnection->setName( peerInfo->contactId() );
if ( peerInfo->nodeId().length() )
if ( !peerInfo->nodeId().isEmpty() )
d->controlConnection->setId( peerInfo->nodeId() );
d->controlConnection->setNodeId( peerInfo->nodeId() );

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
* Copyright 2013-2014, Uwe L. Korn <uwelk@xhochy.com>

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -114,7 +114,7 @@ AlbumModel::addAlbums( const QList<Tomahawk::album_ptr>& albums )
QList<Tomahawk::album_ptr> trimmedAlbums;
foreach ( const album_ptr& album, albums )
{
if ( !album.isNull() && album->name().length() )
if ( !album.isNull() && !album->name().isEmpty() )
{
if ( findItem( album ) || trimmedAlbums.contains( album ) )
continue;
@@ -122,7 +122,7 @@ AlbumModel::addAlbums( const QList<Tomahawk::album_ptr>& albums )
}
}
if ( !trimmedAlbums.count() )
if ( trimmedAlbums.isEmpty() )
{
emit itemCountChanged( rowCount( QModelIndex() ) );
return;
@@ -159,7 +159,7 @@ AlbumModel::addArtists( const QList<Tomahawk::artist_ptr>& artists )
QList<Tomahawk::artist_ptr> trimmedArtists;
foreach ( const artist_ptr& artist, artists )
{
if ( !artist.isNull() && artist->name().length() )
if ( !artist.isNull() && !artist->name().isEmpty() )
{
if ( findItem( artist ) || trimmedArtists.contains( artist ) )
continue;
@@ -167,7 +167,7 @@ AlbumModel::addArtists( const QList<Tomahawk::artist_ptr>& artists )
}
}
if ( !trimmedArtists.count() )
if ( trimmedArtists.isEmpty() )
{
emit itemCountChanged( rowCount( QModelIndex() ) );
return;

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -283,7 +283,7 @@ ColumnView::wheelEvent( QWheelEvent* event )
void
ColumnView::onFilterChangeFinished()
{
if ( selectedIndexes().count() )
if ( !selectedIndexes().isEmpty() )
scrollTo( selectedIndexes().at( 0 ), QAbstractItemView::PositionAtCenter );
if ( !proxyModel()->filter().isEmpty() && !proxyModel()->playlistInterface()->trackCount() && model()->trackCount() )

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -365,7 +365,7 @@ GridView::onDelegateStopped( const QPersistentModelIndex& index )
void
GridView::onFilterChanged( const QString& )
{
if ( selectedIndexes().count() )
if ( !selectedIndexes().isEmpty() )
scrollTo( selectedIndexes().at( 0 ), QAbstractItemView::PositionAtCenter );
onViewChanged();

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2011 Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
*
@@ -666,7 +666,7 @@ void
PlayableModel::insertInternal( const QList< T >& items, int row, const QList< Tomahawk::PlaybackLog >& logs, const QModelIndex& parent )
{
Q_D( PlayableModel );
if ( !items.count() )
if ( items.isEmpty() )
{
emit itemCountChanged( rowCount( QModelIndex() ) );

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2010-2012, Leo Franchi <lfranchi@kde.org>
*
@@ -268,7 +268,7 @@ void
PlaylistModel::insertEntries( const QList< Tomahawk::plentry_ptr >& entries, int row, const QModelIndex& parent, const QList< Tomahawk::PlaybackLog >& logs )
{
Q_D( PlaylistModel );
if ( !entries.count() )
if ( entries.isEmpty() )
{
emit itemCountChanged( rowCount( QModelIndex() ) );
finishLoading();
@@ -456,7 +456,7 @@ PlaylistModel::parsedDroppedTracks( QList< query_ptr > tracks )
else
beginRow = rowCount( QModelIndex() );
if ( tracks.count() )
if ( !tracks.isEmpty() )
{
bool update = ( d->dropStorage.action & Qt::CopyAction || d->dropStorage.action & Qt::MoveAction );
if ( update )

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -682,7 +682,7 @@ TrackView::wheelEvent( QWheelEvent* event )
void
TrackView::onFilterChanged( const QString& )
{
if ( selectedIndexes().count() )
if ( !selectedIndexes().isEmpty() )
scrollTo( selectedIndexes().at( 0 ), QAbstractItemView::PositionAtCenter );
if ( !filter().isEmpty() && !proxyModel()->playlistInterface()->trackCount() && model()->trackCount() )
@@ -912,7 +912,7 @@ TrackView::expand( const QPersistentModelIndex& idx )
void
TrackView::select( const QPersistentModelIndex& idx )
{
if ( selectedIndexes().count() )
if ( !selectedIndexes().isEmpty() )
return;
// selectionModel()->select( idx, QItemSelectionModel::SelectCurrent );
@@ -925,7 +925,7 @@ TrackView::selectFirstTrack()
{
if ( !m_proxyModel->rowCount() )
return;
if ( selectedIndexes().count() )
if ( !selectedIndexes().isEmpty() )
return;
QModelIndex idx = m_proxyModel->index( 0, 0, QModelIndex() );

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2012, Leo Franchi <lfranchi@kde.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
@@ -182,7 +182,7 @@ void
TreeModel::addAlbums( const QModelIndex& parent, const QList<Tomahawk::album_ptr>& albums )
{
finishLoading();
if ( !albums.count() )
if ( albums.isEmpty() )
return;
PlayableItem* parentItem = itemFromIndex( parent );
@@ -291,7 +291,7 @@ TreeModel::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks, const QModel
{
finishLoading();
if ( !tracks.count() )
if ( tracks.isEmpty() )
return;
PlayableItem* parentItem = itemFromIndex( parent );

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -177,7 +177,7 @@ DatabaseGenerator::fetchNext( int /* rating */ )
QString
DatabaseGenerator::sentenceSummary()
{
if( m_controls.count() && m_controls.first()->type() == "SQL" )
if ( !m_controls.isEmpty() && m_controls.first()->type() == "SQL" )
return m_controls.first()->summary();
// TODO

View File

@@ -143,7 +143,7 @@ BreadcrumbButton::setParentIndex( const QModelIndex& idx )
}
}
if ( m_combo->count() && list.count() )
if ( m_combo->count() && !list.isEmpty() )
{
// Check if it's the same, Don't change if it is, as it'll cause flickering
QStringList old;

View File

@@ -1,7 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -65,7 +65,7 @@ SourcesProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourcePar
// always filter empty top-level groups
SourceTreeItem* item = m_model->data( sourceModel()->index( sourceRow, 0, sourceParent ), SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >();
if ( item && item->type() != SourcesModel::Divider && item->parent()->parent() == 0 && !item->children().count() )
if ( item && item->type() != SourcesModel::Divider && item->parent()->parent() == 0 && item->children().isEmpty() )
return false;
if ( !m_filtered )

View File

@@ -1,7 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2012, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -265,9 +265,9 @@ PlaylistItem::dropMimeData( const QMimeData* data, Qt::DropAction action )
void
PlaylistItem::parsedDroppedTracks( const QList< query_ptr >& tracks )
{
if ( tracks.count() && m_playlist && m_playlist->author()->isLocal() )
if ( !tracks.isEmpty() && m_playlist && m_playlist->author()->isLocal() )
{
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Adding" << tracks.count() << "tracks on playlist:" << m_playlist->title() << m_playlist->guid() << m_playlist->currentrevision();
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Adding" << tracks.count() << "tracks to playlist:" << m_playlist->title() << m_playlist->guid() << m_playlist->currentrevision();
m_playlist->addEntries( tracks );
}

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2014-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -169,7 +169,7 @@ QueueItem::dropMimeData( const QMimeData* data, Qt::DropAction action )
void
QueueItem::parsedDroppedTracks( const QList< Tomahawk::query_ptr >& tracks )
{
if ( tracks.count() )
if ( !tracks.isEmpty() )
{
ViewManager::instance()->queue()->view()->trackView()->model()->appendQueries( tracks );
}