* Disable some menu items when no input is available.

 * Some cleanups
parent 4764ebc9
...@@ -46,9 +46,12 @@ KInterface::KInterface( intf_thread_t *p_intf, QWidget *parent, ...@@ -46,9 +46,12 @@ KInterface::KInterface( intf_thread_t *p_intf, QWidget *parent,
fSlider = new KVLCSlider( QSlider::Horizontal, this ); fSlider = new KVLCSlider( QSlider::Horizontal, this );
fSlider->setMaxValue(10000); fSlider->setMaxValue(10000);
connect( fSlider, SIGNAL( userChanged( int ) ), this, SLOT( slotSliderMoved( int ) ) ); connect( fSlider, SIGNAL( userChanged( int ) ), this,
connect( fSlider, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderChanged( int ) ) ); SLOT( slotSliderMoved( int ) ) );
connect( fSlider, SIGNAL( sliderMoved( int ) ), this, SLOT( slotSliderChanged( int ) ) ); connect( fSlider, SIGNAL( valueChanged( int ) ), this,
SLOT( slotSliderChanged( int ) ) );
connect( fSlider, SIGNAL( sliderMoved( int ) ), this,
SLOT( slotSliderChanged( int ) ) );
setCentralWidget(fSlider); setCentralWidget(fSlider);
fTimer = new QTimer( this ); fTimer = new QTimer( this );
...@@ -83,33 +86,60 @@ KInterface::~KInterface() ...@@ -83,33 +86,60 @@ KInterface::~KInterface()
void KInterface::initActions() void KInterface::initActions()
{ {
languages = new KActionMenu( _( "Languages" ), actionCollection(), "language" ); languages = new KActionMenu( _( "Languages" ), actionCollection(),
"language" );
languages->setEnabled( false ); languages->setEnabled( false );
languageCollection = new KActionCollection( this ); languageCollection = new KActionCollection( this );
subtitleCollection = new KActionCollection( this ); subtitleCollection = new KActionCollection( this );
subtitles = new KActionMenu( _( "Subtitles" ), actionCollection(), "subtitles" ); subtitles = new KActionMenu( _( "Subtitles" ), actionCollection(),
"subtitles" );
subtitles->setEnabled( false ); subtitles->setEnabled( false );
fileOpen = KStdAction::open(this, SLOT(slotFileOpen()), actionCollection()); fileOpen =
fileOpenRecent = KStdAction::openRecent(this, SLOT(slotFileOpenRecent(const KURL&)), actionCollection()); KStdAction::open(this, SLOT(slotFileOpen()), actionCollection());
preferences = KStdAction::preferences(this, SLOT(slotShowPreferences()), actionCollection()); fileOpenRecent =
fileQuit = KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection()); KStdAction::openRecent(this, SLOT(slotFileOpenRecent(const KURL&)),
viewToolBar = KStdAction::showToolbar(this, SLOT(slotViewToolBar()), actionCollection()); actionCollection());
viewStatusBar = KStdAction::showStatusbar(this, SLOT(slotViewStatusBar()), actionCollection()); preferences = KStdAction::preferences(this, SLOT(slotShowPreferences()),
actionCollection());
diskOpen = new KAction( i18n( "Open &Disk" ), 0, 0, this, SLOT( slotOpenDisk() ), actionCollection(), "open_disk" ); fileQuit = KStdAction::quit(this, SLOT(slotFileQuit()),
streamOpen = new KAction( i18n( "Open &Stream" ), 0, 0, this, SLOT( slotOpenStream() ), actionCollection(), "open_stream" ); actionCollection());
backward = new KAction( i18n( "&Backward" ), 0, 0, this, SLOT( slotBackward() ), actionCollection(), "backward" ); viewToolBar = KStdAction::showToolbar(this, SLOT(slotViewToolBar()),
stop = new KAction( i18n( "&Stop" ), 0, 0, this, SLOT( slotStop() ), actionCollection(), "stop" ); actionCollection());
play = new KAction( i18n( "&Play" ), 0, 0, this, SLOT( slotPlay() ), actionCollection(), "play" ); viewStatusBar = KStdAction::showStatusbar(this, SLOT(slotViewStatusBar()),
pause = new KAction( i18n( "P&ause" ), 0, 0, this, SLOT( slotPause() ), actionCollection(), "pause" ); actionCollection());
slow = new KAction( i18n( "&Slow" ), 0, 0, this, SLOT( slotSlow() ), actionCollection(), "slow" );
fast = new KAction( i18n( "Fas&t" ), 0, 0, this, SLOT( slotFast() ), actionCollection(), "fast" ); diskOpen = new KAction( i18n( "Open &Disk" ), 0, 0, this,
prev = new KAction( i18n( "Prev" ), 0, 0, this, SLOT( slotPrev() ), actionCollection(), "prev" ); SLOT( slotOpenDisk() ), actionCollection(),
next = new KAction( i18n( "Next" ), 0, 0, this, SLOT( slotNext() ), actionCollection(), "next" ); "open_disk" );
messages = new KAction( _( "Messages..." ), 0, 0, this, SLOT( slotShowMessages() ), actionCollection(), "view_messages"); streamOpen = new KAction( i18n( "Open &Stream" ), 0, 0, this,
SLOT( slotOpenStream() ), actionCollection(),
info = new KAction( _( "Stream info..." ), 0, 0, this, SLOT( slotShowInfo() ), actionCollection(), "view_stream_info"); "open_stream" );
backward = new KAction( i18n( "&Backward" ), 0, 0, this,
SLOT( slotBackward() ), actionCollection(),
"backward" );
stop = new KAction( i18n( "&Stop" ), 0, 0, this,
SLOT( slotStop() ), actionCollection(), "stop" );
play = new KAction( i18n( "&Play" ), 0, 0, this,
SLOT( slotPlay() ), actionCollection(), "play" );
pause = new KAction( i18n( "P&ause" ), 0, 0, this,
SLOT( slotPause() ), actionCollection(), "pause" );
slow = new KAction( i18n( "&Slow" ), 0, 0, this,
SLOT( slotSlow() ), actionCollection(), "slow" );
fast = new KAction( i18n( "Fas&t" ), 0, 0, this,
SLOT( slotFast() ), actionCollection(), "fast" );
prev = new KAction( i18n( "Prev" ), 0, 0, this,
SLOT( slotPrev() ), actionCollection(), "prev" );
next = new KAction( i18n( "Next" ), 0, 0, this,
SLOT( slotNext() ), actionCollection(), "next" );
messages = new KAction( _( "Messages..." ), 0, 0, this,
SLOT( slotShowMessages() ), actionCollection(),
"view_messages");
info = new KAction( _( "Stream info..." ), 0, 0, this,
SLOT( slotShowInfo() ), actionCollection(),
"view_stream_info");
info->setEnabled( false );
program = new KActionMenu( _( "Program" ), actionCollection(), "program" ); program = new KActionMenu( _( "Program" ), actionCollection(), "program" );
program->setEnabled( false ); program->setEnabled( false );
title = new KActionMenu( _( "Title" ), actionCollection(), "title" ); title = new KActionMenu( _( "Title" ), actionCollection(), "title" );
...@@ -265,6 +295,9 @@ void KInterface::slotManage() ...@@ -265,6 +295,9 @@ void KInterface::slotManage()
{ {
vlc_object_release( p_intf->p_sys->p_input ); vlc_object_release( p_intf->p_sys->p_input );
p_intf->p_sys->p_input = NULL; p_intf->p_sys->p_input = NULL;
languages->setEnabled( false );
subtitles->setEnabled( false );
info->setEnabled( false );
} }
/* If the "display popup" flag has changed */ /* If the "display popup" flag has changed */
...@@ -297,7 +330,8 @@ void KInterface::slotManage() ...@@ -297,7 +330,8 @@ void KInterface::slotManage()
#define p_area p_input->stream.p_selected_area #define p_area p_input->stream.p_selected_area
if( p_area->i_size ) { if( p_area->i_size ) {
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
fSlider->setValue( ( 10000 * p_area->i_tell ) / p_area->i_size ); fSlider->setValue( ( 10000 * p_area->i_tell )
/ p_area->i_size );
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
} }
...@@ -353,9 +387,13 @@ void KInterface::slotUpdateLanguages() ...@@ -353,9 +387,13 @@ void KInterface::slotUpdateLanguages()
p_audio_es = NULL; p_audio_es = NULL;
p_spu_es = NULL; p_spu_es = NULL;
for( int i = 0 ; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ ) for( int i = 0 ;
i < p_intf->p_sys->p_input->stream.i_selected_es_number ;
i++
)
{ {
if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == AUDIO_ES ) if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat
== AUDIO_ES )
{ {
p_audio_es = p_intf->p_sys->p_input->stream.pp_selected_es[i]; p_audio_es = p_intf->p_sys->p_input->stream.pp_selected_es[i];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment