]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/playlist/playlist.hpp
Qt: fix previous commit
[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
39 #include <QPushButton>
40 #include <QSplitterHandle>
41 #include <QMouseEvent>
42
43 class StandardPLPanel;
44 class LocationBar;
45 class QSignalMapper;
46 class SearchLineEdit;
47 class QModelIndex;
48
49 class PlaylistWidget : public QSplitter
50 {
51     Q_OBJECT
52 public:
53     PlaylistWidget( intf_thread_t *_p_i, QWidget * );
54     virtual ~PlaylistWidget();
55
56     void forceHide();
57     void forceShow();
58
59 private:
60     QSplitter            *leftSplitter;
61     StandardPLPanel      *mainView;
62
63     QAction *viewActions[ 4 /* StandardPLPanel::VIEW_COUNT*/ ];
64
65     LocationBar          *locationBar;
66     SearchLineEdit       *searchEdit;
67
68     intf_thread_t *p_intf;
69
70 protected:
71     virtual void dropEvent( QDropEvent *);
72     virtual void dragEnterEvent( QDragEnterEvent * );
73     virtual void closeEvent( QCloseEvent * );
74 #ifdef __APPLE__
75     virtual QSplitterHandle *createHandle();
76 #endif
77
78 private slots:
79     void changeView( const QModelIndex& index );
80 };
81
82 #ifdef Q_WS_MAC
83 class SplitterHandle : public QSplitterHandle
84 {
85 public:
86     SplitterHandle( Qt::Orientation orientation, QSplitter * parent );
87
88 protected:
89     virtual void paintEvent ( QPaintEvent * );
90
91 private:
92     virtual QSize sizeHint () const;
93 };
94 #endif /* __APPLE__ */
95
96 class LocationButton : public QPushButton
97 {
98 public:
99     LocationButton( const QString &, bool bold, bool arrow, QWidget * parent = NULL );
100     virtual QSize sizeHint() const;
101 protected:
102     virtual void paintEvent ( QPaintEvent * event );
103 private:
104     bool b_arrow;
105 };
106
107 class PLModel;
108 class QHBoxLayout;
109 class LocationBar : public QWidget
110 {
111     Q_OBJECT
112 public:
113     LocationBar( PLModel * );
114     void setIndex( const QModelIndex & );
115     virtual QSize sizeHint() const;
116 protected:
117     virtual void resizeEvent ( QResizeEvent * event );
118
119 private:
120     void layOut( const QSize& size );
121
122     PLModel *model;
123     QSignalMapper *mapper;
124     QList<QWidget*> buttons;
125     QList<QAction*> actions;
126     LocationButton *btnMore;
127     QMenu *menuMore;
128     QList<int> widths;
129
130 public slots:
131     void setRootIndex();
132 private slots:
133     void invoke( int i_item_id );
134
135 signals:
136     void invoked( const QModelIndex & );
137 };
138
139
140 #endif