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 @@
* 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()
{
}
......@@ -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;
......
/*****************************************************************************
* 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@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();
}
......
......@@ -101,8 +101,8 @@ void InputManager::setInput( input_thread_t *_p_input )
p_input is released once here */
void InputManager::delInput()
{
if( p_input )
{
if( !p_input ) return;
delCallbacks();
i_old_playing_status = END_S;
i_input_id = 0;
......@@ -111,28 +111,36 @@ void InputManager::delInput()
b_video = false;
timeA = 0;
timeB = 0;
emit positionUpdated( -1.0, 0 ,0 );
emit statusChanged( END_S );
emit rateChanged( INPUT_RATE_DEFAULT ); /* TODO: Do we want this ? */
emit nameChanged( "" );
emit artChanged( NULL );
emit rateChanged( INPUT_RATE_DEFAULT );
emit voutChanged( false );
emit chapterChanged( 0 );
emit titleChanged( 0 );
vlc_object_release( p_input );
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;
UpdateTeletext();
}
}
/* 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 );
}
......
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