]> 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 71180e0c0f36a017fea950a0cfa67b9ee896051c..ae38a279a87a68966c0de59a9d4a1c88e7cbcf8f 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 "config.h"
 #endif
 
-#include <vlc_common.h>
 #include "qt4.hpp"
-#include "dialogs_provider.hpp"
-#include "components/interface_widgets.hpp"
+
+//#include <vlc_playlist.h>
 
 #include <QSplitter>
-#include <QLabel>
 
-class PLSelector;
-class PLPanel;
-class QPushButton;
-class CoverArtLabel;
-class ArtLabel;
+#include <QPushButton>
+#include <QSplitterHandle>
+#include <QMouseEvent>
+
+class StandardPLPanel;
+class LocationBar;
+class QSignalMapper;
+class SearchLineEdit;
+class QModelIndex;
+class QStackedWidget;
 
-class PlaylistWidget : public QSplitter
+class PlaylistWidget : public QWidget
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
-    PlaylistWidget( intf_thread_t *_p_i, QWidget *parent ) ;
+    PlaylistWidget( intf_thread_t *_p_i, QWidget * );
     virtual ~PlaylistWidget();
+
+    void forceHide();
+    void forceShow();
+    QStackedWidget *artContainer;
 private:
-    PLSelector *selector;
-    PLPanel *rightPanel;
-    QPushButton *addButton;
-    ArtLabel *art;
-    QWidget *parent;
-protected:
+    QSplitter            *leftSplitter;
+    QSplitter            *split;
+    StandardPLPanel      *mainView;
+
+    QAction *viewActions[ 4 /* StandardPLPanel::VIEW_COUNT*/ ];
+
+    LocationBar          *locationBar;
+    SearchLineEdit       *searchEdit;
+
     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 );
+};
 
-signals:
-    void rootChanged( int );
+#ifdef Q_WS_MAC
+class PlaylistSplitter : public QSplitter
+{
+public:
+    PlaylistSplitter( QWidget *_parent ) : QSplitter( _parent ){}
+protected:
+    virtual QSplitterHandle *createHandle();
 };
+#else
+ #define PlaylistSplitter QSplitter
+#endif
 
-class ArtLabel : public CoverArtLabel
+#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 );
+    virtual QSize sizeHint() const;
+protected:
+    virtual void paintEvent ( QPaintEvent * event );
+private:
+    bool b_arrow;
+};
+
+class PLModel;
+class QHBoxLayout;
+class LocationBar : public QWidget
 {
     Q_OBJECT
 public:
-    ArtLabel( intf_thread_t *intf ) : CoverArtLabel( VLC_OBJECT( intf ) ) {};
-    virtual ~ArtLabel() {};
-    void mouseDoubleClickEvent( QMouseEvent *event )
-    {
-        THEDP->mediaInfoDialog();
-    }
+    LocationBar( PLModel * );
+    void setIndex( const QModelIndex & );
+    virtual QSize sizeHint() const;
+protected:
+    virtual void resizeEvent ( QResizeEvent * event );
+
+private:
+    void layOut( const QSize& size );
+
+    PLModel *model;
+    QSignalMapper *mapper;
+    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 & );
 };