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>
40 PositionUpdate_Type = QEvent::User + IMEventType + 1,
42 ItemStateChanged_Type,
43 ItemTitleChanged_Type,
47 ItemTeletextChanged_Type,
48 InterfaceVoutUpdate_Type,
49 StatisticsUpdate_Type,
52 FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
53 FullscreenControlShow_Type,
54 FullscreenControlHide_Type,
55 FullscreenControlPlanHide_Type,
58 class IMEvent : public QEvent
60 friend class InputManager;
62 IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
64 virtual ~IMEvent() {};
70 class InputManager : public QObject
73 friend class MainInputManager;
76 InputManager( QObject *, intf_thread_t * );
77 virtual ~InputManager();
82 return p_input /* We have an input */
83 && !p_input->b_dead /* not dead yet, */
84 && !p_input->b_eof /* not EOF either, */
85 && vlc_object_alive (p_input); /* and the VLC object is alive */
89 bool hasVideo() { return hasInput() && b_video; }
91 QString getName() { return oldName; }
94 intf_thread_t *p_intf;
95 input_thread_t *p_input;
97 int i_old_playing_status;
102 mtime_t timeA, timeB;
104 void customEvent( QEvent * );
112 void UpdateNavigation();
113 void UpdatePosition();
115 void UpdateTeletext();
120 void AtoBLoop( int );
123 void setInput( input_thread_t * ); ///< Our controlled input changed
124 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
125 /* SpeedRate Rate Management */
136 void telexSetPage( int ); ///< Goto teletext page
137 void telexSetTransparency( bool ); ///< Transparency on teletext background
138 void telexActivation( bool ); ///< Enable disable teletext buttons
139 void activateTeletext( bool ); ///< Toggle buttons after click
144 void togglePlayPause();
147 /// Send new position, new time and new length
148 void positionUpdated( float , int, int );
149 void rateChanged( int );
150 void nameChanged( QString );
151 /// Used to signal whether we should show navigation buttons
152 void titleChanged( bool );
153 void chapterChanged( bool );
154 /// Statistics are updated
155 void statisticsUpdated( input_item_t* );
156 /// Play/pause status
157 void statusChanged( int );
158 void artChanged( input_item_t* );
160 void teletextPossible( bool );
161 void teletextActivated( bool );
162 void teletextTransparencyActivated( bool );
163 void newTelexPageSet( int );
165 void AtoBchanged( bool, bool );
167 void voutChanged( bool );
170 class MainInputManager : public QObject
174 static MainInputManager *getInstance( intf_thread_t *_p_intf )
177 instance = new MainInputManager( _p_intf );
180 static void killInstance()
182 if( instance ) delete instance;
184 virtual ~MainInputManager();
186 input_thread_t *getInput() { return p_input; };
187 InputManager *getIM() { return im; };
190 MainInputManager( intf_thread_t * );
191 static MainInputManager *instance;
193 void customEvent( QEvent * );
196 input_thread_t *p_input;
197 intf_thread_t *p_intf;
200 void togglePlayPause();
206 void inputChanged( input_thread_t * );
207 void volumeChanged();