⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interface_widgets.cpp

📁 VLC Player Source Code
💻 CPP
📖 第 1 页 / 共 4 页
字号:
}ControlsWidget::~ControlsWidget(){}void ControlsWidget::toggleTeletext(){    bool b_enabled = THEMIM->teletextState();    if( b_telexEnabled )    {        telexTransparent->setEnabled( false );        telexPage->setEnabled( false );        b_telexEnabled = false;    }    else if( b_enabled )    {        telexTransparent->setEnabled( true );        telexPage->setEnabled( true );        b_telexEnabled = true;    }}void ControlsWidget::enableTeletext( bool b_enable ){    telexFrame->setVisible( b_enable );    bool b_on = THEMIM->teletextState();    telexOn->setChecked( b_on );    telexTransparent->setEnabled( b_on );    telexPage->setEnabled( b_on );    b_telexEnabled = b_on;}void ControlsWidget::toggleTeletextTransparency(){    if( b_telexTransparent )    {        telexTransparent->setIcon( QIcon( ":/tvtelx" ) );        telexTransparent->setToolTip( qtr( "Teletext" ) );        b_telexTransparent = false;    }    else    {        telexTransparent->setIcon( QIcon( ":/tvtelx-transparent" ) );        telexTransparent->setToolTip( qtr( "Transparent" ) );        b_telexTransparent = true;    }}void ControlsWidget::stop(){    THEMIM->stop();}void ControlsWidget::play(){    if( THEPL->current.i_size == 0 )    {        /* The playlist is empty, open a file requester */        THEDP->openFileDialog();        setStatus( 0 );        return;    }    THEMIM->togglePlayPause();}void ControlsWidget::prev(){    THEMIM->prev();}void ControlsWidget::next(){    THEMIM->next();}void ControlsWidget::setNavigation( int navigation ){#define HELP_PCH N_( "Previous chapter" )#define HELP_NCH N_( "Next chapter" )    // 1 = chapter, 2 = title, 0 = no    if( navigation == 0 )    {        discFrame->hide();    } else if( navigation == 1 ) {        prevSectionButton->setToolTip( qtr( HELP_PCH ) );        nextSectionButton->setToolTip( qtr( HELP_NCH ) );        menuButton->show();        discFrame->show();    } else {        prevSectionButton->setToolTip( qtr( HELP_PCH ) );        nextSectionButton->setToolTip( qtr( HELP_NCH ) );        menuButton->hide();        discFrame->show();    }}static bool b_my_volume;void ControlsWidget::updateVolume( int i_sliderVolume ){    if( !b_my_volume )    {        int i_res = i_sliderVolume  * (AOUT_VOLUME_MAX / 2) / VOLUME_MAX;        aout_VolumeSet( p_intf, i_res );    }    if( i_sliderVolume == 0 )    {        volMuteLabel->setPixmap( QPixmap(":/volume-muted" ) );        volMuteLabel->setToolTip( qtr( "Unmute" ) );        return;    }    if( i_sliderVolume < VOLUME_MAX / 3 )        volMuteLabel->setPixmap( QPixmap( ":/volume-low" ) );    else if( i_sliderVolume > (VOLUME_MAX * 2 / 3 ) )        volMuteLabel->setPixmap( QPixmap( ":/volume-high" ) );    else volMuteLabel->setPixmap( QPixmap( ":/volume-medium" ) );    volMuteLabel->setToolTip( qtr( "Mute" ) );}void ControlsWidget::updateVolume(){    /* Audio part */    audio_volume_t i_volume;    aout_VolumeGet( p_intf, &i_volume );    i_volume = ( i_volume *  VOLUME_MAX )/ (AOUT_VOLUME_MAX/2);    int i_gauge = volumeSlider->value();    b_my_volume = false;    if( i_volume - i_gauge > 1 || i_gauge - i_volume > 1 )    {        b_my_volume = true;        volumeSlider->setValue( i_volume );        b_my_volume = false;    }}void ControlsWidget::updateInput(){    /* Activate the interface buttons according to the presence of the input */    enableInput( THEMIM->getIM()->hasInput() );    enableVideo( THEMIM->getIM()->hasVideo() );}void ControlsWidget::setStatus( int status ){    if( status == PLAYING_S ) /* Playing */    {        playButton->setIcon( QIcon( ":/pause_b" ) );        playButton->setToolTip( qtr( "Pause the playback" ) );    }    else    {        playButton->setIcon( QIcon( ":/play_b" ) );        playButton->setToolTip( qtr( I_PLAY_TOOLTIP ) );    }}/** * TODO * This functions toggle the fullscreen mode * If there is no video, it should first activate Visualisations... *  This has also to be fixed in enableVideo() */void ControlsWidget::fullscreen(){    vout_thread_t *p_vout =        (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );    if( p_vout)    {        var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) );        vlc_object_release( p_vout );    }}void ControlsWidget::extSettings(){    THEDP->extendedDialog();}void ControlsWidget::slower(){    THEMIM->getIM()->slower();}void ControlsWidget::faster(){    THEMIM->getIM()->faster();}void ControlsWidget::enableInput( bool enable ){    slowerButton->setEnabled( enable );    slider->setEnabled( enable );    if( !enable ) slider->setSliderPosition ( -1 );    fasterButton->setEnabled( enable );    /* Advanced Buttons too */    advControls->enableInput( enable );}void ControlsWidget::enableVideo( bool enable ){    // TODO Later make the fullscreenButton toggle Visualisation and so on.    fullscreenButton->setEnabled( enable );    /* Advanced Buttons too */    advControls->enableVideo( enable );}void ControlsWidget::toggleAdvanced(){    if( advControls && !b_advancedVisible )    {        advControls->show();        b_advancedVisible = true;    }    else    {        advControls->hide();        b_advancedVisible = false;    }    emit advancedControlsToggled( b_advancedVisible );}/********************************************************************** * Fullscrenn control widget **********************************************************************/FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i,        MainInterface *_p_mi, bool b_advControls, bool b_shiny )        : ControlsWidget( _p_i, _p_mi, b_advControls, b_shiny, true ),          i_mouse_last_x( -1 ), i_mouse_last_y( -1 ), b_mouse_over(false),          b_slow_hide_begin(false), i_slow_hide_timeout(1),          b_fullscreen( false ), i_hide_timeout( 1 ), p_vout(NULL){    setWindowFlags( Qt::ToolTip );    setFrameShape( QFrame::StyledPanel );    setFrameStyle( QFrame::Sunken );    setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );    QGridLayout *fsLayout = new QGridLayout( this );    fsLayout->setLayoutMargins( 5, 2, 5, 2, 5 );    /* First line */    slider->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum);    slider->setMinimumWidth( 220 );    fsLayout->addWidget( slowerButton, 0, 0 );    fsLayout->addWidget( slider, 0, 1, 1, 9 );    fsLayout->addWidget( fasterButton, 0, 10 );    fsLayout->addWidget( playButton, 1, 0, 1, 2 );    fsLayout->addLayout( controlButLayout, 1, 2 );    fsLayout->addWidget( discFrame, 1, 3 );    fsLayout->addWidget( telexFrame, 1, 4 );    fsLayout->addWidget( fullscreenButton, 1, 5 );    fsLayout->addWidget( advControls, 1, 6, Qt::AlignVCenter );    fsLayout->setColumnStretch( 7, 10 );    fsLayout->addWidget( volMuteLabel, 1, 8 );    fsLayout->addWidget( volumeSlider, 1, 9, 1, 2 );    /* hiding timer */    p_hideTimer = new QTimer( this );    CONNECT( p_hideTimer, timeout(), this, hideFSC() );    p_hideTimer->setSingleShot( true );    /* slow hiding timer */#if HAVE_TRANSPARENCY    p_slowHideTimer = new QTimer( this );    CONNECT( p_slowHideTimer, timeout(), this, slowHideFSC() );#endif    adjustSize ();  /* need to get real width and height for moving */    /* center down */    QDesktopWidget * p_desktop = QApplication::desktop();    move( p_desktop->width() / 2 - width() / 2,          p_desktop->height() - height() );#ifdef WIN32TRICK    setWindowOpacity( 0.0 );    b_fscHidden = true;    adjustSize();    show();#endif    fullscreenButton->setIcon( QIcon( ":/defullscreen" ) );    vlc_mutex_init_recursive( &lock );}FullscreenControllerWidget::~FullscreenControllerWidget(){    detachVout();    vlc_mutex_destroy( &lock );}/** * Show fullscreen controller */void FullscreenControllerWidget::showFSC(){    adjustSize();#ifdef WIN32TRICK    // after quiting and going to fs, we need to call show()    if( isHidden() )        show();    if( b_fscHidden )    {        b_fscHidden = false;        setWindowOpacity( 1.0 );    }#else    show();#endif#if HAVE_TRANSPARENCY    setWindowOpacity( DEFAULT_OPACITY );#endif}/** * Hide fullscreen controller * FIXME: under windows it have to be done by moving out of screen *        because hide() doesnt work */void FullscreenControllerWidget::hideFSC(){#ifdef WIN32TRICK    b_fscHidden = true;    setWindowOpacity( 0.0 );    // simulate hidding#else    hide();#endif}/** * Plane to hide fullscreen controller */void FullscreenControllerWidget::planHideFSC(){    vlc_mutex_lock( &lock );    int i_timeout = i_hide_timeout;    vlc_mutex_unlock( &lock );    p_hideTimer->start( i_timeout );#if HAVE_TRANSPARENCY    b_slow_hide_begin = true;    i_slow_hide_timeout = i_timeout;    p_slowHideTimer->start( i_slow_hide_timeout / 2 );#endif}/** * Hidding fullscreen controller slowly * Linux: need composite manager * Windows: it is blinking, so it can be enabled by define TRASPARENCY */void FullscreenControllerWidget::slowHideFSC(){#if HAVE_TRANSPARENCY    if( b_slow_hide_begin )    {        b_slow_hide_begin = false;        p_slowHideTimer->stop();        /* the last part of time divided to 100 pieces */        p_slowHideTimer->start( (int)( i_slow_hide_timeout / 2 / ( windowOpacity() * 100 ) ) );    }    else    {#ifdef WIN32TRICK         if ( windowOpacity() > 0.0 && !b_fscHidden )#else         if ( windowOpacity() > 0.0 )#endif         {             /* we should use 0.01 because of 100 pieces ^^^                but than it cannt be done in time */             setWindowOpacity( windowOpacity() - 0.02 );         }         if ( windowOpacity() <= 0.0 )             p_slowHideTimer->stop();    }#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -