[vlc-commits] Qt: use the new helper in button selection

Jean-Baptiste Kempf git at videolan.org
Mon Aug 27 14:35:55 CEST 2012


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Aug 27 14:11:22 2012 +0200| [6bb65f65c1ac1bed213ca6f29e7807d092bd27de] | committer: Jean-Baptiste Kempf

Qt: use the new helper in button selection

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

 modules/gui/qt4/components/playlist/playlist.cpp |   21 +--------------------
 modules/gui/qt4/components/playlist/playlist.hpp |    2 --
 2 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index 0448d1f..3598743 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -120,25 +120,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
     viewButton->setToolTip( qtr("Change playlistview") );
     topbarLayout->addWidget( viewButton );
 
-    /* View selection menu */
-    QSignalMapper *viewSelectionMapper = new QSignalMapper( this );
-    CONNECT( viewSelectionMapper, mapped( int ), mainView, showView( int ) );
-
-    QActionGroup *actionGroup = new QActionGroup( this );
-
-# define MAX_VIEW StandardPLPanel::VIEW_COUNT
-    for( int i = 0; i < MAX_VIEW; i++ )
-    {
-        viewActions[i] = actionGroup->addAction( viewNames[i] );
-        viewActions[i]->setCheckable( true );
-        viewSelectionMapper->setMapping( viewActions[i], i );
-        CONNECT( viewActions[i], triggered(), viewSelectionMapper, map() );
-    }
-    viewActions[mainView->currentViewIndex()]->setChecked( true );
-
-    QMenu *viewMenu = new QMenu( viewButton );
-    viewMenu->addActions( actionGroup->actions() );
-    viewButton->setMenu( viewMenu );
+    viewButton->setMenu( StandardPLPanel::viewSelectionMenu( mainView ));
     CONNECT( viewButton, clicked(), mainView, cycleViews() );
 
     /* Search */
@@ -247,7 +229,6 @@ void PlaylistWidget::changeView( const QModelIndex& index )
 {
     searchEdit->clear();
     locationBar->setIndex( index );
-    viewActions[mainView->currentViewIndex()]->setChecked( true );
 }
 
 void PlaylistWidget::clearPlaylist()
diff --git a/modules/gui/qt4/components/playlist/playlist.hpp b/modules/gui/qt4/components/playlist/playlist.hpp
index 122c73f..ea1c1ba 100644
--- a/modules/gui/qt4/components/playlist/playlist.hpp
+++ b/modules/gui/qt4/components/playlist/playlist.hpp
@@ -63,8 +63,6 @@ private:
     StandardPLPanel      *mainView;
     PLSelector           *selector;
 
-    QAction *viewActions[ 4 /* StandardPLPanel::VIEW_COUNT*/ ];
-
     LocationBar          *locationBar;
     SearchLineEdit       *searchEdit;
 



More information about the vlc-commits mailing list