qt4 : QT4 album art in allways-video.
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 19 Aug 2007 00:20:09 +0000 (00:20 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 19 Aug 2007 00:20:09 +0000 (00:20 +0000)
Patch by Ilkka Ollakka, modified by myself to rip-off extra spaces, to modify a constant one and not 4 times, and functions placement in the code.

modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/main_interface.cpp

index 6261c61..2590afd 100644 (file)
@@ -38,7 +38,7 @@
 #include <QPalette>
 #include <QResizeEvent>
 
-#define ICON_SIZE 128
+#define ICON_SIZE 300
 
 /**********************************************************************
  * Video Widget. A simple frame on which video is drawn
@@ -113,7 +113,6 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) :
     plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
     setPalette( plt );
 
-    backgroundLayout = new QHBoxLayout;
     label = new QLabel( "" );
     label->setMaximumHeight( ICON_SIZE );
     label->setMaximumWidth( ICON_SIZE );
@@ -130,6 +129,14 @@ BackgroundWidget::~BackgroundWidget()
     delete backgroundLayout;
 }
 
+void BackgroundWidget::setArt( QString url )
+{
+    if( url.isNull() )
+        label->setPixmap( QPixmap( ":/vlc128.png" ) );
+    else
+        label->setPixmap( QPixmap( url ) );
+}
+
 QSize BackgroundWidget::sizeHint() const
 {
     return widgetSize;
@@ -338,6 +345,7 @@ void PlaylistWidget::setArt( QString url )
     else if( prevArt != url )
         art->setPixmap( QPixmap( url ) );
     prevArt = url;
+    emit artSet( url );
 }
 
 PlaylistWidget::~PlaylistWidget()
index 9896eb8..58577d9 100644 (file)
@@ -79,6 +79,8 @@ private:
     int DrawBackground();
     int CleanBackground();
     intf_thread_t *p_intf;
+private slots:
+    void setArt( QString );
 };
 
 class VisualSelector : public QFrame
@@ -145,6 +147,7 @@ private slots:
     void setArt( QString );
 signals:
     void rootChanged( int );
+    void artSet( QString );
 };
 
 #endif
index da58c5e..ceeb093 100644 (file)
@@ -346,7 +346,7 @@ void MainInterface::handleMainUi( QSettings *settings )
     {
         bgWidget = new BackgroundWidget( p_intf );
         bgWidget->widgetSize = settings->value( "backgroundSize",
-                                           QSize( 200, 200 ) ).toSize();
+                                           QSize( 300, 300 ) ).toSize();
         bgWidget->resize( bgWidget->widgetSize );
         bgWidget->updateGeometry();
         mainLayout->insertWidget( 0, bgWidget );
@@ -569,7 +569,7 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
         if( VISIBLE( bgWidget) )
         {
             bgWasVisible = true;
-//            bgWidget->hide();
+            bgWidget->hide();
         }
         if( THEMIM->getIM()->hasVideo() || !bgWasVisible )
         {
@@ -595,9 +595,9 @@ void MainInterface::releaseVideo( void *p_win )
     videoWidget->resize( videoWidget->widgetSize );
 
     if( embeddedPlaylistWasActive )
-        ;//playlistWidget->show();
+        playlistWidget->show();
     else if( bgWidget )
-        ;//bgWidget->show();
+        bgWidget->show();
 
     videoIsActive = false;
     need_components_update = true;
@@ -714,17 +714,20 @@ void MainInterface::playlist()
         playlistWidget->widgetSize = settings->value( "playlistSize",
                                                QSize( 650, 310 ) ).toSize();
         playlistWidget->hide();
+        if(bgWidget)
+        CONNECT( playlistWidget, artSet( QString ), bgWidget, setArt(QString) );
     }
     if( VISIBLE( playlistWidget ) )
     {
         playlistWidget->hide();
+        if( bgWidget ) bgWidget->show();
         if( videoIsActive )
         {
             videoWidget->widgetSize = savedVideoSize;
             videoWidget->resize( videoWidget->widgetSize );
             videoWidget->updateGeometry();
+            if( bgWidget ) bgWidget->hide();
         }
-        if( bgWidget ) bgWidget->show();
     }
     else
     {