Commit 662dc6f8 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: split playlist mode view in a separate function

parent b216ade1
......@@ -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 )
......
......@@ -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:
......
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