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

List:       kde-commits
Subject:    KDE/kdeplasma-addons/applets/nowplaying
From:       Alex Merry <kde () randomguy3 ! me ! uk>
Date:       2009-02-21 19:00:06
Message-ID: 1235242806.181350.29623.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 929639 by alexmerry:

Display album art.

CCMAIL: mpyne@purinchu.net



 M  +1 -0      CMakeLists.txt  
 A             albumart.cpp   [License: GPL (v2+)]
 A             albumart.h   [License: GPL (v2+)]
 M  +18 -2     infopanel.cpp  
 M  +6 -0      infopanel.h  
 M  +2 -0      nowplaying.cpp  


--- trunk/KDE/kdeplasma-addons/applets/nowplaying/CMakeLists.txt #929638:929639
@@ -6,6 +6,7 @@
 set(nowplaying_SRCS
     nowplaying.cpp
     controls.cpp
+    albumart.cpp
     infopanel.cpp)
 
 kde4_add_plugin(plasma_applet_nowplaying ${nowplaying_SRCS})
--- trunk/KDE/kdeplasma-addons/applets/nowplaying/infopanel.cpp #929638:929639
@@ -18,14 +18,20 @@
  */
 #include "infopanel.h"
 
+#include "albumart.h"
+
 #include <Plasma/Label>
 #include <Plasma/Theme>
 
 #include <QGraphicsGridLayout>
+#include <QGraphicsLinearLayout>
+#include <QGraphicsPixmapItem>
+#include <QGraphicsWidget>
 #include <QLabel>
 
 InfoPanel::InfoPanel(QGraphicsWidget *parent)
     : QGraphicsWidget(parent),
+      m_artwork(new AlbumArt(this)),
       m_artistLabel(new Plasma::Label(this)),
       m_titleLabel(new Plasma::Label(this)),
       m_albumLabel(new Plasma::Label(this)),
@@ -34,8 +40,10 @@
       m_titleText(new Plasma::Label(this)),
       m_albumText(new Plasma::Label(this)),
       m_timeText(new Plasma::Label(this)),
+      m_barLayout(new QGraphicsLinearLayout),
       m_layout(new QGraphicsGridLayout)
 {
+
     m_layout->setColumnStretchFactor(0, 0);
     m_layout->setColumnSpacing(0, 10);
     m_layout->setColumnAlignment(0, Qt::AlignRight);
@@ -59,7 +67,10 @@
     m_layout->addItem(m_timeLabel, 3, 0);
     m_layout->addItem(m_timeText, 3, 1);
 
-    setLayout(m_layout);
+    m_barLayout->addItem(m_artwork);
+    m_barLayout->addItem(m_layout);
+
+    setLayout(m_barLayout);
 }
 
 InfoPanel::~InfoPanel()
@@ -85,7 +96,12 @@
 
     // dirty hack to make sure the Artist: label is in line
     // FIXME: does this ever happen in plasma, or just in the plasmoidviewer?
-    m_layout->invalidate();
+    m_barLayout->invalidate();
 }
 
+void InfoPanel::updateArtwork(const QPixmap &artwork)
+{
+    m_artwork->setPixmap(artwork);
+}
+
 // vim: sw=4 sts=4 et tw=100
--- trunk/KDE/kdeplasma-addons/applets/nowplaying/infopanel.h #929638:929639
@@ -27,8 +27,11 @@
     class Label;
 }
 class QGraphicsLayoutItem;
+class QGraphicsLinearLayout;
 class QGraphicsGridLayout;
 
+class AlbumArt;
+
 class InfoPanel : public QGraphicsWidget
 {
     Q_OBJECT
@@ -39,10 +42,12 @@
 
 public slots:
     void updateMetadata(const QMap<QString,QString>& metadata);
+    void updateArtwork(const QPixmap &artwork);
 
 private:
     void updateLabels();
 
+    AlbumArt* m_artwork;
     Plasma::Label* m_artistLabel;
     Plasma::Label* m_titleLabel;
     Plasma::Label* m_albumLabel;
@@ -53,6 +58,7 @@
     Plasma::Label* m_albumText;
     Plasma::Label* m_timeText;
 
+    QGraphicsLinearLayout *m_barLayout;
     QGraphicsGridLayout* m_layout;
     QMap<QString,QString> m_metadata;
 };
--- trunk/KDE/kdeplasma-addons/applets/nowplaying/nowplaying.cpp #929638:929639
@@ -60,6 +60,8 @@
 
     connect(this, SIGNAL(metadataChanged(QMap<QString,QString>)),
             m_textPanel, SLOT(updateMetadata(QMap<QString,QString>)));
+    connect(this, SIGNAL(coverChanged(QPixmap)),
+            m_textPanel, SLOT(updateArtwork(QPixmap)));
 
     m_volumeSlider->setOrientation(Qt::Vertical);
     m_volumeSlider->setMinimum(0);
[prev in list] [next in list] [prev in thread] [next in thread] 

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