plt.setColor( QPalette::Window, Qt::black );
stable->setPalette( plt );
stable->setAutoFillBackground(true);
+ /* Force the widget to be native so that it gets a winId() */
+ stable->setAttribute( Qt::WA_NativeWindow, true );
/* Indicates that the widget wants to draw directly onto the screen.
Widgets with this attribute set do not participate in composition
management */
/* This is currently disabled on X11 as it does not seem to improve
* performance, but causes the video widget to be transparent... */
-#ifndef Q_WS_X11
+#if !defined (Q_WS_X11) && !defined (Q_WS_QPA)
stable->setAttribute( Qt::WA_PaintOnScreen, true );
#endif
setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
setLineWidth( 1 );
- setRate( var_InheritFloat( p_intf, "rate" ) );
+ setRate( var_InheritFloat( THEPL, "rate" ) );
}
SpeedLabel::~SpeedLabel()
}
CoverArtLabel::CoverArtLabel( QWidget *parent, intf_thread_t *_p_i )
- : QLabel( parent ), p_intf( _p_i )
+ : QLabel( parent ), p_intf( _p_i ), p_item( NULL )
{
setContextMenuPolicy( Qt::ActionsContextMenu );
- CONNECT( this, updateRequested(), this, askForUpdate() );
+ CONNECT( THEMIM->getIM(), artChanged( input_item_t * ),
+ this, showArtUpdate( input_item_t * ) );
setMinimumHeight( 128 );
setMinimumWidth( 128 );
- setMaximumHeight( 128 );
setScaledContents( false );
setAlignment( Qt::AlignCenter );
- QList< QAction* > artActions = actions();
QAction *action = new QAction( qtr( "Download cover art" ), this );
CONNECT( action, triggered(), this, askForUpdate() );
addAction( action );
QList< QAction* > artActions = actions();
foreach( QAction *act, artActions )
removeAction( act );
+ if ( p_item ) vlc_gc_decref( p_item );
+}
+
+void CoverArtLabel::setItem( input_item_t *_p_item )
+{
+ if ( p_item ) vlc_gc_decref( p_item );
+ p_item = _p_item;
+ if ( p_item ) vlc_gc_incref( p_item );
}
void CoverArtLabel::showArtUpdate( const QString& url )
QPixmap pix;
if( !url.isEmpty() && pix.load( url ) )
{
- pix = pix.scaled( minimumWidth(), maximumHeight(),
+ pix = pix.scaled( minimumWidth(), minimumHeight(),
Qt::KeepAspectRatioByExpanding,
Qt::SmoothTransformation );
}
setPixmap( pix );
}
+void CoverArtLabel::showArtUpdate( input_item_t *_p_item )
+{
+ /* not for me */
+ if ( _p_item != p_item )
+ return;
+
+ QString url;
+ if ( _p_item ) url = THEMIM->getIM()->decodeArtURL( _p_item );
+ showArtUpdate( url );
+}
+
void CoverArtLabel::askForUpdate()
{
- THEMIM->getIM()->requestArtUpdate();
+ THEMIM->getIM()->requestArtUpdate( p_item );
}
TimeLabel::TimeLabel( intf_thread_t *_p_intf, TimeLabel::Display _displayType )
buffering( false ), showBuffering(false), bufVal( -1 ), displayType( _displayType )
{
b_remainingTime = false;
+ if( _displayType != TimeLabel::Elapsed )
+ b_remainingTime = getSettings()->value( "MainWindow/ShowRemainingTime", false ).toBool();
switch( _displayType ) {
case TimeLabel::Elapsed:
setText( " --:-- " );
// compute the minimum size that will be required for the psz_length
// and use it to enforce a minimal size to avoid "dancing" widgets
- QSize minsize;
+ QSize minsize( 0, 0 );
if ( length > 0 )
{
QMargins margins = contentsMargins();
void TimeLabel::toggleTimeDisplay()
{
b_remainingTime = !b_remainingTime;
+ getSettings()->setValue( "MainWindow/ShowRemainingTime", b_remainingTime );
}