mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 14:46:33 +02:00
Don't use the slower length/count methods when isEmpty does the job.
This commit is contained in:
@@ -337,7 +337,7 @@ DownloadJob::onDownloadProgress( qint64 rcvd, qint64 total )
|
|||||||
}
|
}
|
||||||
|
|
||||||
QByteArray data = m_reply->readAll();
|
QByteArray data = m_reply->readAll();
|
||||||
if ( data.length() == 0 )
|
if ( data.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( m_file->write( data ) < 0 )
|
if ( m_file->write( data ) < 0 )
|
||||||
|
@@ -586,7 +586,7 @@ void
|
|||||||
Playlist::setPlaylistRevisionFinished()
|
Playlist::setPlaylistRevisionFinished()
|
||||||
{
|
{
|
||||||
Q_D( Playlist );
|
Q_D( Playlist );
|
||||||
if ( d->queuedSetPlaylistRevisionCmds.length() > 0 )
|
if ( !d->queuedSetPlaylistRevisionCmds.isEmpty() )
|
||||||
{
|
{
|
||||||
DatabaseCommand_SetPlaylistRevision* cmd = d->queuedSetPlaylistRevisionCmds.dequeue();
|
DatabaseCommand_SetPlaylistRevision* cmd = d->queuedSetPlaylistRevisionCmds.dequeue();
|
||||||
// Update oldrev to currentRevision so that optimistic locking works correctly.
|
// Update oldrev to currentRevision so that optimistic locking works correctly.
|
||||||
|
@@ -398,7 +398,7 @@ Source::addCollection( const collection_ptr& c )
|
|||||||
{
|
{
|
||||||
Q_D( Source );
|
Q_D( Source );
|
||||||
|
|
||||||
//Q_ASSERT( m_collections.length() == 0 ); // only 1 source supported atm
|
//Q_ASSERT( m_collections.isEmpty() ); // only 1 source supported atm
|
||||||
d->collections.append( c );
|
d->collections.append( c );
|
||||||
emit collectionAdded( c );
|
emit collectionAdded( c );
|
||||||
}
|
}
|
||||||
|
@@ -241,7 +241,7 @@ DatabaseCommand_Resolve::fullTextResolve( DatabaseImpl* lib )
|
|||||||
"track.id = file_join.track AND "
|
"track.id = file_join.track AND "
|
||||||
"file.id = file_join.file AND "
|
"file.id = file_join.file AND "
|
||||||
"%1" )
|
"%1" )
|
||||||
.arg( trksl.length() > 0 ? trksToken : QString( "0" ) );
|
.arg( !trksl.isEmpty() ? trksToken : QString( "0" ) );
|
||||||
|
|
||||||
files_query.prepare( sql );
|
files_query.prepare( sql );
|
||||||
files_query.exec();
|
files_query.exec();
|
||||||
|
@@ -219,7 +219,7 @@ Tomahawk::DatabaseImpl::updateSchema( int oldVersion )
|
|||||||
foreach ( const QString& sl, statements )
|
foreach ( const QString& sl, statements )
|
||||||
{
|
{
|
||||||
QString s( sl.trimmed() );
|
QString s( sl.trimmed() );
|
||||||
if ( s.length() == 0 )
|
if ( s.isEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tLog() << "Executing:" << s;
|
tLog() << "Executing:" << s;
|
||||||
|
@@ -268,7 +268,7 @@ DBSyncConnection::sendOpsData( QString sinceguid, QString lastguid, QList< dbop_
|
|||||||
ops.clear();
|
ops.clear();
|
||||||
|
|
||||||
m_lastSentOp = lastguid;
|
m_lastSentOp = lastguid;
|
||||||
if ( ops.length() == 0 )
|
if ( ops.isEmpty() )
|
||||||
{
|
{
|
||||||
tLog( LOGVERBOSE ) << "Sending ok" << m_source->id() << m_source->friendlyName();
|
tLog( LOGVERBOSE ) << "Sending ok" << m_source->id() << m_source->friendlyName();
|
||||||
sendMsg( Msg::factory( "ok", Msg::DBOP ) );
|
sendMsg( Msg::factory( "ok", Msg::DBOP ) );
|
||||||
|
@@ -423,7 +423,7 @@ Servent::getLocalSipInfos( const QString& nodeid, const QString& key )
|
|||||||
info.setNodeId( nodeid );
|
info.setNodeId( nodeid );
|
||||||
sipInfos.append( info );
|
sipInfos.append( info );
|
||||||
}
|
}
|
||||||
if ( d_func()->externalHostname.length() > 0)
|
if ( !d_func()->externalHostname.isEmpty() )
|
||||||
{
|
{
|
||||||
SipInfo info = SipInfo();
|
SipInfo info = SipInfo();
|
||||||
info.setHost( d_func()->externalHostname );
|
info.setHost( d_func()->externalHostname );
|
||||||
@@ -1047,7 +1047,7 @@ Servent::reverseOfferRequest( ControlConnection* orig_conn, const QString& their
|
|||||||
bool
|
bool
|
||||||
Servent::visibleExternally() const
|
Servent::visibleExternally() const
|
||||||
{
|
{
|
||||||
return (!d_func()->externalHostname.isNull()) || (d_func()->externalAddresses.length() > 0);
|
return !d_func()->externalHostname.isNull() || !d_func()->externalAddresses.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -328,7 +328,7 @@ ColumnView::startDrag( Qt::DropActions supportedActions )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( indexes.count() == 0 )
|
if ( indexes.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tDebug( LOGVERBOSE ) << "Dragging" << indexes.count() << "indexes";
|
tDebug( LOGVERBOSE ) << "Dragging" << indexes.count() << "indexes";
|
||||||
|
@@ -386,7 +386,7 @@ GridView::startDrag( Qt::DropActions supportedActions )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( indexes.count() == 0 )
|
if ( indexes.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qDebug() << "Dragging" << indexes.count() << "indexes";
|
qDebug() << "Dragging" << indexes.count() << "indexes";
|
||||||
|
@@ -719,7 +719,7 @@ TrackView::startDrag( Qt::DropActions supportedActions )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( indexes.count() == 0 )
|
if ( indexes.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tDebug() << "Dragging" << indexes.count() << "indexes";
|
tDebug() << "Dragging" << indexes.count() << "indexes";
|
||||||
|
@@ -507,7 +507,7 @@ JSResolverHelper::addUrlResult( const QString& url, const QVariantMap& result )
|
|||||||
m_pendingAlbum = album;
|
m_pendingAlbum = album;
|
||||||
connect( album.data(), SIGNAL( tracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ),
|
connect( album.data(), SIGNAL( tracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ),
|
||||||
SLOT( tracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ) );
|
SLOT( tracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ) );
|
||||||
if ( album->tracks().count() > 0 )
|
if ( !album->tracks().isEmpty() )
|
||||||
{
|
{
|
||||||
emit m_resolver->informationFound( url, album.objectCast<QObject>() );
|
emit m_resolver->informationFound( url, album.objectCast<QObject>() );
|
||||||
}
|
}
|
||||||
|
@@ -80,7 +80,7 @@ ScriptCommandQueue::onCommandDone()
|
|||||||
disconnect( m_timer, SIGNAL( timeout() ),
|
disconnect( m_timer, SIGNAL( timeout() ),
|
||||||
this, SLOT( onTimeout() ) );
|
this, SLOT( onTimeout() ) );
|
||||||
|
|
||||||
if ( m_queue.count() > 0 )
|
if ( !m_queue.isEmpty() )
|
||||||
nextCommand();
|
nextCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +102,6 @@ ScriptCommandQueue::onTimeout()
|
|||||||
disconnect( m_timer, SIGNAL( timeout() ),
|
disconnect( m_timer, SIGNAL( timeout() ),
|
||||||
this, SLOT( onTimeout() ) );
|
this, SLOT( onTimeout() ) );
|
||||||
|
|
||||||
if ( m_queue.count() > 0 )
|
if ( !m_queue.isEmpty() )
|
||||||
nextCommand();
|
nextCommand();
|
||||||
}
|
}
|
||||||
|
@@ -112,7 +112,7 @@ ScriptCommand_AllAlbums::onAlbumsJobDone(const QVariantMap& result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList< Tomahawk::artist_ptr > resultArtists;
|
QList< Tomahawk::artist_ptr > resultArtists;
|
||||||
if ( result["artists"].toList().length() > 0 )
|
if ( !result["artists"].toList().isEmpty() )
|
||||||
{
|
{
|
||||||
resultArtists = ScriptCommand_AllArtists::parseArtistVariantList( result[ "artists" ].toList() );
|
resultArtists = ScriptCommand_AllArtists::parseArtistVariantList( result[ "artists" ].toList() );
|
||||||
}
|
}
|
||||||
|
@@ -439,7 +439,7 @@ SearchWidget::updateArtists()
|
|||||||
|
|
||||||
qSort( floats.begin(), floats.end() );
|
qSort( floats.begin(), floats.end() );
|
||||||
|
|
||||||
while ( floats.count() > 0 )
|
while ( !floats.isEmpty() )
|
||||||
{
|
{
|
||||||
float f = floats.takeLast();
|
float f = floats.takeLast();
|
||||||
foreach ( const artist_ptr& a, artists )
|
foreach ( const artist_ptr& a, artists )
|
||||||
@@ -469,7 +469,7 @@ SearchWidget::updateAlbums()
|
|||||||
|
|
||||||
qSort( floats.begin(), floats.end() );
|
qSort( floats.begin(), floats.end() );
|
||||||
|
|
||||||
while ( floats.count() > 0 )
|
while ( !floats.isEmpty() )
|
||||||
{
|
{
|
||||||
float f = floats.takeLast();
|
float f = floats.takeLast();
|
||||||
foreach ( const album_ptr& a, albums )
|
foreach ( const album_ptr& a, albums )
|
||||||
|
@@ -125,7 +125,7 @@ Breadcrumb::updateButtons( const QModelIndex& updateFrom )
|
|||||||
btn->show();
|
btn->show();
|
||||||
|
|
||||||
// Animate all buttons except the first
|
// Animate all buttons except the first
|
||||||
if ( m_buttons.count() > 0 && isVisible() )
|
if ( !m_buttons.isEmpty() && isVisible() )
|
||||||
{
|
{
|
||||||
QPropertyAnimation* animation = new QPropertyAnimation( btn, "pos" );
|
QPropertyAnimation* animation = new QPropertyAnimation( btn, "pos" );
|
||||||
animation->setDuration( 300 );
|
animation->setDuration( 300 );
|
||||||
|
@@ -257,7 +257,7 @@ QSize
|
|||||||
AccountsToolButton::sizeHint() const
|
AccountsToolButton::sizeHint() const
|
||||||
{
|
{
|
||||||
QSize size = QToolButton::sizeHint();
|
QSize size = QToolButton::sizeHint();
|
||||||
if ( m_factoryPixmaps.count() == 0 ) //no accounts enabled!
|
if ( m_factoryPixmaps.isEmpty() ) //no accounts enabled!
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
size.rwidth() *= m_factoryPixmaps.count();
|
size.rwidth() *= m_factoryPixmaps.count();
|
||||||
|
Reference in New Issue
Block a user