]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/playlist/playlist.hpp
2b02388d97198979af09b8cd77030b4d125c4e12
[vlc] / modules / gui / qt4 / components / playlist / playlist.hpp
1 /*****************************************************************************
2  * interface_widgets.hpp : Playlist Widgets
3  ****************************************************************************
4  * Copyright (C) 2006-2009 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Clément Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *          Rafaël Carré <funman@videolanorg>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26 #ifndef _PLAYLISTWIDGET_H_
27 #define _PLAYLISTWIDGET_H_
28
29 #ifdef HAVE_CONFIG_H
30 # include "config.h"
31 #endif
32
33 #include "qt4.hpp"
34
35 //#include <vlc_playlist.h>
36
37 #include <QSplitter>
38 #include <QPushButton>
39
40 class StandardPLPanel;
41 class LocationBar;
42 class QSignalMapper;
43 class SearchLineEdit;
44 class QModelIndex;
45
46 class PlaylistWidget : public QSplitter
47 {
48     Q_OBJECT
49 public:
50     PlaylistWidget( intf_thread_t *_p_i, QWidget * );
51     virtual ~PlaylistWidget();
52
53     void forceHide();
54     void forceShow();
55
56 private:
57     QSplitter            *leftSplitter;
58     StandardPLPanel      *mainView;
59
60     QAction *viewActions[ 4 /* StandardPLPanel::VIEW_COUNT*/ ];
61
62     LocationBar          *locationBar;
63     SearchLineEdit       *searchEdit;
64
65     intf_thread_t *p_intf;
66
67 protected:
68     virtual void dropEvent( QDropEvent *);
69     virtual void dragEnterEvent( QDragEnterEvent * );
70     virtual void closeEvent( QCloseEvent * );
71
72 private slots:
73     void changeView( const QModelIndex& index );
74 };
75
76 class LocationButton : public QPushButton
77 {
78 public:
79     LocationButton( const QString &, bool bold, bool arrow, QWidget * parent = NULL );
80     virtual QSize sizeHint() const;
81 protected:
82     virtual void paintEvent ( QPaintEvent * event );
83 private:
84     bool b_arrow;
85 };
86
87 class PLModel;
88 class QHBoxLayout;
89 class LocationBar : public QWidget
90 {
91     Q_OBJECT
92 public:
93     LocationBar( PLModel * );
94     void setIndex( const QModelIndex & );
95     virtual QSize sizeHint() const;
96 protected:
97     virtual void resizeEvent ( QResizeEvent * event );
98
99 private:
100     void layOut( const QSize& size );
101
102     PLModel *model;
103     QSignalMapper *mapper;
104     QList<QWidget*> buttons;
105     QList<QAction*> actions;
106     LocationButton *btnMore;
107     QMenu *menuMore;
108     QList<int> widths;
109
110 public slots:
111     void setRootIndex();
112 private slots:
113     void invoke( int i_item_id );
114
115 signals:
116     void invoked( const QModelIndex & );
117 };
118
119
120 #endif