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 );
58 int i_video_height, i_video_width;
59 vout_thread_t *p_vout;
62 QSize sizeHint() const;
65 intf_thread_t *p_intf;
69 void askVideoWidgetToShow();
71 void SetSizing( unsigned int, unsigned int );
74 /******************** Background Widget ****************/
75 class BackgroundWidget : public QFrame
79 BackgroundWidget( intf_thread_t * );
80 virtual ~BackgroundWidget();
82 QSize sizeHint() const;
87 virtual void resizeEvent( QResizeEvent *e );
88 virtual void contextMenuEvent( QContextMenuEvent *event );
89 intf_thread_t *p_intf;
92 void toggle(){ TOGGLEV( this ); }
93 void update( input_thread_t * );
96 class VisualSelector : public QFrame
100 VisualSelector( intf_thread_t *);
101 virtual ~VisualSelector();
103 intf_thread_t *p_intf;
110 /* Advanced Button Bar */
112 class AdvControlsWidget : public QFrame
116 AdvControlsWidget( intf_thread_t *);
117 virtual ~AdvControlsWidget();
119 void enableInput( bool );
120 void enableVideo( bool );
123 intf_thread_t *p_intf;
124 QPushButton *recordButton, *ABButton;
125 QPushButton *snapshotButton, *frameButton;
127 mtime_t timeA, timeB;
134 void AtoBLoop( float, int, int );
141 class VolumeClickHandler;
143 class QAbstractSlider;
145 class ControlsWidget : public QFrame
149 /* p_intf, advanced control visible or not, blingbling or not */
150 ControlsWidget( intf_thread_t *, MainInterface*, bool, bool );
151 // QSize sizeHint() const;
152 virtual ~ControlsWidget();
154 QPushButton *playlistButton;
155 void setStatus( int );
156 void enableInput( bool );
157 void enableVideo( bool );
159 void setNavigation( int );
160 void updateOnTimer();
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 QPushButton *slowerButton, *fasterButton;
173 AdvControlsWidget *advControls;
174 QLabel *volMuteLabel;
175 QAbstractSlider *volumeSlider;
177 bool b_advancedVisible;
183 void updateVolume( int );
188 void toggleAdvanced();
190 void advancedControlsToggled( bool );
193 class VolumeClickHandler : public QObject
196 VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
197 {m = _m; p_intf = _p_intf; }
198 virtual ~VolumeClickHandler() {};
199 bool eventFilter( QObject *obj, QEvent *e )
201 if (e->type() == QEvent::MouseButtonPress )
203 aout_VolumeMute( p_intf, NULL );
204 audio_volume_t i_volume;
205 aout_VolumeGet( p_intf, &i_volume );
206 m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
213 intf_thread_t *p_intf;
217 #include <QMouseEvent>
218 class TimeLabel : public QLabel
221 void mousePressEvent( QMouseEvent *event )
223 emit timeLabelClicked();
225 void mouseDoubleClickEvent( QMouseEvent *event )
227 emit timeLabelDoubleClicked();
230 void timeLabelClicked();
231 void timeLabelDoubleClicked();
235 /******************** Speed Control Widgets ****************/
236 class SpeedControlWidget : public QFrame
240 SpeedControlWidget( intf_thread_t *);
241 virtual ~SpeedControlWidget();
242 void updateControls( int );
244 intf_thread_t *p_intf;
245 QSlider *speedSlider;
247 void updateRate( int );