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

📄 open.cpp

📁 uclinux 下的vlc播放器源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/***************************************************************************** * Constructor. *****************************************************************************/OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,                        int i_access_method, int i_arg ):      wxDialog( _p_parent, -1, wxU(_("Open...")), wxDefaultPosition,             wxDefaultSize, wxDEFAULT_FRAME_STYLE ){    OpenDialog( _p_intf, _p_parent, i_access_method, i_arg, OPEN_NORMAL );}OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,                        int i_access_method, int i_arg, int _i_method ):      wxDialog( _p_parent, -1, wxU(_("Open...")), wxDefaultPosition,             wxDefaultSize, wxDEFAULT_FRAME_STYLE ){    /* Initializations */    i_method = _i_method;    p_intf = _p_intf;    p_parent = _p_parent;    SetIcon( *p_intf->p_sys->p_icon );    file_dialog = NULL;    i_disc_type_selection = 0;    i_disc_title = 0;    i_open_arg = i_arg;    sout_dialog = NULL;    subsfile_dialog = NULL;    b_disc_device_changed = false;    /* Create a panel to put everything in */    wxPanel *panel = new wxPanel( this, -1 );    panel->SetAutoLayout( TRUE );    /* Advanced options */    wxStaticBox *adv_box = new wxStaticBox( panel, -1,                               wxU(_("Advanced options")) );    wxStaticBoxSizer *adv_sizer = new wxStaticBoxSizer( adv_box,                                                        wxVERTICAL );    wxFlexGridSizer *common_opt_sizer = new wxFlexGridSizer( 5, 1, 20 );    if( i_method == OPEN_NORMAL )    {        /* Create Stream Output checkox */        sout_checkbox = new wxCheckBox( panel, SoutEnable_Event,                                         wxU(_("Stream/Save")) );        sout_checkbox->SetToolTip( wxU(_("Use VLC as a stream server")) );        common_opt_sizer->Add( sout_checkbox, 0,                               wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );        sout_button = new wxButton( panel, SoutSettings_Event,                                    wxU(_("Settings...")) );        sout_button->Disable();        char *psz_sout = config_GetPsz( p_intf, "sout" );        if( psz_sout && *psz_sout )        {            sout_checkbox->SetValue(TRUE);            sout_button->Enable();            subsfile_mrl.Add( wxString(wxT("sout=")) + wxL2U(psz_sout) );        }        if( psz_sout ) free( psz_sout );        common_opt_sizer->Add( sout_button, 1, wxALIGN_LEFT |                               wxALIGN_CENTER_VERTICAL );        common_opt_sizer->Add( new wxPanel( this, -1 ), 1,                               wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );    }    /* Create caching options */    caching_checkbox = new wxCheckBox( panel, CachingEnable_Event,                                       wxU(_("Caching")) );    caching_checkbox->SetToolTip( wxU(_("Change the default caching value "                                        "(in milliseconds)")) );    common_opt_sizer->Add( caching_checkbox, 0,                           wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );    caching_value = new wxSpinCtrl( panel, CachingChange_Event );    caching_value->SetRange( 0, 1000000 );    caching_value->Disable();    common_opt_sizer->Add( caching_value, 0,                           wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );    wxBoxSizer *mrl_sizer = new wxBoxSizer( wxHORIZONTAL );    wxStaticText *mrl_label = new wxStaticText( panel, -1,                                                wxU(_("Customize:")) );    mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),                                wxDefaultPosition, wxDefaultSize );    //Point(20,25), wxSize(120, -1) );    mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing "        "the full MRL you want to open.\n""Alternatively, the field will be "        "filled automatically when you use the controls above.")) );    mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );    mrl_sizer->Add( mrl_combo, 1, wxALL | wxEXPAND | wxALIGN_CENTER_VERTICAL,                    5 );    adv_sizer->Add( common_opt_sizer, 0, wxTOP | wxLEFT|wxRIGHT | wxEXPAND, 5 );    adv_sizer->Add( mrl_sizer, 0, wxBOTTOM  | wxLEFT|wxRIGHT  | wxEXPAND, 5 );    /* Separation */    wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );    /* Create the buttons */    wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("&OK")) );    ok_button->SetDefault();    wxButton *cancel_button = new wxButton( panel, wxID_CANCEL,                                            wxU(_("&Cancel")) );    /* Create notebook */    notebook = new wxNotebook( panel, Notebook_Event );#if (!wxCHECK_VERSION(2,5,2))    wxNotebookSizer *notebook_sizer = new wxNotebookSizer( notebook );#endif    notebook->AddPage( FilePanel( notebook ), wxU(_("File")),                       i_access_method == FILE_ACCESS );    notebook->AddPage( DiscPanel( notebook ), wxU(_("Disc")),                       i_access_method == DISC_ACCESS );    notebook->AddPage( NetPanel( notebook ), wxU(_("Network")),                       i_access_method == NET_ACCESS );    module_t *p_module = config_FindModule( VLC_OBJECT(p_intf), "v4l" );    if( p_module )    {        AutoBuiltPanel *autopanel =            new AutoBuiltPanel( notebook, this, p_intf, p_module );        input_tab_array.Add( autopanel );        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?                        p_module->psz_shortname : p_module->psz_object_name ),                           i_access_method == CAPTURE_ACCESS );    }    p_module = config_FindModule( VLC_OBJECT(p_intf), "pvr" );    if( p_module )    {        AutoBuiltPanel *autopanel =            new AutoBuiltPanel( notebook, this, p_intf, p_module );        input_tab_array.Add( autopanel );        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?                        p_module->psz_shortname : p_module->psz_object_name ),                           i_access_method == CAPTURE_ACCESS );    }    p_module = config_FindModule( VLC_OBJECT(p_intf), "dvb" );    if( p_module )    {        AutoBuiltPanel *autopanel =            new AutoBuiltPanel( notebook, this, p_intf, p_module );        input_tab_array.Add( autopanel );        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?                        p_module->psz_shortname : p_module->psz_object_name ),                           i_access_method == CAPTURE_ACCESS );    }    p_module = config_FindModule( VLC_OBJECT(p_intf), "dshow" );    if( p_module )    {        AutoBuiltPanel *autopanel =            new AutoBuiltPanel( notebook, this, p_intf, p_module );        input_tab_array.Add( autopanel );        notebook->AddPage( autopanel, wxU( p_module->psz_shortname ?                        p_module->psz_shortname : p_module->psz_object_name ),                           i_access_method == CAPTURE_ACCESS );    }    /* Update Disc panel */    wxCommandEvent dummy_event;    OnDiscTypeChange( dummy_event );    /* Update Net panel */    dummy_event.SetId( NetRadio1_Event );    OnNetTypeChange( dummy_event );    /* Update MRL */    wxNotebookEvent event( wxEVT_NULL, 0, i_access_method );    OnPageChange( event );    /* Place everything in sizers */    wxStdDialogButtonSizer *button_sizer = new wxStdDialogButtonSizer;    button_sizer->AddButton( cancel_button );    button_sizer->AddButton( ok_button );    button_sizer->Realize();    wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );    wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );#if (!wxCHECK_VERSION(2,5,2))    panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 );#else    panel_sizer->Add( notebook, 1, wxEXPAND | wxALL, 5 );#endif    panel_sizer->Add( adv_sizer, 0, wxEXPAND | wxALL, 5 );    panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );    panel_sizer->Add( button_sizer, 0, wxEXPAND | wxALL, 5 );    panel_sizer->Layout();    panel->SetSizerAndFit( panel_sizer );    main_sizer->Add( panel, 1, wxGROW, 0 );    main_sizer->Layout();    SetSizerAndFit( main_sizer );}OpenDialog::~OpenDialog(){    /* Clean up */    if( file_dialog ) delete file_dialog;    if( sout_dialog ) delete sout_dialog;    if( subsfile_dialog ) delete subsfile_dialog;}int OpenDialog::Show( int i_access_method, int i_arg ){    notebook->SetSelection( i_access_method );    int i_ret = wxDialog::Show();    Raise();    SetFocus();    i_open_arg = i_arg;    return i_ret;}int OpenDialog::Show(){    int i_ret = wxDialog::Show();    Raise();    SetFocus();    return i_ret;}/***************************************************************************** * Private methods. *****************************************************************************/wxPanel *OpenDialog::FilePanel( wxWindow* parent ){    wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,                                  wxSize(200, 200) );    wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );    /* Create browse file line */    wxBoxSizer *file_sizer = new wxBoxSizer( wxHORIZONTAL );    file_sizer->Add( new wxStaticText( panel, -1, wxU(_("Open:") ) ), 0,                     wxALL | wxALIGN_CENTER_VERTICAL, 5 );    file_combo = new wxComboBox( panel, FileName_Event, wxT("") );    wxButton *browse_button = new wxButton( panel, FileBrowse_Event,                                            wxU(_("Browse...")) );    file_sizer->Add( file_combo, 1, wxALL | wxALIGN_CENTER_VERTICAL, 5 );    file_sizer->Add( browse_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );    /* Create Subtitles File checkox - button  */    wxFlexGridSizer *subtitles_sizer = new wxFlexGridSizer( 2, 1, 20 );    subsfile_checkbox = new wxCheckBox( panel, SubsFileEnable_Event,                                        wxU(_("Use a subtitles file")) );    subsfile_checkbox->SetToolTip( wxU(_("Use an external subtitles file.")) );    subtitles_sizer->Add( subsfile_checkbox, 0,  wxALIGN_CENTER_VERTICAL |                          wxALL, 5 );    subsfile_button = new wxButton( panel, SubsFileSettings_Event,                                    wxU(_("Advanced Settings...")) );    subsfile_button->Disable();    subtitles_sizer->Add( subsfile_button, 1, wxALIGN_CENTER_VERTICAL |                           wxALL, 5 );    /* Create subtitles file line */    wxBoxSizer *subfile_sizer = new wxBoxSizer( wxHORIZONTAL );    char *psz_subsfile = config_GetPsz( p_intf, "sub-file" );    if( psz_subsfile && *psz_subsfile )    {        subsfile_checkbox->SetValue(TRUE);        subsfile_button->Enable();        subsfile_mrl.Add( wxString(wxT("sub-file=")) + wxL2U(psz_subsfile) );    }    if( !psz_subsfile )  psz_subsfile = strdup("");    subfile_sizer->Add( new wxStaticText( panel, -1, wxU(_("File:") ) ),                        0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    subfile_combo = new wxComboBox( panel, SubFileName_Event,                                    wxL2U( psz_subsfile ) );    if( psz_subsfile ) free( psz_subsfile );    subbrowse_button = new wxButton( panel, SubFileBrowse_Event,                                     wxU(_("Browse...")) );    subfile_sizer->Add( subfile_combo, 1, wxALL | wxALIGN_CENTER_VERTICAL, 5 );    subfile_sizer->Add( subbrowse_button, 0, wxALL |wxALIGN_CENTER_VERTICAL, 5 );    subfile_combo->Disable();    subbrowse_button->Disable();    psz_subsfile = config_GetPsz( p_intf, "sub-file" );    if( psz_subsfile && *psz_subsfile )    {        subfile_combo->Enable();        subbrowse_button->Enable();    }    sizer->Add( file_sizer, 0, wxEXPAND | wxALL, 5 );    sizer->Add( subtitles_sizer, 0, wxLEFT | wxRIGHT | wxTOP, 5 );    sizer->Add( subfile_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT| wxBOTTOM, 5 );    panel->SetSizerAndFit( sizer );    return panel;}wxPanel *OpenDialog::DiscPanel( wxWindow* parent ){    wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,                                  wxSize(200, 200) );    wxBoxSizer *sizer_row = new wxBoxSizer( wxVERTICAL );    wxFlexGridSizer *sizer = new wxFlexGridSizer( 2, 3, 20 );    static const wxString disc_type_array[] =    {        wxU(_("DVD (menus)")),        wxU(_("DVD")),        wxU(_("VCD")),        wxU(_("Audio CD")),    };    disc_type = new wxRadioBox( panel, DiscType_Event, wxU(_("Disc type")),                                wxDefaultPosition, wxDefaultSize,                                WXSIZEOF(disc_type_array), disc_type_array,                                WXSIZEOF(disc_type_array), wxRA_SPECIFY_COLS );#ifdef HAVE_LIBCDIO    disc_probe = new wxCheckBox( panel, DiscProbe_Event,                                 wxU(_("Probe Disc(s)")) );    disc_probe->SetToolTip( wxU(_("Probe for a DVD, VCD or audio CD. ""First try the Device name entered for the selected Disc type ""(DVD, DVD Menu, VCD, audio CD). If that doesn't find media, try any device ""for the Disc type.  If that doesn't work, then try looking for CD-ROMs or ""DVD drives. The Disc type, Device name, and some parameter ranges are set ""based on media we find.")) );#endif    sizer_row->Add( disc_type, i_disc_type_selection, wxEXPAND | wxALL, 5 );#ifdef HAVE_LIBCDIO    sizer_row->Add( disc_probe, 0, wxEXPAND | wxALL );#endif    wxStaticText *label = new wxStaticText( panel, -1, wxU(_("Device name")) );    disc_device = new wxTextCtrl( panel, DiscDevice_Event, wxT(""),                                  wxDefaultPosition, wxDefaultSize,                                  wxTE_PROCESS_ENTER);#ifdef WIN32    char psz_default_device[3] = {0};    char *psz_forced;    /* find the drive_name for the first cdrom drive,     * which is probably "D:" and put the drive_name into     * psz_default_device... */    for( char drive_letter = 'A'; drive_letter <= 'Z'; ++drive_letter )    {        char drive_name[3] = {drive_letter, ':', 0};        UINT type = GetDriveTypeA( drive_name );        if( type == DRIVE_CDROM )        {            psz_default_device[0] = drive_letter;            psz_default_device[1] = ':';            break;        }    }    psz_forced = config_GetPsz( p_intf, "dvd" );    if( strlen(psz_default_device) > 0 &&        ( !psz_forced || psz_forced && !*psz_forced ) )    {        if(disc_device)            disc_device->SetValue( wxL2U(psz_default_device) );    }#endif    sizer->Add( label, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );    sizer->Add( disc_device, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL );

⌨️ 快捷键说明

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