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>
50 /******************** Video Widget ****************/
51 class VideoWidget : public QFrame
55 VideoWidget( intf_thread_t * );
56 virtual ~VideoWidget();
58 WId request( int *, int *, unsigned int *, unsigned int *, bool );
60 int control( void *, int, va_list );
64 virtual QPaintEngine *paintEngine() const
70 intf_thread_t *p_intf;
75 void sizeChanged( int, int );
78 void SetSizing( unsigned int, unsigned int );
81 /******************** Background Widget ****************/
82 class BackgroundWidget : public QWidget
86 BackgroundWidget( intf_thread_t * );
87 void setExpandstoHeight( bool b_expand ) { b_expandPixmap = b_expand; }
91 virtual void contextMenuEvent( QContextMenuEvent *event );
92 intf_thread_t *p_intf;
94 void paintEvent( QPaintEvent *e );
95 static const int MARGIN = 5;
97 void toggle(){ TOGGLEV( this ); }
98 void updateArt( const QString& );
102 class VisualSelector : public QFrame
106 VisualSelector( intf_thread_t *);
107 virtual ~VisualSelector();
109 intf_thread_t *p_intf;
117 class TimeLabel : public QLabel
121 TimeLabel( intf_thread_t *_p_intf );
123 virtual void mousePressEvent( QMouseEvent *event )
128 virtual void mouseDoubleClickEvent( QMouseEvent *event )
132 emit timeLabelDoubleClicked();
135 intf_thread_t *p_intf;
136 bool b_remainingTime;
142 char psz_length[MSTRTIME_MAX_SIZE];
143 char psz_time[MSTRTIME_MAX_SIZE];
144 void toggleTimeDisplay();
145 void paintEvent( QPaintEvent* );
147 void timeLabelDoubleClicked();
149 void setDisplayPosition( float pos, int64_t time, int length );
150 void setDisplayPosition( float pos );
151 void updateBuffering( float );
152 void updateBuffering();
155 class SpeedLabel : public QLabel
159 SpeedLabel( intf_thread_t *, QWidget * );
160 virtual ~SpeedLabel();
163 virtual void mousePressEvent ( QMouseEvent * event )
165 showSpeedMenu( event->pos() );
168 void showSpeedMenu( QPoint );
169 void setRate( float );
171 intf_thread_t *p_intf;
172 QMenu *speedControlMenu;
173 QString tooltipStringPattern;
174 SpeedControlWidget *speedControl;
177 /******************** Speed Control Widgets ****************/
178 class SpeedControlWidget : public QFrame
182 SpeedControlWidget( intf_thread_t *, QWidget * );
183 void updateControls( float );
185 intf_thread_t *p_intf;
186 QSlider *speedSlider;
190 void activateOnState();
193 void updateRate( int );
197 class CoverArtLabel : public QLabel
201 CoverArtLabel( QWidget *parent, intf_thread_t * );
202 virtual ~CoverArtLabel();
205 intf_thread_t *p_intf;
208 void requestUpdate() { emit updateRequested(); }
213 void showArtUpdate( const QString& );
219 void updateRequested();