#include "components/interface_widgets.hpp"
#include <assert.h>
+#include <vlc_url.h>
#include <QTreeWidget>
#include <QHeaderView>
#undef UPDATE_META_INT
#undef UPDATE_META
+ // If a artURL is available as a local file, directly display it !
+
+ QString file;
+ char *psz_art = input_item_GetArtURL( p_item );
+ if( psz_art && !strncmp( psz_art, "file://", 7 ) &&
+ decode_URI( psz_art + 7 ) )
+#ifdef WIN32
+ file = qfu( psz_art + 8 ); // Remove extra / on Win32 URI.
+#else
+ file = qfu( psz_art + 7 );
+#endif
+ free( psz_art );
+
+ art_cover->showArtUpdate( file );
+
}
/**
label->setMaximumWidth( MAX_BG_SIZE );
label->setMinimumHeight( MIN_BG_SIZE );
label->setMinimumWidth( MIN_BG_SIZE );
+ label->setAlignment( Qt::AlignCenter );
if( QDate::currentDate().dayOfYear() >= 354 )
label->setPixmap( QPixmap( ":/logo/vlc128-christmas.png" ) );
else
}
else
{
- label->setPixmap( QPixmap( url ) );
+ QPixmap pixmap( url );
+ if( pixmap.width() > label->maximumWidth() ||
+ pixmap.height() > label->maximumHeight() )
+ {
+ pixmap = pixmap.scaled( label->maximumWidth(),
+ label->maximumHeight(), Qt::KeepAspectRatio );
+ }
+
+ label->setPixmap( pixmap );
}
}
{
setContextMenuPolicy( Qt::ActionsContextMenu );
CONNECT( this, updateRequested(), this, askForUpdate() );
- CONNECT( THEMIM->getIM(), artChanged( QString ),
- this, showArtUpdate( const QString& ) );
setMinimumHeight( 128 );
setMinimumWidth( 128 );
setMaximumHeight( 128 );
setMaximumWidth( 128 );
- setScaledContents( true );
+ setScaledContents( false );
+ setAlignment( Qt::AlignCenter );
QList< QAction* > artActions = actions();
QAction *action = new QAction( qtr( "Download cover art" ), this );
QPixmap pix;
if( !url.isEmpty() && pix.load( url ) )
{
- setPixmap( pix );
+ pix = pix.scaled( maximumWidth(), maximumHeight(),
+ Qt::KeepAspectRatioByExpanding );
}
else
{
- setPixmap( QPixmap( ":/noart.png" ) );
+ pix = QPixmap( ":/noart.png" );
}
+ setPixmap( pix );
}
void CoverArtLabel::askForUpdate()
art = new ArtLabel( artContainer, p_intf );
art->setToolTip( qtr( "Double click to get media information" ) );
+ CONNECT( THEMIM->getIM(), artChanged( QString ),
+ art, showArtUpdate( const QString& ) );
+
artContLay->addWidget( art, 1 );
leftW->addWidget( artContainer );