[Amarok] Fix the VA node being shown in the case where the

Jeff Mitchell mitchell at kde.org
Wed Sep 23 15:28:12 CEST 2009


Maximilian Kossick wrote:
> This commit is is a joke, right?

No, why?

Fixes a bug affecting multiple people. And I can be pretty certain that
the name I chose is never used for an artist or album...

> 
> On Wed, Sep 23, 2009 at 12:57 PM, Jeff Mitchell <mitchell at kde.org> wrote:
>> commit 100b8d5905ac764dd0b94380f512309455f4e098
>> Author:     Jeff Mitchell <mitchell at kde.org>
>> AuthorDate: Wed Sep 23 06:54:23 2009 -0400
>> Commit:     Jeff Mitchell <mitchell at kde.org>
>> CommitDate: Wed Sep 23 06:55:34 2009 -0400
>>
>>    Fix the VA node being shown in the case where the actual result from the database is entirely NULL.
>>
>> diff --git a/ChangeLog b/ChangeLog
>> index fa68b9f..69d2fd1 100644
>> --- a/ChangeLog
>> +++ b/ChangeLog
>> @@ -7,6 +7,8 @@ VERSION 2.2
>>     * More collection scanning speedups.
>>
>>   BUGFIXES:
>> +    * Fix the Various Artist node sometimes being shown in the Collection
>> +      Browser with nothing underneath it (or an empty "Unknown" album).
>>     * Fix some tracks' tags not being saved correctly to the database.
>>       (BR 202021)
>>
>> diff --git a/src/browsers/CollectionTreeItemModelBase.cpp b/src/browsers/CollectionTreeItemModelBase.cpp
>> index d2a0b37..0194f80 100644
>> --- a/src/browsers/CollectionTreeItemModelBase.cpp
>> +++ b/src/browsers/CollectionTreeItemModelBase.cpp
>> @@ -698,7 +698,10 @@ CollectionTreeItemModelBase::handleCompilationQueryResult( QueryMaker *qm, const
>>
>>         //if the compilation query did not return a result we have to remove the
>>         //the various artists node itself
>> -        if( dataList.isEmpty() )
>> +
>> +        //HACK: SQL left joins can cause a row of NULLs to be returned in the query, meaning the dataList
>> +        //size is 1 (not empty) and the VA node gets shown with crap in it. So explicitly look for this.
>> +        if( dataList.isEmpty() || ( dataList.size() == 1 && dataList[0]->name() == "**AMAROKHACK_TOTALLYNULL_AMAROKHACK**" ) )
>>         {
>>             for( int i = 0; i < parent->childCount(); i++ )
>>             {
>> diff --git a/src/collection/sqlcollection/SqlRegistry.cpp b/src/collection/sqlcollection/SqlRegistry.cpp
>> index 8d74b47..01db9b5 100644
>> --- a/src/collection/sqlcollection/SqlRegistry.cpp
>> +++ b/src/collection/sqlcollection/SqlRegistry.cpp
>> @@ -302,6 +302,12 @@ SqlRegistry::getYear( const QString &name, int id, bool refresh )
>>  AlbumPtr
>>  SqlRegistry::getAlbum( const QString &name, int id, int artist, bool refresh )
>>  {
>> +    DEBUG_BLOCK
>> +    if( name.isEmpty() && id == 0 && artist == 0 )
>> +    {
>> +        AlbumPtr album( new SqlAlbum( m_collection, id, "**AMAROKHACK_TOTALLYNULL_AMAROKHACK**", artist ) );
>> +        return album;
>> +    }
>>     QMutexLocker locker( &m_albumMutex );
>>     if( m_albumMap.contains( id ) && !refresh )
>>         return m_albumMap.value( id );
>>
>>
>>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
Url : http://mail.kde.org/pipermail/amarok-devel/attachments/20090923/fdddc876/attachment.sig 


More information about the Amarok-devel mailing list