From 7b64c06474e4e305787880c0ed319b765d3b3b89 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Wed, 1 Aug 2007 18:08:23 +0000 Subject: [PATCH] Qt4 - PlaylistWidget use a much nicer QSplitter. Removes also too much class inheritance and hierarchy. --- .../gui/qt4/components/interface_widgets.cpp | 20 ++++++++++++------- .../gui/qt4/components/interface_widgets.hpp | 7 +++++-- .../gui/qt4/components/playlist/panels.hpp | 7 ++++--- .../qt4/components/playlist/standardpanel.cpp | 2 +- modules/gui/qt4/qt4.hpp | 3 ++- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp index 58e14ea278..fed0f35912 100644 --- a/modules/gui/qt4/components/interface_widgets.cpp +++ b/modules/gui/qt4/components/interface_widgets.cpp @@ -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(new StandardPLPanel( this, p_intf, THEPL, p_root ) ); + /* Connects */ CONNECT( selector, activated( int ), rightPanel, setRoot( int ) ); CONNECT( qobject_cast(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 ) diff --git a/modules/gui/qt4/components/interface_widgets.hpp b/modules/gui/qt4/components/interface_widgets.hpp index 16a1dd4866..9896eb8e8a 100644 --- a/modules/gui/qt4/components/interface_widgets.hpp +++ b/modules/gui/qt4/components/interface_widgets.hpp @@ -119,16 +119,17 @@ private slots: /******************** Playlist Widgets ****************/ #include +#include 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: diff --git a/modules/gui/qt4/components/playlist/panels.hpp b/modules/gui/qt4/components/playlist/panels.hpp index 6f21ffcb6e..a3410bcfa0 100644 --- a/modules/gui/qt4/components/playlist/panels.hpp +++ b/modules/gui/qt4/components/playlist/panels.hpp @@ -27,6 +27,7 @@ #include #include "qt4.hpp" +#include "../interface_widgets.hpp" #include #include @@ -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: diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp index 315b7cd83e..594f4c0959 100644 --- a/modules/gui/qt4/components/playlist/standardpanel.cpp +++ b/modules/gui/qt4/components/playlist/standardpanel.cpp @@ -43,7 +43,7 @@ #include -StandardPLPanel::StandardPLPanel( BasePlaylistWidget *_parent, +StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, intf_thread_t *_p_intf, playlist_t *p_playlist, playlist_item_t *p_root ): diff --git a/modules/gui/qt4/qt4.hpp b/modules/gui/qt4/qt4.hpp index a3947ee520..3be7d17d0e 100644 --- a/modules/gui/qt4/qt4.hpp +++ b/modules/gui/qt4/qt4.hpp @@ -108,6 +108,7 @@ public: }; /* Ugly to put it here, but don't want more files ... */ +#if 0 #include class BasePlaylistWidget : public QFrame { @@ -117,5 +118,5 @@ public: protected: intf_thread_t *p_intf; }; - +#endif #endif -- GitLab