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>
8 * Jean-Baptiste <jb@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifndef _INPUT_MANAGER_H_
26 #define _INPUT_MANAGER_H_
32 #include <vlc_input.h>
41 PositionUpdate_Type = QEvent::User + IMEventType + 1,
43 ItemStateChanged_Type,
44 ItemTitleChanged_Type,
48 ItemTeletextChanged_Type,
49 InterfaceVoutUpdate_Type,
50 StatisticsUpdate_Type, /*10*/
56 FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
57 FullscreenControlShow_Type,
58 FullscreenControlHide_Type,
59 FullscreenControlPlanHide_Type,
62 class IMEvent : public QEvent
64 friend class InputManager;
66 IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
68 virtual ~IMEvent() {};
74 class InputManager : public QObject
77 friend class MainInputManager;
80 InputManager( QObject *, intf_thread_t * );
81 virtual ~InputManager();
86 return p_input /* We have an input */
87 && !p_input->b_dead /* not dead yet, */
88 && !p_input->b_eof /* not EOF either, */
89 && vlc_object_alive (p_input); /* and the VLC object is alive */
93 bool hasVideo() { return hasInput() && b_video; }
95 QString getName() { return oldName; }
98 intf_thread_t *p_intf;
99 input_thread_t *p_input;
101 int i_old_playing_status;
106 mtime_t timeA, timeB;
108 void customEvent( QEvent * );
116 void UpdateNavigation();
117 void UpdatePosition();
118 void UpdateTeletext();
125 void AtoBLoop( int );
128 void setInput( input_thread_t * ); ///< Our controlled input changed
129 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
130 /* SpeedRate Rate Management */
141 void telexSetPage( int ); ///< Goto teletext page
142 void telexSetTransparency( bool ); ///< Transparency on teletext background
143 void telexActivation( bool ); ///< Enable disable teletext buttons
144 void activateTeletext( bool ); ///< Toggle buttons after click
149 void togglePlayPause();
152 /// Send new position, new time and new length
153 void positionUpdated( float , int, int );
154 void rateChanged( int );
155 void nameChanged( QString );
156 /// Used to signal whether we should show navigation buttons
157 void titleChanged( bool );
158 void chapterChanged( bool );
159 /// Statistics are updated
160 void statisticsUpdated( input_item_t* );
161 void infoChanged( input_item_t* );
162 void metaChanged( input_item_t* );
163 void artChanged( input_item_t* );
164 /// Play/pause status
165 void statusChanged( int );
167 void teletextPossible( bool );
168 void teletextActivated( bool );
169 void teletextTransparencyActivated( bool );
170 void newTelexPageSet( int );
172 void AtoBchanged( bool, bool );
174 void voutChanged( bool );
175 void synchroChanged();
178 class MainInputManager : public QObject
182 static MainInputManager *getInstance( intf_thread_t *_p_intf )
185 instance = new MainInputManager( _p_intf );
188 static void killInstance()
190 if( instance ) delete instance;
192 virtual ~MainInputManager();
194 input_thread_t *getInput() { return p_input; };
195 InputManager *getIM() { return im; };
198 MainInputManager( intf_thread_t * );
199 static MainInputManager *instance;
201 void customEvent( QEvent * );
204 input_thread_t *p_input;
205 intf_thread_t *p_intf;
208 void togglePlayPause();
214 void inputChanged( input_thread_t * );
215 void volumeChanged();