]> git.sesse.net Git - vlc/commitdiff
Qt: PlaylistWidget parenting and code cleanup/simplifications
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 12 Dec 2009 17:20:47 +0000 (18:20 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 12 Dec 2009 21:49:15 +0000 (22:49 +0100)
modules/gui/qt4/components/playlist/playlist.cpp
modules/gui/qt4/components/playlist/playlist.hpp
modules/gui/qt4/dialogs/playlist.cpp
modules/gui/qt4/main_interface.cpp

index 82b9a18ef1a0a0bdf111e677caf0ce0e892dcb6a..419c4e0a78a153a3227a10a613c9b8a3e433b943 100644 (file)
@@ -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 );
 
index 72289164a069cecef5e0c4addc3d8c461a623ed5..869f0a9395c5285331110f3948f5315de7c599ab 100644 (file)
@@ -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@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_
 
 #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
index 2b518108c3c1af378cfc9e4d28e0ed565c0c8fd7..459ee68163597cee96f21b93ee7d24f26976b288 100644 (file)
@@ -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 ) );
index 5e26980c1d2eba7871b5f5176eb28edb0e56575c..883270277cdc4a17e9531ca56e7201e338666913 100644 (file)
@@ -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()