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;
49 static int const FullscreenControlToggle_Type = QEvent::User + IMEventType + 10;
50 static int const FullscreenControlShow_Type = QEvent::User + IMEventType + 11;
51 static int const FullscreenControlHide_Type = QEvent::User + IMEventType + 12;
52 static int const FullscreenControlPlanHide_Type = QEvent::User + IMEventType + 13;
54 class IMEvent : public QEvent
57 IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
59 virtual ~IMEvent() {};
64 class InputManager : public QObject
68 InputManager( QObject *, intf_thread_t * );
69 virtual ~InputManager();
72 bool hasInput() { return p_input && !p_input->b_dead && vlc_object_alive (p_input); }
74 bool hasVideo() { return hasInput() && b_video; }
76 QString getName() { return old_name; }
79 intf_thread_t *p_intf;
80 input_thread_t *p_input;
82 int i_old_playing_status;
86 bool b_transparentTelextext;
89 void customEvent( QEvent * );
95 void UpdateNavigation();
96 void UpdatePosition();
98 void UpdateTeletext();
103 void setInput( input_thread_t * ); ///< Our controlled input changed
104 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
105 void togglePlayPause();
113 void telexGotoPage( int ); ///< Goto teletext page
114 void telexToggle( bool ); ///< Enable disable teletext buttons
115 void telexToggleButtons(); ///< Toggle buttons after click
116 void telexSetTransparency(); ///< Set transparency on teletext background
119 /// Send new position, new time and new length
120 void positionUpdated( float , int, int );
121 void rateChanged( int );
122 void nameChanged( QString );
123 /// Used to signal whether we should show navigation buttons
124 void navigationChanged( int );
125 /// Play/pause status
126 void statusChanged( int );
127 void artChanged( input_item_t* );
129 void teletextEnabled( bool );
130 void toggleTelexButtons();
131 void toggleTelexTransparency();
132 void setNewTelexPage( int );
134 void advControlsSetIcon();
136 void voutChanged( bool );
139 class MainInputManager : public QObject
143 static MainInputManager *getInstance( intf_thread_t *_p_intf )
146 instance = new MainInputManager( _p_intf );
149 static void killInstance()
151 if( instance ) delete instance;
153 virtual ~MainInputManager();
155 input_thread_t *getInput() { return p_input; };
156 InputManager *getIM() { return im; };
159 MainInputManager( intf_thread_t * );
160 void customEvent( QEvent * );
163 input_thread_t *p_input;
165 intf_thread_t *p_intf;
166 static MainInputManager *instance;
168 bool teletextState();
169 void togglePlayPause();
174 void inputChanged( input_thread_t * );
175 void volumeChanged();