1 /*****************************************************************************
2 * input_manager.hpp : Manage an input and interact with its GUI elements
3 ****************************************************************************
4 * Copyright (C) 2006-2007 the VideoLAN team
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.
22 *****************************************************************************/
24 #ifndef _INPUT_MANAGER_H_
25 #define _INPUT_MANAGER_H_
28 #include <vlc_input.h>
33 static int PositionUpdate_Type = QEvent::User + 6;
34 static int ItemChanged_Type = QEvent::User + 7;
35 static int ItemRateChanged_Type = QEvent::User + 8;
36 static int ItemTitleChanged_Type = QEvent::User + 9;
37 static int ItemStateChanged_Type = QEvent::User + 10;
38 static int VolumeChanged_Type = QEvent::User + 11;
40 class IMEvent : public QEvent
43 IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
45 virtual ~IMEvent() {};
50 class InputManager : public QObject
54 InputManager( QObject *, intf_thread_t * );
55 virtual ~InputManager();
58 bool hasInput() { return p_input && !p_input->b_dead && !p_input->b_die; }
59 bool hasAudio() { return b_has_audio; }
60 bool hasVideo() { return b_has_video; }
61 bool b_has_audio, b_has_video, b_had_audio, b_had_video;
63 void customEvent( QEvent * );
64 void addCallbacks( void );
65 void delCallbacks( void );
66 void UpdateRate( void );
67 void UpdateMeta( void );
68 void UpdateStatus( void );
69 void UpdateTitle( void );
70 void UpdatePosition( void );
71 intf_thread_t *p_intf;
72 input_thread_t *p_input;
73 int i_old_playing_status;
78 void togglePlayPause();
79 void setInput( input_thread_t * ); ///< Our controlled input changed
80 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
89 void telexGotoPage( int );
90 void telexToggle( bool );
91 void telexSetTransparency( bool );
94 /// Send new position, new time and new length
95 void positionUpdated( float , int, int );
96 void rateChanged( int );
97 void nameChanged( QString );
98 /// Used to signal whether we should show navigation buttons
99 void navigationChanged( int );
101 void teletextEnabled( bool );
103 /// Play/pause status
104 void statusChanged( int );
105 void artChanged( QString );
108 class MainInputManager : public QObject
112 static MainInputManager *getInstance( intf_thread_t *_p_intf )
115 instance = new MainInputManager( _p_intf );
118 static void killInstance()
120 if( instance ) delete instance;
122 virtual ~MainInputManager();
123 input_thread_t *getInput() { return p_input; };
124 InputManager *getIM() { return im; };
127 void customEvent( QEvent * );
128 MainInputManager( intf_thread_t * );
131 intf_thread_t *p_intf;
132 input_thread_t *p_input;
133 static MainInputManager *instance;
135 void togglePlayPause();
140 //void updateInput();
142 void inputChanged( input_thread_t * );
143 void volumeChanged( void );