]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/playlist/playlist.hpp
Qt: use a QStackedWidget for the artContainer in the playlist
[vlc] / modules / gui / qt4 / components / playlist / playlist.hpp
index 02ff397b5a7b5c8630d6e85c8a7c7a482e2c3e4a..ae38a279a87a68966c0de59a9d4a1c88e7cbcf8f 100644 (file)
 
 #include "qt4.hpp"
 
-#include "dialogs_provider.hpp"              /* Media Info from ArtLabel */
-#include "components/playlist/standardpanel.hpp"  /* CoverArt */
-#include "components/interface_widgets.hpp"  /* CoverArt */
-
-
 //#include <vlc_playlist.h>
 
 #include <QSplitter>
 
-class PLSelector;
+#include <QPushButton>
+#include <QSplitterHandle>
+#include <QMouseEvent>
 
-class QPushButton;
 class StandardPLPanel;
-
-static const QString viewNames[] = { qtr( "Detailed View" ),
-                                     qtr( "Icon View" ),
-                                     qtr( "List View" ) };
-
-class ArtLabel : public CoverArtLabel
-{
-public:
-    ArtLabel( QWidget *parent, intf_thread_t *intf )
-            : CoverArtLabel( parent, intf ) {}
-
-    virtual void mouseDoubleClickEvent( QMouseEvent *event )
-    {
-        THEDP->mediaInfoDialog();
-        event->accept();
-    }
-};
-
 class LocationBar;
-class PlaylistWidget : public QSplitter
+class QSignalMapper;
+class SearchLineEdit;
+class QModelIndex;
+class QStackedWidget;
+
+class PlaylistWidget : public QWidget
 {
     Q_OBJECT
 public:
     PlaylistWidget( intf_thread_t *_p_i, QWidget * );
     virtual ~PlaylistWidget();
+
     void forceHide();
     void forceShow();
+    QStackedWidget *artContainer;
 private:
-    PLSelector      *selector;
-    ArtLabel        *art;
+    QSplitter            *leftSplitter;
+    QSplitter            *split;
+    StandardPLPanel      *mainView;
 
-    QPushButton     *addButton;
-    QSplitter       *leftSplitter;
-    QSignalMapper *viewSelectionMapper;
-    QAction *viewActions[3];
-    StandardPLPanel *mainView;
+    QAction *viewActions[ 4 /* StandardPLPanel::VIEW_COUNT*/ ];
+
+    LocationBar          *locationBar;
+    SearchLineEdit       *searchEdit;
 
-    LocationBar *locationBar;
-    SearchLineEdit *searchEdit;
-protected:
     intf_thread_t *p_intf;
+
+protected:
     virtual void dropEvent( QDropEvent *);
     virtual void dragEnterEvent( QDragEnterEvent * );
     virtual void closeEvent( QCloseEvent * );
-
 private slots:
     void changeView( const QModelIndex& index );
 };
 
+#ifdef Q_WS_MAC
+class PlaylistSplitter : public QSplitter
+{
+public:
+    PlaylistSplitter( QWidget *_parent ) : QSplitter( _parent ){}
+protected:
+    virtual QSplitterHandle *createHandle();
+};
+#else
+ #define PlaylistSplitter QSplitter
+#endif
+
+#ifdef Q_WS_MAC
+class SplitterHandle : public QSplitterHandle
+{
+public:
+    SplitterHandle( Qt::Orientation orientation, QSplitter * parent );
+
+protected:
+    virtual void paintEvent ( QPaintEvent * );
+
+private:
+    virtual QSize sizeHint () const;
+};
+#endif /* __APPLE__ */
+
 class LocationButton : public QPushButton
 {
 public:
     LocationButton( const QString &, bool bold, bool arrow, QWidget * parent = NULL );
-    QSize sizeHint() const;
+    virtual QSize sizeHint() const;
+protected:
+    virtual void paintEvent ( QPaintEvent * event );
 private:
-    void paintEvent ( QPaintEvent * event );
-    QFontMetrics *metrics;
     bool b_arrow;
 };
 
 class PLModel;
+class QHBoxLayout;
 class LocationBar : public QWidget
 {
     Q_OBJECT
 public:
     LocationBar( PLModel * );
     void setIndex( const QModelIndex & );
-    QSize sizeHint() const;
-signals:
-    void invoked( const QModelIndex & );
-public slots:
-    void setRootIndex();
-private slots:
-    void invoke( int i_item_id );
+    virtual QSize sizeHint() const;
+protected:
+    virtual void resizeEvent ( QResizeEvent * event );
+
 private:
     void layOut( const QSize& size );
-    void resizeEvent ( QResizeEvent * event );
 
     PLModel *model;
     QSignalMapper *mapper;
-    QHBoxLayout *box;
-    QList<QWidget*> buttons;
+    QWidgetList buttons;
     QList<QAction*> actions;
     LocationButton *btnMore;
     QMenu *menuMore;
     QList<int> widths;
+
+public slots:
+    void setRootIndex();
+private slots:
+    void invoke( int i_item_id );
+
+signals:
+    void invoked( const QModelIndex & );
 };