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 @@
#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()
......
......@@ -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
......@@ -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
{
......
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