InfoTree->clear();
}
-/***************************************************************************
- * Tab widget
- ***************************************************************************/
-
-InfoTab::InfoTab( QWidget *parent, intf_thread_t *_p_intf, bool _stats ) :
- QTabWidget( parent ), stats( _stats ), p_intf( _p_intf )
-{
- MP = new MetaPanel( NULL, p_intf );
- addTab( MP, qtr( "&General" ) );
- EMP = new ExtraMetaPanel( NULL, p_intf );
- addTab( EMP, qtr( "&Extra Metadata" ) );
- IP = new InfoPanel( NULL, p_intf);
- addTab(IP, qtr("&Codec Details"));
- if( stats )
- {
- ISP = new InputStatsPanel( NULL, p_intf );
- addTab(ISP, qtr("&Stats"));
- }
-}
-
-InfoTab::~InfoTab()
-{
-}
-
-/* This function should be called approximately twice a second.
- * p_item should be locked
- * Stats will always be updated */
-void InfoTab::update( input_item_t *p_item, bool update_info,
- bool update_meta )
-{
- if( update_info )
- IP->update( p_item );
- if( update_meta )
- MP->update( p_item );
- EMP->update( p_item );
- if( stats )
- ISP->update( p_item );
-}
-
-void InfoTab::clear()
-{
- IP->clear();
- MP->clear();
- EMP->clear();
- if( stats ) ISP->clear();
-}
vlc_value_t oldval, vlc_value_t newval, void *param );
MediaInfoDialog *MediaInfoDialog::instance = NULL;
-MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput ) :
- QVLCFrame( _p_intf ), mainInput(_mainInput)
+MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput,
+ bool _stats ) :
+ QVLCFrame( _p_intf ), mainInput(_mainInput),
+ stats( _stats )
{
i_runs = 0;
p_input = NULL;
resize( 600 , 450 );
QGridLayout *layout = new QGridLayout(this);
- IT = new InfoTab( this, p_intf, true ) ;
+
+ IT = new QTabWidget;
+ MP = new MetaPanel( IT, p_intf );
+ IT->addTab( MP, qtr( "&General" ) );
+ EMP = new ExtraMetaPanel( IT, p_intf );
+ IT->addTab( EMP, qtr( "&Extra Metadata" ) );
+ IP = new InfoPanel( IT, p_intf);
+ IT->addTab( IP, qtr("&Codec Details"));
+ if( stats )
+ {
+ ISP = new InputStatsPanel( IT, p_intf );
+ IT->addTab(ISP, qtr("&Stats"));
+ }
+
QPushButton *closeButton = new QPushButton(qtr("&Close"));
closeButton->setDefault( true );
- layout->addWidget(IT,0,0,1,3);
+ layout->addWidget( IT, 0, 0, 1, 3);
layout->addWidget(closeButton,1,2);
BUTTONACT( closeButton, close() );
+ ON_TIMEOUT( update() );
if( mainInput ) {
- ON_TIMEOUT( update() );
var_AddCallback( THEPL, "item-change", ItemChanged, this );
}
}
void MediaInfoDialog::setInput(input_item_t *p_input)
{
- IT->clear();
+ clear();
vlc_mutex_lock( &p_input->lock );
- IT->update( p_input, true, true );
+ update( p_input, true, true );
vlc_mutex_unlock( &p_input->lock );
}
void MediaInfoDialog::update()
{
+ msg_Dbg( p_intf, "updating" );
/* Timer runs at 150 ms, dont' update more than 2 times per second */
if( i_runs % 3 != 0 ) return;
i_runs++;
+ /* Get Input and clear if non-existant */
input_thread_t *p_input =
MainInputManager::getInstance( p_intf )->getInput();
if( !p_input || p_input->b_dead )
{
- IT->clear();
+ clear();
return;
}
vlc_object_yield( p_input );
vlc_mutex_lock( &input_GetItem(p_input)->lock );
- IT->update( input_GetItem(p_input), need_update, need_update );
+ update( input_GetItem(p_input), need_update, need_update );
need_update = false;
vlc_mutex_unlock( &input_GetItem(p_input)->lock );
vlc_object_release( p_input );
}
+void MediaInfoDialog::update( input_item_t *p_item, bool update_info,
+ bool update_meta )
+{
+ if( update_info )
+ IP->update( p_item );
+ if( update_meta )
+ {
+ MP->update( p_item );
+ EMP->update( p_item );
+ }
+ if( stats )
+ ISP->update( p_item );
+}
+
+void MediaInfoDialog::clear()
+{
+ IP->clear();
+ MP->clear();
+ EMP->clear();
+ if( stats ) ISP->clear();
+}
+
+
void MediaInfoDialog::close()
{
this->toggleVisible();
#define _MEDIAINFO_DIALOG_H_
#include "util/qvlcframe.hpp"
+#include "components/infopanels.hpp"
class QTabWidget;
class InfoTab;
{
Q_OBJECT;
public:
- MediaInfoDialog( intf_thread_t *, bool mainInput = false );
+ MediaInfoDialog( intf_thread_t *, bool stats = true,
+ bool mainInput = false );
static MediaInfoDialog * getInstance( intf_thread_t *p_intf )
{
if( !instance)
- instance = new MediaInfoDialog( p_intf, true);
+ instance = new MediaInfoDialog( p_intf, true, true );
return instance;
}
static void killInstance()
void setInput( input_item_t * );
private:
input_thread_t *p_input;
- InfoTab *IT;
+ QTabWidget *IT;
static MediaInfoDialog *instance;
int i_runs;
bool mainInput;
+ bool stats;
+ InputStatsPanel *ISP;
+ MetaPanel *MP;
+ InfoPanel *IP;
+ ExtraMetaPanel *EMP;
public slots:
void update();
+ void update( input_item_t *, bool, bool );
void close();
+ void clear();
};
#endif