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"
39 #include "input_manager.hpp"
43 #define VOLUME_MAX 200
51 /******************** Video Widget ****************/
52 class VideoWidget : public QFrame
55 friend class MainInterface;
58 VideoWidget( intf_thread_t * );
59 virtual ~VideoWidget();
61 void *request( vout_thread_t *, int *, int *,
62 unsigned int *, unsigned int * );
63 void release( void * );
64 int control( void *, int, va_list );
66 virtual QSize sizeHint() const;
68 intf_thread_t *p_intf;
69 vout_thread_t *p_vout;
75 void askVideoWidgetToShow();
79 void SetSizing( unsigned int, unsigned int );
82 /******************** Background Widget ****************/
83 class BackgroundWidget : public QWidget
87 BackgroundWidget( intf_thread_t * );
88 virtual ~BackgroundWidget();
93 virtual void contextMenuEvent( QContextMenuEvent *event );
94 intf_thread_t *p_intf;
95 virtual void resizeEvent( QResizeEvent * event );
97 void toggle(){ TOGGLEV( this ); }
98 void update( QString );
101 class VisualSelector : public QFrame
105 VisualSelector( intf_thread_t *);
106 virtual ~VisualSelector();
108 intf_thread_t *p_intf;
115 /* Advanced Button Bar */
117 class AdvControlsWidget : public QFrame
121 AdvControlsWidget( intf_thread_t *);
122 virtual ~AdvControlsWidget();
124 void enableInput( bool );
125 void enableVideo( bool );
128 intf_thread_t *p_intf;
129 QPushButton *recordButton, *ABButton;
130 QPushButton *snapshotButton, *frameButton;
132 mtime_t timeA, timeB;
141 void AtoBLoop( float, int, int );
148 class VolumeClickHandler;
150 class QAbstractSlider;
153 class ControlsWidget : public QFrame
157 /* p_intf, advanced control visible or not, blingbling or not */
158 ControlsWidget( intf_thread_t *, MainInterface*, bool, bool );
159 virtual ~ControlsWidget();
161 QPushButton *playlistButton;
162 void setStatus( int );
163 void enableInput( bool );
164 void enableVideo( bool );
166 void setNavigation( int );
168 friend class MainInterface;
169 friend class VolumeClickHandler;
171 intf_thread_t *p_intf;
174 QGridLayout *controlLayout;
176 QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
177 QPushButton *playButton, *fullscreenButton;
178 QToolButton *slowerButton, *fasterButton;
179 AdvControlsWidget *advControls;
180 QLabel *volMuteLabel;
181 QAbstractSlider *volumeSlider;
183 bool b_advancedVisible;
189 void updateVolume( int );
190 void updateVolume( void );
196 void toggleAdvanced();
198 void advancedControlsToggled( bool );
201 class VolumeClickHandler : public QObject
204 VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
205 {m = _m; p_intf = _p_intf; }
206 virtual ~VolumeClickHandler() {};
207 bool eventFilter( QObject *obj, QEvent *e )
209 if (e->type() == QEvent::MouseButtonPress )
211 aout_VolumeMute( p_intf, NULL );
212 audio_volume_t i_volume;
213 aout_VolumeGet( p_intf, &i_volume );
214 m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
221 intf_thread_t *p_intf;
225 #include <QMouseEvent>
226 class TimeLabel : public QLabel
229 void mousePressEvent( QMouseEvent *event )
231 emit timeLabelClicked();
233 void mouseDoubleClickEvent( QMouseEvent *event )
235 emit timeLabelDoubleClicked();
238 void timeLabelClicked();
239 void timeLabelDoubleClicked();
242 class SpeedLabel : public QLabel
246 SpeedLabel( intf_thread_t *_p_intf, const QString text ): QLabel( text)
247 { p_intf = _p_intf; }
250 virtual void mouseDoubleClickEvent ( QMouseEvent * event )
252 THEMIM->getIM()->setRate( INPUT_RATE_DEFAULT );
255 intf_thread_t *p_intf;
258 /******************** Speed Control Widgets ****************/
259 class SpeedControlWidget : public QFrame
263 SpeedControlWidget( intf_thread_t *);
264 virtual ~SpeedControlWidget();
265 void updateControls( int );
267 intf_thread_t *p_intf;
268 QSlider *speedSlider;
270 void setEnable( bool );
272 void updateRate( int );