[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: extragear/multimedia/amarok/src/timecode
From:       Orville Bennett <illogical1 () gmail ! com>
Date:       2009-06-13 11:35:52
Message-ID: 4A338F18.6080403 () gmail ! com
[Download RAW message or body]



Nikolaj Hald Nielsen wrote:
> SVN commit 980995 by nhnielsen:
>
> Add automatic cover fetching whenever the album or artist is changed
Shouldn't this depend on the option set in the preferences instead of 
being true all the time?

>
>   M  +20 -2     TimecodeMeta.cpp
>   M  +3 -0      TimecodeMeta.h
>
>
> --- trunk/extragear/multimedia/amarok/src/timecode/TimecodeMeta.cpp #980994:980995
> @@ -20,6 +20,7 @@
>   #include "TimecodeMeta.h"
>
>   #include "Debug.h"
> +#include "covermanager/CoverFetcher.h"
>   #include "meta/Capability.h"
>   #include "meta/capabilities/BoundedPlaybackCapability.h"
>
> @@ -369,6 +370,8 @@
>   void TimecodeTrack::endMetaDataUpdate()
>   {
>
> +    bool updateCover = false;
> +
>       if ( m_updatedFields | ALBUM_UPDATED )
>       {
>           //create a new album:
> @@ -385,6 +388,7 @@
>           m_artist->addTrack( TimecodeTrackPtr( this ) );
>           setArtist( m_artist );
>           m_album->setAlbumArtist( m_artist );
> +        updateCover = true;
>       }
>
>       if ( m_updatedFields | COMPOSER_UPDATED )
> @@ -415,6 +419,7 @@
>       {
>           //create a new album:
>           m_name = m_fields.value( TITLE_UPDATED );
> +        updateCover = true;
>       }
>
>       if ( m_updatedFields | COMMENT_UPDATED )
> @@ -435,6 +440,9 @@
>           m_discNumber = m_fields.value( DISCNUMBER_UPDATED ).toInt();
>       }
>
> +    if ( updateCover )
> +        The::coverFetcher()->queueAlbum( AlbumPtr::staticCast( m_album ) );
> +
>       m_updatedFields = 0;
>       m_fields.clear();
>
> @@ -597,7 +605,17 @@
>   QPixmap
>   TimecodeAlbum::image( int size )
>   {
> -    return Meta::Album::image( size );
> +    if ( m_cover.isNull() )
> +        return Meta::Album::image( size );
> +
> +    //only cache during session
> +    if ( m_coverSizeMap.contains( size ) )
> +         return m_coverSizeMap.value( size );
> +
> +    QPixmap scaled = m_cover.scaled( size, size, Qt::KeepAspectRatio, Qt::SmoothTransformation );
> +
> +    m_coverSizeMap.insert( size, scaled );
> +    return scaled;
>   }
>
>   bool
> @@ -609,7 +627,7 @@
>   void
>   TimecodeAlbum::setImage( const QPixmap&  pixmap )
>   {
> -    Q_UNUSED(pixmap);
> +    m_cover = pixmap;
>   }
>
>   void
> --- trunk/extragear/multimedia/amarok/src/timecode/TimecodeMeta.h #980994:980995
> @@ -245,6 +245,9 @@
>       TrackList m_tracks;
>       bool m_isCompilation;
>       TimecodeArtistPtr m_albumArtist;
> +
> +    QPixmap m_cover;
> +    QMap<int, QPixmap>  m_coverSizeMap;
>   };
>
>   class TimecodeGenre : public Meta::Genre
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic