]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/interface_widgets.hpp
qt4 - Main controls, small modification and implementation of fullscreen().
[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 signals:
66     void askResize();
67 private slots:
68     void SetMinSize();
69 };
70
71 /******************** Background Widget ****************/
72 class BackgroundWidget : public QFrame
73 {
74     Q_OBJECT
75 public:
76     BackgroundWidget( intf_thread_t * );
77     virtual ~BackgroundWidget();
78     QSize widgetSize;
79     virtual QSize sizeHint() const;
80 private:
81     QPalette plt;
82     QLabel *label;
83     QHBoxLayout *backgroundLayout;
84     virtual void resizeEvent( QResizeEvent *e );
85     int DrawBackground();
86     int CleanBackground();
87     intf_thread_t *p_intf;
88 private slots:
89     void setArt( QString );
90 };
91
92 class VisualSelector : public QFrame
93 {
94     Q_OBJECT
95 public:
96     VisualSelector( intf_thread_t *);
97     virtual ~VisualSelector();
98 private:
99     intf_thread_t *p_intf;
100     QLabel *current;
101 private slots:
102     void prev();
103     void next();
104 };
105
106 class QPushButton;
107 class AdvControlsWidget : public QFrame
108 {
109     Q_OBJECT
110 public:
111     AdvControlsWidget( intf_thread_t *);
112     virtual ~AdvControlsWidget();
113     void enableInput( bool );
114     void enableVideo( bool );
115 private:
116     intf_thread_t *p_intf;
117     QPushButton *normalButton, *recordButton, *ABButton;
118     QPushButton *snapshotButton, *frameButton;
119 private slots:
120     void normal();
121     void snapshot();
122     void frame();
123     void fromAtoB();
124     void record();
125 };
126
127 class InputSlider;
128 class QSlider;
129 class QGridLayout;
130 class VolumeClickHandler;
131 class ControlsWidget : public QFrame
132 {
133     Q_OBJECT
134 public:
135     ControlsWidget( intf_thread_t *, bool );
136     virtual ~ControlsWidget();
137
138     QPushButton *playlistButton;
139     QSlider *volumeSlider;
140     void setStatus( int );
141     void enableInput( bool );
142     void enableVideo( bool );
143 public slots:
144     void setNavigation( int );
145     void updateOnTimer();
146 protected:
147     friend class MainInterface;
148     friend class VolumeClickHandler;
149 private:
150     intf_thread_t       *p_intf;
151     QFrame              *discFrame;
152     QGridLayout         *controlLayout;
153     InputSlider         *slider;
154     QPushButton         *prevSectionButton, *nextSectionButton, *menuButton;
155     QPushButton         *playButton, *fullscreenButton;
156     QPushButton         *slowerButton, *fasterButton;
157     AdvControlsWidget   *advControls;
158
159     bool                 b_advancedVisible;
160 private slots:
161     void play();
162     void stop();
163     void prev();
164     void next();
165     void updateVolume( int );
166     void fullscreen();
167     void extSettings();
168     void prefs();
169     void faster();
170     void slower();
171     void toggleAdvanced();
172 signals:
173     void advancedControlsToggled( bool );
174 };
175
176 class VolumeClickHandler : public QObject
177 {
178 public:
179     VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
180     {m = _m; p_intf = _p_intf; }
181     virtual ~VolumeClickHandler() {};
182     bool eventFilter( QObject *obj, QEvent *e )
183     {
184         if (e->type() == QEvent::MouseButtonPress )
185         {
186             aout_VolumeMute( p_intf, NULL );
187             return true;
188         }
189         return false;
190     }
191 private:
192     ControlsWidget *m;
193     intf_thread_t *p_intf;
194 };
195
196
197 /******************** Playlist Widgets ****************/
198 #include <QModelIndex>
199 #include <QSplitter>
200 class QSignalMapper;
201 class PLSelector;
202 class PLPanel;
203 class QPushButton;
204
205 class PlaylistWidget : public QSplitter
206 {
207     Q_OBJECT;
208 public:
209     PlaylistWidget( intf_thread_t *_p_i ) ;
210     virtual ~PlaylistWidget();
211     QSize widgetSize;
212     virtual QSize sizeHint() const;
213 private:
214     PLSelector *selector;
215     PLPanel *rightPanel;
216     QPushButton *addButton;
217     QLabel *art;
218     QString prevArt;
219 protected:
220      intf_thread_t *p_intf;
221 private slots:
222     void setArt( QString );
223 signals:
224     void rootChanged( int );
225     void artSet( QString );
226 };
227
228 #endif