[vlc-devel] [PATCH] qt: toogle info panel visibility

Romain Vimont rom1v at videolabs.io
Wed Apr 18 11:57:41 CEST 2018


Make the info button toggle the info panel visibility: if the panel is
already open, clicking on the info button closes it (like the
"adjustments and effects" panel).

Fixes #19767
---
 modules/gui/qt/dialogs/mediainfo.cpp |  5 +++++
 modules/gui/qt/dialogs/mediainfo.hpp |  1 +
 modules/gui/qt/dialogs_provider.cpp  | 12 ++++++++++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt/dialogs/mediainfo.cpp b/modules/gui/qt/dialogs/mediainfo.cpp
index 59d4dd6e45..ff658b9ac5 100644
--- a/modules/gui/qt/dialogs/mediainfo.cpp
+++ b/modules/gui/qt/dialogs/mediainfo.cpp
@@ -143,6 +143,11 @@ void MediaInfoDialog::showTab( panel i_tab = META_PANEL )
     show();
 }
 
+int MediaInfoDialog::currentTab()
+{
+    return infoTabW->currentIndex();
+}
+
 void MediaInfoDialog::saveMeta()
 {
     MP->saveMeta();
diff --git a/modules/gui/qt/dialogs/mediainfo.hpp b/modules/gui/qt/dialogs/mediainfo.hpp
index 7740208ff7..34a40c316b 100644
--- a/modules/gui/qt/dialogs/mediainfo.hpp
+++ b/modules/gui/qt/dialogs/mediainfo.hpp
@@ -47,6 +47,7 @@ public:
     };
 
     void showTab( panel );
+    int currentTab();
 #if 0
     void setInput( input_item_t * );
 #endif
diff --git a/modules/gui/qt/dialogs_provider.cpp b/modules/gui/qt/dialogs_provider.cpp
index 0484af8c59..71315de1cb 100644
--- a/modules/gui/qt/dialogs_provider.cpp
+++ b/modules/gui/qt/dialogs_provider.cpp
@@ -311,12 +311,20 @@ void DialogsProvider::aboutDialog()
 
 void DialogsProvider::mediaInfoDialog()
 {
-    MediaInfoDialog::getInstance( p_intf )->showTab( MediaInfoDialog::META_PANEL );
+    MediaInfoDialog *dialog = MediaInfoDialog::getInstance( p_intf );
+    if( !dialog->isVisible() || dialog->currentTab() != MediaInfoDialog::META_PANEL )
+        dialog->showTab( MediaInfoDialog::META_PANEL );
+    else
+        dialog->hide();
 }
 
 void DialogsProvider::mediaCodecDialog()
 {
-    MediaInfoDialog::getInstance( p_intf )->showTab( MediaInfoDialog::INFO_PANEL );
+    MediaInfoDialog *dialog = MediaInfoDialog::getInstance( p_intf );
+    if( !dialog->isVisible() || dialog->currentTab() != MediaInfoDialog::INFO_PANEL )
+        dialog->showTab( MediaInfoDialog::INFO_PANEL );
+    else
+        dialog->hide();
 }
 
 void DialogsProvider::bookmarksDialog()
-- 
2.17.0



More information about the vlc-devel mailing list