Qt: Close #2906
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 1 Jul 2009 22:09:41 +0000 (00:09 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 1 Jul 2009 22:09:41 +0000 (00:09 +0200)
modules/gui/qt4/dialogs/extended.cpp
modules/gui/qt4/dialogs/extended.hpp
modules/gui/qt4/dialogs_provider.cpp

index 26b2a10..ffc34f0 100644 (file)
@@ -113,6 +113,11 @@ void ExtendedDialog::showTab( int i )
     show();
 }
 
+int ExtendedDialog::currentTab()
+{
+    return mainTabW->currentIndex();
+}
+
 void ExtendedDialog::changedItem( int i_status )
 {
     if( i_status != END_S ) return;
index da5e29a..04977ab 100644 (file)
@@ -46,6 +46,7 @@ public:
         instance = NULL;
     }
     void showTab( int i );
+    int currentTab();
 private:
     ExtendedDialog( intf_thread_t * );
     virtual ~ExtendedDialog();
index fcd0bab..dad8834 100644 (file)
@@ -180,12 +180,20 @@ void DialogsProvider::prefsDialog()
 
 void DialogsProvider::extendedDialog()
 {
-    ExtendedDialog::getInstance( p_intf )->showTab( 0 );
+    if( !ExtendedDialog::getInstance( p_intf )->isVisible() || /* Hidden */
+        ExtendedDialog::getInstance( p_intf )->currentTab() != 0 )  /* wrong tab */
+        ExtendedDialog::getInstance( p_intf )->showTab( 0 );
+    else
+        ExtendedDialog::getInstance( p_intf )->hide();
 }
 
 void DialogsProvider::synchroDialog()
 {
-    ExtendedDialog::getInstance( p_intf )->showTab( 2 );
+    if( !ExtendedDialog::getInstance( p_intf )->isVisible() || /* Hidden */
+        ExtendedDialog::getInstance( p_intf )->currentTab() != 2 )  /* wrong tab */
+        ExtendedDialog::getInstance( p_intf )->showTab( 2 );
+    else
+        ExtendedDialog::getInstance( p_intf )->hide();
 }
 
 void DialogsProvider::messagesDialog()