]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/interface_widgets.hpp
Qt: kill many warnings.
[vlc] / modules / gui / qt4 / components / interface_widgets.hpp
1 /*****************************************************************************
2  * interface_widgets.hpp : Custom widgets for the main interface
3  ****************************************************************************
4  * Copyright (C) 2006-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Clément Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *          Rafaël Carré <funman@videolanorg>
10  *
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.
15  *
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.
20  *
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  *****************************************************************************/
25
26 #ifndef _INTFWIDGETS_H_
27 #define _INTFWIDGETS_H_
28
29 #ifdef HAVE_CONFIG_H
30 # include "config.h"
31 #endif
32
33 #include "main_interface.hpp" /* Interface integration */
34 #include "input_manager.hpp"  /* Speed control */
35
36 #include "components/controller.hpp"
37 #include "components/controller_widget.hpp"
38
39 //#include <vlc_aout.h> Visualizer
40
41 #include <QWidget>
42 #include <QFrame>
43 #include <QLabel>
44 #include <QMouseEvent>
45
46 class ResizeEvent;
47 class QPalette;
48 class QPixmap;
49 class QHBoxLayout;
50 class QMenu;
51
52 /******************** Video Widget ****************/
53 class VideoWidget : public QFrame
54 {
55     Q_OBJECT
56 friend class MainInterface;
57
58 public:
59     VideoWidget( intf_thread_t * );
60     virtual ~VideoWidget();
61
62     void *request( vout_thread_t *, int *, int *,
63                    unsigned int *, unsigned int * );
64     void  release( void );
65     int   control( void *, int, va_list );
66
67     virtual QSize sizeHint() const;
68
69 protected:
70     virtual QPaintEngine *paintEngine() const
71     {
72         return NULL;
73     }
74
75     virtual void paintEvent(QPaintEvent *);
76
77 private:
78     intf_thread_t *p_intf;
79     vout_thread_t *p_vout;
80
81     QSize videoSize;
82
83 signals:
84     void askVideoWidgetToShow( unsigned int, unsigned int );
85
86 public slots:
87     void SetSizing( unsigned int, unsigned int );
88
89 };
90
91 /******************** Background Widget ****************/
92 class BackgroundWidget : public QWidget
93 {
94     Q_OBJECT
95 public:
96     BackgroundWidget( intf_thread_t * );
97     virtual ~BackgroundWidget();
98
99 private:
100     QPalette plt;
101     QLabel *label;
102     virtual void contextMenuEvent( QContextMenuEvent *event );
103     intf_thread_t *p_intf;
104     virtual void resizeEvent( QResizeEvent * event );
105
106 public slots:
107     void toggle(){ TOGGLEV( this ); }
108     void updateArt( QString );
109 };
110
111 #if 0
112 class VisualSelector : public QFrame
113 {
114     Q_OBJECT
115 public:
116     VisualSelector( intf_thread_t *);
117     virtual ~VisualSelector();
118 private:
119     intf_thread_t *p_intf;
120     QLabel *current;
121 private slots:
122     void prev();
123     void next();
124 };
125 #endif
126
127 class TimeLabel : public QLabel
128 {
129     Q_OBJECT
130 public:
131     TimeLabel( intf_thread_t *_p_intf );
132 protected:
133     virtual void mousePressEvent( QMouseEvent *event )
134     {
135         toggleTimeDisplay();
136         event->accept();
137     }
138     virtual void mouseDoubleClickEvent( QMouseEvent *event )
139     {
140         event->accept();
141         toggleTimeDisplay();
142         emit timeLabelDoubleClicked();
143     }
144 private:
145     intf_thread_t *p_intf;
146     bool b_remainingTime;
147     void toggleTimeDisplay();
148 signals:
149     void timeLabelDoubleClicked();
150 private slots:
151     void setDisplayPosition( float pos, int time, int length );
152     void setCaching( float );
153 };
154
155 class SpeedLabel : public QLabel
156 {
157     Q_OBJECT
158 public:
159     SpeedLabel( intf_thread_t *, const QString );
160
161 protected:
162     virtual void mouseDoubleClickEvent ( QMouseEvent * event )
163     {
164         event->accept();
165         THEMIM->getIM()->setRate( INPUT_RATE_DEFAULT );
166     }
167 private slots:
168     void showSpeedMenu( QPoint );
169     void setRate( int );
170 private:
171     intf_thread_t *p_intf;
172     QMenu *speedControlMenu;
173     SpeedControlWidget *speedControl;
174 };
175
176 /******************** Speed Control Widgets ****************/
177 class SpeedControlWidget : public QFrame
178 {
179     Q_OBJECT
180 public:
181     SpeedControlWidget( intf_thread_t *, QWidget * );
182     void updateControls( int );
183 private:
184     intf_thread_t *p_intf;
185     QSlider *speedSlider;
186
187 public slots:
188     void activateOnState();
189
190 private slots:
191     void updateRate( int );
192     void resetRate();
193 };
194
195 class CoverArtLabel : public QLabel
196 {
197     Q_OBJECT
198 public:
199     CoverArtLabel( QWidget *parent, intf_thread_t * );
200     virtual ~CoverArtLabel();
201
202 private:
203     intf_thread_t *p_intf;
204
205 public slots:
206     void requestUpdate() { emit updateRequested(); };
207     void update( )
208     {
209         requestUpdate();
210     }
211
212 private slots:
213     void doUpdate();
214     void doUpdate(QString);
215
216 signals:
217     void updateRequested();
218 };
219
220 #endif