]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/interface_widgets.hpp
Qt4 - Volume: if volume > 50% of the sliderBar, then show the highVolume Label.
[vlc] / modules / gui / qt4 / components / interface_widgets.hpp
1 /*****************************************************************************
2  * interface_widgets.hpp : Custom widgets for the main interface
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef _INTFWIDGETS_H_
26 #define _INTFWIDGETS_H_
27
28 #include <vlc/vlc.h>
29 #include <vlc_interface.h>
30
31 #include <vlc_aout.h>
32 #include "qt4.hpp"
33
34 #include <QWidget>
35 #include <QFrame>
36
37 class ResizeEvent;
38 class QPalette;
39 class QPixmap;
40 class QLabel;
41 class QHBoxLayout;
42
43 /******************** Video Widget ****************/
44 class VideoWidget : public QFrame
45 {
46     Q_OBJECT
47 public:
48     VideoWidget( intf_thread_t * );
49     virtual ~VideoWidget();
50
51     void *request( vout_thread_t *, int *, int *,
52                    unsigned int *, unsigned int * );
53     void release( void * );
54     int control( void *, int, va_list );
55
56     int i_video_height, i_video_width;
57     vout_thread_t *p_vout;
58
59     QSize widgetSize;
60     virtual QSize sizeHint() const;
61 private:
62     QWidget *frame;
63     intf_thread_t *p_intf;
64     vlc_mutex_t lock;
65 signals:
66     void askResize();
67 private slots:
68     void SetMinSize();
69 };
70
71 /******************** Background Widget ****************/
72 class BackgroundWidget : public QFrame
73 {
74     Q_OBJECT
75 public:
76     BackgroundWidget( intf_thread_t * );
77     virtual ~BackgroundWidget();
78     QSize widgetSize;
79     virtual QSize sizeHint() const;
80 private:
81     QPalette plt;
82     QLabel *label;
83     QHBoxLayout *backgroundLayout;
84     virtual void resizeEvent( QResizeEvent *e );
85     int DrawBackground();
86     int CleanBackground();
87     intf_thread_t *p_intf;
88 private slots:
89     void setArt( QString );
90 };
91
92 class VisualSelector : public QFrame
93 {
94     Q_OBJECT
95 public:
96     VisualSelector( intf_thread_t *);
97     virtual ~VisualSelector();
98 private:
99     intf_thread_t *p_intf;
100     QLabel *current;
101 private slots:
102     void prev();
103     void next();
104 };
105
106 class QPushButton;
107 class AdvControlsWidget : public QFrame
108 {
109     Q_OBJECT
110 public:
111     AdvControlsWidget( intf_thread_t *);
112     virtual ~AdvControlsWidget();
113     void enableInput( bool );
114     void enableVideo( bool );
115 private:
116     intf_thread_t *p_intf;
117     QPushButton *normalButton, *recordButton, *ABButton;
118     QPushButton *snapshotButton, *frameButton;
119 private slots:
120     void normal();
121     void snapshot();
122     void frame();
123     void fromAtoB();
124     void record();
125 };
126
127 class InputSlider;
128 class QSlider;
129 class QGridLayout;
130 class VolumeClickHandler;
131 class ControlsWidget : public QFrame
132 {
133     Q_OBJECT
134 public:
135     ControlsWidget( intf_thread_t *, bool );
136     virtual ~ControlsWidget();
137
138     QPushButton *playlistButton;
139     QSlider *volumeSlider;
140     void setStatus( int );
141     void enableInput( bool );
142     void enableVideo( bool );
143 public slots:
144     void setNavigation( int );
145     void updateOnTimer();
146 protected:
147     friend class MainInterface;
148     friend class VolumeClickHandler;
149 private:
150     intf_thread_t       *p_intf;
151     QFrame              *discFrame;
152     QGridLayout         *controlLayout;
153     InputSlider         *slider;
154     QPushButton         *prevSectionButton, *nextSectionButton, *menuButton;
155     QPushButton         *playButton, *fullscreenButton;
156     QPushButton         *slowerButton, *fasterButton;
157     AdvControlsWidget   *advControls;
158     QLabel              *volMuteLabel;
159
160     bool                 b_advancedVisible;
161 private slots:
162     void play();
163     void stop();
164     void prev();
165     void next();
166     void updateVolume( int );
167     void fullscreen();
168     void extSettings();
169     void prefs();
170     void faster();
171     void slower();
172     void toggleAdvanced();
173 signals:
174     void advancedControlsToggled( bool );
175 };
176
177 class VolumeClickHandler : public QObject
178 {
179 public:
180     VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
181     {m = _m; p_intf = _p_intf; }
182     virtual ~VolumeClickHandler() {};
183     bool eventFilter( QObject *obj, QEvent *e )
184     {
185         if (e->type() == QEvent::MouseButtonPress )
186         {
187             aout_VolumeMute( p_intf, NULL );
188             return true;
189         }
190         return false;
191     }
192 private:
193     ControlsWidget *m;
194     intf_thread_t *p_intf;
195 };
196
197
198 /******************** Playlist Widgets ****************/
199 #include <QModelIndex>
200 #include <QSplitter>
201 class QSignalMapper;
202 class PLSelector;
203 class PLPanel;
204 class QPushButton;
205
206 class PlaylistWidget : public QSplitter
207 {
208     Q_OBJECT;
209 public:
210     PlaylistWidget( intf_thread_t *_p_i ) ;
211     virtual ~PlaylistWidget();
212     QSize widgetSize;
213     virtual QSize sizeHint() const;
214 private:
215     PLSelector *selector;
216     PLPanel *rightPanel;
217     QPushButton *addButton;
218     QLabel *art;
219     QString prevArt;
220 protected:
221      intf_thread_t *p_intf;
222 private slots:
223     void setArt( QString );
224 signals:
225     void rootChanged( int );
226     void artSet( QString );
227 };
228
229 #endif