Commit fab94892 authored by Jean-Baptiste Kempf's avatar 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.
parent 4792d566
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
...@@ -30,9 +31,9 @@ ...@@ -30,9 +31,9 @@
#include "components/info_panels.hpp" #include "components/info_panels.hpp"
#include "components/interface_widgets.hpp" #include "components/interface_widgets.hpp"
#include <assert.h>
#include <QTreeWidget> #include <QTreeWidget>
#include <QListView>
#include <QPushButton>
#include <QHeaderView> #include <QHeaderView>
#include <QList> #include <QList>
#include <QStringList> #include <QStringList>
...@@ -40,7 +41,6 @@ ...@@ -40,7 +41,6 @@
#include <QLineEdit> #include <QLineEdit>
#include <QLabel> #include <QLabel>
#include <QSpinBox> #include <QSpinBox>
#include <QTabWidget>
/************************************************************************ /************************************************************************
* Single panels * Single panels
...@@ -153,13 +153,13 @@ MetaPanel::MetaPanel( QWidget *parent, ...@@ -153,13 +153,13 @@ MetaPanel::MetaPanel( QWidget *parent,
b_inEditMode = false; b_inEditMode = false;
} }
MetaPanel::~MetaPanel(){}
/** /**
* Update all the MetaData and art on an "item-changed" event * Update all the MetaData and art on an "item-changed" event
**/ **/
void MetaPanel::update( input_item_t *p_item ) void MetaPanel::update( input_item_t *p_item )
{ {
if( !p_item ) clear();
/* Don't update if you are in edit mode */ /* Don't update if you are in edit mode */
if( b_inEditMode ) return; if( b_inEditMode ) return;
else p_input = p_item; else p_input = p_item;
...@@ -354,6 +354,8 @@ ExtraMetaPanel::ExtraMetaPanel( QWidget *parent, ...@@ -354,6 +354,8 @@ ExtraMetaPanel::ExtraMetaPanel( QWidget *parent,
**/ **/
void ExtraMetaPanel::update( input_item_t *p_item ) void ExtraMetaPanel::update( input_item_t *p_item )
{ {
if( !p_item ) clear();
QStringList tempItem; QStringList tempItem;
QList<QTreeWidgetItem *> items; QList<QTreeWidgetItem *> items;
...@@ -418,15 +420,13 @@ InfoPanel::InfoPanel( QWidget *parent, ...@@ -418,15 +420,13 @@ InfoPanel::InfoPanel( QWidget *parent,
layout->addWidget(InfoTree, 1, 0 ); layout->addWidget(InfoTree, 1, 0 );
} }
InfoPanel::~InfoPanel()
{
}
/** /**
* Update the Codecs information on parent->update() * Update the Codecs information on parent->update()
**/ **/
void InfoPanel::update( input_item_t *p_item) void InfoPanel::update( input_item_t *p_item)
{ {
if( !p_item ) clear();
InfoTree->clear(); InfoTree->clear();
QTreeWidgetItem *current_item = NULL; QTreeWidgetItem *current_item = NULL;
QTreeWidgetItem *child_item = NULL; QTreeWidgetItem *child_item = NULL;
...@@ -546,13 +546,6 @@ InputStatsPanel::InputStatsPanel( QWidget *parent, ...@@ -546,13 +546,6 @@ InputStatsPanel::InputStatsPanel( QWidget *parent,
StatsTree->setColumnWidth( 1 , 200 ); StatsTree->setColumnWidth( 1 , 200 );
layout->addWidget(StatsTree, 1, 0 ); 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() ...@@ -560,6 +553,7 @@ InputStatsPanel::~InputStatsPanel()
**/ **/
void InputStatsPanel::update( input_item_t *p_item ) void InputStatsPanel::update( input_item_t *p_item )
{ {
assert( p_item );
vlc_mutex_lock( &p_item->p_stats->lock ); vlc_mutex_lock( &p_item->p_stats->lock );
#define UPDATE( widget, format, calc... ) \ #define UPDATE( widget, format, calc... ) \
...@@ -599,3 +593,4 @@ input_Control( p_input_thread, INPUT_GET_VIDEO_FPS, &f_fps */ ...@@ -599,3 +593,4 @@ input_Control( p_input_thread, INPUT_GET_VIDEO_FPS, &f_fps */
void InputStatsPanel::clear() void InputStatsPanel::clear()
{ {
} }
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <vlc_meta.h> #include <vlc_meta.h>
#include <QWidget> #include <QWidget>
#include <QLabel>
#include <limits.h> #include <limits.h>
...@@ -56,7 +55,6 @@ class MetaPanel: public QWidget ...@@ -56,7 +55,6 @@ class MetaPanel: public QWidget
Q_OBJECT; Q_OBJECT;
public: public:
MetaPanel( QWidget *, intf_thread_t * ); MetaPanel( QWidget *, intf_thread_t * );
virtual ~MetaPanel();
void saveMeta(); void saveMeta();
bool isInEditMode(); bool isInEditMode();
...@@ -100,7 +98,6 @@ class ExtraMetaPanel: public QWidget ...@@ -100,7 +98,6 @@ class ExtraMetaPanel: public QWidget
Q_OBJECT; Q_OBJECT;
public: public:
ExtraMetaPanel( QWidget *, intf_thread_t * ); ExtraMetaPanel( QWidget *, intf_thread_t * );
virtual ~ExtraMetaPanel() {};
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QTreeWidget *extraMetaTree; QTreeWidget *extraMetaTree;
...@@ -114,7 +111,6 @@ class InputStatsPanel: public QWidget ...@@ -114,7 +111,6 @@ class InputStatsPanel: public QWidget
Q_OBJECT; Q_OBJECT;
public: public:
InputStatsPanel( QWidget *, intf_thread_t * ); InputStatsPanel( QWidget *, intf_thread_t * );
virtual ~InputStatsPanel();
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
...@@ -151,7 +147,6 @@ class InfoPanel: public QWidget ...@@ -151,7 +147,6 @@ class InfoPanel: public QWidget
Q_OBJECT; Q_OBJECT;
public: public:
InfoPanel( QWidget *, intf_thread_t * ); InfoPanel( QWidget *, intf_thread_t * );
virtual ~InfoPanel();
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QTreeWidget *InfoTree; QTreeWidget *InfoTree;
......
/***************************************************************************** /*****************************************************************************
* mediainfo.cpp : Information about an item * mediainfo.cpp : Information about an item
**************************************************************************** ****************************************************************************
* Copyright (C) 2006-2007 the VideoLAN team * Copyright (C) 2006-2008 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
******************************************************************************/ ******************************************************************************/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
...@@ -89,19 +90,33 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, ...@@ -89,19 +90,33 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
CONNECT( MP, uriSet( QString ), uriLine, setText( QString ) ); CONNECT( MP, uriSet( QString ), uriLine, setText( QString ) );
CONNECT( MP, editing(), saveMetaButton, show() ); CONNECT( MP, editing(), saveMetaButton, show() );
/* Display the buttonBar according to the Tab selected */
CONNECT( infoTabW, currentChanged( int ), this, updateButtons( int ) ); CONNECT( infoTabW, currentChanged( int ), this, updateButtons( int ) );
/* If using the General Mode */ /* If using the General Mode */
if( isMainInputInfo ) if( isMainInputInfo )
{ {
msg_Dbg( p_intf, "Using a general info windows" ); 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() ) if( THEMIM->getInput() )
p_item = input_GetItem( THEMIM->getInput() ); p_item = input_GetItem( THEMIM->getInput() );
} }
else else
msg_Dbg( p_intf, "Using an item specific info windows" ); 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 ) if( p_item )
updateAllTabs( p_item ); updateAllTabs( p_item );
...@@ -131,8 +146,7 @@ void MediaInfoDialog::updateAllTabs( input_item_t *p_item ) ...@@ -131,8 +146,7 @@ void MediaInfoDialog::updateAllTabs( input_item_t *p_item )
MP->update( p_item ); MP->update( p_item );
EMP->update( p_item ); EMP->update( p_item );
if( isMainInputInfo ) if( isMainInputInfo ) ISP->update( p_item );
ISP->update( p_item );
} }
void MediaInfoDialog::clearAllTabs() void MediaInfoDialog::clearAllTabs()
...@@ -140,6 +154,7 @@ void MediaInfoDialog::clearAllTabs() ...@@ -140,6 +154,7 @@ void MediaInfoDialog::clearAllTabs()
IP->clear(); IP->clear();
MP->clear(); MP->clear();
EMP->clear(); EMP->clear();
if( isMainInputInfo ) ISP->clear(); if( isMainInputInfo ) ISP->clear();
} }
......
...@@ -101,38 +101,46 @@ void InputManager::setInput( input_thread_t *_p_input ) ...@@ -101,38 +101,46 @@ void InputManager::setInput( input_thread_t *_p_input )
p_input is released once here */ p_input is released once here */
void InputManager::delInput() void InputManager::delInput()
{ {
if( p_input ) if( !p_input ) return;
{
delCallbacks(); delCallbacks();
i_old_playing_status = END_S; i_old_playing_status = END_S;
i_input_id = 0; i_input_id = 0;
oldName = ""; oldName = "";
artUrl = ""; artUrl = "";
b_video = false; b_video = false;
timeA = 0; timeA = 0;
timeB = 0; timeB = 0;
emit positionUpdated( -1.0, 0 ,0 );
emit statusChanged( END_S ); emit positionUpdated( -1.0, 0 ,0 );
emit nameChanged( "" ); emit rateChanged( INPUT_RATE_DEFAULT ); /* TODO: Do we want this ? */
emit artChanged( NULL ); emit nameChanged( "" );
emit rateChanged( INPUT_RATE_DEFAULT ); emit chapterChanged( 0 );
emit voutChanged( false ); emit titleChanged( 0 );
emit chapterChanged( 0 ); emit statusChanged( END_S );
emit titleChanged( 0 );
vlc_object_release( p_input ); /* Reset InfoPanels but stats */
p_input = NULL; emit artChanged( NULL );
UpdateTeletext(); 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 */ /* Add the callbacks on Input. Self explanatory */
void InputManager::addCallbacks() inline void InputManager::addCallbacks()
{ {
var_AddCallback( p_input, "intf-event", InputEvent, this ); var_AddCallback( p_input, "intf-event", InputEvent, this );
} }
/* Delete the callbacks on Input. Self explanatory */ /* Delete the callbacks on Input. Self explanatory */
void InputManager::delCallbacks() inline void InputManager::delCallbacks()
{ {
var_DelCallback( p_input, "intf-event", InputEvent, this ); var_DelCallback( p_input, "intf-event", InputEvent, this );
} }
......
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