1 /*****************************************************************************
2 * kde.cpp : KDE plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
7 * Authors: Andres Krapf <dae@chez.com> Sun Mar 25 2001
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
26 #include "interface.h"
32 #include <kaboutdata.h>
33 #include <kcmdlineargs.h>
35 #include <kmainwindow.h>
36 #include <kstdaction.h>
39 /*****************************************************************************
40 * The local class and prototypes
41 *****************************************************************************/
45 static int open( vlc_object_t * p_this );
46 static void close( vlc_object_t * p_this );
47 static void run(intf_thread_t *p_intf);
49 /*****************************************************************************
51 *****************************************************************************/
53 /* int i = getenv( "DISPLAY" ) == NULL ? 8 : 85; */
54 set_category( CAT_INTERFACE );
55 set_subcategory( SUBCAT_INTERFACE_GENERAL );
56 set_description( _("KDE interface") );
57 add_file( "kde-uirc", DATA_PATH "/ui.rc", NULL, N_( "path to ui.rc file" ), NULL, VLC_TRUE );
58 set_capability( "interface", 0 ); /* 0 used to be i, disabled because kvlc not maintained */
59 set_program( "kvlc" );
60 set_callbacks( open, close );
63 /*****************************************************************************
64 * KThread::open: initialize and create window
65 *****************************************************************************/
66 static int open(vlc_object_t *p_this)
68 intf_thread_t *p_intf = (intf_thread_t *)p_this;
70 /* Allocate instance and initialize some members */
71 p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) );
72 if( p_intf->p_sys == NULL )
74 msg_Err( p_intf, "out of memory" );
82 /*****************************************************************************
83 * KThread::close: destroy interface window
84 *****************************************************************************/
85 static void close(vlc_object_t *p_this)
87 intf_thread_t *p_intf = (intf_thread_t *)p_this;
88 if( p_intf->p_sys->p_input )
90 vlc_object_release( p_intf->p_sys->p_input );
93 delete p_intf->p_sys->p_app;
94 delete p_intf->p_sys->p_about;
95 msg_Unsubscribe(p_intf, p_intf->p_sys->p_msg);
96 free( p_intf->p_sys );
99 /*****************************************************************************
100 * KThread::run: KDE thread
101 *****************************************************************************
102 * This part of the interface is in a separate thread so that we can call
103 * exec() from within it without annoying the rest of the program.
104 *****************************************************************************/
105 void run(intf_thread_t *p_intf)
107 p_intf->p_sys->p_about =
108 new KAboutData( "kvlc", I18N_NOOP("Kvlc"), VERSION,
109 _("This is the VLC media player, a DVD, MPEG and DivX player. It can "
110 "play MPEG and MPEG2 files from a file or from a network source."),
111 KAboutData::License_GPL,
112 _("(c) 1996-2004 the VideoLAN team"),
115 p_intf->p_sys->p_about->addAuthor( "the VideoLAN team", 0,
116 "<videolan@videolan.org>" );
119 char *argv[] = { "vlc", "--icon", DATA_PATH "/kvlc32x32.png", "--miniicon", DATA_PATH "/kvlc16x16.png" };
120 KCmdLineArgs::init( argc, argv, p_intf->p_sys->p_about );
122 /* Subscribe to message queue */
123 p_intf->p_sys->p_msg = msg_Subscribe( p_intf );
125 p_intf->p_sys->p_app = new KApplication();
126 p_intf->p_sys->p_window = new KInterface(p_intf);
127 p_intf->p_sys->p_window->setCaption( VOUT_TITLE " (KDE interface)" );
129 p_intf->p_sys->p_input = NULL;
131 p_intf->p_sys->p_window->show();
132 p_intf->p_sys->p_app->exec();