📄 open.cpp
字号:
} break; } mrl_combo->SetValue( mrltemp );}/***************************************************************************** * Events methods. *****************************************************************************/void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) ){ mrl = SeparateEntries( mrl_combo->GetValue() ); mrl_combo->Append( mrl_combo->GetValue() ); if( mrl_combo->GetCount() > 10 ) mrl_combo->Delete( 0 ); mrl_combo->SetSelection( mrl_combo->GetCount() - 1 ); if( i_method == OPEN_STREAM ) { Hide(); return; } /* Update the playlist */ playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist == NULL ) return; for( int i = 0; i < (int)mrl.GetCount(); i++ ) { vlc_bool_t b_start = !i && i_open_arg; playlist_item_t *p_item = playlist_ItemNew( p_intf, (const char*)mrl[i].mb_str(), (const char *)mrl[i].mb_str() ); /* Insert options */ while( i + 1 < (int)mrl.GetCount() && ((const char *)mrl[i + 1].mb_str())[0] == ':' ) { playlist_ItemAddOption( p_item, mrl[i + 1].mb_str() ); i++; } /* Get the options from the subtitles dialog */ if( subsfile_checkbox->IsChecked() && subsfile_mrl.GetCount() ) { for( int j = 0; j < (int)subsfile_mrl.GetCount(); j++ ) { playlist_ItemAddOption( p_item, subsfile_mrl[j].mb_str() ); } } /* Get the options from the stream output dialog */ if( sout_checkbox->IsChecked() && sout_mrl.GetCount() ) { for( int j = 0; j < (int)sout_mrl.GetCount(); j++ ) { playlist_ItemAddOption( p_item, sout_mrl[j].mb_str() ); } } int i_id = playlist_AddItem( p_playlist, p_item, PLAYLIST_APPEND, PLAYLIST_END ); if( b_start ) { int i_pos = playlist_GetPositionById( p_playlist , i_id ); playlist_Command( p_playlist, PLAYLIST_GOTO, i_pos ); } } //TogglePlayButton( PLAYING_S ); vlc_object_release( p_playlist ); Hide();}void OpenDialog::OnCancel( wxCommandEvent& WXUNUSED(event) ){ Hide();}void OpenDialog::OnPageChange( wxNotebookEvent& event ){ UpdateMRL( event.GetSelection() );}void OpenDialog::OnMRLChange( wxCommandEvent& event ){ //mrl = SeparateEntries( event.GetString() );}/***************************************************************************** * File panel event methods. *****************************************************************************/void OpenDialog::OnFilePanelChange( wxCommandEvent& WXUNUSED(event) ){ UpdateMRL( FILE_ACCESS );}void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) ){ if( file_dialog == NULL ) file_dialog = new wxFileDialog( this, wxU(_("Open File")), wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE ); if( file_dialog && file_dialog->ShowModal() == wxID_OK ) { wxArrayString paths; wxString path; file_dialog->GetPaths( paths ); for( size_t i = 0; i < paths.GetCount(); i++ ) { if( paths[i].Find( wxT(' ') ) >= 0 ) path += wxT("\"") + paths[i] + wxT("\" "); else path += paths[i] + wxT(" "); } file_combo->SetValue( path ); file_combo->Append( path ); if( file_combo->GetCount() > 10 ) file_combo->Delete( 0 ); UpdateMRL( FILE_ACCESS ); }}/***************************************************************************** * Disc panel event methods. *****************************************************************************/void OpenDialog::OnDiscPanelChange( wxCommandEvent& event ){ UpdateMRL( DISC_ACCESS );}void OpenDialog::OnDiscDeviceChange( wxCommandEvent& event ){ char *psz_device; switch( disc_type->GetSelection() ) { case 3: psz_device = config_GetPsz( p_intf, "cd-audio" ); break; case 2: psz_device = config_GetPsz( p_intf, "vcd" ); break; default: psz_device = config_GetPsz( p_intf, "dvd" ); break; } if ( !psz_device ) psz_device = ""; if( disc_device->GetValue().Cmp( wxL2U( psz_device ) ) ) { b_disc_device_changed = true; } UpdateMRL( DISC_ACCESS );}void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) ){ char *psz_device = NULL; int i_selection = 1; /* Default Title/Track selection number*/ switch( disc_type->GetSelection() ) { case 0: /* DVD with menues */ i_selection=0; /* Fall through... */ case 1: /* DVD of some sort */ psz_device = config_GetPsz( p_intf, "dvd" ); if( !b_disc_device_changed ) { if( psz_device ) disc_device->SetValue( wxL2U(psz_device) ); else disc_device->SetValue( wxT("") ); disc_title_label->SetLabel ( wxU(_("Title")) ); } disc_title->SetRange( i_selection, 255 ); disc_title->SetValue( i_selection ); break; case 2: /* VCD of some sort */ psz_device = config_GetPsz( p_intf, "vcd" ); if( !b_disc_device_changed ) { if( psz_device ) disc_device->SetValue( wxL2U(psz_device) ); else disc_device->SetValue( wxT("") ); } /* There are at most 98, tracks in a VCD, 999 Segments, 500 entries I don't know what the limit is for LIDs, 999 is probably safe though. FIXME: it would be better however to get the information for this particular Media possibly from the General Info area. */#ifdef HAVE_VCDX disc_title_label->SetLabel ( config_GetInt( p_intf, "vcdx-PBC" ) ? wxT("Playback LID") : wxT("Entry") ); disc_title->SetRange( 0, 999 ); i_selection = 0;#else disc_title_label->SetLabel ( wxU(_("Track")) ); disc_title->SetRange( 1, 98 );#endif disc_title->SetValue( i_selection ); break; case 3: /* CD-DA */ psz_device = config_GetPsz( p_intf, "cd-audio" ); if( !b_disc_device_changed ) { if( psz_device ) disc_device->SetValue( wxL2U(psz_device) ); else disc_device->SetValue( wxT("") ); } disc_title_label->SetLabel ( wxU(_("Track")) );#ifdef HAVE_CDDAX i_selection = 0;#endif /* There are at most 99 tracks in a CD-DA */ disc_title->SetRange( i_selection, 99 ); disc_title->SetValue( i_selection ); break; default: msg_Err( p_intf, "invalid Disc type selection (%d)", disc_type->GetSelection() ); break; } if( psz_device ) free( psz_device ); disc_chapter->SetRange( 1, 255 ); disc_chapter->SetValue( 1 ); UpdateMRL( DISC_ACCESS );}/***************************************************************************** * Net panel event methods. *****************************************************************************/void OpenDialog::OnNetPanelChange( wxCommandEvent& event ){ if( event.GetId() >= NetPort1_Event && event.GetId() <= NetPort3_Event ) { i_net_ports[event.GetId() - NetPort1_Event] = event.GetInt(); } UpdateMRL( NET_ACCESS );}void OpenDialog::OnNetTypeChange( wxCommandEvent& event ){ int i; i_net_type = event.GetId() - NetRadio1_Event; for(i=0; i<4; i++) { net_radios[i]->SetValue( event.GetId() == (NetRadio1_Event+i) ); net_subpanels[i]->Enable( event.GetId() == (NetRadio1_Event+i) ); } UpdateMRL( NET_ACCESS );}#ifndef WIN32/***************************************************************************** * v4l panel event methods. *****************************************************************************/void OpenDialog::OnV4LPanelChange( wxCommandEvent& WXUNUSED(event) ){ UpdateMRL( V4L_ACCESS );}void OpenDialog::OnV4LTypeChange( wxCommandEvent& WXUNUSED(event) ){ video_device->SetValue( wxT( "/dev/video" ) ); v4l_button->Enable(); video_channel->Disable(); switch( video_type->GetSelection() ) { case 1: video_channel->Enable(); video_channel->SetRange( 0, 255 ); break; case 3: v4l_button->Disable(); break; default: break; } UpdateMRL( V4L_ACCESS );}void OpenDialog::OnV4LSettingsChange( wxCommandEvent& WXUNUSED(event) ){ /* Show/hide the open dialog */ if( v4l_dialog == NULL ) v4l_dialog = new V4LDialog( p_intf, this ); if( v4l_dialog && v4l_dialog->ShowModal() == wxID_OK ) { v4l_mrl = v4l_dialog->GetOptions(); } UpdateMRL( V4L_ACCESS );}#endif/***************************************************************************** * Subtitles file event methods. *****************************************************************************/void OpenDialog::OnSubsFileEnable( wxCommandEvent& event ){ subsfile_button->Enable( event.GetInt() != 0 );}void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) ){ /* Show/hide the open dialog */ if( subsfile_dialog == NULL ) subsfile_dialog = new SubsFileDialog( p_intf, this ); if( subsfile_dialog && subsfile_dialog->ShowModal() == wxID_OK ) { subsfile_mrl.Empty(); subsfile_mrl.Add( wxString(wxT("sub-file=")) + subsfile_dialog->file_combo->GetValue() ); if( subsfile_dialog->encoding_combo ) subsfile_mrl.Add( wxString(wxT("subsdec-encoding=")) + subsfile_dialog->encoding_combo->GetValue() ); subsfile_mrl.Add( wxString::Format( wxT("sub-delay=%i"), subsfile_dialog->delay_spinctrl->GetValue() ) ); subsfile_mrl.Add( wxString::Format( wxT("sub-fps=%i"), subsfile_dialog->fps_spinctrl->GetValue() ) ); }}/***************************************************************************** * Stream output event methods. *****************************************************************************/void OpenDialog::OnSoutEnable( wxCommandEvent& event ){ sout_button->Enable( event.GetInt() != 0 );}void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) ){ /* Show/hide the open dialog */ if( sout_dialog == NULL ) sout_dialog = new SoutDialog( p_intf, this ); if( sout_dialog && sout_dialog->ShowModal() == wxID_OK ) { sout_mrl = sout_dialog->GetOptions(); }}/***************************************************************************** * Utility functions. *****************************************************************************/wxArrayString SeparateEntries( wxString entries ){ vlc_bool_t b_quotes_mode = VLC_FALSE; wxArrayString entries_array; wxString entry; wxStringTokenizer token( entries, wxT(" \t\r\n\""), wxTOKEN_RET_DELIMS ); while( token.HasMoreTokens() ) { entry += token.GetNextToken(); if( entry.IsEmpty() ) continue; if( !b_quotes_mode && entry.Last() == wxT('\"') ) { /* Enters quotes mode */ entry.RemoveLast(); b_quotes_mode = VLC_TRUE; } else if( b_quotes_mode && entry.Last() == wxT('\"') ) { /* Finished the quotes mode */ entry.RemoveLast(); if( !entry.IsEmpty() ) entries_array.Add( entry ); entry.Empty(); b_quotes_mode = VLC_FALSE; } else if( !b_quotes_mode && entry.Last() != wxT('\"') ) { /* we found a non-quoted standalone string */ if( token.HasMoreTokens() || entry.Last() == wxT(' ') || entry.Last() == wxT('\t') || entry.Last() == wxT('\r') || entry.Last() == wxT('\n') ) entry.RemoveLast(); if( !entry.IsEmpty() ) entries_array.Add( entry ); entry.Empty(); } else {;} } if( !entry.IsEmpty() ) entries_array.Add( entry ); return entries_array;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -