Changeset 48018aedd562fa8751c620583e1e09852c79e1be

Show
Ignore:
Timestamp:
24/08/08 08:30:51 (3 months ago)
Author:
Jean-Baptiste Kempf <jb@videolan.org>
git-committer:
Jean-Baptiste Kempf <jb@videolan.org> 1219559451 -0700
git-parent:

[ac495caa3816336ac9a2cece655cd69aa149fcbc]

git-author:
Jean-Baptiste Kempf <jb@videolan.org> 1219559363 -0700
Message:

Video Widget cleaning. Corrections of previous commits.

zoom and resize when stop should be fixed. #1652 and #1716

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/gui/qt4/components/interface_widgets.cpp

    ra0841e0 r48018ae  
    6868    /* Init */ 
    6969    i_vout = 0; 
    70     hide(); setMinimumSize( 16, 16 ); 
    7170    videoSize.rwidth() = -1; 
    7271    videoSize.rheight() = -1; 
     72 
     73    hide(); 
     74 
     75    /* Set the policy to expand in both directions */ 
    7376    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); 
    7477 
    75     /* Black background is more coherent for a Video Widget IMVHO */ 
     78    /* Black background is more coherent for a Video Widget */ 
    7679    QPalette plt =  palette(); 
    77     plt.setColor( QPalette::Active, QPalette::Window , Qt::black ); 
    78     plt.setColor( QPalette::Inactive, QPalette::Window , Qt::black ); 
     80    plt.setColor( QPalette::Window, Qt::black ); 
    7981    setPalette( plt ); 
     82    setAutoFillBackground(true); 
     83 
     84    /* Indicates that the widget wants to draw directly onto the screen. 
     85       Widgets with this attribute set do not participate in composition 
     86       management */ 
    8087    setAttribute( Qt::WA_PaintOnScreen, true ); 
    8188 
     
    8693             Qt::BlockingQueuedConnection ); 
    8794#else 
    88 #error This is broken. Fix it with a QEventLoop with a processEvents ()  
     95#warning This is broken. Fix it with a QEventLoop with a processEvents () 
    8996    connect( this, SIGNAL(askVideoWidgetToShow( unsigned int, unsigned int)), 
    9097             this, SLOT(SetSizing(unsigned int, unsigned int )) ); 
     
    100107} 
    101108 
     109/* Kill the vout at Destruction */ 
    102110VideoWidget::~VideoWidget() 
    103111{ 
    104     vout_thread_t *p_vout = i_vout 
    105         ? (vout_thread_t *)vlc_object_get( i_vout ) : NULL; 
     112    vout_thread_t *p_vout = i_vout ? 
     113        (vout_thread_t *)vlc_object_get( i_vout ) : NULL; 
    106114 
    107115    if( p_vout ) 
     
    135143    } 
    136144    i_vout = p_nvout->i_object_id; 
     145#ifndef NDEBUG 
    137146    msg_Dbg( p_intf, "embedded video ready (handle %p)", winId() ); 
     147#endif 
    138148    return ( void* )winId(); 
    139149} 
     
    157167    videoSize.rwidth() = 0; 
    158168    videoSize.rheight() = 0; 
     169    updateGeometry(); 
    159170    hide(); 
    160     updateGeometry(); // Needed for deinterlace 
    161171} 
    162172 
  • modules/gui/qt4/components/interface_widgets.hpp

    r76dfb93 r48018ae  
    4242#include <QFrame> 
    4343 
    44 #define VOLUME_MAX 200 
    45  
    46 /* on WIN32 hide() for fullscreen controller doesnt work, so it have to be 
    47    done by trick with setting the opacity of window */ 
    48 #ifdef WIN32 
    49     #define WIN32TRICK 
    50 #endif 
    51  
    52 /* to trying transparency with fullscreen controller on windows enable that */ 
    53 /* it can be enabled on-non windows systems, 
    54    but it will be transparent only with composite manager */ 
    55 #ifndef WIN32 
    56     #define HAVE_TRANSPARENCY 1 
    57 #else 
    58     #define HAVE_TRANSPARENCY 0 
    59 #endif 
    60  
    61 /* Default value of opacity for FS controller */ 
    62 #define DEFAULT_OPACITY 0.75 
    63  
    6444class ResizeEvent; 
    6545class QPalette; 
     
    241221}; 
    242222 
     223/* on WIN32 hide() for fullscreen controller doesnt work, so it have to be 
     224   done by trick with setting the opacity of window */ 
     225#ifdef WIN32 
     226    #define WIN32TRICK 
     227#endif 
     228 
     229/* to trying transparency with fullscreen controller on windows enable that */ 
     230/* it can be enabled on-non windows systems, 
     231   but it will be transparent only with composite manager */ 
     232#ifndef WIN32 
     233    #define HAVE_TRANSPARENCY 1 
     234#else 
     235    #define HAVE_TRANSPARENCY 0 
     236#endif 
     237 
     238/* Default value of opacity for FS controller */ 
     239#define DEFAULT_OPACITY 0.75 
     240 
    243241/*********************************** 
    244242 * Fullscreen controller 
     
    303301 
    304302 
    305  
     303#define VOLUME_MAX 200 
    306304class VolumeClickHandler : public QObject 
    307305{ 
  • modules/gui/qt4/main_interface.cpp

    rda38842 r48018ae  
    22 * main_interface.cpp : Main interface 
    33 **************************************************************************** 
    4  * Copyright (C) 2006-2007 the VideoLAN team 
     4 * Copyright (C) 2006-2008 the VideoLAN team 
    55 * $Id$ 
    66 * 
     
    5252#include <QSlider> 
    5353#include <QWidgetAction> 
    54 #if 0 
    55 #include <QDockWidget> 
    56 #endif 
    5754#include <QToolBar> 
    5855#include <QGroupBox> 
     
    6259#include <vlc_keys.h> 
    6360#include <vlc_vout.h> 
    64  
    65 #define SET_WIDTH(i,j) i->widgetSize.setWidth(j) 
    66 #define SET_HEIGHT(i,j) i->widgetSize.setHeight(j) 
    67 #define SET_WH( i,j,k) i->widgetSize.setWidth(j); i->widgetSize.setHeight(k); 
    68  
    69 #define DS(i) i.width(),i.height() 
    7061 
    7162/* Callback prototypes */ 
     
    113104    settings->beginGroup( "MainWindow" ); 
    114105 
    115     //TODO: I don't like that code 
    116     visualSelectorEnabled = settings->value( "visual-selector", false ).toBool(); 
     106    /* Visualisation, not really used yet */ 
     107    visualSelectorEnabled = settings->value( "visual-selector", false).toBool(); 
     108 
     109    /* Do we want anoying popups or not */ 
    117110    notificationEnabled = (bool)config_GetInt( p_intf, "qt-notification" ); 
    118111 
     
    135128#endif 
    136129 
    137     /************ 
    138      * Menu Bar 
    139      ************
     130    /************************** 
     131     * Menu Bar and Status Bar 
     132     **************************
    140133    QVLCMenu::createMenuBar( this, p_intf, visualSelectorEnabled ); 
    141  
    142134    /* StatusBar Creation */ 
    143135    createStatusBar(); 
     
    198190    /** OnTimeOut **/ 
    199191    /* TODO Remove this function, but so far, there is no choice because there 
    200        is no intf-should-die variable */ 
     192       is no intf-should-die variable #1365 */ 
    201193    ON_TIMEOUT( updateOnTimer() ); 
    202     //ON_TIMEOUT( debug() ); 
    203  
    204     /** 
     194 
     195    /************ 
    205196     * Callbacks 
    206      **
     197     ************
    207198    var_Create( p_intf, "interaction", VLC_VAR_ADDRESS ); 
    208199    var_AddCallback( p_intf, "interaction", InteractCallback, this ); 
     
    214205    var_AddCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf ); 
    215206 
    216     /* VideoWidget connect mess to avoid different threads speaking to each other */ 
     207 
     208    /* VideoWidget connects to avoid different threads speaking to each other */ 
    217209    CONNECT( this, askReleaseVideo( void * ), 
    218210             this, releaseVideoSlot( void * ) ); 
     
    231223    settings->endGroup(); 
    232224 
     225 
     226    /* Final sizing and showing */ 
     227    setMinimumWidth( __MAX( controls->sizeHint().width(), 
     228                            menuBar()->sizeHint().width() ) ); 
    233229    show(); 
    234230 
     231    /* And switch to minimal view if needed 
     232       Must be called after the show() */ 
    235233    if( i_visualmode == QT_MINIMAL_MODE ) 
    236234        toggleMinimalView(); 
     
    238236    /* Update the geometry TODO: is it useful ?*/ 
    239237    updateGeometry(); 
    240     resize( sizeHint() ); 
     238    //    resize( sizeHint() ); 
    241239 
    242240    /***************************************************** 
     
    307305    nameLabel->setFrameStyle( QFrame::Sunken | QFrame::StyledPanel); 
    308306 
    309  
    310307    /* and adding those */ 
    311308    statusBar()->addWidget( nameLabel, 8 ); 
     
    545542QSize MainInterface::sizeHint() const 
    546543{ 
    547     int nwidth  = __MAX( controls->sizeHint().width(), 
    548                          menuBar()->sizeHint().width() ); 
     544    int nwidth  = controls->sizeHint().width(); 
    549545    int nheight = controls->isVisible() ? 
    550546                  controls->size().height() 
     
    553549                  : 0 ; 
    554550 
    555     msg_Dbg( p_intf, "1 %i %i", nheight, nwidth ); 
    556551    if( VISIBLE( bgWidget ) ) 
    557552    { 
    558553        nheight += bgWidget->size().height(); 
    559554        nwidth  = bgWidget->size().width(); 
    560         msg_Dbg( p_intf, "1b %i %i", nheight, nwidth ); 
    561     } 
    562     else if( videoIsActive ) 
     555    } 
     556    else if( videoIsActive && videoWidget->isVisible() ) 
    563557    { 
    564558        nheight += videoWidget->sizeHint().height(); 
    565559        nwidth  = videoWidget->sizeHint().width(); 
    566         msg_Dbg( p_intf, "2 %i %i", nheight, nwidth ); 
    567560    } 
    568561#if 0 
     
    571564        nheight += dockPL->size().height(); 
    572565        nwidth = __MAX( nwidth, dockPL->size().width() ); 
    573         msg_Dbg( p_intf, "3 %i %i", nheight, nwidth ); 
     566        msg_Warn( p_intf, "3 %i %i", nheight, nwidth ); 
    574567    } 
    575568#endif 
    576     msg_Dbg( p_intf, "4 %i %i", nheight, nwidth ); 
    577569    return QSize( nwidth, nheight ); 
    578570} 
    579  
    580 #if 0 
    581 /* FIXME This is dead code and need to be removed AT THE END */ 
    582 void MainInterface::resizeEvent( QResizeEvent *e ) 
    583 { 
    584     if( videoWidget ) 
    585         videoWidget->widgetSize.setWidth( e->size().width() - addSize.width() ); 
    586     if( videoWidget && videoIsActive && videoWidget->widgetSize.height() > 1 ) 
    587     { 
    588         SET_WH( videoWidget, e->size().width() - addSize.width(), 
    589                              e->size().height()  - addSize.height() ); 
    590         videoWidget->updateGeometry(); 
    591     } 
    592     if( VISIBLE( playlistWidget ) ) 
    593     { 
    594 //        SET_WH( playlistWidget , e->size().width() - addSize.width(), 
    595               //                   e->size().height() - addSize.height() ); 
    596         playlistWidget->updateGeometry(); 
    597     } 
    598 } 
    599 #endif 
    600571 
    601572void MainInterface::toggleFSC() 
     
    606577   QApplication::postEvent( fullscreenControls, static_cast<QEvent *>(eShow) ); 
    607578} 
    608 #if 0 
    609 void MainInterface::requestLayoutUpdate() 
    610 
    611     emit askUpdate(); 
    612 
    613 #endif 
     579 
    614580 
    615581//FIXME remove me at the end... 
    616582void MainInterface::debug() 
    617583{ 
     584#ifndef NDEBUG 
    618585    msg_Dbg( p_intf, "size: %i - %i", size().height(), size().width() ); 
    619586    msg_Dbg( p_intf, "sizeHint: %i - %i", sizeHint().height(), sizeHint().width() ); 
    620587    if( videoWidget && videoWidget->isVisible() ) 
    621588    { 
    622 //    sleep( 10 ); 
    623     msg_Dbg( p_intf, "size: %i - %i", size().height(), size().width() ); 
    624     msg_Dbg( p_intf, "sizeHint: %i - %i", sizeHint().height(), sizeHint().width() ); 
     589        //    sleep( 10 ); 
     590        msg_Dbg( p_intf, "size: %i - %i", size().height(), size().width() ); 
     591        msg_Dbg( p_intf, "sizeHint: %i - %i", sizeHint().height(), sizeHint().width() ); 
    625592    } 
    626593    adjustSize(); 
     594#endif 
    627595} 
    628596 
     
    639607 * Video Handling 
    640608 ****************************************************************************/ 
     609 
     610/* This event is used to deal with the fullscreen and always on top 
     611   issue conflict (bug in wx) */ 
    641612class SetVideoOnTopQtEvent : public QEvent 
    642613{ 
     
    646617    {} 
    647618 
    648     bool OnTop() const 
    649     { 
    650         return onTop; 
    651     } 
     619    bool OnTop() const { return onTop; } 
    652620 
    653621private: 
     
    656624 
    657625/** 
    658  * README 
    659626 * README 
    660627 * Thou shall not call/resize/hide widgets from on another thread. 
     
    665632                                   unsigned int *pi_height ) 
    666633{ 
    667     bgWasVisible = false; 
    668  
    669634    /* Request the videoWidget */ 
    670635    void *ret = videoWidget->request( p_nvout,pi_x, pi_y, pi_width, pi_height ); 
     
    677642            emit askBgWidgetToToggle(); 
    678643        } 
    679 #if 0 
    680         if( THEMIM->getIM()->hasVideo() || !bgWasVisible ) 
    681         { 
    682             videoWidget->widgetSize = QSize( *pi_width, *pi_height ); 
    683         } 
    684         else /* Background widget available, use its size */ 
    685         { 
    686             /* Ok, our visualizations are bad, so don't do this for the moment 
    687              * use the requested size anyway */ 
    688             // videoWidget->widgetSize = bgWidget->widgeTSize; 
    689             videoWidget->widgetSize = QSize( *pi_width, *pi_height ); 
    690         } 
    691 #endif 
     644        else 
     645            bgWasVisible = false; 
     646 
     647        /* Consider the video active now */ 
    692648        videoIsActive = true; 
    693649 
    694 //        emit askVideoToResize( *pi_width, *pi_height ); 
    695650        emit askUpdate(); 
    696651 
     
    700655} 
    701656 
     657/* Call from the WindowClose function */ 
    702658void MainInterface::releaseVideo( void *p_win ) 
    703659{ 
     
    707663} 
    708664 
     665/* Function that is CONNECTED to the previous emit */ 
    709666void MainInterface::releaseVideoSlot( void *p_win ) 
    710667{ 
    711668    videoWidget->release( p_win ); 
    712     videoWidget->hide(); 
    713669 
    714670    if( bgWasVisible ) 
    715671    { 
     672        /* Reset the bg state */ 
    716673        bgWasVisible = false; 
    717674        bgWidget->show(); 
    718675    } 
    719676 
    720     videoIsActive = false; 
    721     if( !isFullScreen() ) adjustSize(); 
    722 
    723  
     677    /* Try to resize, except when you are in Fullscreen mode */ 
     678    if( !isFullScreen() ) doComponentsUpdate(); 
     679
     680 
     681/* Call from WindowControl function */ 
    724682int MainInterface::controlVideo( void *p_window, int i_query, va_list args ) 
    725683{ 
     
    826784        { 
    827785            /* If video is visible, then toggle the status of bgWidget */ 
    828             bgWasVisible = !bgWasVisible;       
     786            bgWasVisible = !bgWasVisible; 
    829787        } 
    830788    } 
     
    841799{ 
    842800    msg_Dbg( p_intf, "Updating the geometry" ); 
    843 //    resize( sizeHint() ); 
    844     debug(); 
     801    //    resize( sizeHint() ); 
     802    adjustSize(); 
    845803} 
    846804 
  • modules/gui/qt4/main_interface.hpp

    rd197ab1 r48018ae  
    7676    int controlVideo( void *p_window, int i_query, va_list args ); 
    7777 
    78 #if 0 
    79     void requestLayoutUpdate(); 
    80 #endif 
    8178    /* Getters */ 
    8279    QSystemTrayIcon *getSysTray() { return sysTray; };