]> git.sesse.net Git - vlc/commitdiff
* 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 3d066b89f74988b6f1b1fa75f1765e50b264ac90..c18f111f594dcc337d85204bdfee298e06b440b3 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 91d14ce0b46fa37faf43526cecc25b042d493f72..69a08403219c6ecfaf4a0e40a47dbd72cb35c404 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 ebbf9e3f4d1d408ab36e4b6249f3ce44a8c254b0..227d0714ce3fb5a9d77323fade3ad94880974255 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 71dd44dc1cdd453535293d76f142e6fd10f58a1f..172efe18adf89794c7a24f1f15fecbafbd5f9c63 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 b58bfa8637d09e9a2a18dbe72371c4d049266895..36d9aaf1e90725e5a739892e7de7b6f01c84a2c2 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();