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_
30 #include <vlc_interface.h>
37 #define VOLUME_MAX 200
45 /******************** Video Widget ****************/
46 class VideoWidget : public QFrame
50 VideoWidget( intf_thread_t * );
51 virtual ~VideoWidget();
53 void *request( vout_thread_t *, int *, int *,
54 unsigned int *, unsigned int * );
55 void release( void * );
56 int control( void *, int, va_list );
59 intf_thread_t *p_intf;
60 vout_thread_t *p_vout;
65 void askVideoWidgetToShow();
69 void SetSizing( unsigned int, unsigned int );
72 /******************** Background Widget ****************/
73 class BackgroundWidget : public QFrame
77 BackgroundWidget( intf_thread_t * );
78 virtual ~BackgroundWidget();
80 QSize sizeHint() const;
85 virtual void resizeEvent( QResizeEvent *e );
86 virtual void contextMenuEvent( QContextMenuEvent *event );
87 intf_thread_t *p_intf;
90 void toggle(){ TOGGLEV( this ); }
91 void update( input_thread_t * );
94 class VisualSelector : public QFrame
98 VisualSelector( intf_thread_t *);
99 virtual ~VisualSelector();
101 intf_thread_t *p_intf;
108 /* Advanced Button Bar */
110 class AdvControlsWidget : public QFrame
114 AdvControlsWidget( intf_thread_t *);
115 virtual ~AdvControlsWidget();
117 void enableInput( bool );
118 void enableVideo( bool );
121 intf_thread_t *p_intf;
122 QPushButton *recordButton, *ABButton;
123 QPushButton *snapshotButton, *frameButton;
125 mtime_t timeA, timeB;
132 void AtoBLoop( float, int, int );
139 class VolumeClickHandler;
141 class QAbstractSlider;
144 class ControlsWidget : public QFrame
148 /* p_intf, advanced control visible or not, blingbling or not */
149 ControlsWidget( intf_thread_t *, MainInterface*, bool, bool );
150 virtual ~ControlsWidget();
152 QPushButton *playlistButton;
153 void setStatus( int );
154 void enableInput( bool );
155 void enableVideo( bool );
157 void setNavigation( int );
158 void updateOnTimer();
160 friend class MainInterface;
161 friend class VolumeClickHandler;
163 intf_thread_t *p_intf;
166 QGridLayout *controlLayout;
168 QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
169 QPushButton *playButton, *fullscreenButton;
170 QToolButton *slowerButton, *fasterButton;
171 AdvControlsWidget *advControls;
172 QLabel *volMuteLabel;
173 QAbstractSlider *volumeSlider;
175 bool b_advancedVisible;
181 void updateVolume( int );
186 void toggleAdvanced();
188 void advancedControlsToggled( bool );
191 class VolumeClickHandler : public QObject
194 VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
195 {m = _m; p_intf = _p_intf; }
196 virtual ~VolumeClickHandler() {};
197 bool eventFilter( QObject *obj, QEvent *e )
199 if (e->type() == QEvent::MouseButtonPress )
201 aout_VolumeMute( p_intf, NULL );
202 audio_volume_t i_volume;
203 aout_VolumeGet( p_intf, &i_volume );
204 m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
211 intf_thread_t *p_intf;
215 #include <QMouseEvent>
216 class TimeLabel : public QLabel
219 void mousePressEvent( QMouseEvent *event )
221 emit timeLabelClicked();
223 void mouseDoubleClickEvent( QMouseEvent *event )
225 emit timeLabelDoubleClicked();
228 void timeLabelClicked();
229 void timeLabelDoubleClicked();
233 /******************** Speed Control Widgets ****************/
234 class SpeedControlWidget : public QFrame
238 SpeedControlWidget( intf_thread_t *);
239 virtual ~SpeedControlWidget();
240 void updateControls( int );
242 intf_thread_t *p_intf;
243 QSlider *speedSlider;
245 void updateRate( int );