Qt4 - PlaylistWidget use a much nicer QSplitter. Removes also too much class inherita...
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 1 Aug 2007 18:08:23 +0000 (18:08 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 1 Aug 2007 18:08:23 +0000 (18:08 +0000)
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/components/playlist/panels.hpp
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/qt4.hpp

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