Commit 14605709 authored by Ilkka Ollakka's avatar Ilkka Ollakka

Edit mediainfo so you can edit meta-data even when playitem changes in
background. Also sets default to readonly, so user can't change meta if
he/she doesn't want to edit it. First try ;)
parent fc386d94
...@@ -126,6 +126,7 @@ MetaPanel::MetaPanel( QWidget *parent, ...@@ -126,6 +126,7 @@ MetaPanel::MetaPanel( QWidget *parent,
#undef ADD_META #undef ADD_META
#undef ADD_META_2 #undef ADD_META_2
ReadOnly( true );
} }
MetaPanel::~MetaPanel(){} MetaPanel::~MetaPanel(){}
...@@ -135,6 +136,7 @@ MetaPanel::~MetaPanel(){} ...@@ -135,6 +136,7 @@ MetaPanel::~MetaPanel(){}
**/ **/
void MetaPanel::saveMeta() void MetaPanel::saveMeta()
{ {
ReadOnly( true );
playlist_t *p_playlist; playlist_t *p_playlist;
char psz[5]; char psz[5];
...@@ -183,6 +185,28 @@ void MetaPanel::saveMeta() ...@@ -183,6 +185,28 @@ void MetaPanel::saveMeta()
pl_Release( p_playlist ); pl_Release( p_playlist );
} }
void MetaPanel::ReadOnly(bool readonly)
{
title_text->setReadOnly( readonly );
artist_text->setReadOnly( readonly );
collection_text->setReadOnly( readonly );
genre_text->setReadOnly( readonly );
date_text->setReadOnly( readonly );
seqnum_text->setReadOnly( readonly );
rating_text->setReadOnly( readonly );
language_text->setReadOnly( readonly );
setting_text->setReadOnly( readonly );
copyright_text->setReadOnly( readonly );
publisher_text->setReadOnly( readonly );
description_text->setReadOnly( readonly );
}
void MetaPanel::editMeta()
{
ReadOnly( false );
}
/** /**
* Update all the MetaData and art on an "item-changed" event * Update all the MetaData and art on an "item-changed" event
**/ **/
......
...@@ -54,6 +54,8 @@ public: ...@@ -54,6 +54,8 @@ public:
MetaPanel( QWidget *, intf_thread_t * ); MetaPanel( QWidget *, intf_thread_t * );
virtual ~MetaPanel(); virtual ~MetaPanel();
input_item_t *p_input; input_item_t *p_input;
void saveMeta();
void editMeta();
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QLineEdit *uri_text; QLineEdit *uri_text;
...@@ -71,11 +73,11 @@ private: ...@@ -71,11 +73,11 @@ private:
QLineEdit *nowplaying_text; QLineEdit *nowplaying_text;
QLineEdit *publisher_text; QLineEdit *publisher_text;
QLabel *art_cover; QLabel *art_cover;
void ReadOnly( bool );
public slots: public slots:
void update( input_item_t * ); void update( input_item_t * );
void clear(); void clear();
void saveMeta();
signals: signals:
void uriSet( QString ); void uriSet( QString );
}; };
......
...@@ -67,7 +67,9 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput, ...@@ -67,7 +67,9 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput,
QGridLayout *layout = new QGridLayout( this ); QGridLayout *layout = new QGridLayout( this );
/* FIXME GNOME/KDE ? */ /* FIXME GNOME/KDE ? */
editMetaButton = new QPushButton( qtr( "&Edit Metadata" ) );
saveMetaButton = new QPushButton( qtr( "&Save Metadata" ) ); saveMetaButton = new QPushButton( qtr( "&Save Metadata" ) );
saveMetaButton->hide();
QPushButton *closeButton = new QPushButton( qtr( "&Close" ) ); QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
closeButton->setDefault( true ); closeButton->setDefault( true );
...@@ -78,12 +80,14 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput, ...@@ -78,12 +80,14 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput,
layout->addWidget( uriLabel, 1, 0, 1, 1 ); layout->addWidget( uriLabel, 1, 0, 1, 1 );
layout->addWidget( uriLine, 1, 1, 1, 7 ); layout->addWidget( uriLine, 1, 1, 1, 7 );
layout->addWidget( saveMetaButton, 2, 6 ); layout->addWidget( saveMetaButton, 2, 6 );
layout->addWidget( editMetaButton, 2, 6 );
layout->addWidget( closeButton, 2, 7 ); layout->addWidget( closeButton, 2, 7 );
BUTTONACT( closeButton, close() ); BUTTONACT( closeButton, close() );
/* The tabs buttons are shown in the main dialog for space and cosmetics */ /* The tabs buttons are shown in the main dialog for space and cosmetics */
CONNECT( saveMetaButton, clicked(), MP, saveMeta() ); CONNECT( saveMetaButton, clicked(), this, saveMeta() );
CONNECT( editMetaButton, clicked(), this, editMeta() );
/* Let the MetaData Panel update the URI */ /* Let the MetaData Panel update the URI */
CONNECT( MP, uriSet( QString ), uriLine, setText( QString ) ); CONNECT( MP, uriSet( QString ), uriLine, setText( QString ) );
...@@ -112,6 +116,22 @@ void MediaInfoDialog::showTab( int i_tab = 0 ) ...@@ -112,6 +116,22 @@ void MediaInfoDialog::showTab( int i_tab = 0 )
IT->setCurrentIndex( i_tab ); IT->setCurrentIndex( i_tab );
} }
void MediaInfoDialog::editMeta()
{
in_edit = true;
editMetaButton->hide();
saveMetaButton->show();
MP->editMeta();
}
void MediaInfoDialog::saveMeta()
{
MP->saveMeta();
editMetaButton->show();
saveMetaButton->hide();
in_edit = false;
}
static int ItemChanged( vlc_object_t *p_this, const char *psz_var, static int ItemChanged( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param ) vlc_value_t oldval, vlc_value_t newval, void *param )
{ {
...@@ -152,6 +172,7 @@ void MediaInfoDialog::update() ...@@ -152,6 +172,7 @@ void MediaInfoDialog::update()
void MediaInfoDialog::update( input_item_t *p_item, bool update_info, void MediaInfoDialog::update( input_item_t *p_item, bool update_info,
bool update_meta ) bool update_meta )
{ {
if( in_edit ) return;
MP->p_input = p_item; MP->p_input = p_item;
if( update_info ) if( update_info )
IP->update( p_item ); IP->update( p_item );
...@@ -174,6 +195,7 @@ void MediaInfoDialog::clear() ...@@ -174,6 +195,7 @@ void MediaInfoDialog::clear()
void MediaInfoDialog::close() void MediaInfoDialog::close()
{ {
in_edit = false;
this->toggleVisible(); this->toggleVisible();
if( mainInput == false ) { if( mainInput == false ) {
......
...@@ -62,13 +62,17 @@ private: ...@@ -62,13 +62,17 @@ private:
int i_runs; int i_runs;
bool mainInput; bool mainInput;
bool stats; bool stats;
bool in_edit;
InputStatsPanel *ISP; InputStatsPanel *ISP;
MetaPanel *MP; MetaPanel *MP;
InfoPanel *IP; InfoPanel *IP;
ExtraMetaPanel *EMP; ExtraMetaPanel *EMP;
QPushButton *saveMetaButton; QPushButton *saveMetaButton;
QPushButton *editMetaButton;
public slots: public slots:
void update(); void update();
void saveMeta();
void editMeta();
void update( input_item_t *, bool, bool ); void update( input_item_t *, bool, bool );
void close(); void close();
void clear(); void clear();
......
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