]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/extended_panels.hpp
770f5582e57b0f332bdbd9fca0da61be98586403
[vlc] / modules / gui / qt4 / components / extended_panels.hpp
1 /*****************************************************************************
2  * extended_panels.hpp : Exentended Panels
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Antoine Cellerier <dionoea at videolan dot 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 _EQUALIZER_H_
26 #define _EQUALIZER_H_
27
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31
32 #include <vlc_common.h>
33
34 #include "ui/equalizer.h"
35 #include "ui/video_effects.h"
36
37 #include <QTabWidget>
38
39 #define BANDS 10
40
41 class QSignalMapper;
42
43 class ExtVideo: public QObject
44 {
45     Q_OBJECT
46     friend class ExtendedDialog;
47 public:
48     ExtVideo( struct intf_thread_t *, QTabWidget * );
49 private:
50     Ui::ExtVideoWidget ui;
51     QSignalMapper* filterMapper;
52     intf_thread_t *p_intf;
53     void initComboBoxItems( QObject* );
54     void setWidgetValue( QObject* );
55     void clean();
56 private slots:
57     void updateFilters();
58     void updateFilterOptions();
59     void cropChange();
60     void browseLogo();
61     void browseEraseFile();
62 };
63
64 class ExtV4l2 : public QWidget
65 {
66     Q_OBJECT
67 public:
68     ExtV4l2( intf_thread_t *, QWidget * );
69
70     virtual void showEvent( QShowEvent *event );
71
72 private:
73     intf_thread_t *p_intf;
74     QGroupBox *box;
75     QLabel *help;
76
77 private slots:
78     void Refresh( void );
79     void ValueChange( int value );
80     void ValueChange( bool value );
81 };
82
83 class FilterSliderData : public QObject
84 {
85     Q_OBJECT
86
87 public:
88     typedef struct
89     {
90         QString name;
91         QString descs;
92         QString units;
93         float f_min;      // min
94         float f_max;      // max
95         float f_value;    // value
96         float f_resolution; // resolution
97         float f_visual_multiplier; // only for display (f_value *)
98     } slider_data_t;
99     FilterSliderData( QObject *parent, intf_thread_t *p_intf,
100                       QSlider *slider,
101                       QLabel *valueLabel, QLabel *nameLabel,
102                       const slider_data_t *p_data );
103     void setValue( float f );
104
105 protected:
106     FilterSliderData( QObject *parent, QSlider *slider );
107     virtual float initialValue();
108     QSlider *slider;
109     QLabel *valueLabel;
110     QLabel *nameLabel;
111     const slider_data_t *p_data;
112     intf_thread_t *p_intf;
113     bool b_save_to_config;
114
115 public slots:
116     virtual void onValueChanged( int i ) const;
117     virtual void updateText( int i );
118     virtual void writeToConfig() const;
119     void setSaveToConfig( bool );
120 };
121
122 class AudioFilterControlWidget : public QWidget
123 {
124     Q_OBJECT
125
126 public:
127     AudioFilterControlWidget( intf_thread_t *, QWidget *, const char *name );
128     virtual ~AudioFilterControlWidget();
129
130 protected:
131     virtual void build();
132     QVector<FilterSliderData::slider_data_t> controls;
133     QVector<FilterSliderData *> sliderDatas;
134     QGroupBox *slidersBox;
135     intf_thread_t *p_intf;
136     QString name; // filter's module name
137     int i_smallfont;
138
139 protected slots:
140     void enable( bool ) const;
141     virtual void setSaveToConfig( bool );
142 };
143
144 class EqualizerSliderData : public FilterSliderData
145 {
146     Q_OBJECT
147
148 public:
149     EqualizerSliderData( QObject *parent, intf_thread_t *p_intf,
150                          QSlider *slider,
151                          QLabel *valueLabel, QLabel *nameLabel,
152                          const slider_data_t *p_data, int index );
153
154 protected:
155     virtual float initialValue();
156     int index;
157     QStringList getBandsFromAout() const;
158
159 public slots:
160     virtual void onValueChanged( int i ) const;
161     virtual void writeToConfig() const;
162 };
163
164 class Equalizer: public AudioFilterControlWidget
165 {
166     Q_OBJECT
167
168 public:
169     Equalizer( intf_thread_t *, QWidget * );
170
171 protected:
172     virtual void build();
173
174 protected slots:
175     virtual void setSaveToConfig( bool );
176
177 private:
178     FilterSliderData *preamp;
179     FilterSliderData::slider_data_t preamp_values;
180
181 private slots:
182     void setCorePreset( int );
183     void enable2Pass( bool ) const;
184 };
185
186 class Compressor: public AudioFilterControlWidget
187 {
188     Q_OBJECT
189
190 public:
191     Compressor( intf_thread_t *, QWidget * );
192 };
193
194 class Spatializer: public AudioFilterControlWidget
195 {
196     Q_OBJECT
197
198 public:
199     Spatializer( intf_thread_t *, QWidget * );
200 };
201
202 class SyncWidget : public QWidget
203 {
204     Q_OBJECT
205 public:
206     SyncWidget( QWidget * );
207     void setValue( double d );
208 signals:
209     void valueChanged( double );
210 private slots:
211     void valueChangedHandler( double d );
212 private:
213     QDoubleSpinBox spinBox;
214     QLabel spinLabel;
215 };
216
217 class SyncControls : public QWidget
218 {
219     Q_OBJECT
220     friend class ExtendedDialog;
221 public:
222     SyncControls( intf_thread_t *, QWidget * );
223     virtual ~SyncControls();
224 private:
225     intf_thread_t *p_intf;
226     SyncWidget *AVSpin;
227     SyncWidget *subsSpin;
228     QDoubleSpinBox *subSpeedSpin;
229     QDoubleSpinBox *subDurationSpin;
230
231     bool b_userAction;
232
233     void clean();
234
235     void initSubsDuration();
236     void subsdelayClean();
237     void subsdelaySetFactor( double );
238 public slots:
239     void update();
240 private slots:
241     void advanceAudio( double );
242     void advanceSubs( double );
243     void adjustSubsSpeed( double );
244     void adjustSubsDuration( double );
245 };
246
247 #endif