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 BookmarksChanged_Type,
57 /* RecordingEvent_Type,
59 SignalChanged_Type, */
61 FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
62 FullscreenControlShow_Type,
63 FullscreenControlHide_Type,
64 FullscreenControlPlanHide_Type,
67 class IMEvent : public QEvent
69 friend class InputManager;
71 IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
73 virtual ~IMEvent() {};
79 class InputManager : public QObject
82 friend class MainInputManager;
85 InputManager( QObject *, intf_thread_t * );
86 virtual ~InputManager();
91 return p_input /* We have an input */
92 && !p_input->b_dead /* not dead yet, */
93 && !p_input->b_eof /* not EOF either, */
94 && vlc_object_alive (p_input); /* and the VLC object is alive */
98 bool hasVideo() { return hasInput() && b_video; }
100 QString getName() { return oldName; }
103 intf_thread_t *p_intf;
104 input_thread_t *p_input;
106 int i_old_playing_status;
112 mtime_t timeA, timeB;
114 void customEvent( QEvent * );
122 void UpdateNavigation();
123 void UpdatePosition();
124 void UpdateTeletext();
130 void UpdateCaching();
132 void AtoBLoop( int );
135 void setInput( input_thread_t * ); ///< Our controlled input changed
136 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
137 /* SpeedRate Rate Management */
148 void telexSetPage( int ); ///< Goto teletext page
149 void telexSetTransparency( bool ); ///< Transparency on teletext background
150 void telexActivation( bool ); ///< Enable disable teletext buttons
151 void activateTeletext( bool ); ///< Toggle buttons after click
156 void togglePlayPause();
159 /// Send new position, new time and new length
160 void positionUpdated( float , int, int );
161 void rateChanged( int );
162 void nameChanged( QString );
163 /// Used to signal whether we should show navigation buttons
164 void titleChanged( bool );
165 void chapterChanged( bool );
166 /// Statistics are updated
167 void statisticsUpdated( input_item_t* );
168 void infoChanged( input_item_t* );
169 void metaChanged( input_item_t* );
170 void artChanged( input_item_t* );
171 /// Play/pause status
172 void statusChanged( int );
174 void teletextPossible( bool );
175 void teletextActivated( bool );
176 void teletextTransparencyActivated( bool );
177 void newTelexPageSet( int );
179 void AtoBchanged( bool, bool );
181 void voutChanged( bool );
182 void synchroChanged();
183 void bookmarksChanged();
184 void cachingChanged( float );
187 class MainInputManager : public QObject
191 static MainInputManager *getInstance( intf_thread_t *_p_intf )
194 instance = new MainInputManager( _p_intf );
197 static void killInstance()
199 if( instance ) delete instance;
201 virtual ~MainInputManager();
203 input_thread_t *getInput() { return p_input; };
204 InputManager *getIM() { return im; };
207 MainInputManager( intf_thread_t * );
208 static MainInputManager *instance;
210 void customEvent( QEvent * );
213 input_thread_t *p_input;
214 intf_thread_t *p_intf;
217 void togglePlayPause();
223 void inputChanged( input_thread_t * );
224 void volumeChanged();