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;
73 /******************** Background Widget ****************/
74 class BackgroundWidget : public QFrame
78 BackgroundWidget( intf_thread_t * );
79 virtual ~BackgroundWidget();
81 virtual QSize sizeHint() const;
85 QHBoxLayout *backgroundLayout;
86 virtual void resizeEvent( QResizeEvent *e );
87 virtual void contextMenuEvent( QContextMenuEvent *event );
89 int CleanBackground();
90 intf_thread_t *p_intf;
92 void setArt( QString );
95 class VisualSelector : public QFrame
99 VisualSelector( intf_thread_t *);
100 virtual ~VisualSelector();
102 intf_thread_t *p_intf;
110 class AdvControlsWidget : public QFrame
114 AdvControlsWidget( intf_thread_t *);
115 virtual ~AdvControlsWidget();
116 void enableInput( bool );
117 void enableVideo( bool );
119 intf_thread_t *p_intf;
120 QPushButton *normalButton, *recordButton, *ABButton;
121 QPushButton *snapshotButton, *frameButton;
135 class VolumeClickHandler;
136 class ControlsWidget : public QFrame
140 ControlsWidget( intf_thread_t *, bool );
141 virtual ~ControlsWidget();
143 QPushButton *playlistButton;
144 QSlider *volumeSlider;
145 void setStatus( int );
146 void enableInput( bool );
147 void enableVideo( bool );
149 void setNavigation( int );
150 void updateOnTimer();
152 friend class MainInterface;
153 friend class VolumeClickHandler;
155 intf_thread_t *p_intf;
157 QGridLayout *controlLayout;
159 QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
160 QPushButton *playButton, *fullscreenButton;
161 QPushButton *slowerButton, *fasterButton;
162 AdvControlsWidget *advControls;
163 QLabel *volMuteLabel;
165 bool b_advancedVisible;
171 void updateVolume( int );
176 void toggleAdvanced();
178 void advancedControlsToggled( bool );
181 class VolumeClickHandler : public QObject
184 VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
185 {m = _m; p_intf = _p_intf; }
186 virtual ~VolumeClickHandler() {};
187 bool eventFilter( QObject *obj, QEvent *e )
189 if (e->type() == QEvent::MouseButtonPress )
191 aout_VolumeMute( p_intf, NULL );
192 audio_volume_t i_volume;
193 aout_VolumeGet( p_intf, &i_volume );
194 m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
201 intf_thread_t *p_intf;
205 #include <QMouseEvent>
206 class TimeLabel : public QLabel
209 void mousePressEvent( QMouseEvent *event )
211 if( event->button() == Qt::LeftButton ) emit timeLabelClicked();
213 void mouseDoubleClickEvent( QMouseEvent *event )
215 emit timeLabelDoubleClicked();
218 void timeLabelClicked();
219 void timeLabelDoubleClicked();
222 /******************** Playlist Widgets ****************/
223 #include <QModelIndex>
230 class PlaylistWidget : public QSplitter
234 PlaylistWidget( intf_thread_t *_p_i ) ;
235 virtual ~PlaylistWidget();
237 virtual QSize sizeHint() const;
239 PLSelector *selector;
241 QPushButton *addButton;
245 intf_thread_t *p_intf;
247 void setArt( QString );
249 void rootChanged( int );
250 void artSet( QString );
254 /******************** Speed Control Widgets ****************/
255 class SpeedControlWidget : public QFrame
259 SpeedControlWidget( intf_thread_t *);
260 virtual ~SpeedControlWidget();
261 void updateControls( int );
263 intf_thread_t *p_intf;
264 QSlider *speedSlider;
265 QPushButton *normalSpeedButton;
267 void updateRate( int );