Please report regressions on that part.
int line = 0; /* Counter for GridLayout */
p_input = NULL;
-#define ADD_META( string, widget ) { \
+#define ADD_META( string, widget ) { \
metaLayout->addWidget( new QLabel( qtr( string ) + " :" ), line, 0 ); \
- widget = new QLineEdit; \
+ widget = new QLineEdit; \
metaLayout->addWidget( widget, line, 1, 1, 9 ); \
line++; }
ADD_META( VLC_META_COLLECTION, collection_text ); /* OK */
/* Genre Name */
- /* FIXME List id3genres.h is not includable yet ? */
+ /* TODO List id3genres.h is not includable yet ? */
genre_text = new QLineEdit;
metaLayout->addWidget( new QLabel( qtr( VLC_META_GENRE ) + " :" ), line, 0 );
metaLayout->addWidget( genre_text, line, 1, 1, 4 );
l->addWidget( setting_text, line, 6, 1, 4 ); */
/* Less used metadata */
-#define ADD_META_2( string, widget ) { \
+#define ADD_META_2( string, widget ) { \
metaLayout->addWidget( new QLabel( qtr( string ) + " :" ), line, 0 ); \
- widget = new QLineEdit; \
+ widget = new QLineEdit; \
metaLayout->addWidget( widget, line, 1, 1, 7 ); \
line++; }
{
/* Don't update if you are in edit mode */
if( b_inEditMode ) return;
+ else p_input = p_item;
char *psz_meta;
#define UPDATE_META( meta, widget ) { \
void MetaPanel::saveMeta()
{
playlist_t *p_playlist;
- char psz[5];
meta_export_t p_export;
p_export.p_item = p_input;
if( b_editing )emit editing();
}
-void MetaPanel::setInput( input_item_t *input )
-{
- if( b_inEditMode ) return;
-
- p_input = input;
-}
-
/*
* Clear all the metadata widgets
- * Unused yet FIXME
*/
-void MetaPanel::clear(){
+void MetaPanel::clear()
+{
+ uri_text->clear();
+ title_text->clear();
+ artist_text->clear();
+ genre_text->clear();
+ copyright_text->clear();
+ collection_text->clear();
+ seqnum_text->clear();
+ description_text->clear();
+ date_text->clear();
+ language_text->clear();
+ nowplaying_text->clear();
+ publisher_text->clear();
+ art_cover;
+
setEditMode( false );
}
MetaPanel( QWidget *, intf_thread_t * );
virtual ~MetaPanel();
void saveMeta();
- void setInput( input_item_t * );
bool isInEditMode();
void setEditMode( bool );
vlc_value_t oldval, vlc_value_t newval, void *param );
MediaInfoDialog *MediaInfoDialog::instance = NULL;
-MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput,
+MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf,
+ input_item_t *_p_item,
+ bool _mainInput,
bool _stats ) :
QVLCFrame( _p_intf ), mainInput(_mainInput),
stats( _stats )
{
i_runs = 0;
- p_input = NULL;
+ p_item = _p_item;
b_need_update = true;
setWindowTitle( qtr( "Media information" ) );
/* Let the MetaData Panel update the URI */
CONNECT( MP, uriSet( QString ), uriLine, setText( QString ) );
- CONNECT( MP, editing(), this, editMeta() );
+ CONNECT( MP, editing(), this, showMetaSaveButton() );
CONNECT( IT, currentChanged( int ), this, updateButtons( int ) );
/* Create the main Update function with a time (150ms) */
if( mainInput ) {
- ON_TIMEOUT( update() );
+ ON_TIMEOUT( updateOnTimeOut() );
var_AddCallback( THEPL, "item-change", ItemChanged, this );
}
}
IT->setCurrentIndex( i_tab );
}
-void MediaInfoDialog::editMeta()
+void MediaInfoDialog::showMetaSaveButton()
{
saveMetaButton->show();
}
return VLC_SUCCESS;
}
-void MediaInfoDialog::setInput( input_item_t *p_input )
-{
- clear();
- update( p_input, true, true );
- /* if info is from current input, don't set default to edit, if user opens
- * some other item, se default to edit, so it won't be updated to current item metas
- *
- * This really doesn't seem as clean solution as it could be
- */
- input_thread_t *p_current =
- MainInputManager::getInstance( p_intf )->getInput();
- MP->setEditMode( ( !p_current || p_current->b_dead || input_GetItem( p_current ) != p_input ) ?
- true: false );
-}
-
-void MediaInfoDialog::update()
+/* Function called on TimeOut */
+void MediaInfoDialog::updateOnTimeOut()
{
/* Timer runs at 150 ms, dont' update more than 2 times per second */
i_runs++;
if( i_runs % 4 != 0 ) return;
/* Get Input and clear if non-existant */
- input_thread_t *p_input =
- MainInputManager::getInstance( p_intf )->getInput();
+ input_thread_t *p_input = THEMIM->getInput();
if( !p_input || p_input->b_dead )
{
clear();
return;
}
+ /* Launch the update in all the panels */
vlc_object_yield( p_input );
update( input_GetItem(p_input), b_need_update, b_need_update );
}
void MediaInfoDialog::update( input_item_t *p_item,
- bool update_info,
- bool update_meta )
+ bool update_info,
+ bool update_meta )
{
- MP->setInput( p_item );
if( update_info )
IP->update( p_item );
if( update_meta )
if( mainInput == false ) {
deleteLater();
}
- MP->setEditMode( false );
}
void MediaInfoDialog::updateButtons( int i_tab )
{
Q_OBJECT;
public:
- MediaInfoDialog( intf_thread_t *, bool stats = true, bool mainInput = false );
+ MediaInfoDialog( intf_thread_t *,
+ input_item_t *,
+ bool stats = true,
+ bool mainInput = false );
+
static MediaInfoDialog * getInstance( intf_thread_t *p_intf )
{
- if( !instance) instance = new MediaInfoDialog( p_intf, true, true );
+ if( !instance) instance = new MediaInfoDialog( p_intf,
+ NULL,
+ true,
+ true );
return instance;
}
+
static void killInstance()
{
if( instance ) delete instance;
instance= NULL;
}
+
virtual ~MediaInfoDialog();
void showTab( int );
+#if 0
void setInput( input_item_t * );
-
+#endif
bool b_need_update;
private:
- input_thread_t *p_input;
+ input_item_t *p_item;
static MediaInfoDialog *instance;
int i_runs;
bool mainInput;
bool stats;
-
QTabWidget *IT;
InputStatsPanel *ISP;
MetaPanel *MP;
QLineEdit *uriLine;
public slots:
- void update();
+ void updateOnTimeOut();
void update( input_item_t *, bool, bool );
-
private slots:
void close();
void clear();
void saveMeta();
- void editMeta();
+ void showMetaSaveButton();
void updateButtons( int i_tab );
};
void PLModel::popupInfo()
{
playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
- i_popup_item,VLC_TRUE );
+ i_popup_item,
+ VLC_TRUE );
if( p_item )
{
- MediaInfoDialog *mid = new MediaInfoDialog( p_intf );
- mid->setInput( p_item->p_input );
+ MediaInfoDialog *mid = new MediaInfoDialog( p_intf, p_item->p_input );
mid->show();
}
}