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>
48 class ReparentableWidget;
50 /******************** Video Widget ****************/
51 class VideoWidget : public QFrame
54 friend class ReparentableWidget;
57 VideoWidget( intf_thread_t * );
58 virtual ~VideoWidget();
60 WId request( int *, int *,
61 unsigned int *, unsigned int *, bool );
63 int control( void *, int, va_list );
65 virtual QSize sizeHint() const;
68 virtual QPaintEngine *paintEngine() const
74 intf_thread_t *p_intf;
77 QWidget *reparentable;
81 void keyPressed( QKeyEvent * );
84 void SetSizing( unsigned int, unsigned int );
85 void SetFullScreen( bool );
88 /******************** Background Widget ****************/
89 class BackgroundWidget : public QWidget
93 BackgroundWidget( intf_thread_t * );
97 virtual void contextMenuEvent( QContextMenuEvent *event );
98 intf_thread_t *p_intf;
99 virtual void resizeEvent( QResizeEvent * event );
102 void toggle(){ TOGGLEV( this ); }
103 void updateArt( const QString& );
107 class VisualSelector : public QFrame
111 VisualSelector( intf_thread_t *);
112 virtual ~VisualSelector();
114 intf_thread_t *p_intf;
122 class TimeLabel : public QLabel
126 TimeLabel( intf_thread_t *_p_intf );
128 virtual void mousePressEvent( QMouseEvent *event )
133 virtual void mouseDoubleClickEvent( QMouseEvent *event )
137 emit timeLabelDoubleClicked();
140 intf_thread_t *p_intf;
141 bool b_remainingTime;
147 char psz_length[MSTRTIME_MAX_SIZE];
148 char psz_time[MSTRTIME_MAX_SIZE];
149 void toggleTimeDisplay();
150 void paintEvent( QPaintEvent* );
152 void timeLabelDoubleClicked();
154 void setDisplayPosition( float pos, int64_t time, int length );
155 void setDisplayPosition( float pos );
156 void updateBuffering( float );
157 void updateBuffering();
160 class SpeedLabel : public QLabel
164 SpeedLabel( intf_thread_t *, QWidget * );
165 virtual ~SpeedLabel();
168 virtual void mousePressEvent ( QMouseEvent * event )
170 showSpeedMenu( event->pos() );
173 void showSpeedMenu( QPoint );
174 void setRate( float );
176 intf_thread_t *p_intf;
177 QMenu *speedControlMenu;
178 SpeedControlWidget *speedControl;
181 /******************** Speed Control Widgets ****************/
182 class SpeedControlWidget : public QFrame
186 SpeedControlWidget( intf_thread_t *, QWidget * );
187 void updateControls( float );
189 intf_thread_t *p_intf;
190 QSlider *speedSlider;
193 void activateOnState();
196 void updateRate( int );
200 class CoverArtLabel : public QLabel
204 CoverArtLabel( QWidget *parent, intf_thread_t * );
205 virtual ~CoverArtLabel();
208 intf_thread_t *p_intf;
211 void requestUpdate() { emit updateRequested(); }
216 void showArtUpdate( const QString& );
222 void updateRequested();