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_
31 #include <vlc_common.h>
32 #include <vlc_input.h>
39 static int const PositionUpdate_Type = QEvent::User + IMEventType + 1;
40 static int const ItemChanged_Type = QEvent::User + IMEventType + 2;
41 static int const ItemStateChanged_Type = QEvent::User + IMEventType + 3;
42 static int const ItemTitleChanged_Type = QEvent::User + IMEventType + 4;
43 static int const ItemRateChanged_Type = QEvent::User + IMEventType + 5;
44 static int const VolumeChanged_Type = QEvent::User + IMEventType + 6;
45 static int const ItemSpuChanged_Type = QEvent::User + IMEventType + 7;
46 static int const ItemTeletextChanged_Type= QEvent::User + IMEventType + 8;
47 static int const InterfaceVoutUpdate_Type= QEvent::User + IMEventType + 9;
48 static int const StatisticsUpdate_Type = QEvent::User + IMEventType + 10;
50 static int const FullscreenControlToggle_Type = QEvent::User + IMEventType + 11;
51 static int const FullscreenControlShow_Type = QEvent::User + IMEventType + 12;
52 static int const FullscreenControlHide_Type = QEvent::User + IMEventType + 13;
53 static int const FullscreenControlPlanHide_Type = QEvent::User + IMEventType + 14;
55 class IMEvent : public QEvent
58 IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
60 virtual ~IMEvent() {};
65 class InputManager : public QObject
68 friend class MainInputManager;
71 InputManager( QObject *, intf_thread_t * );
72 virtual ~InputManager();
75 bool hasInput() { return p_input && !p_input->b_dead
76 && vlc_object_alive (p_input); }
78 bool hasVideo() { return hasInput() && b_video; }
80 QString getName() { return old_name; }
83 intf_thread_t *p_intf;
84 input_thread_t *p_input;
86 int i_old_playing_status;
93 void customEvent( QEvent * );
99 void UpdateNavigation();
100 void UpdatePosition();
102 void UpdateTeletext();
105 void UpdateStats(); // FIXME, remove from this file.
107 void AtoBLoop( int );
110 void setInput( input_thread_t * ); ///< Our controlled input changed
111 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
112 /* SpeedRate Rate Management */
122 void telexSetPage( int ); ///< Goto teletext page
123 void telexSetTransparency( bool ); ///< Transparency on teletext background
124 void telexActivation( bool ); ///< Enable disable teletext buttons
125 void activateTeletext( bool ); ///< Toggle buttons after click
130 void togglePlayPause();
133 /// Send new position, new time and new length
134 void positionUpdated( float , int, int );
135 void rateChanged( int );
136 void nameChanged( QString );
137 /// Used to signal whether we should show navigation buttons
138 void titleChanged( bool );
139 void chapterChanged( bool );
140 /// Statistics are updated
141 void statisticsUpdated( input_item_t* );
142 /// Play/pause status
143 void statusChanged( int );
144 void artChanged( input_item_t* );
146 void teletextPossible( bool );
147 void teletextActivated( bool );
148 void teletextTransparencyActivated( bool );
149 void newTelexPageSet( int );
151 void AtoBchanged( bool, bool );
153 void voutChanged( bool );
156 class MainInputManager : public QObject
160 static MainInputManager *getInstance( intf_thread_t *_p_intf )
163 instance = new MainInputManager( _p_intf );
166 static void killInstance()
168 if( instance ) delete instance;
170 virtual ~MainInputManager();
172 input_thread_t *getInput() { return p_input; };
173 InputManager *getIM() { return im; };
176 MainInputManager( intf_thread_t * );
177 void customEvent( QEvent * );
180 input_thread_t *p_input;
182 intf_thread_t *p_intf;
183 static MainInputManager *instance;
185 bool teletextState();
186 void togglePlayPause();
191 void inputChanged( input_thread_t * );
192 void volumeChanged();