* Added a file panel for subtitles file selection.
authorEric Petit <titer@videolan.org>
Tue, 14 Jan 2003 14:48:55 +0000 (14:48 +0000)
committerEric Petit <titer@videolan.org>
Tue, 14 Jan 2003 14:48:55 +0000 (14:48 +0000)
modules/gui/beos/InterfaceWindow.cpp
modules/gui/beos/InterfaceWindow.h
modules/gui/beos/MsgVals.h
modules/gui/beos/VlcWrapper.cpp
modules/gui/beos/VlcWrapper.h

index 3d066b8..c18f111 100644 (file)
@@ -2,7 +2,7 @@
  * InterfaceWindow.cpp: beos interface
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.cpp,v 1.15 2003/01/12 02:08:38 titer Exp $
+ * $Id: InterfaceWindow.cpp,v 1.16 2003/01/14 14:48:55 titer Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -63,6 +63,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
                           B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ),
          p_intf( p_interface ),
          fFilePanel( NULL ),
+         fSubtitlesPanel( NULL ),
          fLastUpdateTime( system_time() ),
          fSettings( new BMessage( 'sett' ) )
 {
@@ -123,6 +124,9 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
                                                                          new BMessage( OPEN_FILE ), 'O') );
        
        fileMenu->AddItem( new CDMenu( "Open Disc" ) );
+
+       fileMenu->AddItem( new BMenuItem( "Load a subtitle file" B_UTF8_ELLIPSIS,
+                                                                         new BMessage( LOAD_SUBFILE ) ) );
        
        fileMenu->AddSeparatorItem();
        fileMenu->AddItem( new BMenuItem( "Play List" B_UTF8_ELLIPSIS,
@@ -260,6 +264,30 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
                                _UpdatePlaylist();
                        }
                        break;
+               
+               case LOAD_SUBFILE:
+                       if( fSubtitlesPanel )
+                       {
+                               fSubtitlesPanel->Show();
+                               break;
+                       }
+                       fSubtitlesPanel = new BFilePanel();
+                       fSubtitlesPanel->SetTarget( this );
+                       fSubtitlesPanel->SetMessage( new BMessage( SUBFILE_RECEIVED ) );
+                       fSubtitlesPanel->Show();
+                       break;
+
+               case SUBFILE_RECEIVED:
+               {
+                       entry_ref ref;
+                       if( p_message->FindRef( "refs", 0, &ref ) == B_OK )
+                       {
+                               BPath path( &ref );
+                               if ( path.InitCheck() == B_OK )
+                                       p_wrapper->LoadSubFile( (char*)path.Path() );
+                       }
+                       break;
+               }
        
                case STOP_PLAYBACK:
                        // this currently stops playback not nicely
index 91d14ce..69a0840 100644 (file)
@@ -2,7 +2,7 @@
  * InterfaceWindow.h: BeOS interface window class prototype
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.h,v 1.7 2003/01/08 02:09:15 titer Exp $
+ * $Id: InterfaceWindow.h,v 1.8 2003/01/14 14:48:55 titer Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Tony Castley <tcastley@mail.powerup.com.au>
@@ -128,6 +128,7 @@ class InterfaceWindow : public BWindow
 
        bool                                    fPlaylistIsEmpty;
        BFilePanel*                             fFilePanel;
+       BFilePanel*                             fSubtitlesPanel;
        PlayListWindow*                 fPlaylistWindow;
        PreferencesWindow*              fPreferencesWindow;
        BMenuBar*                               fMenuBar;
index ebbf9e3..227d071 100644 (file)
@@ -2,7 +2,7 @@
  * MsgVals.h
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: MsgVals.h,v 1.3 2002/10/28 16:55:05 titer Exp $
+ * $Id: MsgVals.h,v 1.4 2003/01/14 14:48:55 titer Exp $
  *
  * Authors: Tony Castley <tcastley@mail.powerup.com.au>
  *          Stephan Aßmus <stippi@yellowbites.com>
@@ -30,6 +30,8 @@
 
 const uint32 OPEN_FILE                 = 'opfl';
 const uint32 OPEN_DVD                  = 'opdv';
+const uint32 LOAD_SUBFILE       = 'losu';
+const uint32 SUBFILE_RECEIVED   = 'sure';
 const uint32 OPEN_PLAYLIST             = 'oppl';
 const uint32 STOP_PLAYBACK             = 'stpl';
 const uint32 START_PLAYBACK            = 'play';
index 71dd44d..172efe1 100644 (file)
@@ -2,7 +2,7 @@
  * VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: VlcWrapper.cpp,v 1.17 2003/01/12 02:08:39 titer Exp $
+ * $Id: VlcWrapper.cpp,v 1.18 2003/01/14 14:48:55 titer Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -241,7 +241,10 @@ void VlcWrapper::openDisc(BString o_type, BString o_device, int i_title, int i_c
                   PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
 }
 
-
+void VlcWrapper::LoadSubFile( char * psz_file )
+{
+    config_PutPsz( p_intf, "sub-file", strdup( psz_file ) );
+}
 
 void VlcWrapper::ToggleLanguage( int i_language )
 {
index b58bfa8..36d9aaf 100644 (file)
@@ -2,7 +2,7 @@
  * VlcWrapper.h: BeOS plugin for vlc (derived from MacOS X port)
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: VlcWrapper.h,v 1.12 2003/01/12 02:08:39 titer Exp $
+ * $Id: VlcWrapper.h,v 1.13 2003/01/14 14:48:55 titer Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -71,6 +71,7 @@ public:
     void openFiles( BList *o_files, bool replace = true );
     void openDisc( BString o_type, BString o_device,
                    int i_title, int i_chapter );
+    void LoadSubFile( char * psz_file );
     void ToggleLanguage( int i_language );
     void ToggleSubtitle( int i_subtitle );
     const char* getTimeAsString();