]> git.sesse.net Git - vlc/commitdiff
Qt4 - Move the Write MetaData button outside of the component part because it is...
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 24 Jun 2007 16:57:21 +0000 (16:57 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 24 Jun 2007 16:57:21 +0000 (16:57 +0000)
modules/gui/qt4/components/infopanels.cpp
modules/gui/qt4/dialogs/mediainfo.cpp
modules/gui/qt4/dialogs/mediainfo.hpp

index 9ac241161fb03cfba62034b54d4c21a67f2438ad..7525955a8f2e27e757a5fc6ca4e8650736b643a9 100644 (file)
@@ -115,11 +115,6 @@ MetaPanel::MetaPanel( QWidget *parent, intf_thread_t *_p_intf ) :
     ADD_META_B( VLC_META_ENCODED_BY, publisher_text );
     ADD_META_B( VLC_META_DESCRIPTION, description_text ); // Comment Two lines?
 
-    QPushButton *write = new QPushButton( qtr( "&Write" ) );
-    l->addWidget( write, line, 0 );
-
-    BUTTONACT( write, saveMeta() );
-
     /*  ADD_META( TRACKID)  DO NOT SHOW it */
     /*  ADD_URI - DO not show it, done outside */
 
index 9efb50d4bd0cbcd91bca11eadaf3ac807899a54b..774f8ccdddb3917a16ed76683e0d6aaec7474053 100644 (file)
@@ -49,8 +49,7 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput,
     setWindowTitle( qtr( "Media information" ) );
     resize( 700 , 450 );
 
-    QGridLayout *layout = new QGridLayout( this );
-
+    /* TabWidgets and Tabs creation */
     IT = new QTabWidget;
     MP = new MetaPanel( IT, p_intf );
     IT->addTab( MP, qtr( "&General" ) );
@@ -64,6 +63,10 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput,
         IT->addTab( ISP, qtr( "&Stats" ) );
     }
 
+    QGridLayout *layout = new QGridLayout( this );
+
+    /* FIXME GNOME/KDE ? */
+    saveMetaButton = new QPushButton( qtr( "&Save Metadata" ) );
     QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
     closeButton->setDefault( true );
 
@@ -72,12 +75,22 @@ MediaInfoDialog::MediaInfoDialog( intf_thread_t *_p_intf, bool _mainInput,
 
     layout->addWidget( IT, 0, 0, 1, 7 );
     layout->addWidget( closeButton, 2, 6 );
+    layout->addWidget( saveMetaButton, 2, 5 );
     layout->addWidget( uriLabel, 1, 0, 1, 1 );
     layout->addWidget( uriLine, 1, 1, 1, 6 );
 
     BUTTONACT( closeButton, close() );
+
+    /* The tabs buttons are shown in the main dialog for space and cosmetics */
+    CONNECT( saveMetaButton, clicked(), MP, saveMeta() );
+
+    /* Let the MetaData Panel update the URI */
     CONNECT( MP, uriSet( QString ), uriLine, setText( QString ) );
 
+    CONNECT( IT, currentChanged ( int ), this, updateButtons( int ) );
+
+
+    /* Create the main Update function with a time (150ms) */
     if( mainInput ) {
         ON_TIMEOUT( update() );
         var_AddCallback( THEPL, "item-change", ItemChanged, this );
@@ -170,3 +183,11 @@ void MediaInfoDialog::close()
         deleteLater();
     }
 }
+
+void MediaInfoDialog::updateButtons( int i_tab )
+{
+    msg_Dbg( p_intf, "Coin Coin, Tab number: %i", i_tab );
+
+    if( i_tab == 0 ) saveMetaButton->show();
+    else saveMetaButton->hide();
+}
index 1cafec13740f77351ecf277c5cde4ea5d1651393..dbac68cf5781ab686849b7caa0822d66fb300ecb 100644 (file)
@@ -66,11 +66,13 @@ private:
     MetaPanel *MP;
     InfoPanel *IP;
     ExtraMetaPanel *EMP;
+    QPushButton *saveMetaButton;
 public slots:
     void update();
     void update( input_item_t *, bool, bool );
     void close();
     void clear();
+    void updateButtons( int i_tab );
 };
 
 #endif