]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/extended_panels.hpp
Qt: extended panels, code simplification and spatializer slider naming
[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 #include "ui/v4l2.h"
37
38 #include <QTabWidget>
39
40 #define BANDS 10
41 #define NUM_CP_CTRL 7
42 #define NUM_SP_CTRL 5
43
44 class QSignalMapper;
45
46 class ExtVideo: public QObject
47 {
48     Q_OBJECT
49     friend class ExtendedDialog;
50 public:
51     ExtVideo( struct intf_thread_t *, QTabWidget * );
52     virtual ~ExtVideo();
53     /*void gotoConf( QObject* );*/
54 private:
55     Ui::ExtVideoWidget ui;
56     QSignalMapper* filterMapper;
57     intf_thread_t *p_intf;
58     vout_thread_t *p_vout;
59     void initComboBoxItems( QObject* );
60     void setWidgetValue( QObject* );
61     void ChangeVFiltersString( const char *psz_name, bool b_add );
62     void clean();
63 private slots:
64     void updateFilters();
65     void updateFilterOptions();
66     void cropChange();
67 };
68
69 class ExtV4l2 : public QWidget
70 {
71     Q_OBJECT
72 public:
73     ExtV4l2( intf_thread_t *, QWidget * );
74     virtual ~ExtV4l2();
75
76     virtual void showEvent( QShowEvent *event );
77
78 private:
79     intf_thread_t *p_intf;
80     Ui::ExtV4l2Widget ui;
81     QGroupBox *box;
82
83 private slots:
84     void Refresh( void );
85     void ValueChange( int value );
86     void ValueChange( bool value );
87 };
88
89 class Equalizer: public QWidget
90 {
91     Q_OBJECT
92     friend class ExtendedDialog;
93 public:
94     Equalizer( intf_thread_t *, QWidget * );
95     QComboBox *presetsComboBox;
96
97     char * createValuesFromPreset( int i_preset );
98     void updateUIFromCore();
99 private:
100     Ui::EqualizerWidget ui;
101     QSlider *bands[BANDS];
102     QLabel *band_texts[BANDS];
103
104     void delCallbacks( aout_instance_t * );
105     void addCallbacks( aout_instance_t * );
106
107     intf_thread_t *p_intf;
108     void clean() { enable(); }
109 private slots:
110     void enable(bool);
111     void enable();
112     void set2Pass();
113     void setPreamp();
114     void setCoreBands();
115     void setCorePreset(int);
116 };
117
118 class Compressor: public QWidget
119 {
120     Q_OBJECT
121 public:
122     Compressor( intf_thread_t *, QWidget * );
123
124 private:
125     QSlider *compCtrl[NUM_CP_CTRL];
126     QLabel *ctrl_texts[NUM_CP_CTRL];
127     QLabel *ctrl_readout[NUM_CP_CTRL];
128     float controlVars[NUM_CP_CTRL];
129     float oldControlVars[NUM_CP_CTRL];
130
131     QCheckBox *enableCheck;
132
133     intf_thread_t *p_intf;
134
135     void delCallbacks( aout_instance_t * );
136     void addCallbacks( aout_instance_t * );
137
138     void updateSliders(float *);
139     void setValues(float *);
140
141 private slots:
142     void enable(bool);
143     void enable();
144     void setInitValues();
145 };
146
147 class Spatializer: public QWidget
148 {
149     Q_OBJECT
150 public:
151     Spatializer( intf_thread_t *, QWidget * );
152
153 private:
154     QSlider *spatCtrl[NUM_SP_CTRL];
155     QLabel *ctrl_texts[NUM_SP_CTRL];
156     QLabel *ctrl_readout[NUM_SP_CTRL];
157     float controlVars[5];
158     float oldControlVars[5];
159
160     QCheckBox *enableCheck;
161
162     void delCallbacks( aout_instance_t * );
163     void addCallbacks( aout_instance_t * );
164     intf_thread_t *p_intf;
165
166     void setValues(float *);
167
168 private slots:
169     void enable(bool);
170     void enable();
171     void setInitValues();
172 };
173
174 class SyncControls : public QWidget
175 {
176     Q_OBJECT
177     friend class ExtendedDialog;
178 public:
179     SyncControls( intf_thread_t *, QWidget * );
180     virtual ~SyncControls() {};
181 private:
182     intf_thread_t *p_intf;
183     QDoubleSpinBox *AVSpin;
184     QDoubleSpinBox *subsSpin;
185     QDoubleSpinBox *subSpeedSpin;
186
187     bool b_userAction;
188
189     void clean();
190 public slots:
191     void update();
192 private slots:
193     void advanceAudio( double );
194     void advanceSubs( double );
195     void adjustSubsSpeed( double );
196 };
197
198 #endif