1 /*****************************************************************************
2 * interface_widgets.hpp : Custom widgets for the main interface
3 ****************************************************************************
4 * Copyright (C) 2006-2008 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_
33 #include "main_interface.hpp" /* Interface integration */
34 #include "input_manager.hpp" /* Speed control */
36 #include "components/controller.hpp"
37 #include "components/controller_widget.hpp"
42 #include <QMouseEvent>
49 class ReparentableWidget;
51 /******************** Video Widget ****************/
52 class VideoWidget : public QFrame
55 friend class ReparentableWidget;
58 VideoWidget( intf_thread_t * );
59 virtual ~VideoWidget();
61 WId request( int *, int *,
62 unsigned int *, unsigned int *, bool );
64 int control( void *, int, va_list );
66 virtual QSize sizeHint() const;
69 virtual QPaintEngine *paintEngine() const
75 intf_thread_t *p_intf;
78 QWidget *reparentable;
82 void keyPressed( QKeyEvent * );
85 void SetSizing( unsigned int, unsigned int );
86 void SetFullScreen( bool );
89 /******************** Background Widget ****************/
90 class BackgroundWidget : public QWidget
94 BackgroundWidget( intf_thread_t * );
98 virtual void contextMenuEvent( QContextMenuEvent *event );
99 intf_thread_t *p_intf;
100 virtual void resizeEvent( QResizeEvent * event );
103 void toggle(){ TOGGLEV( this ); }
104 void updateArt( const QString& );
108 class VisualSelector : public QFrame
112 VisualSelector( intf_thread_t *);
113 virtual ~VisualSelector();
115 intf_thread_t *p_intf;
123 class TimeLabel : public QLabel
127 TimeLabel( intf_thread_t *_p_intf );
129 virtual void mousePressEvent( QMouseEvent *event )
134 virtual void mouseDoubleClickEvent( QMouseEvent *event )
138 emit timeLabelDoubleClicked();
141 intf_thread_t *p_intf;
142 bool b_remainingTime;
148 char psz_length[MSTRTIME_MAX_SIZE];
149 char psz_time[MSTRTIME_MAX_SIZE];
150 void toggleTimeDisplay();
151 void paintEvent( QPaintEvent* );
153 void timeLabelDoubleClicked();
155 void setDisplayPosition( float pos, int64_t time, int length );
156 void setDisplayPosition( float pos );
157 void updateBuffering( float );
158 void updateBuffering();
161 class SpeedLabel : public QLabel
165 SpeedLabel( intf_thread_t *, QWidget * );
166 virtual ~SpeedLabel();
169 virtual void mousePressEvent ( QMouseEvent * event )
171 showSpeedMenu( event->pos() );
174 void showSpeedMenu( QPoint );
175 void setRate( float );
177 intf_thread_t *p_intf;
178 QMenu *speedControlMenu;
179 SpeedControlWidget *speedControl;
182 /******************** Speed Control Widgets ****************/
183 class SpeedControlWidget : public QFrame
187 SpeedControlWidget( intf_thread_t *, QWidget * );
188 void updateControls( float );
190 intf_thread_t *p_intf;
191 QSlider *speedSlider;
194 void activateOnState();
197 void updateRate( int );
201 class CoverArtLabel : public QLabel
205 CoverArtLabel( QWidget *parent, intf_thread_t * );
206 virtual ~CoverArtLabel();
209 intf_thread_t *p_intf;
212 void requestUpdate() { emit updateRequested(); }
217 void showArtUpdate( const QString& );
223 void updateRequested();