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 *, unsigned int *, unsigned int *, bool );
63 int control( void *, int, va_list );
66 virtual QPaintEngine *paintEngine() const
72 intf_thread_t *p_intf;
74 QWidget *reparentable;
78 void keyPressed( QKeyEvent * );
79 void sizeChanged( int, int );
82 void SetSizing( unsigned int, unsigned int );
83 void SetFullScreen( bool );
86 /******************** Background Widget ****************/
87 class BackgroundWidget : public QWidget
91 BackgroundWidget( intf_thread_t * );
95 virtual void contextMenuEvent( QContextMenuEvent *event );
96 intf_thread_t *p_intf;
97 virtual void resizeEvent( QResizeEvent * event );
100 void toggle(){ TOGGLEV( this ); }
101 void updateArt( const QString& );
105 class VisualSelector : public QFrame
109 VisualSelector( intf_thread_t *);
110 virtual ~VisualSelector();
112 intf_thread_t *p_intf;
120 class TimeLabel : public QLabel
124 TimeLabel( intf_thread_t *_p_intf );
126 virtual void mousePressEvent( QMouseEvent *event )
131 virtual void mouseDoubleClickEvent( QMouseEvent *event )
135 emit timeLabelDoubleClicked();
138 intf_thread_t *p_intf;
139 bool b_remainingTime;
145 char psz_length[MSTRTIME_MAX_SIZE];
146 char psz_time[MSTRTIME_MAX_SIZE];
147 void toggleTimeDisplay();
148 void paintEvent( QPaintEvent* );
150 void timeLabelDoubleClicked();
152 void setDisplayPosition( float pos, int64_t time, int length );
153 void setDisplayPosition( float pos );
154 void updateBuffering( float );
155 void updateBuffering();
158 class SpeedLabel : public QLabel
162 SpeedLabel( intf_thread_t *, QWidget * );
163 virtual ~SpeedLabel();
166 virtual void mousePressEvent ( QMouseEvent * event )
168 showSpeedMenu( event->pos() );
171 void showSpeedMenu( QPoint );
172 void setRate( float );
174 intf_thread_t *p_intf;
175 QMenu *speedControlMenu;
176 SpeedControlWidget *speedControl;
179 /******************** Speed Control Widgets ****************/
180 class SpeedControlWidget : public QFrame
184 SpeedControlWidget( intf_thread_t *, QWidget * );
185 void updateControls( float );
187 intf_thread_t *p_intf;
188 QSlider *speedSlider;
191 void activateOnState();
194 void updateRate( int );
198 class CoverArtLabel : public QLabel
202 CoverArtLabel( QWidget *parent, intf_thread_t * );
203 virtual ~CoverArtLabel();
206 intf_thread_t *p_intf;
209 void requestUpdate() { emit updateRequested(); }
214 void showArtUpdate( const QString& );
220 void updateRequested();