Commit 6bb65f65 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: use the new helper in button selection

parent 662dc6f8
...@@ -120,25 +120,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -120,25 +120,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
viewButton->setToolTip( qtr("Change playlistview") ); viewButton->setToolTip( qtr("Change playlistview") );
topbarLayout->addWidget( viewButton ); topbarLayout->addWidget( viewButton );
/* View selection menu */ viewButton->setMenu( StandardPLPanel::viewSelectionMenu( mainView ));
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 );
CONNECT( viewButton, clicked(), mainView, cycleViews() ); CONNECT( viewButton, clicked(), mainView, cycleViews() );
/* Search */ /* Search */
...@@ -247,7 +229,6 @@ void PlaylistWidget::changeView( const QModelIndex& index ) ...@@ -247,7 +229,6 @@ void PlaylistWidget::changeView( const QModelIndex& index )
{ {
searchEdit->clear(); searchEdit->clear();
locationBar->setIndex( index ); locationBar->setIndex( index );
viewActions[mainView->currentViewIndex()]->setChecked( true );
} }
void PlaylistWidget::clearPlaylist() void PlaylistWidget::clearPlaylist()
......
...@@ -63,8 +63,6 @@ private: ...@@ -63,8 +63,6 @@ private:
StandardPLPanel *mainView; StandardPLPanel *mainView;
PLSelector *selector; PLSelector *selector;
QAction *viewActions[ 4 /* StandardPLPanel::VIEW_COUNT*/ ];
LocationBar *locationBar; LocationBar *locationBar;
SearchLineEdit *searchEdit; SearchLineEdit *searchEdit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment