]> git.sesse.net Git - vlc/blobdiff - modules/gui/kde/interface.cpp
* Remove the old info window from SVN.
[vlc] / modules / gui / kde / interface.cpp
index a3abe508d917e7a7c48cc3c38f34d56ebc3acbd1..3e76dfb5c954e7e8d993df2829b03c47e2eb4f41 100644 (file)
@@ -15,7 +15,7 @@
 #include "preferences.h"
 #include "languagemenu.h"
 
-#include <iostream.h>
+#include <iostream>
 
 #include <kaction.h>
 #include <kfiledialog.h>
@@ -58,7 +58,6 @@ KInterface::KInterface( intf_thread_t *p_intf, QWidget *parent,
     connect( fTimer, SIGNAL( timeout() ), this, SLOT( slotManage() ) );
 
     resize( 400, 30 );
-    msg_Dbg(p_intf, KStdAction::stdName(KStdAction::Preferences));
     ///////////////////////////////////////////////////////////////////
     // call inits to invoke all other construction parts
     // XXX could we move this up ?
@@ -87,7 +86,7 @@ KInterface::~KInterface()
 void KInterface::initActions()
 {
     languages = new KActionMenu( _( "Languages" ), actionCollection(),
-                                 "language" );
+                                 _("language") );
     languages->setEnabled( false );
     languageCollection = new KActionCollection( this );
     subtitleCollection = new KActionCollection( this );
@@ -108,28 +107,28 @@ void KInterface::initActions()
     viewStatusBar = KStdAction::showStatusbar(this, SLOT(slotViewStatusBar()),
                                               actionCollection());
 
-    diskOpen = new KAction( i18n( "Open &Disk" ), 0, 0, this,
+    diskOpen = new KAction( i18n( _("Open &Disk") ), 0, 0, this,
                             SLOT( slotOpenDisk() ), actionCollection(),
                             "open_disk" );
-    streamOpen = new KAction( i18n( "Open &Stream" ), 0, 0, this,
+    streamOpen = new KAction( i18n( _("Open &Stream") ), 0, 0, this,
                               SLOT( slotOpenStream() ), actionCollection(),
                               "open_stream" );
-    backward = new KAction( i18n( "&Backward" ), 0, 0, this,
+    backward = new KAction( i18n( _("&Backward") ), 0, 0, this,
                             SLOT( slotBackward() ), actionCollection(),
                             "backward" );
-    stop = new KAction( i18n( "&Stop" ), 0, 0, this,
+    stop = new KAction( i18n( _("&Stop") ), 0, 0, this,
                         SLOT( slotStop() ), actionCollection(), "stop" );
-    play = new KAction( i18n( "&Play" ), 0, 0, this,
+    play = new KAction( i18n( _("&Play") ), 0, 0, this,
                         SLOT( slotPlay() ), actionCollection(), "play" );
-    pause = new KAction( i18n( "P&ause" ), 0, 0, this,
+    pause = new KAction( i18n( _("P&ause") ), 0, 0, this,
                          SLOT( slotPause() ), actionCollection(), "pause" );
-    slow = new KAction( i18n( "&Slow" ), 0, 0, this,
+    slow = new KAction( i18n( _("&Slow") ), 0, 0, this,
                         SLOT( slotSlow() ), actionCollection(), "slow" );
-    fast = new KAction( i18n( "Fas&t" ), 0, 0, this,
+    fast = new KAction( i18n( _("Fas&t") ), 0, 0, this,
                         SLOT( slotFast() ), actionCollection(), "fast" );
-    prev = new KAction( i18n( "Prev" ), 0, 0, this,
+    prev = new KAction( i18n( _("Prev") ), 0, 0, this,
                         SLOT( slotPrev() ), actionCollection(), "prev" );
-    next = new KAction( i18n( "Next" ), 0, 0, this,
+    next = new KAction( i18n( _("Next") ), 0, 0, this,
                         SLOT( slotNext() ), actionCollection(), "next" );
     messages = new KAction( _( "Messages..." ), 0, 0, this,
                             SLOT( slotShowMessages() ), actionCollection(),
@@ -146,25 +145,25 @@ void KInterface::initActions()
     title->setEnabled( false );
     chapter = new KActionMenu( _( "Chapter" ), actionCollection(), "chapter" );
     chapter->setEnabled( false );
-    fileOpen->setStatusText(i18n("Opens an existing document"));
-    fileOpenRecent->setStatusText(i18n("Opens a recently used file"));
-    fileQuit->setStatusText(i18n("Quits the application"));
-    viewToolBar->setStatusText(i18n("Enables/disables the toolbar"));
-    viewStatusBar->setStatusText(i18n("Enables/disables the statusbar"));
-
-    diskOpen->setStatusText( i18n( "Opens a disk") );
-    streamOpen->setStatusText( i18n( "Opens a network stream" ) );
-    backward->setStatusText( i18n( "Backward" ) );
-    stop->setStatusText( i18n( "Stops playback" ) );
-    play->setStatusText( i18n( "Starts playback" ) );
-    pause->setStatusText( i18n( "Pauses playback" ) );
-    slow->setStatusText( i18n( "Slow" ) );
-    fast->setStatusText( i18n( "Fast" ) );
-    prev->setStatusText( i18n( "Prev" ) );
-    next->setStatusText( i18n( "Next" ) );
+    fileOpen->setStatusText(i18n(_("Opens an existing document")));
+    fileOpenRecent->setStatusText(i18n(_("Opens a recently used file")));
+    fileQuit->setStatusText(i18n(_("Quits the application")));
+    viewToolBar->setStatusText(i18n(_("Enables/disables the toolbar")));
+    viewStatusBar->setStatusText(i18n(_("Enables/disables the status bar")));
+
+    diskOpen->setStatusText( i18n( _("Opens a disk") ) );
+    streamOpen->setStatusText( i18n( _("Opens a network stream") ) );
+    backward->setStatusText( i18n( _("Backward") ) );
+    stop->setStatusText( i18n( _("Stops playback") ) );
+    play->setStatusText( i18n( _("Starts playback") ) );
+    pause->setStatusText( i18n( _("Pauses playback") ) );
+    slow->setStatusText( i18n( _("Slow") ) );
+    fast->setStatusText( i18n( _("Fast") ) );
+    prev->setStatusText( i18n( _("Prev") ) );
+    next->setStatusText( i18n( _("Next") ) );
     // use the absolute path to your ktestui.rc file for testing purpose in createGUI();
-    char *uifile = config_GetPsz( p_intf, "kdeuirc" );
-    createGUI( uifile );
+    char *psz_uifile = config_GetPsz( p_intf, "kde-uirc" );
+    createGUI( psz_uifile );
 //    createGUI( "./modules/gui/kde/ui.rc" );
 }
 
@@ -173,7 +172,7 @@ void KInterface::initStatusBar()
   ///////////////////////////////////////////////////////////////////
   // STATUSBAR
   // TODO: add your own items you need for displaying current application status.
-    statusBar()->insertItem(i18n("Ready."), ID_STATUS_MSG, 1, false);
+    statusBar()->insertItem(i18n(_("Ready.")), ID_STATUS_MSG, 1, false);
     statusBar()->setItemAlignment( ID_STATUS_MSG, AlignLeft | AlignVCenter );
     statusBar()->insertItem( "0:00:00", ID_DATE, 0, true );
 }
@@ -198,9 +197,9 @@ void KInterface::slotFileOpen()
 {
     playlist_t *p_playlist;
 
-    slotStatusMsg( i18n( "Opening file..." ) );
+    slotStatusMsg( i18n( _("Opening file...") ) );
     KURL url=KFileDialog::getOpenURL( QString::null,
-            i18n( "*|All files" ), this, i18n( "Open File..." ) );
+            i18n( "*|All files" ), this, i18n( _("Open File...") ) );
 
     if( !url.isEmpty() )
     {
@@ -209,31 +208,31 @@ void KInterface::slotFileOpen()
         if( p_playlist )
         {
             fileOpenRecent->addURL( url );
-            playlist_Add( p_playlist, url.path(),
+            playlist_Add( p_playlist, url.path(), url.path(), 
                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
             vlc_object_release( p_playlist );
         }
     }
 
-    slotStatusMsg( i18n( "Ready." ) );
+    slotStatusMsg( i18n( _("Ready.") ) );
 }
 
 void KInterface::slotFileOpenRecent(const KURL& url)
 {
-  slotStatusMsg(i18n("Opening file..."));
-  slotStatusMsg(i18n("Ready."));
+  slotStatusMsg(i18n(_("Opening file...")));
+  slotStatusMsg(i18n(_("Ready.")));
 }
 
 void KInterface::slotFileQuit()
 {
-    slotStatusMsg(i18n("Exiting..."));
+    slotStatusMsg(i18n(_("Exiting...")));
     p_intf->p_vlc->b_die = VLC_TRUE;
-    slotStatusMsg(i18n("Ready."));
+    slotStatusMsg(i18n(_("Ready.")));
 }
 
 void KInterface::slotViewToolBar()
 {
-  slotStatusMsg(i18n("Toggling toolbar..."));
+  slotStatusMsg(i18n(_("Toggling toolbar...")));
   ///////////////////////////////////////////////////////////////////
   // turn Toolbar on or off
   if(!viewToolBar->isChecked())
@@ -245,12 +244,12 @@ void KInterface::slotViewToolBar()
     toolBar("mainToolBar")->show();
   }        
 
-  slotStatusMsg(i18n("Ready."));
+  slotStatusMsg(i18n(_("Ready.")));
 }
 
 void KInterface::slotViewStatusBar()
 {
-  slotStatusMsg(i18n("Toggle the statusbar..."));
+  slotStatusMsg(i18n(_("Toggle the status bar...")));
   ///////////////////////////////////////////////////////////////////
   //turn Statusbar on or off
   if(!viewStatusBar->isChecked())
@@ -262,7 +261,7 @@ void KInterface::slotViewStatusBar()
     statusBar()->show();
   }
 
-  slotStatusMsg(i18n("Ready."));
+  slotStatusMsg(i18n(_("Ready.")));
 }
 
 void KInterface::slotShowPreferences()
@@ -290,6 +289,13 @@ void KInterface::slotManage()
     {
         p_intf->p_sys->p_input = (input_thread_t *)
                 vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
+        if ( p_intf->p_sys->p_input )
+        {
+            languages->setEnabled( true );
+            subtitles->setEnabled( true );
+            info->setEnabled( true );
+        }
+            
     }
     else if( p_intf->p_sys->p_input->b_dead )
     {
@@ -387,7 +393,7 @@ void KInterface::slotUpdateLanguages()
     p_audio_es = NULL;
     p_spu_es = NULL;
 
-    for( int i = 0 ;
+    for( unsigned int i = 0 ;
          i < p_intf->p_sys->p_input->stream.i_selected_es_number ;
          i++
         )
@@ -440,7 +446,9 @@ void KInterface::languageMenus(KActionMenu *root, es_descriptor_t *p_es,
     
 #define ES p_intf->p_sys->p_input->stream.pp_es[i]
     /* create a set of language buttons and append them to the container */
-    for( int i = 0 ; i < p_intf->p_sys->p_input->stream.i_es_number ; i++ )
+    for( unsigned int i = 0 ;
+         i < p_intf->p_sys->p_input->stream.i_es_number ;
+         i++ )
     {
         if( ( ES->i_cat == i_cat ) &&
             ( !ES->p_pgrm ||
@@ -494,7 +502,7 @@ void KInterface::slotSliderChanged( int position )
 {
     if( p_intf->p_sys->p_input != NULL )
     {
-        char psz_time[ OFFSETTOTIME_MAX_SIZE ];
+        char psz_time[ MSTRTIME_MAX_SIZE ];
 
         vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
 
@@ -528,7 +536,7 @@ void KInterface::slotOpenDisk()
         if( p_playlist )
         {
             // add it to playlist
-            playlist_Add( p_playlist, source.latin1(),
+            playlist_Add( p_playlist, source.latin1(), source.latin1(),
                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
             vlc_object_release( p_playlist );
         }
@@ -554,7 +562,7 @@ void KInterface::slotOpenStream()
         if( p_playlist )
         {
             // add it to playlist
-            playlist_Add( p_playlist, source.latin1(),
+            playlist_Add( p_playlist, source.latin1(), source.latin1(),
                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
             vlc_object_release( p_playlist );
         }
@@ -656,7 +664,7 @@ void KInterface::dropEvent( QDropEvent *event )
             if( !(*i).isEmpty() )
             {
                 fileOpenRecent->addURL( *i );
-                playlist_Add( p_playlist, (*i).path(),
+                playlist_Add( p_playlist, (*i).path(), (*i).path(),
                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
             }
         }