📄 wizard.cpp
字号:
wxSpinCtrl *ttl_spin;};BEGIN_EVENT_TABLE(wizStreamingExtraPage, wxWizardPage) EVT_CHECKBOX( SAP_Event, wizStreamingExtraPage::OnSAP ) EVT_WIZARD_PAGE_CHANGING(-1, wizStreamingExtraPage::OnWizardPageChanging)END_EVENT_TABLE()/* Local functions */static int ismult( const char *psz_uri );static void pageHeader( wxWindow *window, wxBoxSizer *sizer, char *psz_title, char *psz_text);static void pageHeader( wxWindow *window, wxBoxSizer *sizer, char *psz_title, char *psz_text){ wxStaticText *wtitle = new wxStaticText( window, -1, wxU( psz_title ) ); wxFont font = wtitle->GetFont(); font.SetPointSize(14); wtitle->SetFont(font); sizer->Add( wtitle, 0, wxALL, 5 ); sizer->Add( new wxStaticText( window, -1, wxU( vlc_wraptext( psz_text , TEXTWIDTH, false ) ) ), 0, wxALL, 5 );}/*************************************************************************** * Implementation of the pages ***************************************************************************//*************************************************** * First page: choose between stream and transcode * ***************************************************/wizHelloPage::wizHelloPage( wxWizard *parent) : wxWizardPageSimple(parent){ i_action = 0; p_parent = (WizardDialog *)parent; wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL); /* Create the texts */ pageHeader( this, mainSizer, HELLO_TITLE, HELLO_TEXT ); /* Create the radio buttons with their helps */ action_radios[0] = new wxRadioButton( this, ActionRadio0_Event, wxU( HELLO_STREAMING ) ); action_radios[1] = new wxRadioButton( this, ActionRadio1_Event, wxU( HELLO_TRANSCODE ) ); i_action = 0; mainSizer->Add( 0, 0, 1 ); wxBoxSizer *stream_sizer = new wxBoxSizer( wxHORIZONTAL ); stream_sizer->Add( action_radios[0], 0, wxALL, 5 ); stream_sizer->Add( 0,0,1 ); stream_sizer->Add( new wxButton( this, MoreInfoStreaming_Event, wxU( _("More Info")) ), 0, 0, 0 ); mainSizer->Add( stream_sizer, 0, wxALL | wxEXPAND , 5 ); wxBoxSizer *transcode_sizer = new wxBoxSizer( wxHORIZONTAL ); transcode_sizer->Add( action_radios[1], 0, wxALL, 5 ); transcode_sizer->Add( 0,0,1); transcode_sizer->Add( new wxButton( this, MoreInfoTranscode_Event, wxU( _("More Info")) ), 0 , 0 , 0 ); mainSizer->Add( transcode_sizer, 0, wxALL | wxEXPAND, 5 ); mainSizer->Add( 0, 0, 1 ); mainSizer->Add( new wxStaticLine(this, -1 ), 0, wxEXPAND| wxTOP| wxBOTTOM, 5 ); mainSizer->Add( new wxStaticText(this, -1, wxU( vlc_wraptext(HELLO_NOTICE , TEXTWIDTH , false ))), 0, wxALL, 5 ); SetSizer(mainSizer); mainSizer->Fit(this); }void wizHelloPage::OnMoreInfo(wxCommandEvent& event){ wxString msg; msg.Printf( wxString( wxU( event.GetId() == MoreInfoStreaming_Event ? MOREINFO_STREAM : MOREINFO_TRANSCODE ) ) ); wxMessageBox( msg, wxU(_("More information")), wxOK | wxICON_INFORMATION, this->p_parent );}void wizHelloPage::OnActionChange( wxCommandEvent& event ){ i_action = event.GetId() - ActionRadio0_Event; ((wizInputPage *)GetNext())->SetAction( i_action ); p_parent->SetAction( i_action );}void wizHelloPage::OnWizardPageChanging(wxWizardEvent& event){ ((wizInputPage *)GetNext())->SetAction( i_action ); p_parent->SetAction( i_action );}/************************************ * Second page: choose input stream * ************************************/wizInputPage::wizInputPage( wxWizard *parent, wxWizardPage *prev, intf_thread_t *_p_intf) : wxWizardPage(parent){ p_prev = prev; p_intf = _p_intf; p_parent = (WizardDialog *)parent; b_chosen = false; p_open_dialog = NULL; listview = NULL; mainSizer = new wxBoxSizer(wxVERTICAL); /* Create the texts */ pageHeader( this, mainSizer, INPUT_TITLE, INPUT_TEXT ); mainSizer->Add( 0,20,0 ); /* Create the radio buttons */ input_radios[0] = new wxRadioButton( this, InputRadio0_Event , wxU( INPUT_OPEN ) ); mainSizer->Add( input_radios[0], 0, wxALL, 5 ); input_radios[1] = new wxRadioButton( this, InputRadio1_Event , wxU( INPUT_PL ) ); i_input = 0; mainSizer->Add( input_radios[1], 0, wxALL, 5 ); /* Open Panel */ open_panel = new wxPanel(this, -1); open_panel->SetAutoLayout( TRUE ); wxBoxSizer *openSizer = new wxBoxSizer(wxHORIZONTAL); mrl_text = new wxTextCtrl( open_panel, -1, wxU( "" ), wxDefaultPosition, wxSize(200,25) ); openSizer->Add( mrl_text, 0 , wxALL, 5 ); openSizer->Add( new wxButton( open_panel, Choose_Event, wxU(_("Choose...")) ), 0, wxALL, 5 ); open_panel->SetSizer( openSizer ); openSizer->Layout(); openSizer->Fit(open_panel); mainSizer->Add( open_panel ); playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist ) { if( p_playlist->i_size > 0) { listview = new wxListView( this, ListView_Event, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxSUNKEN_BORDER ); listview->InsertColumn( 0, wxU(_("Name")) ); listview->InsertColumn( 1, wxU(_("URI")) ); listview->SetColumnWidth( 0, 250 ); listview->SetColumnWidth( 1, 100 ); for( int i=0 ; i < p_playlist->i_size ; i++ ) { wxString filename = wxL2U( p_playlist->pp_items[i]->input. psz_name ); listview->InsertItem( i, filename ); listview->SetItem( i, 1, wxL2U( p_playlist->pp_items[i]-> input.psz_uri) ); } listview->Select( p_playlist->i_index , TRUE); mainSizer->Add( listview, 1, wxALL|wxEXPAND, 5 ); listview->Hide(); mainSizer->Hide( listview ); mainSizer->Layout(); } else { input_radios[1]->Disable(); } vlc_object_release( p_playlist ); } else { input_radios[1]->Disable(); } /* Partial Extract Box */ mainSizer->Add( 0, 10, 0 ); wxStaticBox *partial_box = new wxStaticBox( this, -1, wxU(_("Partial Extract")) ); wxStaticBoxSizer *partial_sizer = new wxStaticBoxSizer( partial_box, wxVERTICAL ); enable_checkbox = new wxCheckBox( this, PartialEnable_Event, wxU(_("Enable") ) ); enable_checkbox->SetToolTip(wxU(_(PARTIAL) ) ) ; partial_sizer->Add( enable_checkbox, 0 , wxALIGN_CENTER_VERTICAL|wxALL, 5 ); //wxLEFT wxFlexGridSizer *partial_sizer2 = new wxFlexGridSizer( 4 , 1 , 20 ); partial_sizer2->Add( new wxStaticText(this, -1, wxU(_( "From" ) ) ), 0 , wxLEFT , 5 ); from_text = new wxTextCtrl( this, -1, wxT(""), wxDefaultPosition, wxSize( 80,25 ) ); partial_sizer2->Add( from_text, 0 , wxALIGN_RIGHT); partial_sizer2->Add( new wxStaticText(this, -1, wxU(_( "To" ) ) ), 0 , wxLEFT , 5 ); to_text = new wxTextCtrl( this, -1, wxT(""), wxDefaultPosition, wxSize( 80 , 25 ) ); partial_sizer2->Add( to_text, 0 , wxALIGN_RIGHT ); partial_sizer->Add( partial_sizer2, 0, wxALL, 0 ); partial_sizer->Fit( partial_box ); mainSizer->Add( partial_sizer, 0, 0, 0 ); from_text->Disable(); to_text->Disable(); SetSizer(mainSizer); mainSizer->Fit(this); mainSizer->Layout();}wizInputPage::~wizInputPage(){}void wizInputPage::OnInputChange( wxCommandEvent& event ){ i_input = event.GetId() - InputRadio0_Event; if( i_input == 0 ) { if( listview ) { listview->Hide(); mainSizer->Hide( listview ); open_panel->Show(); mainSizer->Show( open_panel ); mainSizer->Layout(); } } else { open_panel->Hide(); mainSizer->Hide( open_panel ); listview->Show(); mainSizer->Show( listview ); mainSizer->Layout(); }}void wizInputPage::OnEnablePartial(wxCommandEvent& event){ from_text->Enable( event.IsChecked() ); to_text->Enable( event.IsChecked() );}void wizInputPage::OnChoose(wxCommandEvent& event){ p_open_dialog = new OpenDialog( p_intf, this, -1, -1, OPEN_STREAM ); if( p_open_dialog->ShowModal() == wxID_OK && !p_open_dialog->mrl.IsEmpty() ) { mrl_text->SetValue(p_open_dialog->mrl[0] ); } delete p_open_dialog; p_open_dialog = NULL;}void wizInputPage::OnWizardPageChanging(wxWizardEvent& event){ if( i_input == 0) { if( mrl_text->GetValue().IsSameAs( wxT(""), TRUE ) && event.GetDirection() ) { wxMessageBox( wxU( CHOOSE_STREAM ), wxU( ERROR_MSG ), wxICON_WARNING | wxOK, this->p_parent ); event.Veto(); return; } else { p_parent->SetMrl( (const char *)mrl_text->GetValue().mb_str() ); } } else { int i = -1; wxListItem listitem; i = listview->GetNextItem( i , wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if( i != -1 ) { listitem.SetId( i ); listitem.SetColumn( 1 ); listview->GetItem( listitem ); p_parent->SetMrl( (const char*) listitem.GetText().mb_str() ); } } if( enable_checkbox->IsChecked() ) { int i_from = atoi( from_text->GetValue().mb_str() ); int i_to = atoi( to_text->GetValue().mb_str() ); p_parent->SetPartial( i_from, i_to ); } return;}wxWizardPage *wizInputPage::GetPrev() const { return p_prev; }wxWizardPage *wizInputPage::GetNext() const{ if( i_action == ACTION_STREAM ) return p_streaming_page; else return p_transcode_page;}void wizInputPage::SetStreamingPage( wxWizardPage *page){ p_streaming_page = page;}void wizInputPage::SetTranscodePage( wxWizardPage *page){ p_transcode_page = page;}void wizInputPage::SetAction( int i_action ){ this->i_action = i_action;}void wizInputPage::SetPintf( intf_thread_t *p_intf ){ this->p_intf = p_intf;}void wizInputPage::SetUri( char *psz_uri ){ mrl_text->SetValue( wxU( psz_uri ) );}void wizInputPage::SetPartial( int i_from, int i_to ){ wxString msg; msg.Printf( wxString( wxT( "%i") ), i_from ); from_text->Enable( TRUE ); from_text->SetValue( msg ); msg.Printf( wxString( wxT( "%i") ), i_to ); to_text->Enable( TRUE ); to_text->SetValue( msg ); enable_checkbox->SetValue( TRUE );}/*************************************************** * First transcode page: choose codecs * ***************************************************/wizTranscodeCodecPage::wizTranscodeCodecPage( wxWizard *parent, wxWizardPage *next) : wxWizardPage(parent){ p_next = next; acodec = NULL; vcodec = NULL; p_parent = (WizardDialog *) parent; wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL); /* Header */ pageHeader( this, main_sizer, TRANSCODE1_TITLE, TRANSCODE1_TEXT ); /* Video Box */ wxStaticBox *video_box = new wxStaticBox( this, -1, wxU(_("Video")) ); wxStaticBoxSizer *video_sizer = new wxStaticBoxSizer( video_box, wxVERTICAL ); /* Line 1 : only the checkbox */ wxFlexGridSizer *video_sizer1 = new wxFlexGridSizer( 2,3,20 ); video_sizer1->Add( new wxCheckBox( this, VideoEnable_Event, wxU(_("Transcode video") ) ), 0 , wxALIGN_CENTER_VERTICAL|wxALL , 5 ); video_sizer1->Add( 0,0,1); /* Line 2 : codec */ video_sizer1->Add( new wxStaticText(this, -1, wxU(_("Codec"))),0,wxLEFT ,5); video_combo = new wxComboBox( this, VideoCodec_Event, wxT(""), wxDefaultPosition, wxSize(200,25), 0, NULL, wxCB_DROPDOWN| wxCB_READONLY ); for( int i= 0; vcodecs_array[i].psz_display != NULL; i++ ) { video_combo->Append( wxU( vcodecs_array[i].psz_display ) , (void *)&vcodecs_array[i] ); } i_video_codec = 0; video_combo->SetSelection(0); video_sizer1->Add( video_combo, 0 , wxALIGN_LEFT , 0 ); video_sizer1->Add( new wxStaticText(this, -1, wxU(_("Bitrate (kb/s)"))),0, wxLEFT ,5); vb_combo = new wxComboBox( this, VideoBitrate_Event, wxT("1024"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(vbitrates_array), vbitrates_array, wxCB_READONLY ); video_sizer1->Add( vb_combo, 0, wxALIGN_LEFT , 0 ); /* Line 3 : text */ video_text = new wxStaticText( this, -1, wxU( vlc_wraptext( TR_VIDEO_TEXT, TEXTWIDTH, false) ) ); /* Fill the main video sizer */ video_sizer->Add( video_sizer1 , 0, wxEXPAND , 5 ); video_sizer->Add( video_text, 0, wxLEFT|wxTOP , 5 );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -