]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/extended_panels.hpp
17829a8beffe1b12a699e539a7391945f4d9ec1a
[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 #define NUM_CP_CTRL 7
41 #define NUM_SP_CTRL 5
42
43 class QSignalMapper;
44
45 class ExtVideo: public QObject
46 {
47     Q_OBJECT
48     friend class ExtendedDialog;
49 public:
50     ExtVideo( struct intf_thread_t *, QTabWidget * );
51     /*void gotoConf( QObject* );*/
52 private:
53     Ui::ExtVideoWidget ui;
54     QSignalMapper* filterMapper;
55     intf_thread_t *p_intf;
56     void initComboBoxItems( QObject* );
57     void setWidgetValue( QObject* );
58     void clean();
59 private slots:
60     void updateFilters();
61     void updateFilterOptions();
62     void cropChange();
63     void browseLogo();
64     void browseEraseFile();
65 };
66
67 class ExtV4l2 : public QWidget
68 {
69     Q_OBJECT
70 public:
71     ExtV4l2( intf_thread_t *, QWidget * );
72
73     virtual void showEvent( QShowEvent *event );
74
75 private:
76     intf_thread_t *p_intf;
77     QGroupBox *box;
78     QLabel *help;
79
80 private slots:
81     void Refresh( void );
82     void ValueChange( int value );
83     void ValueChange( bool value );
84 };
85
86 class Equalizer: public QWidget
87 {
88     Q_OBJECT
89     friend class ExtendedDialog;
90 public:
91     Equalizer( intf_thread_t *, QWidget * );
92     QComboBox *presetsComboBox;
93
94     char * createValuesFromPreset( int i_preset );
95     void updateUIFromCore();
96     void changeFreqLabels( bool );
97 private:
98     Ui::EqualizerWidget ui;
99     QSlider *bands[BANDS];
100     QLabel *band_texts[BANDS];
101     bool b_vlcBands;
102
103     void delCallbacks( vlc_object_t * );
104     void addCallbacks( vlc_object_t * );
105
106     intf_thread_t *p_intf;
107     void clean() { enable(); }
108 private slots:
109     void enable(bool);
110     void enable();
111     void set2Pass();
112     void setPreamp();
113     void setCoreBands();
114     void setCorePreset(int);
115 };
116
117 class Compressor: public QWidget
118 {
119     Q_OBJECT
120
121 public:
122     Compressor( intf_thread_t *, QWidget * );
123
124 private:
125     typedef struct
126     {
127         const char *psz_name;
128         const char *psz_descs;
129         const char *psz_units;
130         const float f_min;      // min
131         const float f_max;      // max
132         const float f_value;    // value
133         const float f_resolution; // resolution
134     } comp_controls_t;
135     static const comp_controls_t comp_controls[NUM_CP_CTRL];
136     QSlider *compCtrl[NUM_CP_CTRL];
137     QLabel *ctrl_texts[NUM_CP_CTRL];
138     QLabel *ctrl_readout[NUM_CP_CTRL];
139     float controlVars[NUM_CP_CTRL];
140     float oldControlVars[NUM_CP_CTRL];
141
142     QGroupBox *compressorBox;
143
144     intf_thread_t *p_intf;
145
146     void updateSliders();
147
148 private slots:
149     void enable();
150     void setValues();
151 };
152
153 class Spatializer: public QWidget
154 {
155     Q_OBJECT
156
157 public:
158     Spatializer( intf_thread_t *, QWidget * );
159
160 private:
161     typedef struct
162     {
163         const char *psz_name;
164         const char *psz_desc;
165     } spat_controls_t;
166     static const spat_controls_t spat_controls[NUM_SP_CTRL];
167     QSlider *spatCtrl[NUM_SP_CTRL];
168     QLabel *ctrl_texts[NUM_SP_CTRL];
169     QLabel *ctrl_readout[NUM_SP_CTRL];
170     float controlVars[NUM_SP_CTRL];
171     float oldControlVars[NUM_SP_CTRL];
172
173     QGroupBox *spatializerBox;
174
175     void delCallbacks( vlc_object_t * );
176     void addCallbacks( vlc_object_t * );
177     intf_thread_t *p_intf;
178
179 private slots:
180     void enable();
181     void setValues();
182 };
183
184 class SyncWidget : public QWidget
185 {
186     Q_OBJECT
187 public:
188     SyncWidget( QWidget * );
189     void setValue( double d );
190 signals:
191     void valueChanged( double );
192 private slots:
193     void valueChangedHandler( double d );
194 private:
195     QDoubleSpinBox spinBox;
196     QLabel spinLabel;
197 };
198
199 class SyncControls : public QWidget
200 {
201     Q_OBJECT
202     friend class ExtendedDialog;
203 public:
204     SyncControls( intf_thread_t *, QWidget * );
205     virtual ~SyncControls();
206 private:
207     intf_thread_t *p_intf;
208     SyncWidget *AVSpin;
209     SyncWidget *subsSpin;
210     QDoubleSpinBox *subSpeedSpin;
211     QDoubleSpinBox *subDurationSpin;
212
213     bool b_userAction;
214
215     void clean();
216
217     void initSubsDuration();
218     void subsdelayClean();
219     void subsdelaySetFactor( double );
220 public slots:
221     void update();
222 private slots:
223     void advanceAudio( double );
224     void advanceSubs( double );
225     void adjustSubsSpeed( double );
226     void adjustSubsDuration( double );
227 };
228
229 #endif