Commit 8d3702d5 authored by Sam Hocevar's avatar Sam Hocevar

* ./plugins/kde/*: the KDE interface now works again.

parent 6d58f12a
......@@ -2,7 +2,7 @@
* kde.cpp : KDE plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: kde.cpp,v 1.13 2002/06/01 12:31:59 sam Exp $
* $Id: kde.cpp,v 1.14 2002/07/01 17:39:27 sam Exp $
*
* Authors: Andres Krapf <dae@chez.com> Sun Mar 25 2001
*
......@@ -116,9 +116,12 @@ KThread::KThread(intf_thread_t *p_intf)
this->p_intf = p_intf;
p_intf->p_sys->p_about =
new KAboutData( "VideoLAN Client", I18N_NOOP("Kvlc"), VERSION,
"This is the VideoLAN client, a DVD and MPEG player. It can play MPEG and MPEG 2 files from a file or from a network source.", KAboutData::License_GPL,
"(C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 - the VideoLAN Team", 0, 0, "dae@chez.com");
new KAboutData( "VideoLAN Client", I18N_NOOP("Kvlc"), VERSION,
_("This is the VideoLAN client, a DVD and MPEG player. It can play "
"MPEG and MPEG 2 files from a file or from a network source."),
KAboutData::License_GPL,
_("(C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 - the VideoLAN Team"),
0, 0, "");
char *authors[][2] = {
{ "the VideoLAN Team", "<videolan@videolan.org>" },
......@@ -136,6 +139,8 @@ KThread::KThread(intf_thread_t *p_intf)
p_intf->p_sys->p_app = new KApplication();
p_intf->p_sys->p_window = new KInterface(p_intf);
p_intf->p_sys->p_window->setCaption( VOUT_TITLE " (KDE interface)" );
p_intf->p_sys->p_input = NULL;
}
/*****************************************************************************
......@@ -143,6 +148,11 @@ KThread::KThread(intf_thread_t *p_intf)
*****************************************************************************/
KThread::~KThread()
{
if( p_intf->p_sys->p_input )
{
vlc_object_release( p_intf->p_sys->p_input );
}
/* XXX: can be deleted if the user closed the window ! */
//delete p_intf->p_sys->p_window;
......
......@@ -37,14 +37,14 @@ KDiskDialog::KDiskDialog( QWidget *parent, const char *name )
QVGroupBox *startVBox = new QVGroupBox( "Starting position", deviceSelectHBox );
QHBox *titleHBox = new QHBox( startVBox );
QLabel *titleLabel = new QLabel( "Title ", titleHBox );
new QLabel( "Title ", titleHBox );
fTitle = new QSpinBox( titleHBox );
QHBox *chapterHBox = new QHBox( startVBox );
QLabel *chapterLabel = new QLabel( "Chapter ", chapterHBox );
new QLabel( "Chapter ", chapterHBox );
fChapter = new QSpinBox( chapterHBox );
QHBox *deviceNameHBox = new QHBox( pageVBox );
QLabel *deviceNameLabel = new QLabel( "Device name ", deviceNameHBox );
new QLabel( "Device name ", deviceNameHBox );
fLineEdit = new KLineEdit( "/dev/dvd", deviceNameHBox );
}
......
......@@ -136,14 +136,23 @@ void KInterface::initStatusBar()
void KInterface::slotFileOpen()
{
playlist_t *p_playlist;
slotStatusMsg( i18n( "Opening file..." ) );
KURL url=KFileDialog::getOpenURL( QString::null,
i18n( "*|All files" ), this, i18n( "Open File..." ) );
if( !url.isEmpty() )
{
fileOpenRecent->addURL( url );
intf_PlaylistAdd( p_intf->p_vlc->p_playlist, PLAYLIST_END, url.path() );
p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist )
{
fileOpenRecent->addURL( url );
playlist_Add( p_playlist, url.path(),
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
vlc_object_release( p_playlist );
}
}
slotStatusMsg( i18n( "Ready." ) );
......@@ -167,7 +176,7 @@ void KInterface::slotFileClose()
void KInterface::slotFileQuit()
{
slotStatusMsg(i18n("Exiting..."));
p_intf->p_sys->p_app->quit();
p_intf->p_vlc->b_die = 1;
slotStatusMsg(i18n("Ready."));
}
......@@ -223,6 +232,18 @@ void KInterface::slotManage()
{
vlc_mutex_lock( &p_intf->change_lock );
/* Update the input */
if( p_intf->p_sys->p_input == NULL )
{
p_intf->p_sys->p_input = (input_thread_t *)
vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
}
else if( p_intf->p_sys->p_input->b_dead )
{
vlc_object_release( p_intf->p_sys->p_input );
p_intf->p_sys->p_input = NULL;
}
/* If the "display popup" flag has changed */
if( p_intf->b_menu_change )
{
......@@ -232,7 +253,7 @@ void KInterface::slotManage()
/* Update language/chapter menus after user request */
#if 0
if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL && p_intf->p_sys->p_window != NULL &&
if( p_intf->p_sys->p_input != NULL && p_intf->p_sys->p_window != NULL &&
p_intf->p_sys->b_menus_update )
{
// GnomeSetupMenu( p_intf );
......@@ -240,17 +261,14 @@ void KInterface::slotManage()
#endif
/* Manage the slider */
#define p_area p_intf->p_vlc->p_input_bank->pp_input[0]->stream.p_selected_area
if( (p_intf->p_vlc->p_input_bank->pp_input[0] != NULL) && (p_area->i_size != 0 ))
#define p_area p_intf->p_sys->p_input->stream.p_selected_area
if( p_intf->p_sys->p_input && p_area->i_size )
{
fSlider->setValue( ( 10000. * p_area->i_tell ) / p_area->i_size );
}
#undef p_area
/* Manage core vlc functions through the callback */
p_intf->pf_manage(p_intf);
if( p_intf->p_vlc->b_die )
if( p_intf->b_die )
{
p_intf->p_sys->p_app->quit();
}
......@@ -260,33 +278,37 @@ void KInterface::slotManage()
void KInterface::slotSliderMoved( int position )
{
// XXX is this locking really useful ?
vlc_mutex_lock( &p_intf->change_lock );
if( p_intf->p_sys->p_input )
{
// XXX is this locking really useful ?
vlc_mutex_lock( &p_intf->change_lock );
off_t i_seek = ( position * p_intf->p_vlc->p_input_bank->pp_input[0]->stream.p_selected_area->i_size ) / 10000;
input_Seek( p_intf->p_vlc->p_input_bank->pp_input[0]->p_this, i_seek, INPUT_SEEK_SET );
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 );
vlc_mutex_unlock( &p_intf->change_lock );
vlc_mutex_unlock( &p_intf->change_lock );
}
}
void KInterface::slotSliderChanged( int position )
{
if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL )
if( p_intf->p_sys->p_input != NULL )
{
char psz_time[ OFFSETTOTIME_MAX_SIZE ];
vlc_mutex_lock( &p_intf->p_vlc->p_input_bank->pp_input[0]->stream.stream_lock );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
#define p_area p_intf->p_vlc->p_input_bank->pp_input[0]->stream.p_selected_area
statusBar()->changeItem( input_OffsetToTime( p_intf->p_vlc->p_input_bank->pp_input[0], psz_time, ( p_area->i_size * position ) / 10000 ), ID_DATE );
#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
vlc_mutex_unlock( &p_intf->p_vlc->p_input_bank->pp_input[0]->stream.stream_lock );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
}
void KInterface::slotOpenDisk()
{
playlist_t *p_playlist;
int r = fDiskDialog->exec();
if ( r )
{
......@@ -301,20 +323,21 @@ void KInterface::slotOpenDisk()
source += ',';
source += fDiskDialog->chapter();
// add it to playlist
intf_PlaylistAdd( p_intf->p_vlc->p_playlist, PLAYLIST_END, source.latin1() );
// Select added item and switch to disk interface
intf_PlaylistJumpto( p_intf->p_vlc->p_playlist, p_intf->p_vlc->p_playlist->i_size-2 );
if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL )
p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist )
{
p_intf->p_vlc->p_input_bank->pp_input[0]->b_eof = 1;
// add it to playlist
playlist_Add( p_playlist, source.latin1(),
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
vlc_object_release( p_playlist );
}
}
}
void KInterface::slotOpenStream()
{
playlist_t *p_playlist;
int r = fNetDialog->exec();
if ( r )
{
......@@ -326,47 +349,42 @@ void KInterface::slotOpenStream()
source += ":";
source += QString().setNum( fNetDialog->port() );
// add it to playlist
intf_PlaylistAdd( p_intf->p_vlc->p_playlist, PLAYLIST_END, source.latin1() );
intf_PlaylistJumpto( p_intf->p_vlc->p_playlist, p_intf->p_vlc->p_playlist->i_size-2 );
if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL )
p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist )
{
p_intf->p_vlc->p_input_bank->pp_input[0]->b_eof = 1;
// add it to playlist
playlist_Add( p_playlist, source.latin1(),
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
vlc_object_release( p_playlist );
}
}
}
void KInterface::slotPlay()
{
if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL )
if( p_intf->p_sys->p_input )
{
input_SetStatus( p_intf->p_vlc->p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY );
}
}
void KInterface::slotPause()
{
if ( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL )
if ( p_intf->p_sys->p_input )
{
input_SetStatus( p_intf->p_vlc->p_input_bank->pp_input[0], INPUT_STATUS_PAUSE );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
}
}
void KInterface::slotStop()
{
if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL )
playlist_t *p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist )
{
/* end playing item */
p_intf->p_vlc->p_input_bank->pp_input[0]->b_eof = 1;
/* update playlist */
vlc_mutex_lock( &p_intf->p_vlc->p_playlist->change_lock );
p_intf->p_vlc->p_playlist->i_index--;
p_intf->p_vlc->p_playlist->b_stopped = 1;
vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock );
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
}
}
......@@ -377,37 +395,39 @@ void KInterface::slotBackward()
void KInterface::slotPrev()
{
if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL )
playlist_t *p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist )
{
/* FIXME: temporary hack */
intf_PlaylistPrev( p_intf->p_vlc->p_playlist );
intf_PlaylistPrev( p_intf->p_vlc->p_playlist );
p_intf->p_vlc->p_input_bank->pp_input[0]->b_eof = 1;
playlist_Prev( p_playlist );
vlc_object_release( p_playlist );
}
}
void KInterface::slotNext()
{
if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL )
playlist_t *p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist )
{
/* FIXME: temporary hack */
p_intf->p_vlc->p_input_bank->pp_input[0]->b_eof = 1;
playlist_Next( p_playlist );
vlc_object_release( p_playlist );
}
}
void KInterface::slotSlow()
{
if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL )
if( p_intf->p_sys->p_input != NULL )
{
input_SetStatus( p_intf->p_vlc->p_input_bank->pp_input[0], INPUT_STATUS_SLOWER );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
}
}
void KInterface::slotFast()
{
if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL )
if( p_intf->p_sys->p_input != NULL )
{
input_SetStatus( p_intf->p_vlc->p_input_bank->pp_input[0], INPUT_STATUS_FASTER );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER );
}
}
......@@ -420,7 +440,15 @@ void KInterface::dropEvent( QDropEvent *event )
{
KURL::List urlList;
if ( KURLDrag::decode( event, urlList ) ) {
playlist_t *p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
if ( KURLDrag::decode( event, urlList ) )
{
for ( KURL::List::ConstIterator i = urlList.begin(); i != urlList.end(); i++ )
{
// XXX add a private function to add a KURL with checking
......@@ -428,8 +456,11 @@ void KInterface::dropEvent( QDropEvent *event )
if( !(*i).isEmpty() )
{
fileOpenRecent->addURL( *i );
intf_PlaylistAdd( p_intf->p_vlc->p_playlist, PLAYLIST_END, (*i).path() );
playlist_Add( p_playlist, (*i).path(),
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
}
}
}
vlc_object_release( p_playlist );
}
......@@ -143,6 +143,8 @@ struct intf_sys_s
KApplication *p_app;
KInterface *p_window;
KAboutData *p_about;
input_thread_t *p_input;
};
#endif /* _KDE_INTERFACE_H_ */
......@@ -6,6 +6,7 @@
email : dae@chez.com
***************************************************************************/
#include "kde_interface.h"
#include "kde_menu.h"
#include <kaction.h>
......@@ -29,14 +30,14 @@ void KTitleMenu::regenerateSlot()
fLanguageList = new KActionMenu( "Language", 0, this );
int i_item = 0;
vlc_mutex_lock( &fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.stream_lock );
vlc_mutex_lock( &fInterfaceThread->p_sys->p_input->stream.stream_lock );
for( int i = 0 ; i < fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.i_es_number ; i++ )
for( int i = 0 ; i < fInterfaceThread->p_sys->p_input->stream.i_es_number ; i++ )
{
if( fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.pp_es[i]->i_cat /* == i_cat */ )
if( fInterfaceThread->p_sys->p_input->stream.pp_es[i]->i_cat /* == i_cat */ )
{
i_item++;
QString language( fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.pp_es[i]->psz_desc );
QString language( fInterfaceThread->p_sys->p_input->stream.pp_es[i]->psz_desc );
if ( QString::null == language )
{
language += i18n( "Language" );
......@@ -45,7 +46,7 @@ void KTitleMenu::regenerateSlot()
KRadioAction *action = new KRadioAction( language, 0, this, "language_action" );
fLanguageList->insert( action );
if( /* p_es == */ fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.pp_es[i] )
if( /* p_es == */ fInterfaceThread->p_sys->p_input->stream.pp_es[i] )
{
/* don't lose p_item when we append into menu */
//p_item_active = p_item;
......@@ -53,7 +54,7 @@ void KTitleMenu::regenerateSlot()
}
}
vlc_mutex_unlock( &fInterfaceThread->p_vlc->p_input_bank->pp_input[0]->stream.stream_lock );
vlc_mutex_unlock( &fInterfaceThread->p_sys->p_input->stream.stream_lock );
#if 0
/* link the new menu to the menubar item */
......
......@@ -39,10 +39,10 @@ KNetDialog::KNetDialog( QWidget *parent, const char *name )
QVGroupBox *serverVBox = new QVGroupBox( "Starting position", layout );
QHBox *titleHBox = new QHBox( serverVBox );
QLabel *titleLabel = new QLabel( "Address ", titleHBox );
new QLabel( "Address ", titleHBox );
fAddress = new KLineEdit( "vls", titleHBox );
QHBox *portHBox = new QHBox( serverVBox );
QLabel *portLabel = new QLabel( "Port ", portHBox );
new QLabel( "Port ", portHBox );
fPort = new QSpinBox( 0, 65535, 1, portHBox );
}
......
......@@ -41,7 +41,7 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
p_module = p_module->next )
{
if( psz_module_name && !strcmp( psz_module_name, p_module->psz_name ) )
if( psz_module_name && !strcmp( psz_module_name, p_module->psz_object_name ) )
break;
}
if( !p_module ) return;
......@@ -100,7 +100,7 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
p_module_bis = p_module_bis->next ) {
if( p_module_bis->i_capabilities & (1 << p_item->i_value)){
new QListViewItem(item_frame->getListView(),
p_module_bis->psz_name,
p_module_bis->psz_object_name,
p_module_bis->psz_longname);
}
}
......@@ -211,7 +211,7 @@ bool KPreferences::isConfigureable(QString module)
for( p_module = p_intf->p_vlc->module_bank.first ;
p_module != NULL ;
p_module = p_module->next ) {
if( !module.compare( p_module->psz_name ) ) {
if( !module.compare( p_module->psz_object_name ) ) {
return p_module->i_config_items != 0;
}
}
......
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