Commit 346b6cdf authored by Jakob Leben's avatar Jakob Leben

qt4: refactor, remove nonsense & re-enable popup-adding items to playlist

parent 5ce7c2e0
......@@ -90,7 +90,6 @@ private slots:
void gotoPlayingItem();
void doPopup( QModelIndex index, QPoint point );
void search( const QString& searchText );
void setCurrentRootId( playlist_item_t * );
void popupAdd();
void popupSelectColumn( QPoint );
void toggleColumnShown( int );
......
......@@ -80,13 +80,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i ) : p_intf ( _p_i )
CONNECT( selector, activated( playlist_item_t * ),
rightPanel, setRoot( playlist_item_t * ) );
/* Connect the activated() to the rootChanged() signal
This will be used by StandardPLPanel to setCurrentRootId, that will
change the label of the addButton */
connect( selector, SIGNAL( activated( playlist_item_t * ) ),
this, SIGNAL( rootChanged( playlist_item_t * ) ) );
emit rootChanged( p_root );
rightPanel->setRoot( p_root );
/* Add the two sides of the QSplitter */
addWidget( leftW );
......
......@@ -60,9 +60,6 @@ protected:
virtual void dropEvent( QDropEvent *);
virtual void dragEnterEvent( QDragEnterEvent * );
virtual void closeEvent( QCloseEvent * );
signals:
void rootChanged( playlist_item_t *);
};
class ArtLabel : public CoverArtLabel
......
......@@ -107,8 +107,6 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
this, handleExpansion( const QModelIndex& ) );
currentRootId = -1;
CONNECT( parent, rootChanged( playlist_item_t * ),
this, setCurrentRootId( playlist_item_t * ) );
/* Buttons configuration */
QHBoxLayout *buttons = new QHBoxLayout;
......@@ -228,31 +226,6 @@ void StandardPLPanel::handleExpansion( const QModelIndex& index )
view->scrollTo( index );
}
void StandardPLPanel::setCurrentRootId( playlist_item_t *p_item )
{
if( p_item == THEPL->p_local_category ||
p_item == THEPL->p_local_onelevel )
{
addButton->setEnabled( true );
addButton->setToolTip( qtr(I_PL_ADDPL) );
}
else if( ( THEPL->p_ml_category && p_item == THEPL->p_ml_category) ||
( THEPL->p_ml_onelevel && p_item == THEPL->p_ml_onelevel ) )
{
addButton->setEnabled( true );
addButton->setToolTip( qtr(I_PL_ADDML) );
}
else
addButton->setEnabled( false );
/* <jleben> do we need to lock here? */
playlist_Lock( THEPL );
char *psz_title = input_item_GetName( p_item->p_input );
title->setText( psz_title );
free( psz_title );
playlist_Unlock( THEPL );
}
/* PopupAdd Menu for the Add Menu */
void StandardPLPanel::popupAdd()
{
......@@ -320,11 +293,38 @@ void StandardPLPanel::doPopup( QModelIndex index, QPoint point )
void StandardPLPanel::setRoot( playlist_item_t *p_item )
{
QPL_LOCK;
p_item = playlist_GetPreferredNode( THEPL, p_item );
assert( p_item );
p_item = playlist_GetPreferredNode( THEPL, p_item );
/* needed for popupAdd() */
currentRootId = p_item->i_id;
/* cosmetics, ..still need playlist locking.. */
char *psz_title = input_item_GetName( p_item->p_input );
title->setText( psz_title );
free( psz_title );
QPL_UNLOCK;
/* do THE job */
model->rebuild( p_item );
/* enable/disable adding */
if( p_item == THEPL->p_local_category ||
p_item == THEPL->p_local_onelevel )
{
addButton->setEnabled( true );
addButton->setToolTip( qtr(I_PL_ADDPL) );
}
else if( ( THEPL->p_ml_category && p_item == THEPL->p_ml_category) ||
( THEPL->p_ml_onelevel && p_item == THEPL->p_ml_onelevel ) )
{
addButton->setEnabled( true );
addButton->setToolTip( qtr(I_PL_ADDML) );
}
else
addButton->setEnabled( false );
}
void StandardPLPanel::removeItem( int i_id )
......
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