[vlc-commits] Qt: split playlist mode view in a separate function
Jean-Baptiste Kempf
git at videolan.org
Mon Aug 27 14:35:54 CEST 2012
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Aug 27 14:01:31 2012 +0200| [662dc6f869a8edfb13d0f914b4c2625ab2e95e89] | committer: Jean-Baptiste Kempf
Qt: split playlist mode view in a separate function
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=662dc6f869a8edfb13d0f914b4c2625ab2e95e89
---
.../gui/qt4/components/playlist/standardpanel.cpp | 35 +++++++++++---------
.../gui/qt4/components/playlist/standardpanel.hpp | 3 +-
2 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 4fac9f2..81cf03a 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -255,13 +255,25 @@ bool StandardPLPanel::popup( const QModelIndex & index, const QPoint &point, con
CONNECT( &menu, triggered( QAction * ), model, actionSlot( QAction * ) );
- QMenu *viewMenu = new QMenu( qtr( "Playlist View Mode" ) );
+ menu.addMenu( StandardPLPanel::viewSelectionMenu( this ) );
+
+ /* Display and forward the result */
+ if( !menu.isEmpty() )
+ {
+ menu.exec( point ); return true;
+ }
+ else return false;
+
+#undef ADD_MENU_ENTRY
+}
- /* View selection menu */
- QSignalMapper *viewSelectionMapper = new QSignalMapper( this );
- CONNECT( viewSelectionMapper, mapped( int ), this, showView( int ) );
+QMenu* StandardPLPanel::viewSelectionMenu( StandardPLPanel *panel )
+{
+ QMenu *viewMenu = new QMenu( qtr( "Playlist View Mode" ) );
+ QSignalMapper *viewSelectionMapper = new QSignalMapper( viewMenu );
+ CONNECT( viewSelectionMapper, mapped( int ), panel, showView( int ) );
- QActionGroup *viewGroup = new QActionGroup( this );
+ QActionGroup *viewGroup = new QActionGroup( viewMenu );
# define MAX_VIEW StandardPLPanel::VIEW_COUNT
for( int i = 0; i < MAX_VIEW; i++ )
{
@@ -270,19 +282,10 @@ bool StandardPLPanel::popup( const QModelIndex & index, const QPoint &point, con
viewGroup->addAction( action );
viewSelectionMapper->setMapping( action, i );
CONNECT( action, triggered(), viewSelectionMapper, map() );
- if( currentViewIndex() == i )
+ if( panel->currentViewIndex() == i )
action->setChecked( true );
}
- menu.addMenu( viewMenu );
-
- /* Display and forward the result */
- if( !menu.isEmpty() )
- {
- menu.exec( point ); return true;
- }
- else return false;
-
-#undef ADD_MENU_ENTRY
+ return viewMenu;
}
void StandardPLPanel::popupSelectColumn( QPoint )
diff --git a/modules/gui/qt4/components/playlist/standardpanel.hpp b/modules/gui/qt4/components/playlist/standardpanel.hpp
index 4182ecd..03b22f1 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.hpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.hpp
@@ -71,6 +71,7 @@ public:
int currentViewIndex() const;
+ static QMenu *viewSelectionMenu(StandardPLPanel *obj);
protected:
PLModel *model;
MLModel *mlmodel;
@@ -111,6 +112,7 @@ private:
public slots:
void setRootItem( playlist_item_t *, bool );
void browseInto( const QModelIndex& );
+ void showView( int );
private slots:
void deleteSelection();
@@ -136,7 +138,6 @@ private slots:
void decreaseZoom() { updateZoom( i_zoom - 1 ); };
void toggleColumnShown( int );
- void showView( int );
void cycleViews();
signals:
More information about the vlc-commits
mailing list