]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/dialogs.cpp
Re-enable logging
[vlc] / modules / gui / wxwindows / dialogs.cpp
index 122c0d00904b20985b91bbe3ef094e6ad7586019..1dab4ede2cd1cdd7a5335f555ca25e82fac4160a 100644 (file)
@@ -32,7 +32,6 @@
 #include <vlc/vlc.h>
 #include <vlc/aout.h>
 #include <vlc/intf.h>
-#include "stream_control.h"
 
 #include "wxwindows.h"
 
@@ -56,12 +55,12 @@ private:
     void OnMessages( wxCommandEvent& event );
     void OnFileInfo( wxCommandEvent& event );
     void OnPreferences( wxCommandEvent& event );
-    void OnStreamWizardDialog( wxCommandEvent& event );
     void OnWizardDialog( wxCommandEvent& event );
     void OnBookmarks( wxCommandEvent& event );
 
     void OnOpenFileGeneric( wxCommandEvent& event );
     void OnOpenFileSimple( wxCommandEvent& event );
+    void OnOpenDirectory( wxCommandEvent& event );
     void OnOpenFile( wxCommandEvent& event );
     void OnOpenDisc( wxCommandEvent& event );
     void OnOpenNet( wxCommandEvent& event );
@@ -82,10 +81,10 @@ public:
     /* Secondary windows */
     OpenDialog          *p_open_dialog;
     wxFileDialog        *p_file_dialog;
+    wxDirDialog         *p_dir_dialog;
     Playlist            *p_playlist_dialog;
     Messages            *p_messages_dialog;
     FileInfo            *p_fileinfo_dialog;
-    StreamDialog        *p_streamwizard_dialog;
     WizardDialog        *p_wizard_dialog;
     wxFrame             *p_prefs_dialog;
     wxWindow            *p_bookmarks_dialog;
@@ -108,6 +107,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
                 DialogsProvider::OnOpenFileSimple)
     EVT_COMMAND(INTF_DIALOG_FILE_GENERIC, wxEVT_DIALOG,
                 DialogsProvider::OnOpenFileGeneric)
+    EVT_COMMAND(INTF_DIALOG_DIRECTORY, wxEVT_DIALOG,
+                DialogsProvider::OnOpenDirectory)
 
     EVT_COMMAND(INTF_DIALOG_PLAYLIST, wxEVT_DIALOG,
                 DialogsProvider::OnPlaylist)
@@ -115,8 +116,6 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
                 DialogsProvider::OnMessages)
     EVT_COMMAND(INTF_DIALOG_PREFS, wxEVT_DIALOG,
                 DialogsProvider::OnPreferences)
-    EVT_COMMAND(INTF_DIALOG_STREAMWIZARD, wxEVT_DIALOG,
-                DialogsProvider::OnStreamWizardDialog)
     EVT_COMMAND(INTF_DIALOG_WIZARD, wxEVT_DIALOG,
                 DialogsProvider::OnWizardDialog)
     EVT_COMMAND(INTF_DIALOG_FILEINFO, wxEVT_DIALOG,
@@ -149,7 +148,6 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent )
     p_fileinfo_dialog = NULL;
     p_prefs_dialog = NULL;
     p_file_generic_dialog = NULL;
-    p_streamwizard_dialog = NULL;
     p_wizard_dialog = NULL;
     p_bookmarks_dialog = NULL;
 
@@ -178,7 +176,6 @@ DialogsProvider::~DialogsProvider()
     if( p_messages_dialog ) delete p_messages_dialog;
     if( p_fileinfo_dialog ) delete p_fileinfo_dialog;
     if( p_file_generic_dialog ) delete p_file_generic_dialog;
-    if( p_streamwizard_dialog ) delete p_streamwizard_dialog;
     if( p_wizard_dialog ) delete p_wizard_dialog;
     if( p_bookmarks_dialog ) delete p_bookmarks_dialog;
 
@@ -255,29 +252,16 @@ void DialogsProvider::OnPreferences( wxCommandEvent& WXUNUSED(event) )
     }
 }
 
-void DialogsProvider::OnStreamWizardDialog( wxCommandEvent& WXUNUSED(event) )
-{
-    /* Show/hide the stream window */
-    if( !p_streamwizard_dialog )
-        p_streamwizard_dialog = new StreamDialog( p_intf, this );
-
-    if( p_streamwizard_dialog )
-    {
-        p_streamwizard_dialog->Show( !p_streamwizard_dialog->IsShown() );
-    }
-}
-
 void DialogsProvider::OnWizardDialog( wxCommandEvent& WXUNUSED(event) )
 {
-    fprintf(stderr,"AHAH %p\n",p_intf);
-    p_wizard_dialog = new WizardDialog( p_intf, this );
+    p_wizard_dialog = new WizardDialog( p_intf, this, NULL, 0, 0 );
 
     if( p_wizard_dialog )
     {
         p_wizard_dialog->Run();
+        delete p_wizard_dialog;
     }
 
-    delete p_wizard_dialog;
     p_wizard_dialog = NULL;
 }
 
@@ -336,14 +320,6 @@ void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
         p_arg->pf_callback( p_arg );
     }
 
-    /* Blocking or not ? */
-    if( p_arg->b_blocking )
-    {
-        vlc_mutex_lock( &p_arg->lock );
-        p_arg->b_ready = 1;
-        vlc_cond_signal( &p_arg->wait );
-    }
-
     if( p_arg->psz_results )
     {
         for( int i = 0; i < p_arg->i_results; i++ )
@@ -355,14 +331,7 @@ void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
     if( p_arg->psz_title ) free( p_arg->psz_title );
     if( p_arg->psz_extensions ) free( p_arg->psz_extensions );
 
-    if( p_arg->b_blocking )
-    {
-        vlc_mutex_unlock( &p_arg->lock );
-    }
-    else
-    {
-        free( p_arg );
-    }
+    free( p_arg );
 }
 
 void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
@@ -400,6 +369,37 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
     vlc_object_release( p_playlist );
 }
 
+void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
+{
+    playlist_t *p_playlist =
+        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                       FIND_ANYWHERE );
+    if( p_playlist == NULL )
+    {
+        return;
+    }
+
+    if( p_dir_dialog == NULL )
+        p_dir_dialog = new wxDirDialog( NULL );
+
+    if( p_dir_dialog && p_dir_dialog->ShowModal() == wxID_OK )
+    {
+        playlist_item_t *p_item;
+        wxString path = p_dir_dialog->GetPath();
+
+        int i_id = playlist_Add( p_playlist, (const char *)path.mb_str(),
+                                             (const char *)path.mb_str(),
+                                             PLAYLIST_APPEND, PLAYLIST_END );
+        p_item = playlist_ItemGetById( p_playlist, i_id );
+        if( p_item )
+        {
+            input_CreateThread( p_intf, &p_item->input );
+        }
+    }
+
+    vlc_object_release( p_playlist );
+}
+
 void DialogsProvider::OnOpenFile( wxCommandEvent& event )
 {
     Open( FILE_ACCESS, event.GetInt() );