QActionGroup *actionGroup = new QActionGroup( this );
- QAction *action = actionGroup->addAction( "Detailed view" );
- action->setCheckable( true );
- viewSelectionMapper->setMapping( action, TREE_VIEW );
- CONNECT( action, triggered(), viewSelectionMapper, map() );
+ treeViewAction = actionGroup->addAction( "Detailed view" );
+ treeViewAction->setCheckable( true );
+ viewSelectionMapper->setMapping( treeViewAction, TREE_VIEW );
+ CONNECT( treeViewAction, triggered(), viewSelectionMapper, map() );
- action = actionGroup->addAction( "Icon view" );
- action->setCheckable( true );
- viewSelectionMapper->setMapping( action, ICON_VIEW );
- CONNECT( action, triggered(), viewSelectionMapper, map() );
+ iconViewAction = actionGroup->addAction( "Icon view" );
+ iconViewAction->setCheckable( true );
+ viewSelectionMapper->setMapping( iconViewAction, ICON_VIEW );
+ CONNECT( iconViewAction, triggered(), viewSelectionMapper, map() );
+ BUTTONACT( viewButton, cycleViews() );
QMenu *viewMenu = new QMenu( this );
viewMenu->addActions( actionGroup->actions() );
if( iconView ) iconView->hide();
treeView->show();
currentView = treeView;
+ treeViewAction->setChecked( true );
break;
}
case ICON_VIEW:
if( treeView ) treeView->hide();
iconView->show();
currentView = iconView;
+ iconViewAction->setChecked( true );
break;
}
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 )
{
// Accept this event in order to prevent unwanted volume up/down changes
PlIconView *iconView;
QAbstractItemView *currentView;
+ QAction *iconViewAction, *treeViewAction;
int currentRootId;
QSignalMapper *selectColumnsSigMapper;
QSignalMapper *viewSelectionMapper;
void popupPlView( const QPoint & );
void toggleColumnShown( int );
void showView( int );
+ void cycleViews();
void activate( const QModelIndex & );
void handleInputChange( input_thread_t * );
};