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"
38 #include "dialogs_provider.hpp"
39 #include "components/info_panels.hpp"
44 #include <QMouseEvent>
52 /******************** Video Widget ****************/
53 class VideoWidget : public QFrame
57 VideoWidget( intf_thread_t * );
58 virtual ~VideoWidget();
60 WId request( int *, int *, unsigned int *, unsigned int *, bool );
62 int control( void *, int, va_list );
66 virtual QPaintEngine *paintEngine() const
72 intf_thread_t *p_intf;
77 void sizeChanged( int, int );
80 void SetSizing( unsigned int, unsigned int );
83 /******************** Background Widget ****************/
84 class BackgroundWidget : public QWidget
88 BackgroundWidget( intf_thread_t * );
89 void setExpandstoHeight( bool b_expand ) { b_expandPixmap = b_expand; }
90 void setWithArt( bool b_withart_ ) { b_withart = b_withart_; };
92 intf_thread_t *p_intf;
96 virtual void contextMenuEvent( QContextMenuEvent *event );
98 void paintEvent( QPaintEvent *e );
99 static const int MARGIN = 5;
101 void toggle(){ TOGGLEV( this ); }
102 void updateArt( const QString& );
106 class VisualSelector : public QFrame
110 VisualSelector( intf_thread_t *);
111 virtual ~VisualSelector();
113 intf_thread_t *p_intf;
121 class ClickableQLabel : public QLabel
125 virtual void mouseDoubleClickEvent( QMouseEvent *event )
128 emit doubleClicked();
131 void doubleClicked();
134 class TimeLabel : public ClickableQLabel
145 TimeLabel( intf_thread_t *_p_intf, TimeLabel::Display _displayType = TimeLabel::Both );
147 virtual void mousePressEvent( QMouseEvent *event )
149 if( displayType == TimeLabel::Elapsed ) return;
153 virtual void mouseDoubleClickEvent( QMouseEvent *event )
155 if( displayType != TimeLabel::Both ) return;
158 ClickableQLabel::mouseDoubleClickEvent( event );
161 intf_thread_t *p_intf;
162 bool b_remainingTime;
169 TimeLabel::Display displayType;
171 char psz_length[MSTRTIME_MAX_SIZE];
172 char psz_time[MSTRTIME_MAX_SIZE];
173 void toggleTimeDisplay();
174 void paintEvent( QPaintEvent* );
176 void setDisplayPosition( float pos, int64_t time, int length );
177 void setDisplayPosition( float pos );
178 void updateBuffering( float );
179 void updateBuffering();
182 class SpeedLabel : public QLabel
186 SpeedLabel( intf_thread_t *, QWidget * );
187 virtual ~SpeedLabel();
190 virtual void mousePressEvent ( QMouseEvent * event )
192 showSpeedMenu( event->pos() );
195 void showSpeedMenu( QPoint );
196 void setRate( float );
198 intf_thread_t *p_intf;
199 QMenu *speedControlMenu;
200 QString tooltipStringPattern;
201 SpeedControlWidget *speedControl;
204 /******************** Speed Control Widgets ****************/
205 class SpeedControlWidget : public QFrame
209 SpeedControlWidget( intf_thread_t *, QWidget * );
210 void updateControls( float );
212 intf_thread_t* p_intf;
213 QSlider* speedSlider;
214 QDoubleSpinBox* spinBox;
218 void activateOnState();
221 void updateRate( int );
222 void updateSpinBoxRate( double );
226 class CoverArtLabel : public QLabel
230 CoverArtLabel( QWidget *parent, intf_thread_t * );
231 virtual ~CoverArtLabel();
234 virtual void mouseDoubleClickEvent( QMouseEvent *event )
236 if( qobject_cast<MetaPanel *>(this->window()) == NULL )
238 THEDP->mediaInfoDialog();
243 intf_thread_t *p_intf;
246 void requestUpdate() { emit updateRequested(); }
251 void showArtUpdate( const QString& );
257 void updateRequested();