extragear/multimedia/amarok/src

Mark Kretschmann markey at web.de
Tue Dec 12 16:34:11 UTC 2006


SVN commit 612787 by markey:

Show album covers in collection browser. Experimental patch by Trever Fischer <wm161 at wm161.net>.

I think this is pretty cool. Maybe we should limit size of the images though?

BUG: 91044
CCMAIL: amarok at kde.org


 M  +19 -0     collectionbrowser.cpp  
 M  +2 -0      collectionbrowser.h  


--- trunk/extragear/multimedia/amarok/src/collectionbrowser.cpp #612786:612787
@@ -1490,7 +1490,26 @@
     }
 }
 
+void
+CollectionItem::setPixmap(int column, const QPixmap & pix)
+{
+    if ( m_cat == IdAlbum ) {
+        QString album = text(0);
+        QStringList values =
+            CollectionDB::instance()->query ( QString (
+                "SELECT DISTINCT artist.name FROM artist, album, tags "
+                "WHERE artist.id = tags.artist AND tags.album = album.id "
+                "AND album.name = '%1';" )
+                .arg( CollectionDB::instance()->escapeString( album ) ) );
+        if ( !values.isEmpty() )
+            QListViewItem::setPixmap( column, QPixmap( CollectionDB::instance()->albumImage( values[0], album ) ) );
+        else
+            QListViewItem::setPixmap( column, QPixmap( CollectionDB::instance()->notAvailCover() ) );
+    } else
+        QListViewItem::setPixmap( column, pix );
+}
 
+
 void
 CollectionView::fetchCover() //SLOT
 {
--- trunk/extragear/multimedia/amarok/src/collectionbrowser.h #612786:612787
@@ -165,6 +165,8 @@
         inline bool isUnknown() {return m_isUnknown;}
         inline bool isSampler() {return m_isSampler;}
 
+        virtual void setPixmap(int column, const QPixmap & pix);
+
         static QPixmap *star();
         static QPixmap *smallStar();
 



More information about the Amarok mailing list