[vlc-devel] commit: qt4: remove item-change callback from playlist-model ( Ilkka Ollakka )
git version control
git at videolan.org
Tue Feb 17 00:26:21 CET 2009
vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Mon Feb 16 23:28:04 2009 +0200| [cb81565b63c8062ced063a49d854e9156e2a5de3] | committer: Ilkka Ollakka
qt4: remove item-change callback from playlist-model
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cb81565b63c8062ced063a49d854e9156e2a5de3
---
.../gui/qt4/components/playlist/playlist_model.cpp | 27 +++++++++++++------
.../gui/qt4/components/playlist/playlist_model.hpp | 3 +-
modules/gui/qt4/input_manager.cpp | 11 ++++++-
modules/gui/qt4/input_manager.hpp | 2 +
4 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 0b4cdd2..64e52fc 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -96,6 +96,10 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
#undef ADD_ICON
rebuild( p_root );
+ CONNECT( THEMIM->getIM(), metaChanged( int ),
+ this, ProcessInputItemUpdate( int ) );
+ CONNECT( THEMIM, inputChanged( input_thread_t * ),
+ this, ProcessInputItemUpdate( input_thread_t* ) );
}
PLModel::~PLModel()
@@ -220,18 +224,20 @@ void PLModel::addCallbacks()
{
/* Some global changes happened -> Rebuild all */
var_AddCallback( p_playlist, "intf-change", PlaylistChanged, this );
- /* We went to the next item */
+ /* We went to the next item
var_AddCallback( p_playlist, "item-current", PlaylistNext, this );
+ */
/* One item has been updated */
- var_AddCallback( p_playlist, "item-change", ItemChanged, this );
- var_AddCallback( p_playlist, "playlist-item-append", ItemAppended, this );
- var_AddCallback( p_playlist, "playlist-item-deleted", ItemDeleted, this );
+ var_AddCallback( p_playlist, "item-append", ItemAppended, this );
+ var_AddCallback( p_playlist, "item-deleted", ItemDeleted, this );
}
void PLModel::delCallbacks()
{
var_DelCallback( p_playlist, "item-change", ItemChanged, this );
+ /*
var_DelCallback( p_playlist, "item-current", PlaylistNext, this );
+ */
var_DelCallback( p_playlist, "intf-change", PlaylistChanged, this );
var_DelCallback( p_playlist, "playlist-item-append", ItemAppended, this );
var_DelCallback( p_playlist, "playlist-item-deleted", ItemDeleted, this );
@@ -512,16 +518,14 @@ PLItem * PLModel::FindInner( PLItem *root, int i_id, bool b_input )
void PLModel::customEvent( QEvent *event )
{
int type = event->type();
- if( type != ItemUpdate_Type && type != ItemAppend_Type &&
+ if( type != ItemAppend_Type &&
type != ItemDelete_Type && type != PLUpdate_Type )
return;
PLEvent *ple = static_cast<PLEvent *>(event);
- if( type == ItemUpdate_Type )
- ProcessInputItemUpdate( ple->i_id );
- else if( type == ItemAppend_Type )
- ProcessItemAppend( &ple->add );
+ if( type == ItemAppend_Type )
+ ProcessItemAppend( ple->p_add );
else if( type == ItemDelete_Type )
ProcessItemRemoval( ple->i_id );
else
@@ -529,6 +533,11 @@ void PLModel::customEvent( QEvent *event )
}
/**** Events processing ****/
+void PLModel::ProcessInputItemUpdate( input_thread_t *p_input )
+{
+ if( !p_input ) return;
+ ProcessInputItemUpdate( input_GetItem( p_input )->i_id );
+}
void PLModel::ProcessInputItemUpdate( int i_input_id )
{
if( i_input_id <= 0 ) return;
diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp
index 04fb783..39af4c8 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.hpp
@@ -140,7 +140,6 @@ private:
static QIcon icons[ITEM_TYPE_NUMBER];
/* Update processing */
- void ProcessInputItemUpdate( int i_input_id );
void ProcessItemRemoval( int i_id );
void ProcessItemAppend( const playlist_add_t *p_add );
@@ -184,6 +183,8 @@ private slots:
void popupSave();
void popupExplore();
void viewchanged( int );
+ void ProcessInputItemUpdate( int i_input_id );
+ void ProcessInputItemUpdate( input_thread_t* p_input );
};
#endif
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index f36b64c..fed980f 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -136,7 +136,7 @@ void InputManager::delInput()
/* Reset all InfoPanels but stats */
emit artChanged( NULL );
emit infoChanged( NULL );
- emit metaChanged( NULL );
+ emit metaChanged( (input_item_t *)NULL );
}
/* Convert the event from the callbacks in actions */
@@ -171,7 +171,9 @@ void InputManager::customEvent( QEvent *event )
UpdateStatus();
// UpdateName();
UpdateArt();
+ /* Update duration of file */
}
+ UpdateMeta( ple->i_id );
break;
case ItemStateChanged_Type:
// TODO: Fusion with above state
@@ -599,6 +601,11 @@ inline void InputManager::UpdateStats()
emit statisticsUpdated( input_GetItem( p_input ) );
}
+inline void InputManager::UpdateMeta( int id )
+{
+ emit metaChanged( id );
+}
+
inline void InputManager::UpdateMeta()
{
emit metaChanged( input_GetItem( p_input ) );
@@ -889,7 +896,7 @@ void MainInputManager::customEvent( QEvent *event )
vlc_mutex_lock( &p_intf->change_lock );
if( p_input && ( p_input->b_dead || !vlc_object_alive (p_input) ) )
{
- emit inputChanged( NULL );
+ emit inputChanged( p_input );
var_DelCallback( p_input, "state", PLItemChanged, this );
vlc_object_release( p_input );
p_input = NULL;
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 3228873..94f84d0 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -129,6 +129,7 @@ private:
void UpdateArt();
void UpdateInfo();
void UpdateMeta();
+ void UpdateMeta(int);
void UpdateVout();
void UpdateAout();
void UpdateStats();
@@ -172,6 +173,7 @@ signals:
void statisticsUpdated( input_item_t* );
void infoChanged( input_item_t* );
void metaChanged( input_item_t* );
+ void metaChanged( int );
void artChanged( QString );
/// Play/pause status
void statusChanged( int );
More information about the vlc-devel
mailing list