]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/interface_widgets.cpp
implements --qt-keep-size (persistent main windows for qt4)
[vlc] / modules / gui / qt4 / components / interface_widgets.cpp
index 806e52c6301afe74e53580bb9d27bb2666283f57..3c07475c077d00ee9063c1751daf8a3362e4549e 100644 (file)
@@ -101,9 +101,17 @@ VideoWidget::~VideoWidget()
  * Request the video to avoid the conflicts
  **/
 void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
-                            unsigned int *pi_width, unsigned int *pi_height )
+                            unsigned int *pi_width, unsigned int *pi_height,
+                            bool b_keep_size )
 {
     msg_Dbg( p_intf, "Video was requested %i, %i", *pi_x, *pi_y );
+
+    if( b_keep_size )
+    {
+        *pi_width  = size().width();
+        *pi_height = size().height();
+    }
+
     emit askVideoWidgetToShow( *pi_width, *pi_height );
     if( p_vout )
     {
@@ -112,7 +120,7 @@ void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
     }
     p_vout = p_nvout;
 #ifndef NDEBUG
-    msg_Dbg( p_intf, "embedded video ready (handle %p)", winId() );
+    msg_Dbg( p_intf, "embedded video ready (handle %p)", (void *)winId() );
 #endif
     return ( void* )winId();
 }
@@ -215,6 +223,7 @@ void BackgroundWidget::updateArt( QString url )
 void BackgroundWidget::contextMenuEvent( QContextMenuEvent *event )
 {
     QVLCMenu::PopupMenu( p_intf, true );
+    event->accept();
 }
 
 #if 0
@@ -413,10 +422,21 @@ CoverArtLabel::CoverArtLabel( QWidget *parent, intf_thread_t *_p_i )
     setMaximumHeight( 128 );
     setMaximumWidth( 128 );
     setScaledContents( true );
+    QList< QAction* > artActions = actions();
+    QAction *action = new QAction( qtr( "Download cover art" ), this );
+    addAction( action );
+    CONNECT( action, triggered(), this, doUpdate() );
 
     doUpdate();
 }
 
+CoverArtLabel::~CoverArtLabel()
+{
+    QList< QAction* > artActions = actions();
+    foreach( QAction *act, artActions )
+        removeAction( act );
+}
+
 void CoverArtLabel::doUpdate( QString url )
 {
     QPixmap pix;
@@ -451,6 +471,12 @@ TimeLabel::TimeLabel( intf_thread_t *_p_intf  ) :QLabel(), p_intf( _p_intf )
 
 void TimeLabel::setDisplayPosition( float pos, int time, int length )
 {
+    if( pos == -1.f )
+    {
+        setText( " --:--/--:-- " );
+        return;
+    }
+
     char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
     secstotimestr( psz_length, length );
     secstotimestr( psz_time, ( b_remainingTime && length ) ? length - time
@@ -472,7 +498,10 @@ void TimeLabel::toggleTimeDisplay()
 
 void TimeLabel::setCaching( float f_cache )
 {
-    setText( "Buffering" );
+    QString amount;
+    amount.setNum( (int)(100 * f_cache) );
+    msg_Dbg( p_intf, "New caching: %d", (int)(100*f_cache));
+    setText( "Buffering " + amount + "%" );
 }