Commit bf144ba3 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: Playlist, map the click to cycleViews

And adapt the actions in consequences
parent 86e411e4
...@@ -108,16 +108,17 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, ...@@ -108,16 +108,17 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
QActionGroup *actionGroup = new QActionGroup( this ); QActionGroup *actionGroup = new QActionGroup( this );
QAction *action = actionGroup->addAction( "Detailed view" ); treeViewAction = actionGroup->addAction( "Detailed view" );
action->setCheckable( true ); treeViewAction->setCheckable( true );
viewSelectionMapper->setMapping( action, TREE_VIEW ); viewSelectionMapper->setMapping( treeViewAction, TREE_VIEW );
CONNECT( action, triggered(), viewSelectionMapper, map() ); CONNECT( treeViewAction, triggered(), viewSelectionMapper, map() );
action = actionGroup->addAction( "Icon view" ); iconViewAction = actionGroup->addAction( "Icon view" );
action->setCheckable( true ); iconViewAction->setCheckable( true );
viewSelectionMapper->setMapping( action, ICON_VIEW ); viewSelectionMapper->setMapping( iconViewAction, ICON_VIEW );
CONNECT( action, triggered(), viewSelectionMapper, map() ); CONNECT( iconViewAction, triggered(), viewSelectionMapper, map() );
BUTTONACT( viewButton, cycleViews() );
QMenu *viewMenu = new QMenu( this ); QMenu *viewMenu = new QMenu( this );
viewMenu->addActions( actionGroup->actions() ); viewMenu->addActions( actionGroup->actions() );
...@@ -372,6 +373,7 @@ void StandardPLPanel::showView( int i_view ) ...@@ -372,6 +373,7 @@ void StandardPLPanel::showView( int i_view )
if( iconView ) iconView->hide(); if( iconView ) iconView->hide();
treeView->show(); treeView->show();
currentView = treeView; currentView = treeView;
treeViewAction->setChecked( true );
break; break;
} }
case ICON_VIEW: case ICON_VIEW:
...@@ -383,12 +385,23 @@ void StandardPLPanel::showView( int i_view ) ...@@ -383,12 +385,23 @@ void StandardPLPanel::showView( int i_view )
if( treeView ) treeView->hide(); if( treeView ) treeView->hide();
iconView->show(); iconView->show();
currentView = iconView; currentView = iconView;
iconViewAction->setChecked( true );
break; break;
} }
default:; default:;
} }
} }
void StandardPLPanel::cycleViews()
{
if( currentView == iconView )
showView( TREE_VIEW );
else if( currentView == treeView )
showView( ICON_VIEW );
else
assert( 0 );
}
void StandardPLPanel::wheelEvent( QWheelEvent *e ) void StandardPLPanel::wheelEvent( QWheelEvent *e )
{ {
// Accept this event in order to prevent unwanted volume up/down changes // Accept this event in order to prevent unwanted volume up/down changes
......
...@@ -76,6 +76,7 @@ private: ...@@ -76,6 +76,7 @@ private:
PlIconView *iconView; PlIconView *iconView;
QAbstractItemView *currentView; QAbstractItemView *currentView;
QAction *iconViewAction, *treeViewAction;
int currentRootId; int currentRootId;
QSignalMapper *selectColumnsSigMapper; QSignalMapper *selectColumnsSigMapper;
QSignalMapper *viewSelectionMapper; QSignalMapper *viewSelectionMapper;
...@@ -104,6 +105,7 @@ private slots: ...@@ -104,6 +105,7 @@ private slots:
void popupPlView( const QPoint & ); void popupPlView( const QPoint & );
void toggleColumnShown( int ); void toggleColumnShown( int );
void showView( int ); void showView( int );
void cycleViews();
void activate( const QModelIndex & ); void activate( const QModelIndex & );
void handleInputChange( input_thread_t * ); void handleInputChange( input_thread_t * );
}; };
......
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