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 virtual QSize sizeHint() const;
65 intf_thread_t *p_intf;
69 void askVideoToShow();
74 /******************** Background Widget ****************/
75 class BackgroundWidget : public QFrame
79 BackgroundWidget( intf_thread_t * );
80 virtual ~BackgroundWidget();
82 virtual QSize sizeHint() const;
86 QHBoxLayout *backgroundLayout;
87 virtual void resizeEvent( QResizeEvent *e );
88 virtual void contextMenuEvent( QContextMenuEvent *event );
90 int CleanBackground();
91 intf_thread_t *p_intf;
93 void setArt( QString );
94 void toggle(){ TOGGLEV( this ); }
97 class VisualSelector : public QFrame
101 VisualSelector( intf_thread_t *);
102 virtual ~VisualSelector();
104 intf_thread_t *p_intf;
111 /* Advanced Button Bar */
113 class AdvControlsWidget : public QFrame
117 AdvControlsWidget( intf_thread_t *);
118 virtual ~AdvControlsWidget();
120 void enableInput( bool );
121 void enableVideo( bool );
124 intf_thread_t *p_intf;
125 QPushButton *recordButton, *ABButton;
126 QPushButton *snapshotButton, *frameButton;
139 class VolumeClickHandler;
140 class ControlsWidget : public QFrame
144 ControlsWidget( intf_thread_t *, bool );
145 virtual ~ControlsWidget();
147 QPushButton *playlistButton;
148 QSlider *volumeSlider;
149 void setStatus( int );
150 void enableInput( bool );
151 void enableVideo( bool );
153 void setNavigation( int );
154 void updateOnTimer();
156 friend class MainInterface;
157 friend class VolumeClickHandler;
159 intf_thread_t *p_intf;
161 QGridLayout *controlLayout;
163 QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
164 QPushButton *playButton, *fullscreenButton;
165 QPushButton *slowerButton, *fasterButton;
166 AdvControlsWidget *advControls;
167 QLabel *volMuteLabel;
169 bool b_advancedVisible;
175 void updateVolume( int );
180 void toggleAdvanced();
182 void advancedControlsToggled( bool );
185 class VolumeClickHandler : public QObject
188 VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
189 {m = _m; p_intf = _p_intf; }
190 virtual ~VolumeClickHandler() {};
191 bool eventFilter( QObject *obj, QEvent *e )
193 if (e->type() == QEvent::MouseButtonPress )
195 aout_VolumeMute( p_intf, NULL );
196 audio_volume_t i_volume;
197 aout_VolumeGet( p_intf, &i_volume );
198 m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
205 intf_thread_t *p_intf;
209 #include <QMouseEvent>
210 class TimeLabel : public QLabel
213 void mousePressEvent( QMouseEvent *event )
215 if( event->button() == Qt::LeftButton ) emit timeLabelClicked();
217 void mouseDoubleClickEvent( QMouseEvent *event )
219 emit timeLabelDoubleClicked();
222 void timeLabelClicked();
223 void timeLabelDoubleClicked();
226 /******************** Playlist Widgets ****************/
227 #include <QModelIndex>
234 class PlaylistWidget : public QSplitter
238 PlaylistWidget( intf_thread_t *_p_i ) ;
239 virtual ~PlaylistWidget();
240 virtual QSize sizeHint() const;
242 PLSelector *selector;
244 QPushButton *addButton;
248 intf_thread_t *p_intf;
250 void setArt( QString );
252 void rootChanged( int );
253 void artSet( QString );
257 /******************** Speed Control Widgets ****************/
258 class SpeedControlWidget : public QFrame
262 SpeedControlWidget( intf_thread_t *);
263 virtual ~SpeedControlWidget();
264 void updateControls( int );
266 intf_thread_t *p_intf;
267 QSlider *speedSlider;
268 QPushButton *normalSpeedButton;
270 void updateRate( int );