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>
38 #include "main_interface.hpp"
42 #define VOLUME_MAX 200
50 /******************** Video Widget ****************/
51 class VideoWidget : public QFrame
54 friend class MainInterface;
57 VideoWidget( intf_thread_t * );
58 virtual ~VideoWidget();
60 void *request( vout_thread_t *, int *, int *,
61 unsigned int *, unsigned int * );
62 void release( void * );
63 int control( void *, int, va_list );
65 virtual QSize sizeHint() const;
67 intf_thread_t *p_intf;
68 vout_thread_t *p_vout;
74 void askVideoWidgetToShow();
78 void SetSizing( unsigned int, unsigned int );
81 /******************** Background Widget ****************/
82 class BackgroundWidget : public QWidget
86 BackgroundWidget( intf_thread_t * );
87 virtual ~BackgroundWidget();
92 virtual void contextMenuEvent( QContextMenuEvent *event );
93 intf_thread_t *p_intf;
94 virtual void resizeEvent( QResizeEvent * event );
96 void toggle(){ TOGGLEV( this ); }
97 void update( QString );
100 class VisualSelector : public QFrame
104 VisualSelector( intf_thread_t *);
105 virtual ~VisualSelector();
107 intf_thread_t *p_intf;
114 /* Advanced Button Bar */
116 class AdvControlsWidget : public QFrame
120 AdvControlsWidget( intf_thread_t *);
121 virtual ~AdvControlsWidget();
123 void enableInput( bool );
124 void enableVideo( bool );
127 intf_thread_t *p_intf;
128 QPushButton *recordButton, *ABButton;
129 QPushButton *snapshotButton, *frameButton;
131 mtime_t timeA, timeB;
140 void AtoBLoop( float, int, int );
147 class VolumeClickHandler;
149 class QAbstractSlider;
152 class ControlsWidget : public QFrame
156 /* p_intf, advanced control visible or not, blingbling or not */
157 ControlsWidget( intf_thread_t *, MainInterface*, bool, bool );
158 virtual ~ControlsWidget();
160 QPushButton *playlistButton;
161 void setStatus( int );
162 void enableInput( bool );
163 void enableVideo( bool );
165 void setNavigation( int );
167 friend class MainInterface;
168 friend class VolumeClickHandler;
170 intf_thread_t *p_intf;
173 QGridLayout *controlLayout;
175 QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
176 QPushButton *playButton, *fullscreenButton;
177 QToolButton *slowerButton, *fasterButton;
178 AdvControlsWidget *advControls;
179 QLabel *volMuteLabel;
180 QAbstractSlider *volumeSlider;
182 bool b_advancedVisible;
188 void updateVolume( int );
189 void updateVolume( void );
195 void toggleAdvanced();
197 void advancedControlsToggled( bool );
200 class VolumeClickHandler : public QObject
203 VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
204 {m = _m; p_intf = _p_intf; }
205 virtual ~VolumeClickHandler() {};
206 bool eventFilter( QObject *obj, QEvent *e )
208 if (e->type() == QEvent::MouseButtonPress )
210 aout_VolumeMute( p_intf, NULL );
211 audio_volume_t i_volume;
212 aout_VolumeGet( p_intf, &i_volume );
213 m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
220 intf_thread_t *p_intf;
224 #include <QMouseEvent>
225 class TimeLabel : public QLabel
228 void mousePressEvent( QMouseEvent *event )
230 emit timeLabelClicked();
232 void mouseDoubleClickEvent( QMouseEvent *event )
234 emit timeLabelDoubleClicked();
237 void timeLabelClicked();
238 void timeLabelDoubleClicked();
242 /******************** Speed Control Widgets ****************/
243 class SpeedControlWidget : public QFrame
247 SpeedControlWidget( intf_thread_t *);
248 virtual ~SpeedControlWidget();
249 void updateControls( int );
251 virtual void mouseDoubleClickEvent( QMouseEvent * event );
253 intf_thread_t *p_intf;
254 QSlider *speedSlider;
256 void setEnable( bool );
258 void updateRate( int );