]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/interface_widgets.hpp
Qt4 - comment non-existing feature.
[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  *          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
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26 #ifndef _INTFWIDGETS_H_
27 #define _INTFWIDGETS_H_
28
29 #include <vlc/vlc.h>
30 #include <vlc_interface.h>
31
32 #include <vlc_aout.h>
33 #include "qt4.hpp"
34
35 #include <QWidget>
36 #include <QFrame>
37 #define VOLUME_MAX 200
38
39 class ResizeEvent;
40 class QPalette;
41 class QPixmap;
42 class QLabel;
43 class QHBoxLayout;
44
45 /******************** Video Widget ****************/
46 class VideoWidget : public QFrame
47 {
48     Q_OBJECT
49 public:
50     VideoWidget( intf_thread_t * );
51     virtual ~VideoWidget();
52
53     void *request( vout_thread_t *, int *, int *,
54                    unsigned int *, unsigned int * );
55     void  release( void * );
56     int   control( void *, int, va_list );
57
58 private:
59     intf_thread_t *p_intf;
60     vout_thread_t *p_vout;
61
62     vlc_mutex_t lock;
63
64 signals:
65     void askVideoWidgetToShow();
66     //void askResize();
67
68 public slots:
69     void SetSizing( unsigned int, unsigned int );
70 };
71
72 /******************** Background Widget ****************/
73 class BackgroundWidget : public QWidget
74 {
75     Q_OBJECT
76 public:
77     BackgroundWidget( intf_thread_t * );
78     virtual ~BackgroundWidget();
79
80 private:
81     QPalette plt;
82     QLabel *label;
83     virtual void contextMenuEvent( QContextMenuEvent *event );
84     intf_thread_t *p_intf;
85
86 public slots:
87     void toggle(){ TOGGLEV( this ); }
88     void update( QString );
89 };
90
91 class VisualSelector : public QFrame
92 {
93     Q_OBJECT
94 public:
95     VisualSelector( intf_thread_t *);
96     virtual ~VisualSelector();
97 private:
98     intf_thread_t *p_intf;
99     QLabel *current;
100 private slots:
101     void prev();
102     void next();
103 };
104
105 /* Advanced Button Bar */
106 class QPushButton;
107 class AdvControlsWidget : public QFrame
108 {
109     Q_OBJECT
110 public:
111     AdvControlsWidget( intf_thread_t *);
112     virtual ~AdvControlsWidget();
113
114     void enableInput( bool );
115     void enableVideo( bool );
116
117 private:
118     intf_thread_t *p_intf;
119     QPushButton *recordButton, *ABButton;
120     QPushButton *snapshotButton, *frameButton;
121
122     mtime_t timeA, timeB;
123
124 private slots:
125     void snapshot();
126 #if 0
127     void frame();
128 #endif
129     void fromAtoB();
130     void record();
131     void AtoBLoop( float, int, int );
132 };
133
134 /* Button Bar */
135 class InputSlider;
136 class QSlider;
137 class QGridLayout;
138 class VolumeClickHandler;
139 class SoundSlider;
140 class QAbstractSlider;
141 class QToolButton;
142
143 class ControlsWidget : public QFrame
144 {
145     Q_OBJECT
146 public:
147     /* p_intf, advanced control visible or not, blingbling or not */
148     ControlsWidget( intf_thread_t *, MainInterface*, bool, bool );
149     virtual ~ControlsWidget();
150
151     QPushButton *playlistButton;
152     void setStatus( int );
153     void enableInput( bool );
154     void enableVideo( bool );
155 public slots:
156     void setNavigation( int );
157 protected:
158     friend class MainInterface;
159     friend class VolumeClickHandler;
160 private:
161     intf_thread_t       *p_intf;
162     QWidget             *discFrame;
163     QWidget             *telexFrame;
164     QGridLayout         *controlLayout;
165     InputSlider         *slider;
166     QPushButton         *prevSectionButton, *nextSectionButton, *menuButton;
167     QPushButton         *playButton, *fullscreenButton;
168     QToolButton         *slowerButton, *fasterButton;
169     AdvControlsWidget   *advControls;
170     QLabel              *volMuteLabel;
171     QAbstractSlider     *volumeSlider;
172
173     bool                 b_advancedVisible;
174 private slots:
175     void play();
176     void stop();
177     void prev();
178     void next();
179     void updateVolume( int );
180     void updateVolume( void );
181     void fullscreen();
182     void extSettings();
183     void faster();
184     void slower();
185     void toggleAdvanced();
186 signals:
187     void advancedControlsToggled( bool );
188 };
189
190 class VolumeClickHandler : public QObject
191 {
192 public:
193     VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
194     {m = _m; p_intf = _p_intf; }
195     virtual ~VolumeClickHandler() {};
196     bool eventFilter( QObject *obj, QEvent *e )
197     {
198         if (e->type() == QEvent::MouseButtonPress  )
199         {
200             aout_VolumeMute( p_intf, NULL );
201             audio_volume_t i_volume;
202             aout_VolumeGet( p_intf, &i_volume );
203             m->updateVolume( i_volume *  VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
204             return true;
205         }
206         return false;
207     }
208 private:
209     ControlsWidget *m;
210     intf_thread_t *p_intf;
211 };
212
213 #include <QLabel>
214 #include <QMouseEvent>
215 class TimeLabel : public QLabel
216 {
217     Q_OBJECT
218     void mousePressEvent( QMouseEvent *event )
219     {
220         emit timeLabelClicked();
221     }
222     void mouseDoubleClickEvent( QMouseEvent *event )
223     {
224         emit timeLabelDoubleClicked();
225     }
226 signals:
227     void timeLabelClicked();
228     void timeLabelDoubleClicked();
229 };
230
231
232 /******************** Speed Control Widgets ****************/
233 class SpeedControlWidget : public QFrame
234 {
235     Q_OBJECT
236 public:
237     SpeedControlWidget( intf_thread_t *);
238     virtual ~SpeedControlWidget();
239     void updateControls( int );
240 private:
241     intf_thread_t *p_intf;
242     QSlider *speedSlider;
243 private slots:
244     void updateRate( int );
245     void resetRate();
246 };
247
248 #endif