#include <vlc_input.h>
#include "qt4.hpp"
+#include "util/singleton.hpp"
+#include "variables.hpp"
#include <QObject>
#include <QEvent>
-
enum {
PositionUpdate_Type = QEvent::User + IMEventType + 1,
ItemChanged_Type,
ItemStateChanged_Type,
ItemTitleChanged_Type,
ItemRateChanged_Type,
- VolumeChanged_Type,
- SoundMuteChanged_Type,
ItemEsChanged_Type,
ItemTeletextChanged_Type,
InterfaceVoutUpdate_Type,
RecordingEvent_Type,
ProgramChanged_Type,
RandomChanged_Type,
- LoopChanged_Type,
- RepeatChanged_Type,
+ LoopOrRepeatChanged_Type,
LeafToParent_Type,
+ EPGEvent_Type,
/* SignalChanged_Type, */
FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
};
enum { NORMAL, /* loop: 0, repeat: 0 */
- REPEAT_ONE,/* loop: 1, repeat: 0 */
- REPEAT_ALL,/* loop: 0, repeat: 1 */
+ REPEAT_ONE,/* loop: 0, repeat: 1 */
+ REPEAT_ALL,/* loop: 1, repeat: 0 */
};
class IMEvent : public QEvent
enum PLEventTypes
{
PLItemAppended_Type = QEvent::User + PLEventType + 1,
- PLItemRemoved_Type
+ PLItemRemoved_Type,
+ PLEmpty_Type
};
class PLEvent : public QEvent
{
public:
- PLEvent( PLEventTypes t, int i, int p )
- : QEvent( (QEvent::Type)t ), i_item(i), i_parent(p) {}
+ PLEvent( int t, int i, int p = 0 )
+ : QEvent( (QEvent::Type)(t) ), i_item(i), i_parent(p) {}
+
+ /* Needed for "playlist-item*" and "leaf-to-parent" callbacks
+ * !! Can be a input_item_t->i_id or a playlist_item_t->i_id */
int i_item;
+ // Needed for "playlist-item-append" callback, notably
int i_parent;
};
class InputManager : public QObject
{
- Q_OBJECT;
+ Q_OBJECT
friend class MainInputManager;
public:
&& vlc_object_alive (p_input); /* and the VLC object is alive */
}
+ int playingStatus();
bool hasAudio();
bool hasVideo() { return hasInput() && b_video; }
- void requestArtUpdate();
+ bool hasVisualisation();
+ void requestArtUpdate( input_item_t *p_item );
QString getName() { return oldName; }
static const QString decodeArtURL( input_item_t *p_item );
void UpdateCaching();
void UpdateRecord();
void UpdateProgramEvent();
+ void UpdateEPG();
public slots:
void setInput( input_thread_t * ); ///< Our controlled input changed
void setAtoB();
private slots:
- void togglePlayPause();
void AtoBLoop( float, int64_t, int );
signals:
/// Used to signal whether we should show navigation buttons
void titleChanged( bool );
void chapterChanged( bool );
+ void inputCanSeek( bool );
/// Statistics are updated
void statisticsUpdated( input_item_t* );
void infoChanged( input_item_t* );
void currentMetaChanged( input_item_t* );
void metaChanged( input_item_t *);
- void artChanged( QString );
+ void artChanged( QString ); /* current item art ( same as item == NULL ) */
+ void artChanged( input_item_t * );
/// Play/pause status
- void statusChanged( int );
+ void playingStatusChanged( int );
void recordingStateChanged( bool );
/// Teletext
void teletextPossible( bool );
void cachingChanged( float );
/// Program Event changes
void encryptionChanged( bool );
+ void epgChanged();
};
-class MainInputManager : public QObject
+class MainInputManager : public QObject, public Singleton<MainInputManager>
{
- Q_OBJECT;
+ Q_OBJECT
+ friend class Singleton<MainInputManager>;
public:
- static MainInputManager *getInstance( intf_thread_t *_p_intf )
- {
- if( !instance )
- instance = new MainInputManager( _p_intf );
- return instance;
- }
- static void killInstance()
- {
- delete instance;
- instance = NULL;
- }
-
input_thread_t *getInput() { return p_input; }
InputManager *getIM() { return im; }
inline input_item_t *currentInputItem()
}
vout_thread_t* getVout();
- aout_instance_t *getAout();
+ audio_output_t *getAout();
+
+ bool getPlayExitState();
+ bool hasEmptyPlaylist();
+ void requestVoutUpdate() { return im->UpdateVout(); }
private:
MainInputManager( intf_thread_t * );
virtual ~MainInputManager();
- static MainInputManager *instance;
-
void customEvent( QEvent * );
InputManager *im;
input_thread_t *p_input;
intf_thread_t *p_intf;
+ QVLCBool random, repeat, loop;
+ QVLCInteger volume;
+ QVLCBool mute;
- void notifyRepeatLoop();
public slots:
void togglePlayPause();
void play();
void stop();
void next();
void prev();
+ void prevOrReset();
void activatePlayQuit( bool );
void loopRepeatLoopStatus();
-
+private slots:
+ void notifyRandom( bool );
+ void notifyRepeatLoop( bool );
+ void notifyVolume( qlonglong );
+ void notifyMute( bool );
signals:
void inputChanged( input_thread_t * );
- void volumeChanged();
- void soundMuteChanged();
+ void volumeChanged( float );
+ void soundMuteChanged( bool );
void playlistItemAppended( int itemId, int parentId );
void playlistItemRemoved( int itemId );
+ void playlistNotEmpty( bool );
void randomChanged( bool );
void repeatLoopChanged( int );
- void leafBecameParent( input_item_t * );
+ void leafBecameParent( int );
};
#endif