1 /*****************************************************************************
2 * interface_widgets.hpp : Custom widgets for the main interface
3 ****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste Kempf <jb@videolan.org>
9 * Rafaël Carré <funman@videolanorg>
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.
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.
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 *****************************************************************************/
26 #ifndef _INTFWIDGETS_H_
27 #define _INTFWIDGETS_H_
34 #include <vlc_interface.h>
41 #define VOLUME_MAX 200
49 /******************** Video Widget ****************/
50 class VideoWidget : public QFrame
54 VideoWidget( intf_thread_t * );
55 virtual ~VideoWidget();
57 void *request( vout_thread_t *, int *, int *,
58 unsigned int *, unsigned int * );
59 void release( void * );
60 int control( void *, int, va_list );
63 intf_thread_t *p_intf;
64 vout_thread_t *p_vout;
69 void askVideoWidgetToShow();
73 void SetSizing( unsigned int, unsigned int );
76 /******************** Background Widget ****************/
77 class BackgroundWidget : public QWidget
81 BackgroundWidget( intf_thread_t * );
82 virtual ~BackgroundWidget();
87 virtual void contextMenuEvent( QContextMenuEvent *event );
88 intf_thread_t *p_intf;
91 void toggle(){ TOGGLEV( this ); }
92 void update( QString );
95 class VisualSelector : public QFrame
99 VisualSelector( intf_thread_t *);
100 virtual ~VisualSelector();
102 intf_thread_t *p_intf;
109 /* Advanced Button Bar */
111 class AdvControlsWidget : public QFrame
115 AdvControlsWidget( intf_thread_t *);
116 virtual ~AdvControlsWidget();
118 void enableInput( bool );
119 void enableVideo( bool );
122 intf_thread_t *p_intf;
123 QPushButton *recordButton, *ABButton;
124 QPushButton *snapshotButton, *frameButton;
126 mtime_t timeA, timeB;
135 void AtoBLoop( float, int, int );
142 class VolumeClickHandler;
144 class QAbstractSlider;
147 class ControlsWidget : public QFrame
151 /* p_intf, advanced control visible or not, blingbling or not */
152 ControlsWidget( intf_thread_t *, MainInterface*, bool, bool );
153 virtual ~ControlsWidget();
155 QPushButton *playlistButton;
156 void setStatus( int );
157 void enableInput( bool );
158 void enableVideo( bool );
160 void setNavigation( int );
162 friend class MainInterface;
163 friend class VolumeClickHandler;
165 intf_thread_t *p_intf;
168 QGridLayout *controlLayout;
170 QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
171 QPushButton *playButton, *fullscreenButton;
172 QToolButton *slowerButton, *fasterButton;
173 AdvControlsWidget *advControls;
174 QLabel *volMuteLabel;
175 QAbstractSlider *volumeSlider;
177 bool b_advancedVisible;
183 void updateVolume( int );
184 void updateVolume( void );
190 void toggleAdvanced();
192 void advancedControlsToggled( bool );
195 class VolumeClickHandler : public QObject
198 VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
199 {m = _m; p_intf = _p_intf; }
200 virtual ~VolumeClickHandler() {};
201 bool eventFilter( QObject *obj, QEvent *e )
203 if (e->type() == QEvent::MouseButtonPress )
205 aout_VolumeMute( p_intf, NULL );
206 audio_volume_t i_volume;
207 aout_VolumeGet( p_intf, &i_volume );
208 m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
215 intf_thread_t *p_intf;
219 #include <QMouseEvent>
220 class TimeLabel : public QLabel
223 void mousePressEvent( QMouseEvent *event )
225 emit timeLabelClicked();
227 void mouseDoubleClickEvent( QMouseEvent *event )
229 emit timeLabelDoubleClicked();
232 void timeLabelClicked();
233 void timeLabelDoubleClicked();
237 /******************** Speed Control Widgets ****************/
238 class SpeedControlWidget : public QFrame
242 SpeedControlWidget( intf_thread_t *);
243 virtual ~SpeedControlWidget();
244 void updateControls( int );
246 intf_thread_t *p_intf;
247 QSlider *speedSlider;
249 void updateRate( int );