]> git.sesse.net Git - vlc/blobdiff - modules/gui/kde/interface.cpp
* modules/video_output/directx/events.c: fixes for VOUT_REPARENT.
[vlc] / modules / gui / kde / interface.cpp
index f7a9737fe43c1f15d024998b722eebe9e79ba59b..3c6c107ba62a25fbcf4e743baa8df103ee73685c 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 )
     {
@@ -371,9 +377,8 @@ void KInterface::slotSliderMoved( int position )
         // XXX is this locking really useful ?
         vlc_mutex_lock( &p_intf->change_lock );
 
-        off_t i_seek = ( position * p_intf->p_sys->p_input->stream.p_selected_area->i_size ) / 10000;
-        input_Seek( p_intf->p_sys->p_input, i_seek, INPUT_SEEK_SET );
-
+        var_SetFloat( p_intf->p_sys->p_input, "position",
+                       (double)position / 10000.0 );
         vlc_mutex_unlock( &p_intf->change_lock );
     }
 }
@@ -489,22 +494,23 @@ void KInterface::languageMenus(KActionMenu *root, es_descriptor_t *p_es,
 
 void KInterface::slotSetLanguage( bool on, es_descriptor_t *p_es )
 {
-    input_ToggleES( p_intf->p_sys->p_input, p_es, on );
+    if( p_es )
+        var_SetInteger( p_intf->p_sys->p_input, "audio-es", p_es->i_id );
+    else
+        var_SetInteger( p_intf->p_sys->p_input, "audio-es", -1 );
 }
 
 void KInterface::slotSliderChanged( int position )
 {
     if( p_intf->p_sys->p_input != NULL )
     {
-        char psz_time[ OFFSETTOTIME_MAX_SIZE ];
-
-        vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
+        char psz_time[ MSTRTIME_MAX_SIZE ];
+        int64_t i_seconds;
 
-#define p_area p_intf->p_sys->p_input->stream.p_selected_area
-        statusBar()->changeItem( input_OffsetToTime( p_intf->p_sys->p_input, psz_time, ( p_area->i_size * position ) / 10000 ), ID_DATE );
-#undef p_area
+        i_seconds = var_GetTime( p_intf->p_sys->p_input, "time" ) / I64C(1000000 );
+        secstotimestr( psz_time, i_seconds );
 
-        vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
+        statusBar()->changeItem( psz_time, ID_DATE );
      }
 }
 
@@ -530,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 );
         }
@@ -556,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 );
         }
@@ -567,7 +573,7 @@ void KInterface::slotPlay()
 {
     if( p_intf->p_sys->p_input )
     {
-        input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
+        var_SetInteger( p_intf->p_sys->p_input, "state", PLAYING_S );
     }
 }
 
@@ -575,7 +581,7 @@ void KInterface::slotPause()
 {
     if ( p_intf->p_sys->p_input )
     {
-        input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
+        var_SetInteger( p_intf->p_sys->p_input, "state", PAUSE_S );
     }
 }
 
@@ -621,7 +627,7 @@ void KInterface::slotSlow()
 {
     if( p_intf->p_sys->p_input != NULL )
     {
-        input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
+        var_SetVoid( p_intf->p_sys->p_input, "rate-slower" );
     }
 }
 
@@ -629,7 +635,7 @@ void KInterface::slotFast()
 {
     if( p_intf->p_sys->p_input != NULL )
     {
-        input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER );
+        var_SetVoid( p_intf->p_sys->p_input, "rate-faster" );
     }
 }
 
@@ -658,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 );
             }
         }