]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/interface_widgets.hpp
Qt4 - PlaylistWidget use a much nicer QSplitter. Removes also too much class inherita...
[vlc] / modules / gui / qt4 / components / interface_widgets.hpp
1 /*****************************************************************************
2  * interface_widgets.hpp : Custom widgets for the main interface
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef _INTFWIDGETS_H_
25 #define _INTFWIDGETS_H_
26
27 #include <vlc/vlc.h>
28 #include <vlc_interface.h>
29
30 #include "qt4.hpp"
31
32 #include <QWidget>
33 #include <QFrame>
34
35 class ResizeEvent;
36 class QPalette;
37 class QPixmap;
38 class QLabel;
39 class QHBoxLayout;
40
41 /******************** Video Widget ****************/
42 class VideoWidget : public QFrame
43 {
44     Q_OBJECT
45 public:
46     VideoWidget( intf_thread_t * );
47     virtual ~VideoWidget();
48
49     void *request( vout_thread_t *, int *, int *,
50                    unsigned int *, unsigned int * );
51     void release( void * );
52     int control( void *, int, va_list );
53
54     int i_video_height, i_video_width;
55     vout_thread_t *p_vout;
56
57     QSize widgetSize;
58     virtual QSize sizeHint() const;
59 private:
60     QWidget *frame;
61     intf_thread_t *p_intf;
62     vlc_mutex_t lock;
63 };
64
65 /******************** Background Widget ****************/
66 class BackgroundWidget : public QFrame
67 {
68     Q_OBJECT
69 public:
70     BackgroundWidget( intf_thread_t * );
71     virtual ~BackgroundWidget();
72     QSize widgetSize;
73     virtual QSize sizeHint() const;
74 private:
75     QPalette plt;
76     QLabel *label;
77     QHBoxLayout *backgroundLayout;
78     virtual void resizeEvent( QResizeEvent *e );
79     int DrawBackground();
80     int CleanBackground();
81     intf_thread_t *p_intf;
82 };
83
84 class VisualSelector : public QFrame
85 {
86     Q_OBJECT
87 public:
88     VisualSelector( intf_thread_t *);
89     virtual ~VisualSelector();
90 private:
91     intf_thread_t *p_intf;
92     QLabel *current;
93 private slots:
94     void prev();
95     void next();
96 };
97
98 class QPushButton;
99 class ControlsWidget : public QFrame
100 {
101     Q_OBJECT
102 public:
103     ControlsWidget( intf_thread_t *);
104     virtual ~ControlsWidget();
105     void enableInput( bool );
106     void enableVideo( bool );
107 private:
108     intf_thread_t *p_intf;
109     QPushButton *slowerButton, *normalButton, *fasterButton;
110     QPushButton *fullscreenButton, *snapshotButton;
111 private slots:
112     void faster();
113     void slower();
114     void normal();
115     void snapshot();
116     void fullscreen();
117 };
118
119
120 /******************** Playlist Widgets ****************/
121 #include <QModelIndex>
122 #include <QSplitter>
123 class QSignalMapper;
124 class PLSelector;
125 class PLPanel;
126 class QPushButton;
127
128 class PlaylistWidget : public QSplitter
129 {
130     Q_OBJECT;
131 public:
132     PlaylistWidget( intf_thread_t *_p_i ) ;
133     virtual ~PlaylistWidget();
134     QSize widgetSize;
135     virtual QSize sizeHint() const;
136 private:
137     PLSelector *selector;
138     PLPanel *rightPanel;
139     QPushButton *addButton;
140     QLabel *art;
141     QString prevArt;
142 protected:
143      intf_thread_t *p_intf;
144 private slots:
145     void setArt( QString );
146 signals:
147     void rootChanged( int );
148 };
149
150 #endif