]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/dialogs/open.cpp
* modules/gui/wxwindows/menus.cpp: avoid using the C++ STL. This gets rid of weird...
[vlc] / modules / gui / wxwidgets / dialogs / open.cpp
index a77765b9bb1de3216782e37c2a4b2a69af38be64..dc10cfeec349c57986cf50ed19ce45aad1a4f18d 100644 (file)
@@ -51,9 +51,6 @@
 #include <wx/statline.h>
 #include <wx/tokenzr.h>
 
-#include <vector>
-
-
 #ifndef wxRB_SINGLE
 #   define wxRB_SINGLE 0
 #endif
@@ -317,15 +314,15 @@ AutoBuiltPanel::AutoBuiltPanel( wxWindow *parent, OpenDialog *dialog,
 
         /* Create buttons */
         wxButton *ok_button =
-            new wxButton( p_advanced_dialog, wxID_OK, wxU(_("OK")) );
+            new wxButton( p_advanced_dialog, wxID_OK, wxU(_("&OK")) );
         ok_button->SetDefault();
         wxButton *cancel_button =
-            new wxButton( p_advanced_dialog, wxID_CANCEL, wxU(_("Cancel")) );
-        wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
-        button_sizer->Add( ok_button, 0, wxALL, 5 );
-        button_sizer->Add( cancel_button, 0, wxALL, 5 );
-        button_sizer->Layout();
-        sizer->Add( button_sizer, 0, wxALL, 0 );
+            new wxButton( p_advanced_dialog, wxID_CANCEL, wxU(_("&Cancel")) );
+        wxStdDialogButtonSizer *button_sizer = new wxStdDialogButtonSizer;
+        button_sizer->AddButton( ok_button );
+        button_sizer->AddButton( cancel_button );
+        button_sizer->Realize();
+        sizer->Add( button_sizer, 0, wxEXPAND|wxALL, 5 );
 
         sizer->SetMinSize( 400, -1 );
         p_advanced_dialog->SetSizerAndFit( sizer );
@@ -428,7 +425,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
         /* Create Stream Output checkox */
         sout_checkbox = new wxCheckBox( panel, SoutEnable_Event,
                                          wxU(_("Stream/Save")) );
-        sout_checkbox->SetToolTip( wxU(_("Use VLC as a server of streams")) );
+        sout_checkbox->SetToolTip( wxU(_("Use VLC as a stream server")) );
         common_opt_sizer->Add( sout_checkbox, 0,
                                wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
 
@@ -487,10 +484,10 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
 
     /* Create the buttons */
-    wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) );
+    wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("&OK")) );
     ok_button->SetDefault();
     wxButton *cancel_button = new wxButton( panel, wxID_CANCEL,
-                                            wxU(_("Cancel")) );
+                                            wxU(_("&Cancel")) );
 
     /* Create notebook */
     notebook = new wxNotebook( panel, Notebook_Event );
@@ -563,10 +560,10 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
     OnPageChange( event );
 
     /* Place everything in sizers */
-    wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
-    button_sizer->Add( ok_button, 0, wxALL, 5 );
-    button_sizer->Add( cancel_button, 0, wxALL, 5 );
-    button_sizer->Layout();
+    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))
@@ -576,7 +573,7 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
 #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, wxALIGN_LEFT | 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 );
@@ -727,6 +724,7 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
 
 #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
@@ -743,8 +741,10 @@ wxPanel *OpenDialog::DiscPanel( wxWindow* parent )
         }
     }
 
+    psz_forced = config_GetPsz( p_intf, "dvd" );
 
-    if( strlen(psz_default_device) > 0 )
+    if( strlen(psz_default_device) > 0 &&
+        ( !psz_forced || psz_forced && !*psz_forced ) )
     {
         if(disc_device)
             disc_device->SetValue( wxL2U(psz_default_device) );
@@ -921,8 +921,7 @@ void OpenDialog::UpdateMRL( int i_access_method )
         {
         case 0: /* DVD with menus */
         case 1: /* DVD without menus */
-            disc_device->SetToolTip( wxU(_("Name of DVD device "
-            "to read from.")) );
+            disc_device->SetToolTip( wxU(_("DVD device to use" ) )  );
             if( i_disc_type_selection == 0 )
             {
                 mrltemp = wxT("dvd://") + disc_device->GetValue();
@@ -961,8 +960,7 @@ void OpenDialog::UpdateMRL( int i_access_method )
                                   config_GetInt( p_intf, "vcdx-PBC"  )
                                   ? 'P' : 'E', i_disc_title );
 #else
-            disc_device->SetToolTip( wxU(_("Name of CD-ROM device "
-            "to read Video CD from.")) );
+            disc_device->SetToolTip( wxU(_("CD-ROM device to use" ) ) );
             mrltemp = wxT("vcd://") + disc_device->GetValue();
             if( i_disc_title > 0 )
                 mrltemp += wxString::Format( wxT("@%d"), i_disc_title );
@@ -985,8 +983,7 @@ void OpenDialog::UpdateMRL( int i_access_method )
             "for a CD-ROM with an audio CD in it." )) );
             mrltemp = wxT("cddax://")
 #else
-            disc_device->SetToolTip( wxU(_("Name of CD-ROM device "
-            "to read audio CD from." )) );
+            disc_device->SetToolTip( wxU(_("CD-ROM device to use" ) ) ) ;
             mrltemp = wxT("cdda://")
 #endif
               + disc_device->GetValue();
@@ -1048,8 +1045,12 @@ void OpenDialog::UpdateMRL( int i_access_method )
                 mrltemp = wxT("http://");
 
             mrltemp += net_addrs[2]->GetLineText(0);
-
-            caching_name = wxT("http-caching");
+            if( ! mrltemp.Left(4).CmpNoCase(wxT("http")) )
+                caching_name = wxT("http-caching");
+            else if( ! mrltemp.Left(3).CmpNoCase(wxT("mms")) )
+                caching_name = wxT("mms-caching");
+            else
+                caching_name= wxT("ftp-caching");
             break;
 
         case 3:
@@ -1161,11 +1162,11 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
     for( int i = 0; i < (int)mrl.GetCount(); i++ )
     {
         vlc_bool_t b_start = !i && i_open_arg;
-        playlist_item_t *p_item;
+        input_item_t *p_input;
         char *psz_utf8;
 
         psz_utf8 = wxFromLocale( mrl[i] );
-        p_item = playlist_ItemNew( p_intf, psz_utf8, psz_utf8 );
+        p_input = input_ItemNew( p_intf, psz_utf8, NULL );
         wxLocaleFree( psz_utf8 );
 
         /* Insert options */
@@ -1173,7 +1174,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
                ((const char *)mrl[i + 1].mb_str())[0] == ':' )
         {
             psz_utf8 = wxFromLocale( mrl[i + 1] );
-            playlist_ItemAddOption( p_item, psz_utf8 );
+            input_ItemAddOption( p_input, psz_utf8 );
             wxLocaleFree( psz_utf8 );
             i++;
         }
@@ -1184,7 +1185,7 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
             for( int j = 0; j < (int)subsfile_mrl.GetCount(); j++ )
             {
                 psz_utf8 = wxFromLocale( subsfile_mrl[j] );
-                playlist_ItemAddOption( p_item, psz_utf8 );
+                input_ItemAddOption( p_input, psz_utf8 );
                 wxLocaleFree( psz_utf8 );
             }
         }
@@ -1195,24 +1196,22 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
             for( int j = 0; j < (int)sout_mrl.GetCount(); j++ )
             {
                 psz_utf8 = wxFromLocale( sout_mrl[j] );
-                playlist_ItemAddOption( p_item, psz_utf8 );
+                input_ItemAddOption( p_input, psz_utf8 );
                 wxLocaleFree( psz_utf8 );
             }
         }
 
-
         if( b_start )
         {
-            playlist_AddItem( p_playlist, p_item,
-                              PLAYLIST_APPEND,
-                              PLAYLIST_END );
-            playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
+            playlist_PlaylistAddInput( p_playlist, p_input,
+                                       PLAYLIST_APPEND | PLAYLIST_GO,
+                                       PLAYLIST_END );
         }
         else
         {
-            playlist_AddItem( p_playlist, p_item,
-                              PLAYLIST_APPEND|PLAYLIST_PREPARSE,
-                              PLAYLIST_END );
+            playlist_PlaylistAddInput( p_playlist, p_input,
+                                       PLAYLIST_APPEND|PLAYLIST_PREPARSE,
+                                       PLAYLIST_END );
         }
     }
 
@@ -1260,6 +1259,12 @@ void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
         file_dialog = new wxFileDialog( this, wxU(_("Open File")),
             wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );
 
+    file_dialog->SetWildcard(wxU(_("All Files (*.*)|*"
+        "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO
+        "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO
+        "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST
+        "|Subtitle Files (*.srt, *.sub, etc.)|" EXTENSIONS_SUBTITLE)));
+
     if( file_dialog && file_dialog->ShowModal() == wxID_OK )
     {
         wxArrayString paths;
@@ -1662,10 +1667,12 @@ void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
         disc_audio->SetRange( 0, 7 );  // up to 8 audio channels
         disc_chapter->SetRange( 0, 255 );
         disc_title->SetToolTip( wxU(_("Title number.")) );
+        // \bug [string] needs to be DVDs instead of DVD's
         disc_sub->SetToolTip( wxU(_(
           "DVD's can have up to 32 subtitles numbered 0..31. "
-          "Note this is not the same thing as a subtitle name e.g. 'en'. "
+          "Note this is not the same thing as a subtitle name (e.g. 'en'). "
           "If a value -1 is used, no subtitle will be shown." )) );
+        // \bug [string] needs to be DVDs instead of DVD's
         disc_audio->SetToolTip( wxU(_("Audio track number. "
           "DVD's can have up to 8 audio tracks numbered 0..7."
         )) );
@@ -1703,9 +1710,11 @@ void OpenDialog::OnDiscTypeChange( wxCommandEvent& WXUNUSED(event) )
         disc_title->SetRange( 0, 99 );  // only 100 tracks allowed on VCDs
         disc_sub->SetRange( -1, 3 );    // up to 4 subtitles -1 = no subtitle
         disc_audio->SetRange( 0, 1 );   // up to 2 audio tracks
+        // \bug [string] needs to be SVCDs instead of SVCD's
         disc_sub->SetToolTip( wxU(_(
           "SVCD's can have up to 4 subtitles numbered 0..3. "
           "If a value -1 is used, no subtitle will be shown." )) );
+        // \bug [string] needs to be SVCDs instead of SVCD's
         disc_audio->SetToolTip( wxU(_("Audio track number. "
           "VCD's can have up to 2 audio tracks numbered 0 or 1. "
         )) );
@@ -1819,14 +1828,14 @@ void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
         if( subsfile_dialog->align_combo )
         {
             subsfile_mrl.Add( wxString::Format(wxT("subsdec-align=%i"),
-                              (int)subsfile_dialog->align_combo->GetClientData(
-                              subsfile_dialog->align_combo->GetSelection()) ) );
+                        (int)subsfile_dialog->align_combo->GetClientData(
+                        subsfile_dialog->align_combo->GetSelection()) ) );
         }
         if( subsfile_dialog->size_combo )
         {
             subsfile_mrl.Add( wxString::Format( wxT("freetype-rel-fontsize=%i"),
-                              (int)subsfile_dialog->size_combo->GetClientData(
-                              subsfile_dialog->size_combo->GetSelection()) ) );
+                        (int)subsfile_dialog->size_combo->GetClientData(
+                        subsfile_dialog->size_combo->GetSelection()) ) );
         }
         subsfile_mrl.Add( wxString::Format( wxT("sub-fps=%i"),
                           subsfile_dialog->fps_spinctrl->GetValue() ) );