[vlc-devel] commit: Qt: input manager and media info cleanup continues. ( Jean-Baptiste Kempf )
git version control
git at videolan.org
Wed Dec 31 13:44:16 CET 2008
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Dec 31 13:03:47 2008 +0100| [fab94892f2c53eddcd293fb6405c4595ef197452] | committer: Jean-Baptiste Kempf
Qt: input manager and media info cleanup continues.
The code seems to be in a better shape now, and removes duplicates calls.
However: there seems to be a few issues left:
- If you open the MediaInfo Dialog before an input, it doesn't fill after
- If you stop, the MediaInfo doesn't clean itself.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fab94892f2c53eddcd293fb6405c4595ef197452
---
modules/gui/qt4/components/info_panels.cpp | 27 +++++--------
modules/gui/qt4/components/info_panels.hpp | 5 --
modules/gui/qt4/dialogs/mediainfo.cpp | 23 +++++++++--
modules/gui/qt4/input_manager.cpp | 56 ++++++++++++++++------------
4 files changed, 62 insertions(+), 49 deletions(-)
diff --git a/modules/gui/qt4/components/info_panels.cpp b/modules/gui/qt4/components/info_panels.cpp
index 664e7d8..eb71bb6 100644
--- a/modules/gui/qt4/components/info_panels.cpp
+++ b/modules/gui/qt4/components/info_panels.cpp
@@ -22,6 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -30,9 +31,9 @@
#include "components/info_panels.hpp"
#include "components/interface_widgets.hpp"
+#include <assert.h>
+
#include <QTreeWidget>
-#include <QListView>
-#include <QPushButton>
#include <QHeaderView>
#include <QList>
#include <QStringList>
@@ -40,7 +41,6 @@
#include <QLineEdit>
#include <QLabel>
#include <QSpinBox>
-#include <QTabWidget>
/************************************************************************
* Single panels
@@ -153,13 +153,13 @@ MetaPanel::MetaPanel( QWidget *parent,
b_inEditMode = false;
}
-MetaPanel::~MetaPanel(){}
-
/**
* Update all the MetaData and art on an "item-changed" event
**/
void MetaPanel::update( input_item_t *p_item )
{
+ if( !p_item ) clear();
+
/* Don't update if you are in edit mode */
if( b_inEditMode ) return;
else p_input = p_item;
@@ -354,6 +354,8 @@ ExtraMetaPanel::ExtraMetaPanel( QWidget *parent,
**/
void ExtraMetaPanel::update( input_item_t *p_item )
{
+ if( !p_item ) clear();
+
QStringList tempItem;
QList<QTreeWidgetItem *> items;
@@ -418,15 +420,13 @@ InfoPanel::InfoPanel( QWidget *parent,
layout->addWidget(InfoTree, 1, 0 );
}
-InfoPanel::~InfoPanel()
-{
-}
-
/**
* Update the Codecs information on parent->update()
**/
void InfoPanel::update( input_item_t *p_item)
{
+ if( !p_item ) clear();
+
InfoTree->clear();
QTreeWidgetItem *current_item = NULL;
QTreeWidgetItem *child_item = NULL;
@@ -546,13 +546,6 @@ InputStatsPanel::InputStatsPanel( QWidget *parent,
StatsTree->setColumnWidth( 1 , 200 );
layout->addWidget(StatsTree, 1, 0 );
-
- CONNECT( THEMIM->getIM() , statisticsUpdated( input_item_t* ),
- this, update( input_item_t* ) );
-}
-
-InputStatsPanel::~InputStatsPanel()
-{
}
/**
@@ -560,6 +553,7 @@ InputStatsPanel::~InputStatsPanel()
**/
void InputStatsPanel::update( input_item_t *p_item )
{
+ assert( p_item );
vlc_mutex_lock( &p_item->p_stats->lock );
#define UPDATE( widget, format, calc... ) \
@@ -599,3 +593,4 @@ input_Control( p_input_thread, INPUT_GET_VIDEO_FPS, &f_fps */
void InputStatsPanel::clear()
{
}
+
diff --git a/modules/gui/qt4/components/info_panels.hpp b/modules/gui/qt4/components/info_panels.hpp
index ed2d8d5..d1e5084 100644
--- a/modules/gui/qt4/components/info_panels.hpp
+++ b/modules/gui/qt4/components/info_panels.hpp
@@ -34,7 +34,6 @@
#include <vlc_meta.h>
#include <QWidget>
-#include <QLabel>
#include <limits.h>
@@ -56,7 +55,6 @@ class MetaPanel: public QWidget
Q_OBJECT;
public:
MetaPanel( QWidget *, intf_thread_t * );
- virtual ~MetaPanel();
void saveMeta();
bool isInEditMode();
@@ -100,7 +98,6 @@ class ExtraMetaPanel: public QWidget
Q_OBJECT;
public:
ExtraMetaPanel( QWidget *, intf_thread_t * );
- virtual ~ExtraMetaPanel() {};
private:
intf_thread_t *p_intf;
QTreeWidget *extraMetaTree;
@@ -114,7 +111,6 @@ class InputStatsPanel: public QWidget
Q_OBJECT;
public:
InputStatsPanel( QWidget *, intf_thread_t * );
- virtual ~InputStatsPanel();
private:
intf_thread_t *p_intf;
@@ -151,7 +147,6 @@ class InfoPanel: public QWidget
Q_OBJECT;
public:
InfoPanel( QWidget *, intf_thread_t * );
- virtual ~InfoPanel();
private:
intf_thread_t *p_intf;
QTreeWidget *InfoTree;
diff --git a/modules/gui/qt4/dialogs/mediainfo.cpp b/modules/gui/qt4/dialogs/mediainfo.cpp
index 6994a03..e908b87 100644
--- a/modules/gui/qt4/dialogs/mediainfo.cpp
+++ b/modules/gui/qt4/dialogs/mediainfo.cpp
@@ -1,7 +1,7 @@
/*****************************************************************************
* mediainfo.cpp : Information about an item
****************************************************************************
- * Copyright (C) 2006-2007 the VideoLAN team
+ * Copyright (C) 2006-2008 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub at videolan.org>
@@ -21,6 +21,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
******************************************************************************/
+
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -89,19 +90,33 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
CONNECT( MP, uriSet( QString ), uriLine, setText( QString ) );
CONNECT( MP, editing(), saveMetaButton, show() );
+ /* Display the buttonBar according to the Tab selected */
CONNECT( infoTabW, currentChanged( int ), this, updateButtons( int ) );
/* If using the General Mode */
if( isMainInputInfo )
{
msg_Dbg( p_intf, "Using a general info windows" );
+ /**
+ * Connects on the various signals of input_Manager
+ * For the currently playing element
+ **/
+ CONNECT( THEMIM, infoChanged( input_item_t* ),
+ IP, update( input_item_t* ) );
+ CONNECT( THEMIM, metaChanged( input_item_t* ),
+ MP, update( input_item_t* ) );
+ CONNECT( THEMIM, metaChanged( input_item_t* ),
+ EMP, update( input_item_t* ) );
+ CONNECT( THEMIM, statisticsUpdated( input_item_t* ),
+ ISP, update( input_item_t* ) );
+
if( THEMIM->getInput() )
p_item = input_GetItem( THEMIM->getInput() );
}
else
msg_Dbg( p_intf, "Using an item specific info windows" );
- /* Call update at start, so info is shown for a running input */
+ /* Call update at start, so info is filled up at begginning */
if( p_item )
updateAllTabs( p_item );
@@ -131,8 +146,7 @@ void MediaInfoDialog::updateAllTabs( input_item_t *p_item )
MP->update( p_item );
EMP->update( p_item );
- if( isMainInputInfo )
- ISP->update( p_item );
+ if( isMainInputInfo ) ISP->update( p_item );
}
void MediaInfoDialog::clearAllTabs()
@@ -140,6 +154,7 @@ void MediaInfoDialog::clearAllTabs()
IP->clear();
MP->clear();
EMP->clear();
+
if( isMainInputInfo ) ISP->clear();
}
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 88d9424..ff126e5 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -101,38 +101,46 @@ void InputManager::setInput( input_thread_t *_p_input )
p_input is released once here */
void InputManager::delInput()
{
- if( p_input )
- {
- delCallbacks();
- i_old_playing_status = END_S;
- i_input_id = 0;
- oldName = "";
- artUrl = "";
- b_video = false;
- timeA = 0;
- timeB = 0;
- emit positionUpdated( -1.0, 0 ,0 );
- emit statusChanged( END_S );
- emit nameChanged( "" );
- emit artChanged( NULL );
- emit rateChanged( INPUT_RATE_DEFAULT );
- emit voutChanged( false );
- emit chapterChanged( 0 );
- emit titleChanged( 0 );
- vlc_object_release( p_input );
- p_input = NULL;
- UpdateTeletext();
- }
+ if( !p_input ) return;
+
+ delCallbacks();
+ i_old_playing_status = END_S;
+ i_input_id = 0;
+ oldName = "";
+ artUrl = "";
+ b_video = false;
+ timeA = 0;
+ timeB = 0;
+
+ emit positionUpdated( -1.0, 0 ,0 );
+ emit rateChanged( INPUT_RATE_DEFAULT ); /* TODO: Do we want this ? */
+ emit nameChanged( "" );
+ emit chapterChanged( 0 );
+ emit titleChanged( 0 );
+ emit statusChanged( END_S );
+
+ /* Reset InfoPanels but stats */
+ emit artChanged( NULL );
+ emit infoChanged( NULL );
+ emit metaChanged( NULL );
+
+ emit teletextPossible( false );
+ emit voutChanged( false );
+
+// FIXME emit AtoBchanged( );
+ vlc_object_release( p_input ); /* FIXME: Can't we release sooner ? */
+
+ p_input = NULL;
}
/* Add the callbacks on Input. Self explanatory */
-void InputManager::addCallbacks()
+inline void InputManager::addCallbacks()
{
var_AddCallback( p_input, "intf-event", InputEvent, this );
}
/* Delete the callbacks on Input. Self explanatory */
-void InputManager::delCallbacks()
+inline void InputManager::delCallbacks()
{
var_DelCallback( p_input, "intf-event", InputEvent, this );
}
More information about the vlc-devel
mailing list