Commit 1497d96c authored by Jakob Leben's avatar Jakob Leben

Qt: the Add button on playlist panel is gone

parent 0c323ab0
...@@ -77,12 +77,12 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, ...@@ -77,12 +77,12 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
locationBar = new LocationBar( model ); locationBar = new LocationBar( model );
locationBar->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred ); locationBar->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred );
layout->addWidget( locationBar, 0, 1 ); layout->addWidget( locationBar, 0, 0 );
layout->setColumnStretch( 1, 100 ); layout->setColumnStretch( 0, 100 );
CONNECT( locationBar, invoked( const QModelIndex & ), CONNECT( locationBar, invoked( const QModelIndex & ),
this, browseInto( const QModelIndex & ) ); this, browseInto( const QModelIndex & ) );
layout->setColumnStretch( 2, 1 ); layout->setColumnStretch( 1, 1 );
searchEdit = new SearchLineEdit( this ); searchEdit = new SearchLineEdit( this );
searchEdit->setMaximumWidth( 250 ); searchEdit->setMaximumWidth( 250 );
...@@ -92,17 +92,10 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, ...@@ -92,17 +92,10 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
this, search( const QString& ) ); this, search( const QString& ) );
layout->setColumnStretch( 3, 50 ); layout->setColumnStretch( 3, 50 );
/* Add item to the playlist button */
addButton = new QToolButton;
addButton->setIcon( QIcon( ":/buttons/playlist/playlist_add" ) );
addButton->setMaximumWidth( 30 );
BUTTONACT( addButton, popupAdd() );
layout->addWidget( addButton, 0, 0 );
/* Button to switch views */ /* Button to switch views */
QToolButton *viewButton = new QToolButton( this ); QToolButton *viewButton = new QToolButton( this );
viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) ); viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) );
layout->addWidget( viewButton, 0, 4 ); layout->addWidget( viewButton, 0, 2 );
/* View selection menu */ /* View selection menu */
viewSelectionMapper = new QSignalMapper( this ); viewSelectionMapper = new QSignalMapper( this );
...@@ -168,48 +161,7 @@ void StandardPLPanel::handleExpansion( const QModelIndex& index ) ...@@ -168,48 +161,7 @@ void StandardPLPanel::handleExpansion( const QModelIndex& index )
void StandardPLPanel::handleRootChange() void StandardPLPanel::handleRootChange()
{ {
/* needed for popupAdd() */
PLItem *root = model->getItem( QModelIndex() );
currentRootId = root->id();
browseInto(); browseInto();
/* enable/disable adding */
if( currentRootId == THEPL->p_playing->i_id )
{
addButton->setEnabled( true );
addButton->setToolTip( qtr(I_PL_ADDPL) );
}
else if( THEPL->p_media_library &&
currentRootId == THEPL->p_media_library->i_id )
{
addButton->setEnabled( true );
addButton->setToolTip( qtr(I_PL_ADDML) );
}
else
addButton->setEnabled( false );
}
/* PopupAdd Menu for the Add Menu */
void StandardPLPanel::popupAdd()
{
QMenu popup;
if( currentRootId == THEPL->p_playing->i_id )
{
popup.addAction( qtr(I_PL_ADDF), THEDP, SLOT( simplePLAppendDialog()) );
popup.addAction( qtr(I_PL_ADDDIR), THEDP, SLOT( PLAppendDir()) );
popup.addAction( qtr(I_OP_ADVOP), THEDP, SLOT( PLAppendDialog()) );
}
else if( THEPL->p_media_library &&
currentRootId == THEPL->p_media_library->i_id )
{
popup.addAction( qtr(I_PL_ADDF), THEDP, SLOT( simpleMLAppendDialog()) );
popup.addAction( qtr(I_PL_ADDDIR), THEDP, SLOT( MLAppendDir() ) );
popup.addAction( qtr(I_OP_ADVOP), THEDP, SLOT( MLAppendDialog() ) );
}
popup.exec( QCursor::pos() - addButton->mapFromGlobal( QCursor::pos() )
+ QPoint( 0, addButton->height() ) );
} }
void StandardPLPanel::popupPlView( const QPoint &point ) void StandardPLPanel::popupPlView( const QPoint &point )
......
...@@ -74,7 +74,6 @@ private: ...@@ -74,7 +74,6 @@ private:
QWidget *parent; QWidget *parent;
QLabel *title; QLabel *title;
QToolButton *addButton;
QGridLayout *layout; QGridLayout *layout;
LocationBar *locationBar; LocationBar *locationBar;
SearchLineEdit *searchEdit; SearchLineEdit *searchEdit;
...@@ -109,7 +108,6 @@ private slots: ...@@ -109,7 +108,6 @@ private slots:
void handleRootChange(); void handleRootChange();
void gotoPlayingItem(); void gotoPlayingItem();
void search( const QString& searchText ); void search( const QString& searchText );
void popupAdd();
void popupSelectColumn( QPoint ); void popupSelectColumn( QPoint );
void popupPlView( const QPoint & ); void popupPlView( const QPoint & );
void toggleColumnShown( int ); void toggleColumnShown( int );
......
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