Qt4 - Cleanups and use QMenu on the stack to avoid leaks. Show menu with exec instead...
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 5 Sep 2007 15:33:32 +0000 (15:33 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 5 Sep 2007 15:33:32 +0000 (15:33 +0000)
modules/gui/qt4/components/playlist/panels.hpp
modules/gui/qt4/components/playlist/standardpanel.cpp

index 92213b0..cab5ecf 100644 (file)
@@ -75,7 +75,7 @@ private:
     QPushButton *repeatButton , *randomButton,*addButton;
     ClickLineEdit *searchLine;
     int currentRootId;
     QPushButton *repeatButton , *randomButton,*addButton;
     ClickLineEdit *searchLine;
     int currentRootId;
-QSignalMapper *ContextUpdateMapper;
+    QSignalMapper *ContextUpdateMapper;
 public slots:
     void removeItem( int );
     virtual void setRoot( int );
 public slots:
     void removeItem( int );
     virtual void setRoot( int );
index a9f7aa0..360315e 100644 (file)
@@ -188,32 +188,32 @@ void StandardPLPanel::setCurrentRootId( int _new )
 
 void StandardPLPanel::add()
 {
 
 void StandardPLPanel::add()
 {
-    QMenu *popup = new QMenu();
+    QMenu popup;
     if( currentRootId == THEPL->p_local_category->i_id ||
         currentRootId == THEPL->p_local_onelevel->i_id )
     {
     if( currentRootId == THEPL->p_local_category->i_id ||
         currentRootId == THEPL->p_local_onelevel->i_id )
     {
-        popup->addAction( qtr(I_PL_ADDF), THEDP, SLOT(simplePLAppendDialog()));
-        popup->addAction( qtr(I_PL_ADVADD), THEDP, SLOT(PLAppendDialog()) );
-        popup->addAction( qtr(I_PL_ADDDIR), THEDP, SLOT( PLAppendDir()) );
+        popup.addAction( qtr(I_PL_ADDF), THEDP, SLOT(simplePLAppendDialog()));
+        popup.addAction( qtr(I_PL_ADVADD), THEDP, SLOT(PLAppendDialog()) );
+        popup.addAction( qtr(I_PL_ADDDIR), THEDP, SLOT( PLAppendDir()) );
     }
     else if( currentRootId == THEPL->p_ml_category->i_id ||
              currentRootId == THEPL->p_ml_onelevel->i_id )
     {
     }
     else if( currentRootId == THEPL->p_ml_category->i_id ||
              currentRootId == THEPL->p_ml_onelevel->i_id )
     {
-        popup->addAction( qtr(I_PL_ADDF), THEDP, SLOT(simpleMLAppendDialog()));
-        popup->addAction( qtr(I_PL_ADVADD), THEDP, SLOT( MLAppendDialog() ) );
-        popup->addAction( qtr(I_PL_ADDDIR), THEDP, SLOT( MLAppendDir() ) );
+        popup.addAction( qtr(I_PL_ADDF), THEDP, SLOT(simpleMLAppendDialog()));
+        popup.addAction( qtr(I_PL_ADVADD), THEDP, SLOT( MLAppendDialog() ) );
+        popup.addAction( qtr(I_PL_ADDDIR), THEDP, SLOT( MLAppendDir() ) );
     }
     }
-    popup->popup( QCursor::pos() );
+    popup.exec( QCursor::pos() );
 }
 
 void StandardPLPanel::popupSelectColumn( QPoint )
 {     
     ContextUpdateMapper = new QSignalMapper(this);
 
 }
 
 void StandardPLPanel::popupSelectColumn( QPoint )
 {     
     ContextUpdateMapper = new QSignalMapper(this);
 
-    QMenu *selectColMenu = new QMenu( qtr("Show columns") );
+    QMenu selectColMenu;
 
 #define ADD_META_ACTION( meta ) { \
 
 #define ADD_META_ACTION( meta ) { \
-   QAction* option = selectColMenu->addAction( qfu(VLC_META_##meta) );     \
+   QAction* option = selectColMenu.addAction( qfu(VLC_META_##meta) );     \
    option->setCheckable( true );                                           \
    option->setChecked( model->shownFlags() & VLC_META_ENGINE_##meta );   \
    ContextUpdateMapper->setMapping( option, VLC_META_ENGINE_##meta );      \
    option->setCheckable( true );                                           \
    option->setChecked( model->shownFlags() & VLC_META_ENGINE_##meta );   \
    ContextUpdateMapper->setMapping( option, VLC_META_ENGINE_##meta );      \
@@ -232,7 +232,7 @@ void StandardPLPanel::popupSelectColumn( QPoint )
 
 #undef ADD_META_ACTION
     
 
 #undef ADD_META_ACTION
     
-    selectColMenu->popup( QCursor::pos() );
+    selectColMenu.exec( QCursor::pos() );
  }
 
 void StandardPLPanel::clearFilter()
  }
 
 void StandardPLPanel::clearFilter()