1 /*****************************************************************************
2 * main_inteface.cpp : Main interface
3 ****************************************************************************
4 * Copyright (C) 2000-2005 the VideoLAN team
5 * $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
7 * Authors: Clément Stenac <zorglub@videolan.org>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
23 #include "main_interface.hpp"
24 #include "input_manager.hpp"
25 #include "dialogs_provider.hpp"
26 #include <QCloseEvent>
29 MainInterface::MainInterface( intf_thread_t *_p_intf ) :
30 QWidget( NULL ), p_intf( _p_intf)
32 fprintf( stderr, "QT Main interface\n" );
36 /* Init input manager */
38 main_input_manager = new InputManager( this, p_intf );
41 void MainInterface::init()
43 /* Get timer updates */
44 QObject::connect( DialogsProvider::getInstance(NULL)->fixed_timer,
45 SIGNAL( timeout() ), this, SLOT(updateOnTimer() ) );
46 /* Tell input manager about the input changes */
47 QObject::connect( this, SIGNAL( inputChanged( input_thread_t * ) ),
48 main_input_manager, SLOT( setInput( input_thread_t * ) ) );
50 /* Connect the slider and the input manager */
53 /* Connect the display and the input manager */
56 MainInterface::~MainInterface()
60 void MainInterface::updateOnTimer()
66 vlc_mutex_lock( &p_intf->change_lock );
67 if( p_input && p_input->b_dead )
69 vlc_object_release( p_input );
71 emit inputChanged( NULL );
76 playlist_t *p_playlist = (playlist_t *) vlc_object_find( p_intf,
77 VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
81 p_input = p_playlist->p_input;
84 vlc_object_yield( p_input );
85 fprintf( stderr, "Sending input\n");
86 emit inputChanged( p_input );
90 vlc_object_release( p_playlist );
92 vlc_mutex_unlock( &p_intf->change_lock );
95 void MainInterface::closeEvent( QCloseEvent *e )
98 p_intf->b_die = VLC_TRUE;