]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/interface_widgets.hpp
Qt4 : fullscreen Button activation/deactivation
[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 *normalButton;
114     QPushButton *fullscreenButton, *snapshotButton;
115 private slots:
116     void normal();
117     void snapshot();
118     void fullscreen();
119 };
120
121 class InputSlider;
122 class QSlider;
123 class QGridLayout;
124 class VolumeClickHandler;
125 class ControlsWidget : public QFrame
126 {
127     Q_OBJECT
128 public:
129     ControlsWidget( intf_thread_t *);
130     virtual ~ControlsWidget();
131
132     QPushButton *playlistButton;
133     QSlider *volumeSlider;
134     void setStatus( int );
135     void enableInput( bool );
136     void enableVideo( bool );
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, *fullscreenButton;
150     QPushButton *slowerButton, *fasterButton;
151 private slots:
152     void play();
153     void stop();
154     void prev();
155     void next();
156     void updateVolume( int );
157     void fullscreen();
158     void extSettings();
159     void prefs();
160     void faster();
161     void slower();
162 };
163
164 class VolumeClickHandler : public QObject
165 {
166 public:
167     VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
168     {m = _m; p_intf = _p_intf; }
169     virtual ~VolumeClickHandler() {};
170     bool eventFilter( QObject *obj, QEvent *e )
171     {
172         if (e->type() == QEvent::MouseButtonPress )
173         {
174             aout_VolumeMute( p_intf, NULL );
175             return true;
176         }
177         return false;
178     }
179 private:
180     ControlsWidget *m;
181     intf_thread_t *p_intf;
182 };
183
184
185 /******************** Playlist Widgets ****************/
186 #include <QModelIndex>
187 #include <QSplitter>
188 class QSignalMapper;
189 class PLSelector;
190 class PLPanel;
191 class QPushButton;
192
193 class PlaylistWidget : public QSplitter
194 {
195     Q_OBJECT;
196 public:
197     PlaylistWidget( intf_thread_t *_p_i ) ;
198     virtual ~PlaylistWidget();
199     QSize widgetSize;
200     virtual QSize sizeHint() const;
201 private:
202     PLSelector *selector;
203     PLPanel *rightPanel;
204     QPushButton *addButton;
205     QLabel *art;
206     QString prevArt;
207 protected:
208      intf_thread_t *p_intf;
209 private slots:
210     void setArt( QString );
211 signals:
212     void rootChanged( int );
213     void artSet( QString );
214 };
215
216 #endif