]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/interface_widgets.hpp
Qt4 : Changes in the main interface:
[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  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef _INTFWIDGETS_H_
26 #define _INTFWIDGETS_H_
27
28 #include <vlc/vlc.h>
29 #include <vlc_interface.h>
30
31 #include <vlc_aout.h>
32 #include "qt4.hpp"
33
34 #include <QWidget>
35 #include <QFrame>
36
37 class ResizeEvent;
38 class QPalette;
39 class QPixmap;
40 class QLabel;
41 class QHBoxLayout;
42
43 /******************** Video Widget ****************/
44 class VideoWidget : public QFrame
45 {
46     Q_OBJECT
47 public:
48     VideoWidget( intf_thread_t * );
49     virtual ~VideoWidget();
50
51     void *request( vout_thread_t *, int *, int *,
52                    unsigned int *, unsigned int * );
53     void release( void * );
54     int control( void *, int, va_list );
55
56     int i_video_height, i_video_width;
57     vout_thread_t *p_vout;
58
59     QSize widgetSize;
60     virtual QSize sizeHint() const;
61 private:
62     QWidget *frame;
63     intf_thread_t *p_intf;
64     vlc_mutex_t lock;
65 };
66
67 /******************** Background Widget ****************/
68 class BackgroundWidget : public QFrame
69 {
70     Q_OBJECT
71 public:
72     BackgroundWidget( intf_thread_t * );
73     virtual ~BackgroundWidget();
74     QSize widgetSize;
75     virtual QSize sizeHint() const;
76 private:
77     QPalette plt;
78     QLabel *label;
79     QHBoxLayout *backgroundLayout;
80     virtual void resizeEvent( QResizeEvent *e );
81     int DrawBackground();
82     int CleanBackground();
83     intf_thread_t *p_intf;
84 private slots:
85     void setArt( QString );
86 };
87
88 class VisualSelector : public QFrame
89 {
90     Q_OBJECT
91 public:
92     VisualSelector( intf_thread_t *);
93     virtual ~VisualSelector();
94 private:
95     intf_thread_t *p_intf;
96     QLabel *current;
97 private slots:
98     void prev();
99     void next();
100 };
101
102 class QPushButton;
103 class AdvControlsWidget : public QFrame
104 {
105     Q_OBJECT
106 public:
107     AdvControlsWidget( intf_thread_t *);
108     virtual ~AdvControlsWidget();
109     void enableInput( bool );
110     void enableVideo( bool );
111 private:
112     intf_thread_t *p_intf;
113     QPushButton *slowerButton, *normalButton, *fasterButton;
114     QPushButton *fullscreenButton, *snapshotButton;
115 private slots:
116     void faster();
117     void slower();
118     void normal();
119     void snapshot();
120     void fullscreen();
121 };
122
123 class InputSlider;
124 class QSlider;
125 class QGridLayout;
126 class VolumeClickHandler;
127 class ControlsWidget : public QFrame
128 {
129     Q_OBJECT
130 public:
131     ControlsWidget( intf_thread_t *);
132     virtual ~ControlsWidget();
133
134     QPushButton *playlistButton;
135     QSlider *volumeSlider;
136     void setStatus( int );
137 public slots:
138     void setNavigation( int );
139     void updateOnTimer();
140 protected:
141     friend class MainInterface;
142     friend class VolumeClickHandler;
143 private:
144     intf_thread_t *p_intf;
145     QFrame *discFrame;
146     QGridLayout *controlLayout;
147     InputSlider         *slider;
148     QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
149     QPushButton *playButton;
150 private slots:
151     void play();
152     void stop();
153     void prev();
154     void next();
155     void updateVolume( int );
156     void fullscreen();
157     void extSettings();
158     void prefs();
159 };
160
161 class VolumeClickHandler : public QObject
162 {
163 public:
164     VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
165     {m = _m; p_intf = _p_intf; }
166     virtual ~VolumeClickHandler() {};
167     bool eventFilter( QObject *obj, QEvent *e )
168     {
169         if (e->type() == QEvent::MouseButtonPress )
170         {
171             aout_VolumeMute( p_intf, NULL );
172             return true;
173         }
174         return false;
175     }
176 private:
177     ControlsWidget *m;
178     intf_thread_t *p_intf;
179 };
180
181
182 /******************** Playlist Widgets ****************/
183 #include <QModelIndex>
184 #include <QSplitter>
185 class QSignalMapper;
186 class PLSelector;
187 class PLPanel;
188 class QPushButton;
189
190 class PlaylistWidget : public QSplitter
191 {
192     Q_OBJECT;
193 public:
194     PlaylistWidget( intf_thread_t *_p_i ) ;
195     virtual ~PlaylistWidget();
196     QSize widgetSize;
197     virtual QSize sizeHint() const;
198 private:
199     PLSelector *selector;
200     PLPanel *rightPanel;
201     QPushButton *addButton;
202     QLabel *art;
203     QString prevArt;
204 protected:
205      intf_thread_t *p_intf;
206 private slots:
207     void setArt( QString );
208 signals:
209     void rootChanged( int );
210     void artSet( QString );
211 };
212
213 #endif