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 TimeLabel : public QLabel
125 TimeLabel( intf_thread_t *_p_intf );
127 virtual void mousePressEvent( QMouseEvent *event )
132 virtual void mouseDoubleClickEvent( QMouseEvent *event )
136 emit timeLabelDoubleClicked();
139 intf_thread_t *p_intf;
140 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 QString tooltipStringPattern;
180 SpeedControlWidget *speedControl;
183 /******************** Speed Control Widgets ****************/
184 class SpeedControlWidget : public QFrame
188 SpeedControlWidget( intf_thread_t *, QWidget * );
189 void updateControls( float );
191 intf_thread_t *p_intf;
192 QSlider *speedSlider;
196 void activateOnState();
199 void updateRate( int );
203 class CoverArtLabel : public QLabel
207 CoverArtLabel( QWidget *parent, intf_thread_t * );
208 virtual ~CoverArtLabel();
211 virtual void mouseDoubleClickEvent( QMouseEvent *event )
213 if( qobject_cast<MetaPanel *>(this->window()) == NULL )
215 THEDP->mediaInfoDialog();
220 intf_thread_t *p_intf;
223 void requestUpdate() { emit updateRequested(); }
228 void showArtUpdate( const QString& );
234 void updateRequested();