[vlc-commits] Qt: fix regression about popupmenu

Erwan Tulou git at videolan.org
Fri Jul 18 12:28:16 CEST 2014


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Jul 17 10:58:42 2014 +0200| [2ba05d1ff03661caa55e943d32fcb492b395ecf2] | committer: Erwan Tulou

Qt: fix regression about popupmenu

Always rely on the Dialog Provider to manage the popupmenu.
This fixes a regression brought by 01f2d198c11044816c1782bdfc3fe35c0ae813e2

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2ba05d1ff03661caa55e943d32fcb492b395ecf2
---

 modules/gui/qt4/components/interface_widgets.cpp      |    2 +-
 modules/gui/qt4/components/playlist/standardpanel.cpp |    2 +-
 modules/gui/qt4/dialogs_provider.cpp                  |   12 ++++++++++++
 modules/gui/qt4/dialogs_provider.hpp                  |    2 ++
 modules/gui/qt4/main_interface.cpp                    |   14 ++------------
 modules/gui/qt4/main_interface.hpp                    |    2 --
 6 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index 84babdb..6d27876 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -287,7 +287,7 @@ void BackgroundWidget::paintEvent( QPaintEvent *e )
 
 void BackgroundWidget::contextMenuEvent( QContextMenuEvent *event )
 {
-    VLCMenuBar::PopupMenu( p_intf, true );
+    THEDP->setPopupMenu();
     event->accept();
 }
 
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 19c67dc..38de867 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -157,7 +157,7 @@ void StandardPLPanel::popupPlView( const QPoint &point )
         currentView->selectionModel()->select( index, QItemSelectionModel::Select );
     }
 
-    if( !popup( globalPoint ) ) VLCMenuBar::PopupMenu( p_intf, true );
+    if( !popup( globalPoint ) ) THEDP->setPopupMenu();
 }
 
 /*********** Popup *********/
diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp
index bd4dd9e..7c3cf16 100644
--- a/modules/gui/qt4/dialogs_provider.cpp
+++ b/modules/gui/qt4/dialogs_provider.cpp
@@ -316,6 +316,18 @@ void DialogsProvider::epgDialog()
     EpgDialog::getInstance( p_intf )->toggleVisible();
 }
 
+void DialogsProvider::setPopupMenu()
+{
+    delete popupMenu;
+    popupMenu = VLCMenuBar::PopupMenu( p_intf, true );
+}
+
+void DialogsProvider::destroyPopupMenu()
+{
+    delete popupMenu;
+    popupMenu = NULL;
+}
+
 /* Generic open file */
 void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
 {
diff --git a/modules/gui/qt4/dialogs_provider.hpp b/modules/gui/qt4/dialogs_provider.hpp
index a475b19..4327fcd 100644
--- a/modules/gui/qt4/dialogs_provider.hpp
+++ b/modules/gui/qt4/dialogs_provider.hpp
@@ -140,6 +140,8 @@ public slots:
     void toolbarDialog();
     void pluginDialog();
     void epgDialog();
+    void setPopupMenu();
+    void destroyPopupMenu();
 
     void openFileGenericDialog( intf_dialog_args_t * );
 
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 43e5dcc..466e089 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -159,7 +159,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
      ************/
     VLCMenuBar::createMenuBar( this, p_intf );
     CONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ),
-             this, destroyPopupMenu() );
+             THEDP, destroyPopupMenu() );
 
     createMainWidget( settings );
 
@@ -429,7 +429,7 @@ void MainInterface::createMainWidget( QSettings *creationSettings )
     /* Enable the popup menu in the MI */
     main->setContextMenuPolicy( Qt::CustomContextMenu );
     CONNECT( main, customContextMenuRequested( const QPoint& ),
-             this, popupMenu( const QPoint& ) );
+             THEDP, setPopupMenu() );
 
     if ( depth() > 8 ) /* 8bit depth has too many issues with opacity */
         /* Create the FULLSCREEN CONTROLS Widget */
@@ -611,16 +611,6 @@ inline void MainInterface::showTab( QWidget *widget )
     }
 }
 
-void MainInterface::destroyPopupMenu()
-{
-    VLCMenuBar::PopupMenu( p_intf, false );
-}
-
-void MainInterface::popupMenu( const QPoint & )
-{
-    VLCMenuBar::PopupMenu( p_intf, true );
-}
-
 void MainInterface::toggleFSC()
 {
    if( !fullscreenControls ) return;
diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp
index 8a69193..f19ab0b 100644
--- a/modules/gui/qt4/main_interface.hpp
+++ b/modules/gui/qt4/main_interface.hpp
@@ -199,7 +199,6 @@ public slots:
     void setStatusBarVisibility(bool b_visible);
     void setPlaylistVisibility(bool b_visible);
 
-    void popupMenu( const QPoint& );
 #ifdef _WIN32
     void changeThumbbarButtons( int );
 #endif
@@ -217,7 +216,6 @@ public slots:
 
 private slots:
     void debug();
-    void destroyPopupMenu();
     void recreateToolbars();
     void setName( const QString& );
     void setVLCWindowsTitle( const QString& title = "" );



More information about the vlc-commits mailing list