modules/gui/kde/interface.cpp: made the kde interface look for the rc

file in DATA_PATH
 modules/gui/kde/kde.cpp and interface.h: removed a stupid class, moved
stuff from open() to run() to make the kde interface start without
segfaults.
parent 0ace3bb2
......@@ -25,6 +25,7 @@
#include <qdragobject.h>
#include <qtimer.h>
#include <kdialog.h>
#include <kstatusbar.h>
#define ID_STATUS_MSG 1
#define ID_DATE 2
......@@ -117,7 +118,7 @@ void KInterface::initActions()
next->setStatusText( i18n( "Next" ) );
// use the absolute path to your ktestui.rc file for testing purpose in createGUI();
createGUI("modules/gui/kde/ui.rc");
createGUI( DATA_PATH "/vlc_kde_ui.rc" );
}
void KInterface::initStatusBar()
......
......@@ -44,10 +44,14 @@ class KInterface : public KMainWindow
void slotFileOpen();
/** opens a file from the recent files menu */
void slotFileOpenRecent(const KURL& url);
/** asks for saving if the file is modified, then closes the actual file and window*/
/** asks for saving if the file is modified, then closes the
* actual file and window*/
void slotFileClose();
/** closes all open windows by calling close() on each memberList item until the list is empty, then quits the application.
* If queryClose() returns false because the user canceled the saveModified() dialog, the closing breaks.
/** closes all open windows by calling close() on each
* memberList item until the list is empty, then quits the
* application. If queryClose() returns false because the
* user canceled the saveModified() dialog, the closing
* breaks.
*/
void slotFileQuit();
void slotShowPreferences();
......@@ -58,7 +62,8 @@ class KInterface : public KMainWindow
/** toggles the statusbar
*/
void slotViewStatusBar();
/** changes the statusbar contents for the standard label permanently, used to indicate current actions.
/** changes the statusbar contents for the standard label
* permanently, used to indicate current actions.
* @param text the text that is displayed in the statusbar
*/
void slotStatusMsg( const QString &text );
......@@ -138,8 +143,6 @@ class KInterface : public KMainWindow
*****************************************************************************/
struct intf_sys_t
{
KThread *p_thread;
KApplication *p_app;
KInterface *p_window;
KAboutData *p_about;
......
......@@ -2,7 +2,7 @@
* kde.cpp : KDE plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: kde.cpp,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id: kde.cpp,v 1.2 2002/08/18 13:14:39 sigmunau Exp $
*
* Authors: Andres Krapf <dae@chez.com> Sun Mar 25 2001
*
......@@ -37,28 +37,14 @@
#include <qwidget.h>
/*****************************************************************************
* The local class.
* The local class and prototypes
*****************************************************************************/
class KInterface;
class KAboutData;
class KThread
{
private:
KThread ( KThread &thread ) { };
KThread &operator= ( KThread &thread ) { return ( *this ); };
intf_thread_t *p_intf;
public:
KThread(intf_thread_t *p_intf);
~KThread();
// These methods get exported to the core
static int open ( vlc_object_t * );
static void close ( vlc_object_t * );
static void run ( intf_thread_t * );
};
static int open( vlc_object_t * p_this );
static void close( vlc_object_t * p_this );
static void run(intf_thread_t *p_intf);
/*****************************************************************************
* Module descriptor
......@@ -73,65 +59,13 @@ vlc_module_begin();
set_capability( "interface", i );
set_program( "kvlc" );
//set_callbacks( E_(Open), E_(Close) );
set_callbacks( KThread::open, KThread::close );
set_callbacks( open, close );
vlc_module_end();
/*****************************************************************************
* KThread::KThread: KDE interface constructor
*****************************************************************************/
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, "");
char *authors[][2] = {
{ "the VideoLAN Team", "<videolan@videolan.org>" },
{ NULL, NULL },
};
for ( int i = 0; NULL != authors[i][0]; i++ ) {
p_intf->p_sys->p_about->addAuthor( authors[i][0], 0, authors[i][1] );
}
int argc = 1;
char *argv[] = { p_intf->p_vlc->psz_object_name, NULL };
KCmdLineArgs::init( argc, argv, p_intf->p_sys->p_about );
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;
}
/*****************************************************************************
* KThread::~KThread: KDE interface destructor
*****************************************************************************/
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;
delete p_intf->p_sys->p_app;
delete p_intf->p_sys->p_about;
}
/*****************************************************************************
* KThread::open: initialize and create window
*****************************************************************************/
int KThread::open(vlc_object_t *p_this)
static int open(vlc_object_t *p_this)
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
......@@ -143,20 +77,23 @@ int KThread::open(vlc_object_t *p_this)
return( 1 );
}
p_intf->pf_run = KThread::run;
p_intf->p_sys->p_thread = new KThread(p_intf);
p_intf->pf_run = run;
return ( 0 );
}
/*****************************************************************************
* KThread::close: destroy interface window
*****************************************************************************/
void KThread::close(vlc_object_t *p_this)
static void close(vlc_object_t *p_this)
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
if( p_intf->p_sys->p_input )
{
vlc_object_release( p_intf->p_sys->p_input );
}
delete p_intf->p_sys->p_thread;
delete p_intf->p_sys->p_app;
delete p_intf->p_sys->p_about;
free( p_intf->p_sys );
}
......@@ -166,8 +103,35 @@ void KThread::close(vlc_object_t *p_this)
* This part of the interface is in a separate thread so that we can call
* exec() from within it without annoying the rest of the program.
*****************************************************************************/
void KThread::run(intf_thread_t *p_intf)
void run(intf_thread_t *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, "");
char *authors[][2] = {
{ "the VideoLAN Team", "<videolan@videolan.org>" },
{ NULL, NULL },
};
for ( int i = 0; NULL != authors[i][0]; i++ ) {
p_intf->p_sys->p_about->addAuthor( authors[i][0], 0, authors[i][1] );
}
int argc = 1;
char *argv[] = { p_intf->p_vlc->psz_object_name, NULL };
KCmdLineArgs::init( argc, argv, p_intf->p_sys->p_about );
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;
p_intf->p_sys->p_window->show();
p_intf->p_sys->p_app->exec();
}
......
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