]> git.sesse.net Git - vlc/blob - modules/gui/qt4/input_manager.hpp
Qt4 - More Module_Exist for SPrefs.
[vlc] / modules / gui / qt4 / input_manager.hpp
1 /*****************************************************************************
2  * input_manager.hpp : Manage an input and interact with its GUI elements
3  ****************************************************************************
4  * Copyright (C) 2006-2007 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23
24 #ifndef _INPUT_MANAGER_H_
25 #define _INPUT_MANAGER_H_
26
27 #include <vlc/vlc.h>
28 #include <vlc_input.h>
29
30 #include <QObject>
31
32 class InputManager : public QObject
33 {
34     Q_OBJECT;
35 public:
36     InputManager( QObject *, intf_thread_t * );
37     virtual ~InputManager();
38
39     void delInput();
40     bool hasInput() { return p_input && !p_input->b_dead && !p_input->b_die; }
41     bool hasAudio() { return b_has_audio; }
42     bool hasVideo() { return b_has_video; }
43     bool b_has_audio, b_has_video, b_had_audio, b_had_video;
44 private:
45     intf_thread_t  *p_intf;
46     input_thread_t *p_input;
47     int             i_old_playing_status;
48     QString         old_name;
49     int             i_rate;
50 public slots:
51     void togglePlayPause();
52     void update(); ///< Periodic updates
53     void setInput( input_thread_t * ); ///< Our controlled input changed
54     void sliderUpdate( float ); ///< User dragged the slider. We get new pos
55     void slower();
56     void faster();
57     void normalRate();
58     void setRate( int );
59     void sectionNext();
60     void sectionPrev();
61     void sectionMenu();
62 #ifdef ZVBI_COMPILED
63     void telexGotoPage( int );
64     void telexToggle( bool );
65     void telexSetTransparency( bool );
66 #endif
67 signals:
68     /// Send new position, new time and new length
69     void positionUpdated( float , int, int );
70     void rateChanged( int );
71     void nameChanged( QString );
72     /// Used to signal whether we should show navigation buttons
73     void navigationChanged( int );
74 #ifdef ZVBI_COMPILED
75     void teletextEnabled( bool );
76 #endif
77     /// Play/pause status
78     void statusChanged( int );
79 };
80
81 class MainInputManager : public QObject
82 {
83     Q_OBJECT;
84 public:
85     static MainInputManager *getInstance( intf_thread_t *_p_intf )
86     {
87         if( !instance )
88             instance = new MainInputManager( _p_intf );
89         return instance;
90     }
91     static void killInstance()
92     {
93         if( instance ) delete instance;
94     }
95     virtual ~MainInputManager();
96     input_thread_t *getInput() { return p_input; };
97     InputManager *getIM() { return im; };
98
99 private:
100     MainInputManager( intf_thread_t * );
101
102     InputManager            *im;
103     intf_thread_t           *p_intf;
104     input_thread_t          *p_input;
105     static MainInputManager *instance;
106 public slots:
107     void togglePlayPause();
108     void stop();
109     void next();
110     void prev();
111 private slots:
112     void updateInput();
113 signals:
114     void inputChanged( input_thread_t * );
115 };
116
117 #endif