| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
#ifndef _INPUT_MANAGER_H_ |
|---|
| 25 |
#define _INPUT_MANAGER_H_ |
|---|
| 26 |
|
|---|
| 27 |
#ifdef HAVE_CONFIG_H |
|---|
| 28 |
# include "config.h" |
|---|
| 29 |
#endif |
|---|
| 30 |
|
|---|
| 31 |
#include <vlc_common.h> |
|---|
| 32 |
#include <vlc_input.h> |
|---|
| 33 |
|
|---|
| 34 |
#include "qt4.hpp" |
|---|
| 35 |
|
|---|
| 36 |
#include <QObject> |
|---|
| 37 |
#include <QEvent> |
|---|
| 38 |
|
|---|
| 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; |
|---|
| 48 |
|
|---|
| 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; |
|---|
| 53 |
|
|---|
| 54 |
class IMEvent : public QEvent |
|---|
| 55 |
{ |
|---|
| 56 |
public: |
|---|
| 57 |
IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) ) |
|---|
| 58 |
{ i_id = id ; } ; |
|---|
| 59 |
virtual ~IMEvent() {}; |
|---|
| 60 |
|
|---|
| 61 |
int i_id; |
|---|
| 62 |
}; |
|---|
| 63 |
|
|---|
| 64 |
class InputManager : public QObject |
|---|
| 65 |
{ |
|---|
| 66 |
Q_OBJECT; |
|---|
| 67 |
public: |
|---|
| 68 |
InputManager( QObject *, intf_thread_t * ); |
|---|
| 69 |
virtual ~InputManager(); |
|---|
| 70 |
|
|---|
| 71 |
void delInput(); |
|---|
| 72 |
bool hasInput() { return p_input && !p_input->b_dead && vlc_object_alive (p_input); } |
|---|
| 73 |
bool hasAudio(); |
|---|
| 74 |
bool hasVideo() { return hasInput() && b_video; } |
|---|
| 75 |
|
|---|
| 76 |
QString getName() { return old_name; } |
|---|
| 77 |
|
|---|
| 78 |
private: |
|---|
| 79 |
intf_thread_t *p_intf; |
|---|
| 80 |
input_thread_t *p_input; |
|---|
| 81 |
int i_input_id; |
|---|
| 82 |
int i_old_playing_status; |
|---|
| 83 |
QString old_name; |
|---|
| 84 |
QString artUrl; |
|---|
| 85 |
int i_rate; |
|---|
| 86 |
bool b_transparentTelextext; |
|---|
| 87 |
bool b_video; |
|---|
| 88 |
|
|---|
| 89 |
void customEvent( QEvent * ); |
|---|
| 90 |
void addCallbacks(); |
|---|
| 91 |
void delCallbacks(); |
|---|
| 92 |
void UpdateRate(); |
|---|
| 93 |
void UpdateMeta(); |
|---|
| 94 |
void UpdateStatus(); |
|---|
| 95 |
void UpdateNavigation(); |
|---|
| 96 |
void UpdatePosition(); |
|---|
| 97 |
void UpdateSPU(); |
|---|
| 98 |
void UpdateTeletext(); |
|---|
| 99 |
void UpdateArt(); |
|---|
| 100 |
void UpdateVout(); |
|---|
| 101 |
|
|---|
| 102 |
public slots: |
|---|
| 103 |
void setInput( input_thread_t * ); |
|---|
| 104 |
void sliderUpdate( float ); |
|---|
| 105 |
void togglePlayPause(); |
|---|
| 106 |
void slower(); |
|---|
| 107 |
void faster(); |
|---|
| 108 |
void normalRate(); |
|---|
| 109 |
void setRate( int ); |
|---|
| 110 |
void sectionNext(); |
|---|
| 111 |
void sectionPrev(); |
|---|
| 112 |
void sectionMenu(); |
|---|
| 113 |
void telexGotoPage( int ); |
|---|
| 114 |
void telexToggle( bool ); |
|---|
| 115 |
void telexToggleButtons(); |
|---|
| 116 |
void telexSetTransparency(); |
|---|
| 117 |
|
|---|
| 118 |
signals: |
|---|
| 119 |
|
|---|
| 120 |
void positionUpdated( float , int, int ); |
|---|
| 121 |
void rateChanged( int ); |
|---|
| 122 |
void nameChanged( QString ); |
|---|
| 123 |
|
|---|
| 124 |
void navigationChanged( int ); |
|---|
| 125 |
|
|---|
| 126 |
void statusChanged( int ); |
|---|
| 127 |
void artChanged( input_item_t* ); |
|---|
| 128 |
|
|---|
| 129 |
void teletextEnabled( bool ); |
|---|
| 130 |
void toggleTelexButtons(); |
|---|
| 131 |
void toggleTelexTransparency(); |
|---|
| 132 |
void setNewTelexPage( int ); |
|---|
| 133 |
|
|---|
| 134 |
void advControlsSetIcon(); |
|---|
| 135 |
|
|---|
| 136 |
void voutChanged( bool ); |
|---|
| 137 |
}; |
|---|
| 138 |
|
|---|
| 139 |
class MainInputManager : public QObject |
|---|
| 140 |
{ |
|---|
| 141 |
Q_OBJECT; |
|---|
| 142 |
public: |
|---|
| 143 |
static MainInputManager *getInstance( intf_thread_t *_p_intf ) |
|---|
| 144 |
{ |
|---|
| 145 |
if( !instance ) |
|---|
| 146 |
instance = new MainInputManager( _p_intf ); |
|---|
| 147 |
return instance; |
|---|
| 148 |
} |
|---|
| 149 |
static void killInstance() |
|---|
| 150 |
{ |
|---|
| 151 |
if( instance ) delete instance; |
|---|
| 152 |
} |
|---|
| 153 |
virtual ~MainInputManager(); |
|---|
| 154 |
|
|---|
| 155 |
input_thread_t *getInput() { return p_input; }; |
|---|
| 156 |
InputManager *getIM() { return im; }; |
|---|
| 157 |
|
|---|
| 158 |
private: |
|---|
| 159 |
MainInputManager( intf_thread_t * ); |
|---|
| 160 |
void customEvent( QEvent * ); |
|---|
| 161 |
|
|---|
| 162 |
InputManager *im; |
|---|
| 163 |
input_thread_t *p_input; |
|---|
| 164 |
|
|---|
| 165 |
intf_thread_t *p_intf; |
|---|
| 166 |
static MainInputManager *instance; |
|---|
| 167 |
public slots: |
|---|
| 168 |
bool teletextState(); |
|---|
| 169 |
void togglePlayPause(); |
|---|
| 170 |
void stop(); |
|---|
| 171 |
void next(); |
|---|
| 172 |
void prev(); |
|---|
| 173 |
signals: |
|---|
| 174 |
void inputChanged( input_thread_t * ); |
|---|
| 175 |
void volumeChanged(); |
|---|
| 176 |
}; |
|---|
| 177 |
|
|---|
| 178 |
#endif |
|---|