Commit cafb8e30 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: InputManager: Namespace PLEvent types.

Pointed out that LeafToParent_Type was misused.
parent b54356d1
...@@ -1027,19 +1027,19 @@ void MainInputManager::customEvent( QEvent *event ) ...@@ -1027,19 +1027,19 @@ void MainInputManager::customEvent( QEvent *event )
// msg_Dbg( p_intf, "New MainIM Event of type: %i", type ); // msg_Dbg( p_intf, "New MainIM Event of type: %i", type );
switch( type ) switch( type )
{ {
case PLItemAppended_Type: case PLEvent::PLItemAppended_Type:
plEv = static_cast<PLEvent*>( event ); plEv = static_cast<PLEvent*>( event );
emit playlistItemAppended( plEv->i_item, plEv->i_parent ); emit playlistItemAppended( plEv->i_item, plEv->i_parent );
return; return;
case PLItemRemoved_Type: case PLEvent::PLItemRemoved_Type:
plEv = static_cast<PLEvent*>( event ); plEv = static_cast<PLEvent*>( event );
emit playlistItemRemoved( plEv->i_item ); emit playlistItemRemoved( plEv->i_item );
return; return;
case PLEmpty_Type: case PLEvent::PLEmpty_Type:
plEv = static_cast<PLEvent*>( event ); plEv = static_cast<PLEvent*>( event );
emit playlistNotEmpty( plEv->i_item >= 0 ); emit playlistNotEmpty( plEv->i_item >= 0 );
return; return;
case LeafToParent_Type: case PLEvent::LeafToParent_Type:
plEv = static_cast<PLEvent*>( event ); plEv = static_cast<PLEvent*>( event );
emit leafBecameParent( plEv->i_item ); emit leafBecameParent( plEv->i_item );
return; return;
...@@ -1226,7 +1226,7 @@ static int LeafToParent( vlc_object_t *p_this, const char *psz_var, ...@@ -1226,7 +1226,7 @@ static int LeafToParent( vlc_object_t *p_this, const char *psz_var,
VLC_UNUSED( p_this ); VLC_UNUSED( psz_var ); VLC_UNUSED( oldval ); VLC_UNUSED( p_this ); VLC_UNUSED( psz_var ); VLC_UNUSED( oldval );
MainInputManager *mim = (MainInputManager*)param; MainInputManager *mim = (MainInputManager*)param;
PLEvent *event = new PLEvent( LeafToParent_Type, newval.i_int ); PLEvent *event = new PLEvent( PLEvent::LeafToParent_Type, newval.i_int );
QApplication::postEvent( mim, event ); QApplication::postEvent( mim, event );
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -1249,9 +1249,9 @@ static int PLItemAppended ...@@ -1249,9 +1249,9 @@ static int PLItemAppended
MainInputManager *mim = static_cast<MainInputManager*>(data); MainInputManager *mim = static_cast<MainInputManager*>(data);
playlist_add_t *p_add = static_cast<playlist_add_t*>( cur.p_address ); playlist_add_t *p_add = static_cast<playlist_add_t*>( cur.p_address );
PLEvent *event = new PLEvent( PLItemAppended_Type, p_add->i_item, p_add->i_node ); PLEvent *event = new PLEvent( PLEvent::PLItemAppended_Type, p_add->i_item, p_add->i_node );
QApplication::postEvent( mim, event ); QApplication::postEvent( mim, event );
event = new PLEvent( PLEmpty_Type, p_add->i_item, 0 ); event = new PLEvent( PLEvent::PLEmpty_Type, p_add->i_item, 0 );
QApplication::postEvent( mim, event ); QApplication::postEvent( mim, event );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -1263,12 +1263,12 @@ static int PLItemRemoved ...@@ -1263,12 +1263,12 @@ static int PLItemRemoved
playlist_t *pl = (playlist_t *) obj; playlist_t *pl = (playlist_t *) obj;
MainInputManager *mim = static_cast<MainInputManager*>(data); MainInputManager *mim = static_cast<MainInputManager*>(data);
PLEvent *event = new PLEvent( PLItemRemoved_Type, cur.i_int, 0 ); PLEvent *event = new PLEvent( PLEvent::PLItemRemoved_Type, cur.i_int, 0 );
QApplication::postEvent( mim, event ); QApplication::postEvent( mim, event );
// can't use playlist_IsEmpty( ) as it isn't true yet // can't use playlist_IsEmpty( ) as it isn't true yet
if ( pl->items.i_size == 1 ) // lock is held if ( pl->items.i_size == 1 ) // lock is held
{ {
event = new PLEvent( PLEmpty_Type, -1, 0 ); event = new PLEvent( PLEvent::PLEmpty_Type, -1, 0 );
QApplication::postEvent( mim, event ); QApplication::postEvent( mim, event );
} }
return VLC_SUCCESS; return VLC_SUCCESS;
......
...@@ -60,7 +60,6 @@ enum { ...@@ -60,7 +60,6 @@ enum {
ProgramChanged_Type, ProgramChanged_Type,
RandomChanged_Type, RandomChanged_Type,
LoopOrRepeatChanged_Type, LoopOrRepeatChanged_Type,
LeafToParent_Type,
EPGEvent_Type, EPGEvent_Type,
/* SignalChanged_Type, */ /* SignalChanged_Type, */
...@@ -104,17 +103,17 @@ private: ...@@ -104,17 +103,17 @@ private:
input_item_t *p_item; input_item_t *p_item;
}; };
enum PLEventTypes
{
PLItemAppended_Type = QEvent::User + PLEventType + 1,
PLItemRemoved_Type,
PLEmpty_Type
};
class PLEvent : public QEvent class PLEvent : public QEvent
{ {
public: public:
PLEvent( int t, int i, int p = 0 ) enum PLEventTypes
{
PLItemAppended_Type = QEvent::User + PLEventType + 1,
PLItemRemoved_Type,
LeafToParent_Type,
PLEmpty_Type
};
PLEvent( PLEventTypes t, int i, int p = 0 )
: QEvent( (QEvent::Type)(t) ), i_item(i), i_parent(p) {} : QEvent( (QEvent::Type)(t) ), i_item(i), i_parent(p) {}
/* Needed for "playlist-item*" and "leaf-to-parent" callbacks /* Needed for "playlist-item*" and "leaf-to-parent" callbacks
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment