]> git.sesse.net Git - vlc/commitdiff
Very very preliminary Qt implementation of album art
authorClément Stenac <zorglub@videolan.org>
Sat, 23 Sep 2006 20:16:08 +0000 (20:16 +0000)
committerClément Stenac <zorglub@videolan.org>
Sat, 23 Sep 2006 20:16:08 +0000 (20:16 +0000)
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/playlist/panels.hpp
modules/gui/qt4/components/playlist/selector.hpp
modules/gui/qt4/playlist_model.cpp
modules/gui/qt4/playlist_model.hpp

index c0fb11fa77b6135192667485f563e0e208996d41..71112e6fd4c5c09d6706ce4a6317e16662da57ba 100644 (file)
@@ -287,7 +287,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) :
     selector->setMaximumWidth( 130 );
     left->addWidget( selector );
 
-    QLabel *art = new QLabel( "" );
+    art = new QLabel( "" );
     art->setMaximumHeight( 128 );
     art->setMaximumWidth( 128 );
     art->setScaledContents( true );
@@ -302,6 +302,8 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) :
 
     CONNECT( selector, activated( int ), rightPanel, setRoot( int ) );
 
+    CONNECT( qobject_cast<StandardPLPanel *>(rightPanel)->model, artSet( QString ) , this, setArt( QString ) );
+
     connect( selector, SIGNAL(activated( int )),
              this, SIGNAL( rootChanged( int ) ) );
     emit rootChanged( p_root->i_id );
@@ -312,6 +314,12 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) :
     setLayout( layout );
 }
 
+void PlaylistWidget::setArt( QString url )
+{
+    fprintf( stderr, "************** YEAH ! *************\n" );
+    art->setPixmap( QPixmap( url ) );
+}
+
 PlaylistWidget::~PlaylistWidget()
 {
 }
index 04b476f5bcf6c73a579096fa9438a59e182671aa..c80d240fe02ccd9160fcbf46949885e2eaa9a029 100644 (file)
@@ -136,6 +136,9 @@ private:
     PLSelector *selector;
     PLPanel *rightPanel;
     QPushButton *addButton;
+    QLabel *art;
+private slots:
+    void setArt( QString );
 signals:
     void rootChanged( int );
 };
index f6d3336591d6c40b5f92722b0b2f1333e1fb438a..bd13eb265fb78b5091817fcf61b328590da9acba 100644 (file)
@@ -55,6 +55,7 @@ public slots:
     virtual void setRoot( int ) = 0;
 };
 
+class PlaylistWidget;
 
 class StandardPLPanel: public PLPanel
 {
@@ -65,8 +66,10 @@ public:
     virtual ~StandardPLPanel();
 protected:
     virtual void keyPressEvent( QKeyEvent *e );
-private:
+protected:
     PLModel *model;
+    friend class PlaylistWidget;
+private:
     QTreeView *view;
     QPushButton *repeatButton , *randomButton,*addButton;
     ClickLineEdit *searchLine;
index a2ef28be95575ab7a596d63c036fd7a7bb9488f1..9a93a551bd1b05c950149d61995a03a44f584116 100644 (file)
@@ -30,6 +30,7 @@
 #include <playlist_model.hpp>
 
 class QTreeView;
+class PlaylistWidget;
 
 class PLSelector: public QWidget
 {
@@ -37,9 +38,11 @@ class PLSelector: public QWidget
 public:
     PLSelector( QWidget *p, intf_thread_t *_p_intf, playlist_t * );
     virtual ~PLSelector();
+protected:
+    PLModel *model;
+    friend class PlaylistWidget;
 private:
     intf_thread_t *p_intf;
-    PLModel *model;
     QTreeView *view;
 private slots:
     void setSource( const QModelIndex& );
index 10a88e377d793824acd5b060bed88ff18f30ba22..f1d0db3bbfeab15f7f0503b97bbeba4f0955c802 100644 (file)
@@ -132,6 +132,15 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
     strings[2] = QString( psz_duration );
     type = p_item->p_input->i_type;
     current = iscurrent;
+    fprintf( stderr, "Updating current %i\n" );
+    fprintf( stderr, "Meta %p art %s\n", p_item->p_input->p_meta,p_item->p_input->p_meta ?p_item->p_input->p_meta->psz_arturl : "non" );
+    if( current && p_item->p_input->p_meta &&
+        p_item->p_input->p_meta->psz_arturl &&
+        !strncmp( p_item->p_input->p_meta->psz_arturl, "file://", 7 ) )
+    {
+        fprintf( stderr, "Have art %s\n", p_item->p_input->p_meta->psz_arturl );
+        model->sendArt( qfu( p_item->p_input->p_meta->psz_arturl ) );
+    }
 }
 
 /*************************************************************************
@@ -593,6 +602,13 @@ void PLModel::UpdateTreeItem( playlist_item_t *p_item, PLItem *item,
 
 /************************* Actions ******************************/
 
+void PLModel::sendArt( QString url )
+{
+    QString arturl = url.replace( "file://",QString("" ) );
+    fprintf( stderr, "send %s\n", qta( arturl ) );
+    emit artSet( arturl );
+}
+
 /**
  * Deletion, here we have to do a ugly slow hack as we retrieve the full
  * list of indexes to delete at once: when we delete a node and all of
index 38efe739706d5ef1200403427b69dc944870210c..d7cbf652cc9c00754f242209ffc72fccc9a65f83 100644 (file)
@@ -121,6 +121,8 @@ public:
     void doDelete( QModelIndexList selected );
     void search( QString search );
     void sort( int column, Qt::SortOrder order );
+
+    void sendArt( QString url );
 private:
     void addCallbacks();
     void delCallbacks();
@@ -159,6 +161,8 @@ private:
     PLItem *p_cached_item_bi;
     int i_cached_id;
     int i_cached_input_id;
+signals:
+    void artSet( QString );
 public slots:
     void activateItem( const QModelIndex &index );
     void activateItem( playlist_item_t *p_item );