Commit 7b64c064 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - PlaylistWidget use a much nicer QSplitter. Removes also too much class...

Qt4 - PlaylistWidget use a much nicer QSplitter. Removes also too much class inheritance and hierarchy.

parent bd4b7150
...@@ -278,30 +278,35 @@ void ControlsWidget::fullscreen() ...@@ -278,30 +278,35 @@ void ControlsWidget::fullscreen()
#include "components/playlist/selector.hpp" #include "components/playlist/selector.hpp"
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) : PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) :
BasePlaylistWidget ( _p_intf) p_intf ( _p_intf)
{ {
QVBoxLayout *left = new QVBoxLayout( ); /* Left Part and design */
QWidget *leftW = new QWidget( this );
QVBoxLayout *left = new QVBoxLayout( leftW );
/* Source Selector */
selector = new PLSelector( this, p_intf, THEPL ); selector = new PLSelector( this, p_intf, THEPL );
selector->setMaximumWidth( 130 ); selector->setMaximumWidth( 130 );
left->addWidget( selector ); left->addWidget( selector );
/* Art label */
art = new QLabel( "" ); art = new QLabel( "" );
art->setMinimumHeight( 128 ); art->setMinimumHeight( 128 );
art->setMinimumWidth( 128 ); art->setMinimumWidth( 128 );
art->setMaximumHeight( 128 ); art->setMaximumHeight( 128 );
art->setMaximumWidth( 128 ); art->setMaximumWidth( 128 );
art->setScaledContents( true ); art->setScaledContents( true );
art->setPixmap( QPixmap( ":/noart.png" ) ); art->setPixmap( QPixmap( ":/noart.png" ) );
left->addWidget( art ); left->addWidget( art );
/* Initialisation of the playlist */
playlist_item_t *p_root = playlist_GetPreferredNode( THEPL, playlist_item_t *p_root = playlist_GetPreferredNode( THEPL,
THEPL->p_local_category ); THEPL->p_local_category );
rightPanel = qobject_cast<PLPanel *>(new StandardPLPanel( this, rightPanel = qobject_cast<PLPanel *>(new StandardPLPanel( this,
p_intf, THEPL, p_root ) ); p_intf, THEPL, p_root ) );
/* Connects */
CONNECT( selector, activated( int ), rightPanel, setRoot( int ) ); CONNECT( selector, activated( int ), rightPanel, setRoot( int ) );
CONNECT( qobject_cast<StandardPLPanel *>(rightPanel)->model, CONNECT( qobject_cast<StandardPLPanel *>(rightPanel)->model,
...@@ -315,10 +320,11 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) : ...@@ -315,10 +320,11 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) :
this, SIGNAL( rootChanged( int ) ) ); this, SIGNAL( rootChanged( int ) ) );
emit rootChanged( p_root->i_id ); emit rootChanged( p_root->i_id );
QHBoxLayout *layout = new QHBoxLayout(this); /* Add the two sides of the QSplitter */
layout->addLayout( left, 0 ); addWidget( leftW );
layout->addWidget( rightPanel, 10 ); addWidget( rightPanel );
setLayout( layout );
/* FIXME Sizing to do */
} }
void PlaylistWidget::setArt( QString url ) void PlaylistWidget::setArt( QString url )
......
...@@ -119,16 +119,17 @@ private slots: ...@@ -119,16 +119,17 @@ private slots:
/******************** Playlist Widgets ****************/ /******************** Playlist Widgets ****************/
#include <QModelIndex> #include <QModelIndex>
#include <QSplitter>
class QSignalMapper; class QSignalMapper;
class PLSelector; class PLSelector;
class PLPanel; class PLPanel;
class QPushButton; class QPushButton;
class PlaylistWidget : public BasePlaylistWidget class PlaylistWidget : public QSplitter
{ {
Q_OBJECT; Q_OBJECT;
public: public:
PlaylistWidget( intf_thread_t * ); PlaylistWidget( intf_thread_t *_p_i ) ;
virtual ~PlaylistWidget(); virtual ~PlaylistWidget();
QSize widgetSize; QSize widgetSize;
virtual QSize sizeHint() const; virtual QSize sizeHint() const;
...@@ -138,6 +139,8 @@ private: ...@@ -138,6 +139,8 @@ private:
QPushButton *addButton; QPushButton *addButton;
QLabel *art; QLabel *art;
QString prevArt; QString prevArt;
protected:
intf_thread_t *p_intf;
private slots: private slots:
void setArt( QString ); void setArt( QString );
signals: signals:
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include "qt4.hpp" #include "qt4.hpp"
#include "../interface_widgets.hpp"
#include <QModelIndex> #include <QModelIndex>
#include <QWidget> #include <QWidget>
...@@ -42,7 +43,7 @@ class PLPanel: public QWidget ...@@ -42,7 +43,7 @@ class PLPanel: public QWidget
{ {
Q_OBJECT; Q_OBJECT;
public: public:
PLPanel( BasePlaylistWidget *p, intf_thread_t *_p_intf ) : QWidget( p ) PLPanel( PlaylistWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
{ {
p_intf = _p_intf; p_intf = _p_intf;
parent = p; parent = p;
...@@ -50,7 +51,7 @@ public: ...@@ -50,7 +51,7 @@ public:
virtual ~PLPanel() {}; virtual ~PLPanel() {};
protected: protected:
intf_thread_t *p_intf; intf_thread_t *p_intf;
BasePlaylistWidget *parent; QFrame *parent;
public slots: public slots:
virtual void setRoot( int ) = 0; virtual void setRoot( int ) = 0;
}; };
...@@ -61,7 +62,7 @@ class StandardPLPanel: public PLPanel ...@@ -61,7 +62,7 @@ class StandardPLPanel: public PLPanel
{ {
Q_OBJECT; Q_OBJECT;
public: public:
StandardPLPanel( BasePlaylistWidget *, intf_thread_t *, StandardPLPanel( PlaylistWidget *, intf_thread_t *,
playlist_t *,playlist_item_t * ); playlist_t *,playlist_item_t * );
virtual ~StandardPLPanel(); virtual ~StandardPLPanel();
protected: protected:
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include <assert.h> #include <assert.h>
StandardPLPanel::StandardPLPanel( BasePlaylistWidget *_parent, StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
intf_thread_t *_p_intf, intf_thread_t *_p_intf,
playlist_t *p_playlist, playlist_t *p_playlist,
playlist_item_t *p_root ): playlist_item_t *p_root ):
......
...@@ -108,6 +108,7 @@ public: ...@@ -108,6 +108,7 @@ public:
}; };
/* Ugly to put it here, but don't want more files ... */ /* Ugly to put it here, but don't want more files ... */
#if 0
#include <QFrame> #include <QFrame>
class BasePlaylistWidget : public QFrame class BasePlaylistWidget : public QFrame
{ {
...@@ -117,5 +118,5 @@ public: ...@@ -117,5 +118,5 @@ public:
protected: protected:
intf_thread_t *p_intf; intf_thread_t *p_intf;
}; };
#endif
#endif #endif
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