Commit 30d40eac authored by Jakob Leben's avatar Jakob Leben

qt4: access visible playlist column selector menu from general playlist popup menu

This fixes the issue that it was not possible to get any column back once all had been hidden
parent a67c1330
......@@ -102,11 +102,14 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
ADD_ICON( NODE, ":/type/node" );
#undef ADD_ICON
ContextUpdateMapper = new QSignalMapper(this);
rebuild( p_root );
CONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
this, processInputItemUpdate( input_item_t *) );
CONNECT( THEMIM, inputChanged( input_thread_t * ),
this, processInputItemUpdate( input_thread_t* ) );
CONNECT( ContextUpdateMapper, mapped( int ), this, toggleColumnShown( int ) );
}
PLModel::~PLModel()
......@@ -1041,9 +1044,27 @@ void PLModel::popup( QModelIndex & index, QPoint &point, QModelIndexList list )
menu->addSeparator();
menu->addAction( qtr( I_POP_EXPLORE ), this, SLOT( popupExplore() ) );
}
if( tree || i_popup_item > -1 )
menu->addSeparator();
QMenu *col_selector = menu->addMenu( qtr( "Visible columns" ) );
makeColumnSelectMenu( col_selector );
menu->popup( point );
}
void PLModel::makeColumnSelectMenu( QMenu *menu )
{
int i_column = 1;
for( i_column = 1; i_column != COLUMN_END; i_column<<=1 )
{
QAction* option = menu->addAction(
qfu( psz_column_title( i_column ) ) );
option->setCheckable( true );
option->setChecked( shownFlags() & i_column );
ContextUpdateMapper->setMapping( option, i_column );
CONNECT( option, triggered(), ContextUpdateMapper, map() );
}
}
void PLModel::toggleColumnShown( int meta )
{
assert( meta );
......
......@@ -128,6 +128,8 @@ public:
void removeItem( int );
void rebuild(); void rebuild( playlist_item_t * );
/* Helpers */
void makeColumnSelectMenu( QMenu *menu );
private:
/* General */
......
......@@ -308,22 +308,9 @@ void StandardPLPanel::checkSortingIndicator( int meta )
void StandardPLPanel::popupSelectColumn( QPoint pos )
{
ContextUpdateMapper = new QSignalMapper(this);
QMenu selectColMenu;
int i_column = 1;
for( i_column = 1; i_column != COLUMN_END; i_column<<=1 )
{
QAction* option = selectColMenu.addAction(
qfu( psz_column_title( i_column ) ) );
option->setCheckable( true );
option->setChecked( model->shownFlags() & i_column );
ContextUpdateMapper->setMapping( option, i_column );
CONNECT( option, triggered(), ContextUpdateMapper, map() );
}
CONNECT( ContextUpdateMapper, mapped( int ), model, toggleColumnShown( int ) );
model->makeColumnSelectMenu( &selectColMenu );
selectColMenu.exec( QCursor::pos() );
}
......
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