[vlc-devel] commit: Qt: PlaylistWidget parenting and code cleanup/simplifications ( Jean-Baptiste Kempf )

git version control git at videolan.org
Sat Dec 12 22:49:37 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Dec 12 18:20:47 2009 +0100| [f0c9c7fb93f22800980777c4069c74a27d4d6a25] | committer: Jean-Baptiste Kempf 

Qt: PlaylistWidget parenting and code cleanup/simplifications

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f0c9c7fb93f22800980777c4069c74a27d4d6a25
---

 modules/gui/qt4/components/playlist/playlist.cpp |    3 +-
 modules/gui/qt4/components/playlist/playlist.hpp |   52 +++++++++------------
 modules/gui/qt4/dialogs/playlist.cpp             |    2 +-
 modules/gui/qt4/main_interface.cpp               |    2 +-
 4 files changed, 26 insertions(+), 33 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index 82b9a18..419c4e0 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -40,7 +40,8 @@
  * 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 );
 
diff --git a/modules/gui/qt4/components/playlist/playlist.hpp b/modules/gui/qt4/components/playlist/playlist.hpp
index 7228916..869f0a9 100644
--- a/modules/gui/qt4/components/playlist/playlist.hpp
+++ b/modules/gui/qt4/components/playlist/playlist.hpp
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * interface_widgets.hpp : Playlist Widgets
  ****************************************************************************
- * Copyright (C) 2006 the VideoLAN team
+ * Copyright (C) 2006-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Clément Stenac <zorglub at videolan.org>
@@ -19,8 +19,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #ifndef _PLAYLISTWIDGET_H_
@@ -32,43 +32,22 @@
 
 #include "qt4.hpp"
 
-#include "dialogs_provider.hpp" /* Media Info from ArtLabel */
-#include "components/interface_widgets.hpp"
+#include "dialogs_provider.hpp"              /* Media Info from ArtLabel */
+#include "components/interface_widgets.hpp"  /* CoverArt */
 //#include <vlc_playlist.h>
 
 #include <QSplitter>
-#include <QLabel>
 
 class PLSelector;
 class StandardPLPanel;
 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
 {
-    Q_OBJECT
 public:
     ArtLabel( QWidget *parent, intf_thread_t *intf )
             : CoverArtLabel( parent, intf ) {};
+
     virtual void mouseDoubleClickEvent( QMouseEvent *event )
     {
         THEDP->mediaInfoDialog();
@@ -76,9 +55,22 @@ public:
     }
 };
 
-enum PLEventType {
-    ItemAddedEv = QEvent::User,
-    ItemRemovedEv
+class PlaylistWidget : public QSplitter
+{
+    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
diff --git a/modules/gui/qt4/dialogs/playlist.cpp b/modules/gui/qt4/dialogs/playlist.cpp
index 2b51810..459ee68 100644
--- a/modules/gui/qt4/dialogs/playlist.cpp
+++ b/modules/gui/qt4/dialogs/playlist.cpp
@@ -48,7 +48,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
 
     getSettings()->beginGroup("playlistdialog");
 
-    playlistWidget = new PlaylistWidget( p_intf );
+    playlistWidget = new PlaylistWidget( p_intf, this );
     l->addWidget( playlistWidget );
 
     readSettings( getSettings(), QSize( 600,700 ) );
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 5e26980..8832702 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -913,7 +913,7 @@ int MainInterface::controlVideo( int i_query, va_list args )
  **/
 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_dock_e)getSettings()




More information about the vlc-devel mailing list