1 /*****************************************************************************
2 * input_manager.hpp : Manage an input and interact with its GUI elements
3 ****************************************************************************
4 * Copyright (C) 2006-2008 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_
32 #include <vlc_input.h>
37 static int const PositionUpdate_Type = QEvent::User + 6;
38 static int const ItemChanged_Type = QEvent::User + 7;
39 static int const ItemRateChanged_Type = QEvent::User + 8;
40 static int const ItemTitleChanged_Type = QEvent::User + 9;
41 static int const ItemStateChanged_Type = QEvent::User + 10;
42 static int const VolumeChanged_Type = QEvent::User + 11;
44 class IMEvent : public QEvent
47 IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
49 virtual ~IMEvent() {};
54 class InputManager : public QObject
58 InputManager( QObject *, intf_thread_t * );
59 virtual ~InputManager();
62 bool hasInput() { return p_input && !p_input->b_dead && !p_input->b_die; }
63 bool hasAudio() { return b_has_audio; }
64 bool hasVideo() { return b_has_video; }
65 bool b_has_audio, b_has_video, b_had_audio, b_had_video;
67 void customEvent( QEvent * );
74 void UpdatePosition();
76 intf_thread_t *p_intf;
77 input_thread_t *p_input;
78 int i_old_playing_status;
83 void togglePlayPause();
84 void setInput( input_thread_t * ); ///< Our controlled input changed
85 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
94 void telexGotoPage( int );
95 void telexToggle( bool );
96 void telexSetTransparency( bool );
99 /// Send new position, new time and new length
100 void positionUpdated( float , int, int );
101 void rateChanged( int );
102 void nameChanged( QString );
103 /// Used to signal whether we should show navigation buttons
104 void navigationChanged( int );
106 void teletextEnabled( bool );
108 /// Play/pause status
109 void statusChanged( int );
110 void artChanged( QString );
113 class MainInputManager : public QObject
117 static MainInputManager *getInstance( intf_thread_t *_p_intf )
120 instance = new MainInputManager( _p_intf );
123 static void killInstance()
125 if( instance ) delete instance;
127 virtual ~MainInputManager();
128 input_thread_t *getInput() { return p_input; };
129 InputManager *getIM() { return im; };
132 void customEvent( QEvent * );
133 MainInputManager( intf_thread_t * );
136 intf_thread_t *p_intf;
137 input_thread_t *p_input;
138 static MainInputManager *instance;
140 void togglePlayPause();
145 //void updateInput();
147 void inputChanged( input_thread_t * );
148 void volumeChanged();