Commit 81ffa2cc authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

qt4 : QT4 album art in allways-video.

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.
parent c809e98f
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include <QPalette> #include <QPalette>
#include <QResizeEvent> #include <QResizeEvent>
#define ICON_SIZE 128 #define ICON_SIZE 300
/********************************************************************** /**********************************************************************
* Video Widget. A simple frame on which video is drawn * Video Widget. A simple frame on which video is drawn
...@@ -113,7 +113,6 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) : ...@@ -113,7 +113,6 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i ) :
plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black ); plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black );
setPalette( plt ); setPalette( plt );
backgroundLayout = new QHBoxLayout;
label = new QLabel( "" ); label = new QLabel( "" );
label->setMaximumHeight( ICON_SIZE ); label->setMaximumHeight( ICON_SIZE );
label->setMaximumWidth( ICON_SIZE ); label->setMaximumWidth( ICON_SIZE );
...@@ -130,6 +129,14 @@ BackgroundWidget::~BackgroundWidget() ...@@ -130,6 +129,14 @@ BackgroundWidget::~BackgroundWidget()
delete backgroundLayout; delete backgroundLayout;
} }
void BackgroundWidget::setArt( QString url )
{
if( url.isNull() )
label->setPixmap( QPixmap( ":/vlc128.png" ) );
else
label->setPixmap( QPixmap( url ) );
}
QSize BackgroundWidget::sizeHint() const QSize BackgroundWidget::sizeHint() const
{ {
return widgetSize; return widgetSize;
...@@ -338,6 +345,7 @@ void PlaylistWidget::setArt( QString url ) ...@@ -338,6 +345,7 @@ void PlaylistWidget::setArt( QString url )
else if( prevArt != url ) else if( prevArt != url )
art->setPixmap( QPixmap( url ) ); art->setPixmap( QPixmap( url ) );
prevArt = url; prevArt = url;
emit artSet( url );
} }
PlaylistWidget::~PlaylistWidget() PlaylistWidget::~PlaylistWidget()
......
...@@ -79,6 +79,8 @@ private: ...@@ -79,6 +79,8 @@ private:
int DrawBackground(); int DrawBackground();
int CleanBackground(); int CleanBackground();
intf_thread_t *p_intf; intf_thread_t *p_intf;
private slots:
void setArt( QString );
}; };
class VisualSelector : public QFrame class VisualSelector : public QFrame
...@@ -145,6 +147,7 @@ private slots: ...@@ -145,6 +147,7 @@ private slots:
void setArt( QString ); void setArt( QString );
signals: signals:
void rootChanged( int ); void rootChanged( int );
void artSet( QString );
}; };
#endif #endif
...@@ -346,7 +346,7 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -346,7 +346,7 @@ void MainInterface::handleMainUi( QSettings *settings )
{ {
bgWidget = new BackgroundWidget( p_intf ); bgWidget = new BackgroundWidget( p_intf );
bgWidget->widgetSize = settings->value( "backgroundSize", bgWidget->widgetSize = settings->value( "backgroundSize",
QSize( 200, 200 ) ).toSize(); QSize( 300, 300 ) ).toSize();
bgWidget->resize( bgWidget->widgetSize ); bgWidget->resize( bgWidget->widgetSize );
bgWidget->updateGeometry(); bgWidget->updateGeometry();
mainLayout->insertWidget( 0, bgWidget ); mainLayout->insertWidget( 0, bgWidget );
...@@ -569,7 +569,7 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x, ...@@ -569,7 +569,7 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
if( VISIBLE( bgWidget) ) if( VISIBLE( bgWidget) )
{ {
bgWasVisible = true; bgWasVisible = true;
// bgWidget->hide(); bgWidget->hide();
} }
if( THEMIM->getIM()->hasVideo() || !bgWasVisible ) if( THEMIM->getIM()->hasVideo() || !bgWasVisible )
{ {
...@@ -595,9 +595,9 @@ void MainInterface::releaseVideo( void *p_win ) ...@@ -595,9 +595,9 @@ void MainInterface::releaseVideo( void *p_win )
videoWidget->resize( videoWidget->widgetSize ); videoWidget->resize( videoWidget->widgetSize );
if( embeddedPlaylistWasActive ) if( embeddedPlaylistWasActive )
;//playlistWidget->show(); playlistWidget->show();
else if( bgWidget ) else if( bgWidget )
;//bgWidget->show(); bgWidget->show();
videoIsActive = false; videoIsActive = false;
need_components_update = true; need_components_update = true;
...@@ -714,17 +714,20 @@ void MainInterface::playlist() ...@@ -714,17 +714,20 @@ void MainInterface::playlist()
playlistWidget->widgetSize = settings->value( "playlistSize", playlistWidget->widgetSize = settings->value( "playlistSize",
QSize( 650, 310 ) ).toSize(); QSize( 650, 310 ) ).toSize();
playlistWidget->hide(); playlistWidget->hide();
if(bgWidget)
CONNECT( playlistWidget, artSet( QString ), bgWidget, setArt(QString) );
} }
if( VISIBLE( playlistWidget ) ) if( VISIBLE( playlistWidget ) )
{ {
playlistWidget->hide(); playlistWidget->hide();
if( bgWidget ) bgWidget->show();
if( videoIsActive ) if( videoIsActive )
{ {
videoWidget->widgetSize = savedVideoSize; videoWidget->widgetSize = savedVideoSize;
videoWidget->resize( videoWidget->widgetSize ); videoWidget->resize( videoWidget->widgetSize );
videoWidget->updateGeometry(); videoWidget->updateGeometry();
if( bgWidget ) bgWidget->hide();
} }
if( bgWidget ) bgWidget->show();
} }
else else
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment