# include "config.h"
#endif
-#include "components/playlist/panels.hpp"
+#include "components/playlist/standardpanel.hpp"
#include "components/playlist/selector.hpp"
#include "components/playlist/playlist.hpp"
+
#include "input_manager.hpp" /* art signal */
+#include "main_interface.hpp" /* DropEvent TODO remove this*/
-#include <QSettings>
-#include <QLabel>
-#include <QSpacerItem>
-#include <QCursor>
-#include <QPushButton>
-#include <QVBoxLayout>
+#include <QGroupBox>
+#include <iostream>
/**********************************************************************
* Playlist Widget. The embedded playlist
**********************************************************************/
-PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i,
- QSettings *settings,
- QWidget *_parent )
- : p_intf ( _p_i ), parent( _parent )
+PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
+ : QSplitter( _par ), p_intf ( _p_i )
{
+ setContentsMargins( 3, 3, 3, 3 );
+
/* Left Part and design */
QSplitter *leftW = new QSplitter( Qt::Vertical, this );
/* Source Selector */
- selector = new PLSelector( this, p_intf, THEPL );
- leftW->addWidget( selector );
+ selector = new PLSelector( this, p_intf );
+ QVBoxLayout *selBox = new QVBoxLayout();
+ selBox->setContentsMargins(5,5,5,0);
+ selBox->addWidget( selector );
+ QGroupBox *selGroup = new QGroupBox( qtr( "Media Browser") );
+ selGroup->setLayout( selBox );
+ leftW->addWidget( selGroup );
/* Create a Container for the Art Label
in order to have a beautiful resizing for the selector above it */
artContainer->setMaximumHeight( 128 );
/* Art label */
- art = new ArtLabel;
- art->setMinimumHeight( 128 );
- art->setMinimumWidth( 128 );
- art->setMaximumHeight( 128 );
- art->setMaximumWidth( 128 );
- art->setScaledContents( true );
- art->setPixmap( QPixmap( ":/noart.png" ) );
- art->setToolTip( qtr( "Double click to get the media informations" ) );
+ art = new ArtLabel( artContainer, p_intf );
+ art->setToolTip( qtr( "Double click to get media information" ) );
+
+ CONNECT( THEMIM->getIM(), artChanged( QString ),
+ art, showArtUpdate( const QString& ) );
artContLay->addWidget( art, 1 );
leftW->addWidget( artContainer );
/* Initialisation of the playlist */
+ playlist_t * p_playlist = THEPL;
+ PL_LOCK;
playlist_item_t *p_root =
playlist_GetPreferredNode( THEPL, THEPL->p_local_category );
+ PL_UNLOCK;
rightPanel = new StandardPLPanel( this, p_intf, THEPL, p_root );
/* Connect the activation of the selector to a redefining of the PL */
- CONNECT( selector, activated( int ), rightPanel, setRoot( int ) );
-
- /* 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( int ) ),
- this, SIGNAL( rootChanged( int ) ) );
-
- /* Forward removal requests from the selector to the main panel */
- CONNECT( qobject_cast<PLSelector *>( selector )->model,
- shouldRemove( int ),
- qobject_cast<StandardPLPanel *>( rightPanel ), removeItem( int ) );
+ CONNECT( selector, activated( playlist_item_t * ),
+ rightPanel, setRoot( playlist_item_t * ) );
- emit rootChanged( p_root->i_id );
-
- /* art */
- CONNECT( THEMIM->getIM(), artChanged( QString ) , this, setArt( QString ) );
+ rightPanel->setRoot( p_root );
/* Add the two sides of the QSplitter */
addWidget( leftW );
/* In case we want to keep the splitter informations */
// components shall never write there setting to a fixed location, may infer
// with other uses of the same component...
- // settings->beginGroup( "playlist" );
- restoreState( settings->value("splitterSizes").toByteArray());
+ // getSettings()->beginGroup( "playlist" );
+ getSettings()->beginGroup("Playlist");
+ restoreState( getSettings()->value("splitterSizes").toByteArray());
+ getSettings()->endGroup();
+
+ setAcceptDrops( true );
+ setWindowTitle( qtr( "Playlist" ) );
+ setWindowRole( "vlc-playlist" );
+ setWindowIcon( QApplication::windowIcon() );
}
-void PlaylistWidget::setArt( QString url )
+PlaylistWidget::~PlaylistWidget()
{
- if( prevArt != url )
- {
- art->setPixmap( QPixmap( url.isEmpty() ? ":/noart.png" : url ) );
- prevArt = url;
- }
+ getSettings()->beginGroup("Playlist");
+ getSettings()->setValue( "splitterSizes", saveState() );
+ getSettings()->endGroup();
+ msg_Dbg( p_intf, "Playlist Destroyed" );
}
-QSize PlaylistWidget::sizeHint() const
+void PlaylistWidget::dropEvent( QDropEvent *event )
{
- return QSize( 600 , 300 );
+ if( p_intf->p_sys->p_mi )
+ p_intf->p_sys->p_mi->dropEventPlay( event, false );
}
-
-PlaylistWidget::~PlaylistWidget()
-{}
-
-void PlaylistWidget::savingSettings( QSettings *settings )
+void PlaylistWidget::dragEnterEvent( QDragEnterEvent *event )
{
- settings->setValue( "splitterSizes", saveState() );
+ event->acceptProposedAction();
}
+void PlaylistWidget::closeEvent( QCloseEvent *event )
+{
+ if( THEDP->isDying() )
+ {
+ /* FIXME is it needed ? */
+ event->accept();
+ }
+ else
+ {
+ hide();
+ event->ignore();
+ }
+}