📄 intf.cpp
字号:
}/***************************************************************************** * DateDisplay: display date ***************************************************************************** * This function displays the current date in the date label. *****************************************************************************/void IntfWindow::DateDisplay( int i_range ){ if( p_intf->p_sys->p_input ) { char psz_time[ MSTRTIME_MAX_SIZE ]; int64_t i_seconds; i_seconds = var_GetTime( p_intf->p_sys->p_input, "time" ) / I64C(1000000 ); secstotimestr( psz_time, i_seconds ); p_date->setText( psz_time ); }}/***************************************************************************** * FileOpen: open a file ***************************************************************************** * This function opens a file requester and adds the selected file to * the playlist. *****************************************************************************/void IntfWindow::FileOpen( void ){ playlist_t *p_playlist; QString file = QFileDialog::getOpenFileName( QString::null, QString::null, this ); if( file.isEmpty() ) { statusBar()->message( "No file loaded", 2000 ); } else { p_playlist = (playlist_t *) vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist == NULL ) { return; } playlist_Add( p_playlist, file.latin1(), file.latin1(), PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); vlc_object_release( p_playlist ); }}/***************************************************************************** * FileQuit: terminate vlc *****************************************************************************/void IntfWindow::FileQuit( void ){ p_intf->p_vlc->b_die = VLC_TRUE;}/***************************************************************************** * About: display the "about" box ***************************************************************************** * This function displays a simple "about" box with copyright information. *****************************************************************************/void IntfWindow::About( void ){ QMessageBox::about( this, "About", "VLC media player\n" "(C) 1996 - 2004 - the VideoLAN Team\n" "\n" "This is the VLC media player, a DVD and MPEG player.\n" "It can play MPEG and MPEG 2 files from a file " "or from a network source.\n" "\n" "More information: http://www.videolan.org/" );}/***************************************************************************** * Manage: manage main thread messages ***************************************************************************** * In this function, called approx. 10 times a second, we check what the * main program wanted to tell us. *****************************************************************************/void IntfWindow::Manage( void ){ /* Update the input */ if( p_intf->p_sys->p_input == NULL ) { p_intf->p_sys->p_input = (input_thread_t *) vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); } else if( p_intf->p_sys->p_input->b_dead ) { vlc_object_release( p_intf->p_sys->p_input ); p_intf->p_sys->p_input = NULL; } /* Manage the slider */ if( p_intf->p_sys->p_input && p_intf->p_sys->p_input->stream.b_seekable ) { int i_value = p_slider->value();#define p_area p_intf->p_sys->p_input->stream.p_selected_area /* If the user hasn't touched the slider since the last time, * then the input can safely change it */ if( i_value == p_slider->oldvalue() ) { i_value = ( SLIDER_MAX * p_area->i_tell ) / p_area->i_size; p_slider->setValue( i_value ); p_slider->setOldValue( i_value ); } /* Otherwise, send message to the input if the user has * finished dragging the slider */ else if( p_slider->b_free ) { double f_pos = (double)i_value / (double)SLIDER_MAX; var_SetFloat( p_intf->p_sys->p_input, "position", f_pos ); /* Update the old value */ p_slider->setOldValue( i_value ); }#undef p_area } /* If the "display popup" flag has changed, popup the context menu */ if( p_intf->b_menu_change ) { p_popup->popup( QCursor::pos() ); p_intf->b_menu_change = 0; } if( p_intf->b_die ) { qApp->quit(); }}/***************************************************************************** * PlaybackPlay: play *****************************************************************************/void IntfWindow::PlaybackPlay( void ){ if( p_intf->p_sys->p_input != NULL ) { var_SetInteger( p_intf->p_sys->p_input, "state", PLAYING_S ); }}/***************************************************************************** * PlaybackPause: pause *****************************************************************************/void IntfWindow::PlaybackPause( void ){ if( p_intf->p_sys->p_input != NULL ) { var_SetInteger( p_intf->p_sys->p_input, "state", PAUSE_S ); }}/***************************************************************************** * PlaybackSlow: slow *****************************************************************************/void IntfWindow::PlaybackSlow( void ){ if( p_intf->p_sys->p_input != NULL ) { var_SetVoid( p_intf->p_sys->p_input, "rate-slower" ); }}/***************************************************************************** * PlaybackFast: fast *****************************************************************************/void IntfWindow::PlaybackFast( void ){ if( p_intf->p_sys->p_input != NULL ) { var_SetVoid( p_intf->p_sys->p_input, "rate-faster" ); }}/***************************************************************************** * PlaylistPrev: previous playlist entry *****************************************************************************/void IntfWindow::PlaylistPrev( void ){ playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist == NULL ) { return; } playlist_Prev( p_playlist ); vlc_object_release( p_playlist );}/***************************************************************************** * PlaylistNext: next playlist entry *****************************************************************************/void IntfWindow::PlaylistNext( void ){ playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist == NULL ) { return; } playlist_Next( p_playlist ); vlc_object_release( p_playlist );}/***************************************************************************** * IntfSlider: slider creator ***************************************************************************** * This function creates the slider, sets its default values, and connects * the interesting signals. *****************************************************************************/IntfSlider::IntfSlider( intf_thread_t *p_intf, QWidget *p_parent ) :QSlider( Horizontal, p_parent ){ this->p_intf = p_intf; setRange( SLIDER_MIN, SLIDER_MAX ); setPageStep( SLIDER_STEP ); setValue( SLIDER_MIN ); setOldValue( SLIDER_MIN ); setTracking( TRUE ); b_free = TRUE; connect( this, SIGNAL(sliderMoved(int)), this, SLOT(SlideStart()) ); connect( this, SIGNAL(sliderPressed()), this, SLOT(SlideStart()) ); connect( this, SIGNAL(sliderReleased()), this, SLOT(SlideStop()) );}/***************************************************************************** * ~IntfSlider: slider destructor ***************************************************************************** * This function is called when the interface slider is destroyed. *****************************************************************************/IntfSlider::~IntfSlider( void ){ /* We don't need to remove anything */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -