[vlc-devel] commit: Qt: Playlist, map the click to cycleViews (Jean-Baptiste Kempf )
git version control
git at videolan.org
Fri Jan 29 01:43:19 CET 2010
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Jan 29 01:26:58 2010 +0100| [bf144ba3f5ea4fb7b0f3ca5c03cf0257fd858b65] | committer: Jean-Baptiste Kempf
Qt: Playlist, map the click to cycleViews
And adapt the actions in consequences
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bf144ba3f5ea4fb7b0f3ca5c03cf0257fd858b65
---
.../gui/qt4/components/playlist/standardpanel.cpp | 29 ++++++++++++++-----
.../gui/qt4/components/playlist/standardpanel.hpp | 2 +
2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 87180eb..a514736 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -108,16 +108,17 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
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() );
@@ -372,6 +373,7 @@ void StandardPLPanel::showView( int i_view )
if( iconView ) iconView->hide();
treeView->show();
currentView = treeView;
+ treeViewAction->setChecked( true );
break;
}
case ICON_VIEW:
@@ -383,12 +385,23 @@ void StandardPLPanel::showView( int i_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
diff --git a/modules/gui/qt4/components/playlist/standardpanel.hpp b/modules/gui/qt4/components/playlist/standardpanel.hpp
index 58c118a..78c6920 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.hpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.hpp
@@ -76,6 +76,7 @@ private:
PlIconView *iconView;
QAbstractItemView *currentView;
+ QAction *iconViewAction, *treeViewAction;
int currentRootId;
QSignalMapper *selectColumnsSigMapper;
QSignalMapper *viewSelectionMapper;
@@ -104,6 +105,7 @@ private slots:
void popupPlView( const QPoint & );
void toggleColumnShown( int );
void showView( int );
+ void cycleViews();
void activate( const QModelIndex & );
void handleInputChange( input_thread_t * );
};
More information about the vlc-devel
mailing list