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*/
51 InterfaceAoutUpdate_Type,
57 BookmarksChanged_Type,
58 /* RecordingEvent_Type,
60 SignalChanged_Type, */
62 FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
63 FullscreenControlShow_Type,
64 FullscreenControlHide_Type,
65 FullscreenControlPlanHide_Type,
68 class IMEvent : public QEvent
70 friend class InputManager;
72 IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
74 virtual ~IMEvent() {};
80 class InputManager : public QObject
83 friend class MainInputManager;
86 InputManager( QObject *, intf_thread_t * );
87 virtual ~InputManager();
92 return p_input /* We have an input */
93 && !p_input->b_dead /* not dead yet, */
94 && !p_input->b_eof /* not EOF either, */
95 && vlc_object_alive (p_input); /* and the VLC object is alive */
99 bool hasVideo() { return hasInput() && b_video; }
100 void requestArtUpdate();
102 QString getName() { return oldName; }
105 intf_thread_t *p_intf;
106 input_thread_t *p_input;
108 int i_old_playing_status;
114 mtime_t timeA, timeB;
116 void customEvent( QEvent * );
124 void UpdateNavigation();
125 void UpdatePosition();
126 void UpdateTeletext();
133 void UpdateCaching();
135 void AtoBLoop( int );
138 void setInput( input_thread_t * ); ///< Our controlled input changed
139 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
140 /* SpeedRate Rate Management */
151 void telexSetPage( int ); ///< Goto teletext page
152 void telexSetTransparency( bool ); ///< Transparency on teletext background
153 void telexActivation( bool ); ///< Enable disable teletext buttons
154 void activateTeletext( bool ); ///< Toggle buttons after click
159 void togglePlayPause();
162 /// Send new position, new time and new length
163 void positionUpdated( float , int, int );
164 void rateChanged( int );
165 void nameChanged( QString );
166 /// Used to signal whether we should show navigation buttons
167 void titleChanged( bool );
168 void chapterChanged( bool );
169 /// Statistics are updated
170 void statisticsUpdated( input_item_t* );
171 void infoChanged( input_item_t* );
172 void metaChanged( input_item_t* );
173 void artChanged( QString );
174 /// Play/pause status
175 void statusChanged( int );
177 void teletextPossible( bool );
178 void teletextActivated( bool );
179 void teletextTransparencyActivated( bool );
180 void newTelexPageSet( int );
182 void AtoBchanged( bool, bool );
184 void voutChanged( bool );
185 void synchroChanged();
186 void bookmarksChanged();
187 void cachingChanged( float );
188 void voutListChanged( vout_thread_t **pp_vout, int i_vout );
191 class MainInputManager : public QObject
195 static MainInputManager *getInstance( intf_thread_t *_p_intf )
198 instance = new MainInputManager( _p_intf );
201 static void killInstance()
203 if( instance ) delete instance;
205 virtual ~MainInputManager();
207 input_thread_t *getInput() { return p_input; };
208 InputManager *getIM() { return im; };
211 MainInputManager( intf_thread_t * );
212 static MainInputManager *instance;
214 void customEvent( QEvent * );
217 input_thread_t *p_input;
218 intf_thread_t *p_intf;
221 void togglePlayPause();
227 void inputChanged( input_thread_t * );
228 void volumeChanged();