]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/interface_widgets.cpp
UI: prefix/namespace resources for better maintainability
[vlc] / modules / gui / qt4 / components / interface_widgets.cpp
index a57cae171032d56cac4334340d4b6466b8ca32fd..5b4d532fc0f0cc7db35da773859644a94d7df8b9 100644 (file)
@@ -76,11 +76,6 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
        Widgets with this attribute set do not participate in composition
        management */
     setAttribute( Qt::WA_PaintOnScreen, true );
-
-    /* The core can ask through a callback to show the video. */
-    connect( this, SIGNAL(askVideoWidgetToShow( unsigned int, unsigned int)),
-             this, SLOT(SetSizing(unsigned int, unsigned int )),
-             Qt::BlockingQueuedConnection );
 }
 
 void VideoWidget::paintEvent(QPaintEvent *ev)
@@ -112,7 +107,6 @@ WId VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
         *pi_height = size().height();
     }
 
-    emit askVideoWidgetToShow( *pi_width, *pi_height );
     if( p_vout )
     {
         msg_Dbg( p_intf, "embedded video already in use" );
@@ -127,13 +121,13 @@ WId VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
 
 /* Set the Widget to the correct Size */
 /* Function has to be called by the parent
-   Parent has to care about resizing himself*/
+   Parent has to care about resizing itself */
 void VideoWidget::SetSizing( unsigned int w, unsigned int h )
 {
     msg_Dbg( p_intf, "Video is resizing to: %i %i", w, h );
     videoSize.rwidth() = w;
     videoSize.rheight() = h;
-    if( isHidden() ) show();
+    if( !isVisible() ) show();
     updateGeometry(); // Needed for deinterlace
 }
 
@@ -181,9 +175,9 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i )
     label->setMinimumHeight( MIN_BG_SIZE );
     label->setMinimumWidth( MIN_BG_SIZE );
     if( QDate::currentDate().dayOfYear() >= 354 )
-        label->setPixmap( QPixmap( ":/vlc128-christmas.png" ) );
+        label->setPixmap( QPixmap( ":/logo/vlc128-christmas.png" ) );
     else
-        label->setPixmap( QPixmap( ":/vlc128.png" ) );
+        label->setPixmap( QPixmap( ":/logo/vlc128.png" ) );
 
     QGridLayout *backgroundLayout = new QGridLayout( this );
     backgroundLayout->addWidget( label, 0, 1 );
@@ -191,7 +185,7 @@ BackgroundWidget::BackgroundWidget( intf_thread_t *_p_i )
     backgroundLayout->setColumnStretch( 2, 1 );
 
     CONNECT( THEMIM->getIM(), artChanged( QString ),
-             this, updateArt( QString ) );
+             this, updateArt( const QString& ) );
 }
 
 BackgroundWidget::~BackgroundWidget()
@@ -205,14 +199,14 @@ void BackgroundWidget::resizeEvent( QResizeEvent * event )
         label->show();
 }
 
-void BackgroundWidget::updateArt( QString url )
+void BackgroundWidget::updateArt( const QString& url )
 {
     if( url.isEmpty() )
     {
         if( QDate::currentDate().dayOfYear() >= 354 )
-            label->setPixmap( QPixmap( ":/vlc128-christmas.png" ) );
+            label->setPixmap( QPixmap( ":/logo/vlc128-christmas.png" ) );
         else
-            label->setPixmap( QPixmap( ":/vlc128.png" ) );
+            label->setPixmap( QPixmap( ":/logo/vlc128.png" ) );
     }
     else
     {
@@ -284,8 +278,7 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, const QString& text,
                         QWidget *parent )
            : QLabel( text, parent ), p_intf( _p_intf )
 {
-    setToolTip( qtr( "Current playback speed.\nRight click to adjust" ) );
-    setContextMenuPolicy ( Qt::CustomContextMenu );
+    setToolTip( qtr( "Current playback speed.\nClick to adjust" ) );
 
     /* Create the Speed Control Widget */
     speedControl = new SpeedControlWidget( p_intf, this );
@@ -295,16 +288,12 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, const QString& text,
     widgetAction->setDefaultWidget( speedControl );
     speedControlMenu->addAction( widgetAction );
 
-    /* Speed Label behaviour:
-       - right click gives the vertical speed slider */
-    CONNECT( this, customContextMenuRequested( QPoint ),
-             this, showSpeedMenu( QPoint ) );
-
     /* Change the SpeedRate in the Status Bar */
     CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) );
 
     CONNECT( THEMIM, inputChanged( input_thread_t * ),
              speedControl, activateOnState() );
+
 }
 SpeedLabel::~SpeedLabel()
 {
@@ -415,24 +404,25 @@ void SpeedControlWidget::resetRate()
 }
 
 CoverArtLabel::CoverArtLabel( QWidget *parent, intf_thread_t *_p_i )
-        : QLabel( parent ), p_intf( _p_i )
+              : QLabel( parent ), p_intf( _p_i )
 {
     setContextMenuPolicy( Qt::ActionsContextMenu );
-    CONNECT( this, updateRequested(), this, doUpdate() );
+    CONNECT( this, updateRequested(), this, askForUpdate() );
     CONNECT( THEMIM->getIM(), artChanged( QString ),
-             this, doUpdate( QString ) );
+             this, showArtUpdate( const QString& ) );
 
     setMinimumHeight( 128 );
     setMinimumWidth( 128 );
     setMaximumHeight( 128 );
     setMaximumWidth( 128 );
     setScaledContents( true );
+
     QList< QAction* > artActions = actions();
     QAction *action = new QAction( qtr( "Download cover art" ), this );
+    CONNECT( action, triggered(), this, askForUpdate() );
     addAction( action );
-    CONNECT( action, triggered(), this, doUpdate() );
 
-    doUpdate();
+    showArtUpdate( "" );
 }
 
 CoverArtLabel::~CoverArtLabel()
@@ -442,7 +432,7 @@ CoverArtLabel::~CoverArtLabel()
         removeAction( act );
 }
 
-void CoverArtLabel::doUpdate( QString url )
+void CoverArtLabel::showArtUpdate( const QString& url )
 {
     QPixmap pix;
     if( !url.isEmpty()  && pix.load( url ) )
@@ -455,7 +445,7 @@ void CoverArtLabel::doUpdate( QString url )
     }
 }
 
-void CoverArtLabel::doUpdate()
+void CoverArtLabel::askForUpdate()
 {
     THEMIM->getIM()->requestArtUpdate();
 }
@@ -506,7 +496,7 @@ void TimeLabel::setCaching( float f_cache )
     QString amount;
     amount.setNum( (int)(100 * f_cache) );
     msg_Dbg( p_intf, "New caching: %d", (int)(100*f_cache));
-    setText( "Buffering " + amount + "%" );
+    setText( "Buff: " + amount + "%" );
 }