Commit f0c9c7fb authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: PlaylistWidget parenting and code cleanup/simplifications

parent 3f6e3c48
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
* Playlist Widget. The embedded playlist * Playlist Widget. The embedded playlist
**********************************************************************/ **********************************************************************/
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i ) : p_intf ( _p_i ) PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
: QSplitter( _par ), p_intf ( _p_i )
{ {
setContentsMargins( 3, 3, 3, 3 ); setContentsMargins( 3, 3, 3, 3 );
......
/***************************************************************************** /*****************************************************************************
* interface_widgets.hpp : Playlist Widgets * interface_widgets.hpp : Playlist Widgets
**************************************************************************** ****************************************************************************
* Copyright (C) 2006 the VideoLAN team * Copyright (C) 2006-2009 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software Foundation, Inc.,
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#ifndef _PLAYLISTWIDGET_H_ #ifndef _PLAYLISTWIDGET_H_
...@@ -32,43 +32,22 @@ ...@@ -32,43 +32,22 @@
#include "qt4.hpp" #include "qt4.hpp"
#include "dialogs_provider.hpp" /* Media Info from ArtLabel */ #include "dialogs_provider.hpp" /* Media Info from ArtLabel */
#include "components/interface_widgets.hpp" #include "components/interface_widgets.hpp" /* CoverArt */
//#include <vlc_playlist.h> //#include <vlc_playlist.h>
#include <QSplitter> #include <QSplitter>
#include <QLabel>
class PLSelector; class PLSelector;
class StandardPLPanel; class StandardPLPanel;
class QPushButton; class QPushButton;
class CoverArtLabel;
class ArtLabel;
class PlaylistWidget : public QSplitter
{
Q_OBJECT;
public:
PlaylistWidget( intf_thread_t *_p_i );
virtual ~PlaylistWidget();
private:
PLSelector *selector;
StandardPLPanel *rightPanel;
QPushButton *addButton;
ArtLabel *art;
protected:
intf_thread_t *p_intf;
virtual void dropEvent( QDropEvent *);
virtual void dragEnterEvent( QDragEnterEvent * );
virtual void closeEvent( QCloseEvent * );
};
class ArtLabel : public CoverArtLabel class ArtLabel : public CoverArtLabel
{ {
Q_OBJECT
public: public:
ArtLabel( QWidget *parent, intf_thread_t *intf ) ArtLabel( QWidget *parent, intf_thread_t *intf )
: CoverArtLabel( parent, intf ) {}; : CoverArtLabel( parent, intf ) {};
virtual void mouseDoubleClickEvent( QMouseEvent *event ) virtual void mouseDoubleClickEvent( QMouseEvent *event )
{ {
THEDP->mediaInfoDialog(); THEDP->mediaInfoDialog();
...@@ -76,9 +55,22 @@ public: ...@@ -76,9 +55,22 @@ public:
} }
}; };
enum PLEventType { class PlaylistWidget : public QSplitter
ItemAddedEv = QEvent::User, {
ItemRemovedEv Q_OBJECT
public:
PlaylistWidget( intf_thread_t *_p_i, QWidget * );
virtual ~PlaylistWidget();
private:
PLSelector *selector;
ArtLabel *art;
StandardPLPanel *rightPanel;
QPushButton *addButton;
protected:
intf_thread_t *p_intf;
virtual void dropEvent( QDropEvent *);
virtual void dragEnterEvent( QDragEnterEvent * );
virtual void closeEvent( QCloseEvent * );
}; };
#endif #endif
...@@ -48,7 +48,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) ...@@ -48,7 +48,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
getSettings()->beginGroup("playlistdialog"); getSettings()->beginGroup("playlistdialog");
playlistWidget = new PlaylistWidget( p_intf ); playlistWidget = new PlaylistWidget( p_intf, this );
l->addWidget( playlistWidget ); l->addWidget( playlistWidget );
readSettings( getSettings(), QSize( 600,700 ) ); readSettings( getSettings(), QSize( 600,700 ) );
......
...@@ -913,7 +913,7 @@ int MainInterface::controlVideo( int i_query, va_list args ) ...@@ -913,7 +913,7 @@ int MainInterface::controlVideo( int i_query, va_list args )
**/ **/
void MainInterface::createPlaylist( bool b_show ) void MainInterface::createPlaylist( bool b_show )
{ {
playlistWidget = new PlaylistWidget( p_intf ); playlistWidget = new PlaylistWidget( p_intf, this );
i_pl_dock = PL_BOTTOM; i_pl_dock = PL_BOTTOM;
/* i_pl_dock = (pl_dock_e)getSettings() /* i_pl_dock = (pl_dock_e)getSettings()
......
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