1 /*****************************************************************************
2 * interface_widgets.hpp : Custom widgets for the main interface
3 ****************************************************************************
4 * Copyright (C) 2006 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 <vlc_common.h>
34 #include <vlc_interface.h>
35 //#include <vlc_aout.h> Visualizer
38 #include "main_interface.hpp"
39 #include "input_manager.hpp"
40 #include "components/controller.hpp"
41 #include "components/controller_widget.hpp"
46 #include <QMouseEvent>
53 /******************** Video Widget ****************/
54 class VideoWidget : public QFrame
57 friend class MainInterface;
60 VideoWidget( intf_thread_t * );
61 virtual ~VideoWidget();
63 void *request( vout_thread_t *, int *, int *,
64 unsigned int *, unsigned int * );
66 int control( void *, int, va_list );
68 virtual QSize sizeHint() const;
71 virtual QPaintEngine *paintEngine() const
76 virtual void paintEvent(QPaintEvent *);
79 intf_thread_t *p_intf;
80 vout_thread_t *p_vout;
85 void askVideoWidgetToShow( unsigned int, unsigned int );
88 void SetSizing( unsigned int, unsigned int );
92 /******************** Background Widget ****************/
93 class BackgroundWidget : public QWidget
97 BackgroundWidget( intf_thread_t * );
98 virtual ~BackgroundWidget();
103 virtual void contextMenuEvent( QContextMenuEvent *event );
104 intf_thread_t *p_intf;
105 virtual void resizeEvent( QResizeEvent * event );
108 void toggle(){ TOGGLEV( this ); }
109 void updateArt( input_item_t* );
113 class VisualSelector : public QFrame
117 VisualSelector( intf_thread_t *);
118 virtual ~VisualSelector();
120 intf_thread_t *p_intf;
128 class TimeLabel : public QLabel
132 TimeLabel( intf_thread_t *_p_intf );
134 virtual void mousePressEvent( QMouseEvent *event )
138 virtual void mouseDoubleClickEvent( QMouseEvent *event )
141 emit timeLabelDoubleClicked();
144 intf_thread_t *p_intf;
145 bool b_remainingTime;
146 void toggleTimeDisplay();
148 void timeLabelDoubleClicked();
150 void setDisplayPosition( float pos, int time, int length );
151 void setStatus( int i_status );
154 class SpeedLabel : public QLabel
158 SpeedLabel( intf_thread_t *_p_intf, const QString text ): QLabel( text)
159 { p_intf = _p_intf; }
162 virtual void mouseDoubleClickEvent ( QMouseEvent * event )
164 THEMIM->getIM()->setRate( INPUT_RATE_DEFAULT );
167 intf_thread_t *p_intf;
170 /******************** Speed Control Widgets ****************/
171 class SpeedControlWidget : public QFrame
175 SpeedControlWidget( intf_thread_t *);
176 virtual ~SpeedControlWidget();
177 void updateControls( int );
179 intf_thread_t *p_intf;
180 QSlider *speedSlider;
182 void setEnable( bool );
184 void updateRate( int );
188 class CoverArtLabel : public QLabel
192 CoverArtLabel( QWidget *parent,
193 vlc_object_t *p_this,
194 input_item_t *p_input = NULL );
195 virtual ~CoverArtLabel()
196 { if( p_input ) vlc_gc_decref( p_input ); };
198 input_item_t *p_input;
199 vlc_object_t *p_this;
203 void requestUpdate() { emit updateRequested(); };
204 void update( input_item_t* p_item )
205 { if( p_input ) vlc_gc_decref( p_input );
206 if( ( p_input = p_item ) ) vlc_gc_incref( p_input );
211 void downloadCover();
214 void updateRequested();